DarwinBotsManual
Open the app EspañolES

Defensive bots

How to live armed: which defense works against which enemy, how much energy it costs to keep it up, and the Bestiary bots that really use it.

Defenses left a promise for this page: the mechanisms are over there (how each substance is made, what it absorbs and what it bounces), and the strategy is here. If you're coming from A bot that shoots, you already know what a hunter does to a still bot with a −1 or a −6. Here you take the side of the one on the receiving end: when each defense pays off, how much it costs to keep it on, and how real Bestiary bots use it.

Which one against which

Each defense works against a different enemy, and none works against all of them:

DefenseWorks againstDoesn't stopPrice per 100 (F1 league)Evaporates
Shellbody theft (−6) and venom (−3)−1, memory, viruses10 (20)no
Slimeties and virusesall shots10 (20)2% per cycle
Poisonenergy theft (−1), memory shots and tie drains−625 (26)2% per cycle
Venomnothing: it's ammunition, it punishes whoever gets close—100 (101)no

Read as strategy:

Shell and poison complement each other: one stops what the other doesn't. A bot with both leaves the ordinary hunter neither the −6 nor the −1.

The price of going armed

Making things always costs the conversion (10 energy per 100 of shell or slime, 25 per 100 of poison, 100 per 100 of venom), and on top of that the scenario can charge you a transaction fee per unit. In the app's F1 league that fee doubles the price of shell and slime (0.1 per unit, Shell and Slime) and barely touches poison and venom (0.01, Poison and Venom), all multiplied by Cost multiplier. In the built-in scenarios, except the league matches, the costs are 0 and you only pay the conversion.

What really costs is upkeep. Slime and poison lose 2% per cycle (Defenses): keeping both above 100 means topping up one recharge of each about every 35 cycles. Measured on the bot that follows, with F1 league costs: 66 energy to arm 100 of each, and then 46 every ~35 cycles (about 1.3 per cycle). The shell, after the first payment, never costs anything again. Added to the dues of being alive (Energy, body and waste), going armed is a salary, not a purchase.

Always armed: Massed Hunter

Massed Hunter (Massed_Hunter_with_poison_and_shell_and_slime_F2_rayz_02-04-.txt) pays for the full insurance while it can: it's a hunter (nine eyes covering the whole front, −1, −6, ties) that also keeps all three defenses topped up with three twin genes:

' While it has energy to spare: shell, slime and poison topped up
cond
 *.shell 100 <
 *.nrg 750 >
start
 100 .mkshell store
stop

cond
 *.slime 100 <
 *.nrg 750 >
start
 100 .mkslime store
stop

cond
 *.poison 100 <
 *.nrg 750 >
start
 100 .strpoison store
 7 .ploc store
stop

Note the two details that make the policy:

Armed on demand: Paranoia

Paranoia (Paranoia1_F1_Eight_-02.09.04.txt) pays nothing until danger appears, and then it pays just enough. It has two triggers.

It sees a bot that knows how to tie. .reftie doesn't measure ties in place: it counts how many times the tie command appears in the DNA of the bot it's looking at. If it sees someone with that command (and it isn't its own species), it arms slime and poison, and warns its own kind by smell so they arm too:

' If I saw a bot that knows how to tie: slime, and I warn by smell
cond
 *45 0 >
 *.slime 100 <
 *.nrg *.slime >
start
 50 .mkslime store
stop

cond
 *45 0 >
start
 .out1 inc
stop

' And whoever sees the warning arms too
cond
 *.in1 0 >
start
 45 inc
stop

In the run against a bot that only tied, slime and poison went up and stayed just above 100 (it makes 50 when it drops below 100). And along the way Paranoia ate it: it also knows how to hunt through ties, and the attacker ended up a corpse at cycle 40.

A shot hits it. The bot knows what hit it and from which side: the flavor is in .shflav, and .shup, .shdn, .shsx or .shdx depending on the angle. A −6 triggers the healing, in four twin genes (one per side; the one for the back also answers back):

' Body hit from behind: new shell and body rebuilt
cond
 *.shdn -6 =
 *.body *.nrg !%=
start
 50 .mkshell store
 50 .strbody store
 -1 .backshot store
 5 .up store
stop

Each healing costs 55 energy (5 for the 50 of shell, 50 for the 5 of body that .strbody gives back) plus whatever the hit stole: the −6 takes part of the energy and of the body. Over 120 cycles against a −6 hunter, Paranoia went from 0 to 527 of shell, ended with more body than it started with (1023 against 1000) and stayed alive, paying about 1900 energy; the hunter won anyway (1454), but more slowly. The version for the −1 (its twin with .fdbody) managed less: against the tutorial's hunter it was drained before cycle 60. Reacting heals; preventing, like the hedgehog below, doesn't even let you get hurt.

Dodging and answering back, without substances

The last bot makes none of the four: Untitled defensive shooter (Untitled_defensive_shooter_Testlund_2012.txt) reads the shot it receives and reacts. A −1 makes it jump at random (with a separate gene); and any hit that isn't a gift turns it toward the shooter, throws it backward at full speed and answers back with waste:

' Any hit that isn't a gift: I turn toward the shooter,
' back off and answer back with waste
start
 *.shflav 0 !=
 *.shflav -2 != and
 0 .shflav store
 *.aim *.shang sub .setaim store
 *.maxvel .dn store
 -4 .shoot store
 *.waste .shootval store
stop

.shang is the angle of the shot that hit you: with *.aim *.shang sub the bot orients itself toward where it came from. It's an elegant, free defense… until the enemy insists: in the run, against the same −1 that couldn't beat the hedgehog, it jumped at random with every hit received, drained away anyway and ended up a corpse before cycle 75. The reaction always arrives one cycle late; poison that is already up bounces the hit in the same cycle it's thrown at you.

A minimal hedgehog

Here's the minimal version of “poison while I have energy to spare,” complete and ready to seed:

' Poison hedgehog: whoever bites it goes mute
cond
 *.robage 0 =
start
 .shoot .ploc store
 0 .pval store
stop

' Poison while it has energy to spare
cond
 *.poison 1000 <
 *.nrg 500 >
start
 100 .strpoison store
stop
end

The reason for 1000: poison only bounces hits smaller than itself, and a −1 from a hunter with 1000 body hits with 220. Keeping 1000 up costs about 5 energy per cycle (25 for each 100 refill, plus the 2% that evaporates; with F1 league costs, 5.2), as long as there's energy to spare.

Against the tutorial's hunter, over 200 cycles: the hunter bit it three times in the first cycles, each bounce added ~146 cycles of poisoning to it, and with its .shoot wiped cycle after cycle it never shot again. Its energy stayed pinned at 3000: zero gain. The hedgehog spent 1400 on staying toxic and came out whole. The same hunter against a still target left it a corpse before cycle 40, with 6163 energy.

The shell variant, against a −6 hunter:

' Shell hedgehog: the shell eats the -6 shots
cond
 *.shell 1000 <
 *.nrg 500 >
start
 100 .mkshell store
stop
end

Since the shell doesn't evaporate, this hedgehog only repairs what the shots eat away: about 2.8 energy per cycle under fire. Over 200 cycles it ended with its body intact and the hunter having gained nothing. Without shell, the target ended up a corpse before cycle 60 and the hunter went from 3000 to 14871.

What to try next