DarwinBotsManual
Open the app EspañolES

What it sees (ref*)

The ref* sysvars describe what is in front of the focus eye: its DNA signature, its energy and body, where it is and how it moves.

AddressSysvarKindSummary
477.reffixedSenseIt is 1 if what you are looking at can't move: a bot anchored with .fixpos or a still shape.
685.reftypeSenseWhat you are looking at: 0 if it is a bot and 1 if it is a shape (an obstacle of the scenario).
686.refmultiSenseIt is 1 if the bot you are looking at is part of a multibot, an organism of several cells joined by ties.
687.refshellSenseHow much shell the bot you are looking at has: the shell stops venom and body shots.
688.refbodySenseThe body of the bot you are looking at, from 0 to 32000: its size, and what you can take from it with a body shot.
689.refxposSenseThe x coordinate of what you are looking at: together with .refypos and the angle operator, it lets you aim right at it.
690.refyposSenseThe y coordinate of what you are looking at: together with .refxpos and the angle operator, it lets you aim right at it.
695.refvelscalarSenseHow fast what you are looking at is moving relative to you, regardless of direction.
696.refvelsxSenseHow fast what you are looking at is moving to your left: it is .refveldx with the sign flipped.
697.refveldxSenseHow fast what you are looking at is moving sideways: positive toward your right, negative toward your left.
698.refveldnSenseThe speed at which what you are looking at comes toward you: it is .refvel with the sign flipped.
699.refvel .refvelupSenseHow fast what you are looking at moves away (positive) or comes closer (negative), in the direction you are looking and relative to yours.
701.refupSenseHow many times the DNA of the bot you are looking at writes to .up: one of the numbers in its signature, for recognizing species.
702.refdnSenseHow many times the DNA of the bot you are looking at writes to .dn: one number in its species signature.
703.refsxSenseHow many times the DNA of the bot you are looking at writes to .sx: one number in its species signature.
704.refdxSenseHow many times the DNA of the bot you are looking at writes to .dx: one number in its species signature.
705.refaimdxSenseHow many times the DNA of the bot you are looking at writes to .aimdx: one number in its species signature.
706.refaimsxSenseHow many times the DNA of the bot you are looking at writes to .aimsx: one number in its species signature.
707.refshootSenseHow many times the DNA of the bot you are looking at writes to .shoot: if it is greater than 0, it knows how to shoot.
708.refeyeSenseHow many times the DNA of the bot you are looking at reads its eyes: the signature number most used to recognize your own species.
709.refnrgSenseThe energy of the bot you are looking at, from 0 to 32000: for choosing prey worth the trouble or well-fed mates.
710.refageSenseThe age in cycles of the bot you are looking at, up to 32000: for recognizing newborns.
711.refaimSenseWhich way the bot you are looking at is pointing, on the same scale as .aim: for knowing whether it is looking at you.
712.reftieSenseHow many times .tie appears in the DNA of the bot you are looking at: if it is greater than 0, it knows how to tie to other bots.
713.refpoisonSenseHow much defensive poison the bot you are looking at has stored: shooting at it can send poison back at you.
714.refvenomSenseHow much attack venom the bot you are looking at has stored: with it, that bot can paralyze you.
715.refkillsSenseHow many bots the bot you are looking at has killed: a way to recognize a predator.

The eyes (.eye5 and its neighbors) only tell you how close something is. To know what it is, there are the ref* sysvars: every cycle the engine copies into them data about the object the focus eye sees, which is .eye5 unless you change it with .focuseye. If that eye sees several things, the closest one wins.

They come in three families:

The rules are the same for all of them. They arrive one cycle late, like any sense. They are cleared to 0 before being rewritten, so if the focus eye sees nothing they are all 0. And they are also filled in when you collide with another bot, even if you aren't looking at it.

The most-used combination comes from Animal Minimalis, by Numsgil, in the Bestiary: if what it sees isn't of its species, it copies its movement so as not to lose it and shoots it. Here it is condensed into a single gene:

cond
*.eye5 0 >
*.refeye *.myeye !=
start
*.refveldx .dx store
*.refvel 30 add .up store
-1 .shoot store
stop

The full explanation of sight is in Vision and recognition step by step is in A bot that recognizes its own species.