Tie Tutorial
Contents
Meet Animal Minimalis
Note that this tutorial refers to 2.4 and prior. An entirely new interface is presently being worked on for the next version.
This is Animal Minimalis: (He's been slightly modified to produce offspring with more energy, but otherwise he's the same)
'Animal Minimalis 'by Nums cond *.eye5 0 > *.refeye *.myeye != start *.refveldx .dx store *.refvelup 30 add .up store stop cond *.eye5 50 > *.refeye *.myeye != start -1 .shoot store *.refvelup .up store stop cond *.eye5 0 = *.refeye *.myeye = or start 314 rnd .aimdx store stop cond *.nrg 15000 > start 30 .repro store stop end
We're going to be using him to demonstrate some cool things using ties.
Ties
Ties are connections between bots that can be fired by putting a positive number into .tie.
Tie ID
The number that you put into .tie will be the tie's ID, sometimes called its port or (more rarely) phase.
If you want to detete a tie, you will need to put the tie's ID into .deltie. If you want to change or fix the angle of a tie, or change or fix it's length, or if you want to feed through a tie or use it to alter another bot's memory values you will need to store the tie's ID into .tienum.
Tiepres
You can readback the value of the last tie created by using *.tiepres. For example:
*.tiepres .tienum store
Will select the last tie created.
Deleting ties
To delete a tie simply store the tie ID into .deltie. Forgotten it? - simply use *.tiepres
*.tiepres .deltie store
Will delete the last tie created.
Deleting the Birth Tie
If you're a combat bot then efficiency counts. You definately don't want to be mucking about with an umbilical cord for the first few cycles of your life.
Combat bot programmers use a neat trick to remove that pesky birth tie.
First, fire a tie at your parent when you are born:
cond *.robage 0 = start .tie inc stop
Since only one tie can exist between two bots this will replace the birth tie.
You can then delete the new tie on the next cycle:
cond *.robage 1 = start .deltie inc stop
Note the use of inc and dec to save energy.
Put an anti-birth tie gene into Animal Minimalis and see how much better he does.
In this forum thread Nums comes up with a few very concise anti-birth tie genes.
Selecting a Tie
The easiest method to select a tie is with:
*.tiepres .tienum store
This will select the most recently formed tie, which is usually the one you're interested in anyway. Remember that this will automatically select any tie to your bot, including those accidentally attached by family members.
You can select other, older ties if you remember what "port" they were on. That is, the number you used for .tie.
4 .tie store
will create a tie with port 4.
4 .tienum store
will select a tie with port 4, whether you made it yourself or not.
Feeding through a tie
To feed trough a tie you must first tie to another bot, address the tie number(.tienum), then use .tieloc and .tieval to transfer nrg.
cond *.refeye *.myeye != *.eye5 45 > start 13 .tie *.robage sgn mult *.refage sgn mult store stop cond *.tiepres 0 > *.tienum 0 = start *.tiepres .tienum store stop cond *.tienum 0 > start -1 .tieloc store -1000 .tieval store stop
For a basic tie feeder thats all there is to it.
The bot ties to non-family(normally), thats the reason the robage and refage check is there to prevent parent and child from tieing to one another. The next part is that the bot will store the number of the latest tie into tienum. Next it will attempt to feed. The -1 stored into tieloc initiats nrg transfer. The -1000 specifies the bot attempt to take the maximum allowed level.
Leaching and Counter-Leaching
A leach is a bot that makes use of another bot's attempt to tie feed to reverse the nrg flow and take nrg without doing the work of hunting. This gene:
cond *.tiepres 0 > start .tieval .tieloc store 1000 .tieval store stop
Stores 1000 into an enemy's tieval location reversing the nrg flow.
When our basic tie feeder ties to feed from a bot with these genes, it will begin giving nrg to the bot rather than taking it.
Fortunatly there is a number of ways we can thwart these nasty leaches, from simply deleting strange ties or more excitingly reversing their attacks.
Sharing
(Work in progress)
Multibots
(Work in progress)
Batterybots
(Work in progress)
Changing the Angle and Length of Your Tie
(Work in progress)
The Tie Ports
(Work in progress)
The Tie-Reference Variables
(Work in progress)