MB Construction
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 slighly 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 becouse nothing is stored inside head.
'Gene 6 Splits. cond *.nrg 30000 > start .deltie inc stop
If a multibot has a load of energie it will split. That's where the life-cycle goes back to gene 4, the old body becomes a head, and two new bodys 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 importent 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 literaly just going after the head.
Maybe a small id-system for the recocnition 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.
Defences 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 dont'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