DarwinBotsManual
Open the app EspañolES

Ties and multicellular bots

How one bot gets tied to another, how the tie behaves like a spring, what travels through it and how, and how, with stiffened ties, several bots form a multicellular organism.

A tie joins two bots. Physically it is a spring that keeps them at a certain distance; it is also a channel: through it each bot senses the other, writes to its memory and passes resources to it or takes them from it. With stiffened ties, several bots stop being loose individuals and form a multicellular organism (multibot): one that shares energy, holds its shape and moves as a single thing.

This page describes the mechanism as a whole. Each memory cell has its own page in the reference, grouped in Ties.

Two ways to have a tie

Birth tieTie made with .tie
WhenEvery birth ties the parent to the childWhen the bot asks for it
How long it lastsBreaks by itself at 100 cyclesUntil it is cut or breaks
StiffensNeverAt 19 cycles
Who creates itThe parentThe bot that wrote .tie

How a tie is created

You write a number other than 0 to .tie and, at the end of the actions phase, the engine tries to tie you to the bot you are looking at (the same one that .refeye and company describe). If you don't see anyone, in your first two cycles of life it tries your parent, and otherwise the last bot that touched you. The parent shortcut is reliable early in a simulation; later on, once bots have been born and died many times, it may not find it, so it is best for the child to be looking at it.

The command is always cleared, whether it succeeds or not.

For the tie to form:

Every attempt on someone within range costs energy: the cost of tying (Tie) divided by the number of ties you have after the attempt plus one. The first tie costs half, the second a third, and an attempt that fails with no ties costs the full price. The birth tie charges it too: the parent pays it (in sexual reproduction, the mother) at every birth. If there was already a tie between those two bots, the new one replaces it: it starts counting from zero again and becomes a .tie tie.

The app's Disable ties option turns .tie off for everyone; birth ties still form as usual. In contests, the disqualification option (Disqualification) can forbid tying to a rival or passing resources to one through a tie.

Tie ports: what each tie is called

A bot can have several ties, so each one has a number, its tie port. The important thing is that each end calls it by a different number:

   child: wrote 7 .tie                          parent: received the tie
   calls it 7   ●━━━━━━━━━━━━━━━━━━━━━━━━━━━━━●  calls it 1
   (the number it set)                           (its order number: it is its first tie)

Whoever creates the tie calls it by the number they wrote to .tie. Whoever receives it calls it by its order number among their ties: 1 if it is the first, 2 if it is the second. When a tie forms, each one's .tiepres is set to the name that bot gives it.

With that number you choose which tie each command acts on: .tienum for writing and transferring, .readtie for reading, .deltie for cutting. If you leave .tienum at 0, most commands use the tie in .tiepres.

The birth tie

Every birth ties the parent to the child. It is a soft tie that never stiffens, and it breaks by itself at 100 cycles (to be exact, the counter starts at 100 and the tie disappears 99 cycles after the birth). It has an oddity: the parent creates it with port 0, and a 0 is no use for choosing ties. So:

While it lasts, the genetic memory arrives through this tie: cells 976 to 990 as the parent had them at the moment of birth reach the child one per cycle, during its first 15 cycles (see Free and epigenetic memory).

Tie physics

A tie is a spring with a damper. It remembers a rest length (the distance between the two bots at the moment it formed) and, if the bots move too far apart or too close together, it pulls or pushes to get back to that length, damping the oscillations at the same time. It tolerates about 20 units of difference without exerting force, so tied bots tend to end up swaying near the requested length.

A tie is born soft and, if it was made with .tie, it stiffens at 19 cycles:

SoftStiffened
Spring strengthlowabout five times higher
Rest lengththe distance when it formedthe distance when it stiffened
Anglefree: the bots rotate around each otherfixed, as seen from the bot that created the tie
Can be adjustednoyes: length, angle and stiffness

The fixed angle turns the tie into something like an arm: the partner has to stay in a given direction relative to where the bot points (.aim). If it strays from there, the engine turns the bot and pushes the partner sideways until it is back in place, with a 5-degree slack that it doesn't correct.

On a stiffened tie you can change all three things, from either end:

For measuring: .tieang and .tielen give the direction and distance of the partner on the .tiepres tie.

A tie breaks by itself only if the bots end up more than 1000 apart from edge to edge, and it is deleted if the other bot disappears from the world. A partner that dies and is left as a corpse stays tied until the corpse decays.

This two-cell organism separates to 300 and puts the partner at its side as soon as the tie stiffens:

' Two cells: the child ties itself to the parent and, once the tie is stiff, shapes it
cond
 *.robage 5 =
 *.numties 0 =
start
 50 .repro store
stop
cond
 *.robage 1 =
start
 7 .tie store
stop
cond
 *.multi 1 =
start
 300 .fixlen store
 314 .fixang store
stop

Running it, the distance oscillates at first between 250 and 400 and settles near 300; the partner ends up at an angle of about 314, a quarter turn. Both of them ask for it, so both of them hold it.

Stiffening: multicellular bots

When a .tie tie stiffens, both bots become multicellular: .multi is 1. They stay that way as long as they have any tie left, even if it isn't the stiffened one; with 0 ties, .multi goes back to 0. Since the birth tie doesn't stiffen, parent and child are not a single organism just because they were born together: one of them has to tie with .tie.

Being multicellular enables and cheapens things:

In a world with connected edges, when a cell crosses the edge the engine moves the whole organism, up to 50 connected cells, so that it isn't split in two (see Physics).

Communicating through the tie

There are three ways, from the mildest to the most invasive:

ToYou writeThe other one
Sense it, without doing anything.readtie chooses the tieNothing: you read its tref (energy, age, position, signature…)
Publish a piece of data.tout1 … .tout10Reads it in .tin1 … .tin10 if it listens to that tie
Write to its memory.tienum, .tieloc (1 to 1000) and .tievalFinds the written value in that cell

The third one is powerful: you can write to any cell of the other bot, even its commands (someone else's .up or .shoot). It happens in the forces and collisions phase, after everyone's DNA has run, so the other one reads it on its next turn. To use it, .tienum has to be different from 0; .tiepres is not enough.

' The child signals the parent through the birth tie
cond
 *.robage 5 =
 *.numties 0 =
start
 50 .repro store
stop
cond
 *.robage 1 =
 *.numties 0 >
start
 1 .tienum store
 60 .tieloc store
 1234 .tieval store
stop

The child, when its .robage is 1, writes 1234 to cell 60 of the parent through port 1. The parent couldn't do the same through that tie: for it, the tie is called 0.

Passing and sharing resources

There are two mechanisms, and it is best not to mix them up.

One-off transfers. With a negative .tieloc and an amount in .tieval you give the other bot (positive) or take from it (negative) energy (-1), venom (-3), waste (-4) or body (-6). It works with any tie, soft or stiffened, and with any bot, whether or not it is of your species: it is the basis of the parasites that tie themselves to their prey and drain it. The per-cycle caps and what is lost along the way are on the .tieloc page.

Sharing. Only between multicellular bots. With .sharenrg you write a percentage: for each tie, the engine adds your energy and your partner's and leaves you that percentage of the total; the rest stays with it. .sharewaste (waste), .shareshell (shell), .shareslime (slime) and .sharechlr (chloroplasts, only between close relatives) do the same. Three things to keep in mind:

' Two-cell organism that splits its energy equally
cond
 *.robage 5 =
 *.numties 0 =
start
 50 .repro store
stop
cond
 *.robage 1 =
start
 7 .tie store
stop
cond
 *.multi 1 =
start
 50 .sharenrg store
stop

With 50 the two end up even. Watch out for the extremes: 100 .sharenrg store means “everything for me”. Tested with this same bot, the child leaves the parent without energy in a few cycles and the parent becomes a corpse, which stays tied.

Cutting a tie

A tie disappears from both sides when:

When the tie that .tiepres pointed to is cut, that cell moves to the previous tie in the list. .numties always says how many are left.

In the Bestiary

About 190 bots in the Bestiary use .sharenrg. A small, curious one is Snap Tie bot: it ties itself at random and asks for a length of 10000 with .fixlen, so the tie snaps and the jerk moves it.

To build one step by step, follow the tutorial A multibot; for strategies, Multibots.