Difference between revisions of "MB Construction"

From WikiManual
Jump to: navigation, search
(Contruction page for basic mb)
m (Fixed typos)
 
(5 intermediate revisions by 4 users not shown)
Line 1: Line 1:
Below is a slightly modified form of TierMBt2. It represents a basic form of a multibot and has several unique features that make it easier to work with. It typically forms lines but will also form triangular forms on occasion.
+
In this tutorial you will see animal multi. Here you will see the core of a multibot. Feeding and searching genes are added from animal minimalis, these genes have been slightly modded to fit into a this multibot.
  
 +
In this tutorial you will make a simple multibot that exists out of two parts. A head that decides what direction there is going to be taken. And a body that doesn't decide anything.
 +
 +
def head 50
 +
 +
'Gene 1 Food Finder
 
  cond
 
  cond
  *.robage 0 =
+
  *.eye5 0 >
 +
*.refeye *.myeye !=
 +
*.head 0 !=
 +
*.multi 1 =
 
  start
 
  start
  .tie inc
+
  *.refveldx .dx store
  .numties .memloc store
+
  *.refvelup 30 add .up store
 
  stop
 
  stop
  
The .tie inc allows it to setup it's initial tie, typically tieing itself to it's parent. Next it stores the location of numties into memloc, this allows it to easily determine the number of ties other bots have. Multi works similar, but doesn't record unhardened ties.
+
'Gene 2 Eat Food
 
+
cond
cond
+
*.eye5 50 >
start
+
*.refeye *.myeye !=
.out1 inc
+
'*.refeye *.myeye !=
stop
+
*.head 0 !=
 
+
*.multi 1 =
This gene continually increases out1. Other bots can check this against refage to see if the bot's age does in fact match.  
+
start
 +
-1 .shoot store
 +
*.refvelup .up store
 +
stop
  
 +
'Gene 3 Avoiding Family
 
  cond
 
  cond
  *.nrg 3000 >
+
  *.multi 1 =
  *.body 100 <
+
  *.head 0 !=
 +
*.eye5 0 =
 +
*.refeye *.myeye = or
 
  start
 
  start
  100 *.body sub .strbody store
+
  314 rnd .aimdx store
 
  stop
 
  stop
  
Keeps body levels around 100, only activates when the bot has enough nrg.
+
These genes should look pretty familiair, these are the same genes as in animal minimalis. If you wonder what the genes do look for the basic bot tutorial.
 +
The difference you could see, are the 'def head 50'. Here the sysvar head is made. And the condition
 +
'*.head 0 !=' in every gene. What means that a bot with a non-zero number in head will execute the genes. All bodys have a zero in head. This will be explained later.
 +
 
 +
All bot also have a  '*.multi 1 =' condition. This only checks if the bot is a multibot. This condition is not really neaded for the functioning of the bot. Possible needed to participate is MB-league. Although there aren't any rules at the moment.
 +
*.multi will only return true if the tie is hardened. This takes ~20 cycles. That is the reason you see the bot doing nothing for a small moment of time after reproduction.
  
 +
'Gene 4 Duplicate
 
  cond
 
  cond
  *.nrg 3000 >
+
  *.numties 0 =
  *.body 100 >
+
  *.robage 0 !=
 
  start
 
  start
 
  50 .repro store
 
  50 .repro store
 +
.head inc
 
  stop
 
  stop
  
Ahh, reproduction the beginnings of life.  
+
This gene duplicates and increases the sysvar head with one. That way it becomes a head. The conditions will only fire if there are no ties(it isn't a multibot) and it isn't 0 cycles old. That is made that way so it won't interfere with the body recombining what only happens at cycle one.
  
 +
'Gene 5 Recombine
 
  cond
 
  cond
  *.myeye *.refeye =
+
  *.robage 0 =
*.in1 *.refage =
 
*.numties 2 <
 
*.memval 2 <
 
 
  start
 
  start
 
  .tie inc
 
  .tie inc
 
  stop
 
  stop
  
Any time the bot and the bot it's looking at have less than two ties, a new tie is formed. This helps with bots seperated from the main multibot either by natural tie stretching, accidental tie removal, or it's partner dieing.
+
This gene combines body with head using a tie. This can only happen in the first cycle. It is body because nothing is stored inside head.
  
 +
'Gene 6 Splits.
 
  cond
 
  cond
  *.myeye *.refeye !=
+
  *.nrg 30000 >
*.in1 *.refage !=
 
*.eye5 45 >
 
*.multi 1 =
 
 
  start
 
  start
  -1 .shoot store
+
  .deltie inc
 
  stop
 
  stop
  
Feeding gene, currently bot only feeds when it ties have hardened.
+
If a multibot has a load of energy it will split. That's where the life-cycle goes back to gene 4, the old body becomes a head, and two new bodies are formed.
  
 +
'Gene 7 multibot control center
 
  cond
 
  cond
  *.myeye *.refeye =
+
  *.multi 1 = or
*.in1 *.refage =
 
*.eye5 0 >
 
 
  start
 
  start
  314 rnd *.aim add .setaim store store
+
  '*.eye5 .tout1 store
 +
50 .sharenrg store
 +
1 .fixlen store
 +
100 .stifftie store
 +
628 .fixang store
 +
*.aimright .tout1 store
 
  stop
 
  stop
  
 +
The most important gene, in this gene everything is being taken care for.
 +
50 .sharenrg store,
 +
gives every side the half of the nrg.
 +
 +
 +
  1 .fixlen store,
 +
sets length of the tie try making this longer to get a longer tie.
 +
  100 .stifftie store,
 +
stiffness of the tie. A lower value will make this more elastic.
 +
  628 .fixang store,
 +
sets the eye5 directly opposed to the tie.
 +
  *.aimright .tout1 store
 +
This is meant for communication between the two bots.
 +
 +
'Gene 8 body follows
 
  cond
 
  cond
  *.eye5 0 =
+
  *.head 0 =
 
  start
 
  start
  314 rnd *.aim add .setaim store
+
  *.tiepres .readtie store
 +
*.tin1 .aimright store
 
  stop
 
  stop
  
Random search genes using setaim. This is one of the most useful commands since it allows individual bots to look around themselves. Using aimdx or aimsx will turn the entire multibot, making co-ordinated motion difficult without specifically designating a single "head" for the entire multibot.
+
*.tiepres .readtie store, selects the last tie created.
 +
 
 +
This let the body move with the head,
 +
the head stores *.aimright into .tout1,
 +
the body stores *.tin1 into .aimright.
 +
Everything what one bot stores inside one tout(1-10),
 +
is found on the other side at tin(1-10).
 +
 
 +
end
 +
 
 +
Alright, newer versions don't need this anymore. But still often used.
 +
 
 +
'''Improvements''',
 +
 
 +
Well this isn't the perfect multibot, and it wasn't meant to be. Just a simple multibot and I hope it is understandable.
 +
This bot can for example be made better by making real communications between head and body, and maybe let the body decide something. Now the body is literally just going after the head.
 +
 
 +
 
 +
Maybe a small id-system for the recognition of the other side of the tie, bots can't see the other side. It would be horrible to find out that the bot  you where sharing your precious nrg with was an opponent.
 +
 
 +
 
 +
Defenses in the way of shell slime and stuff.
 +
 
 +
 
 +
I have deleted the previous MB-tutorial that was lying here, that bot wasn't compatible with the current version, if you want to see it it is still inside the history.
  
cond
 
*.myeye *.refeye !=
 
*.in1 *.refage !=
 
*.eye5 0 >
 
start
 
*.refxpos *.refypos angle .setaim store
 
stop
 
  
Hunting gene allows bot to exactly focus on it's prey.
+
This was the first tutorial I wrote here, if you don't understand it or something doesn't work right. Don't wait with blaming me. I don't look at it with beginners eyes.
  
cond
+
Peter, that is the name you can blame. I'll be at the forum.
*.eye5 0 >
 
*.myeye *.refeye !=
 
*.in1 *.refage !=
 
start
 
*.maxvel *.vel sub 2 div .up store
 
stop
 
  
Acceleration controls, bot accelerates whenever it sees prey.
+
Coming Soon:
  
cond
+
tielen tieang 1 ... 5 fixed.
*.numties 2 >
 
start
 
.deltie inc
 
stop
 
  
This causes the bot to delete ties when it has more than two. This helps to keep the structure of the mb from getting out of control.
+
Blind robots can tie to parent or tie by touch.
  
end
+
-Botsareus

Latest revision as of 21:10, 14 February 2014

In this tutorial you will see animal multi. Here you will see the core of a multibot. Feeding and searching genes are added from animal minimalis, these genes have been slightly modded to fit into a this multibot.

In this tutorial you will make a simple multibot that exists out of two parts. A head that decides what direction there is going to be taken. And a body that doesn't decide anything.

def head 50
'Gene 1 Food Finder
cond
*.eye5 0 >
*.refeye *.myeye !=
*.head 0 !=
*.multi 1 =
start
*.refveldx .dx store
*.refvelup 30 add .up store
stop
'Gene 2 Eat Food
cond
*.eye5 50 >
*.refeye *.myeye !=
'*.refeye *.myeye !=
*.head 0 !=
*.multi 1 =
start
-1 .shoot store
*.refvelup .up store
stop
'Gene 3 Avoiding Family
cond
*.multi 1 =
*.head 0 !=
*.eye5 0 =
*.refeye *.myeye = or
start
314 rnd .aimdx store
stop

These genes should look pretty familiair, these are the same genes as in animal minimalis. If you wonder what the genes do look for the basic bot tutorial. The difference you could see, are the 'def head 50'. Here the sysvar head is made. And the condition '*.head 0 !=' in every gene. What means that a bot with a non-zero number in head will execute the genes. All bodys have a zero in head. This will be explained later.

All bot also have a '*.multi 1 =' condition. This only checks if the bot is a multibot. This condition is not really neaded for the functioning of the bot. Possible needed to participate is MB-league. Although there aren't any rules at the moment.

  • .multi will only return true if the tie is hardened. This takes ~20 cycles. That is the reason you see the bot doing nothing for a small moment of time after reproduction.
'Gene 4 Duplicate
cond
*.numties 0 =
*.robage 0 !=
start
50 .repro store
.head inc
stop

This gene duplicates and increases the sysvar head with one. That way it becomes a head. The conditions will only fire if there are no ties(it isn't a multibot) and it isn't 0 cycles old. That is made that way so it won't interfere with the body recombining what only happens at cycle one.

'Gene 5 Recombine
cond
*.robage 0 =
start
.tie inc
stop

This gene combines body with head using a tie. This can only happen in the first cycle. It is body because nothing is stored inside head.

'Gene 6 Splits.
cond
*.nrg 30000 >
start
.deltie inc
stop

If a multibot has a load of energy it will split. That's where the life-cycle goes back to gene 4, the old body becomes a head, and two new bodies are formed.

'Gene 7 multibot control center
cond
*.multi 1 = or
start
'*.eye5 .tout1 store
50 .sharenrg store
1 .fixlen store
100 .stifftie store
628 .fixang store
*.aimright .tout1 store
stop

The most important gene, in this gene everything is being taken care for. 50 .sharenrg store, gives every side the half of the nrg.


 1 .fixlen store,

sets length of the tie try making this longer to get a longer tie.

 100 .stifftie store,

stiffness of the tie. A lower value will make this more elastic.

 628 .fixang store,

sets the eye5 directly opposed to the tie.

 *.aimright .tout1 store

This is meant for communication between the two bots.

'Gene 8 body follows
cond
*.head 0 =
start
*.tiepres .readtie store
*.tin1 .aimright store
stop
  • .tiepres .readtie store, selects the last tie created.

This let the body move with the head, the head stores *.aimright into .tout1, the body stores *.tin1 into .aimright. Everything what one bot stores inside one tout(1-10), is found on the other side at tin(1-10).

end 

Alright, newer versions don't need this anymore. But still often used.

Improvements,

Well this isn't the perfect multibot, and it wasn't meant to be. Just a simple multibot and I hope it is understandable. This bot can for example be made better by making real communications between head and body, and maybe let the body decide something. Now the body is literally just going after the head.


Maybe a small id-system for the recognition of the other side of the tie, bots can't see the other side. It would be horrible to find out that the bot you where sharing your precious nrg with was an opponent.


Defenses in the way of shell slime and stuff.


I have deleted the previous MB-tutorial that was lying here, that bot wasn't compatible with the current version, if you want to see it it is still inside the history.


This was the first tutorial I wrote here, if you don't understand it or something doesn't work right. Don't wait with blaming me. I don't look at it with beginners eyes.

Peter, that is the name you can blame. I'll be at the forum.

Coming Soon:

tielen tieang 1 ... 5 fixed.

Blind robots can tie to parent or tie by touch.

-Botsareus