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.
| Address | Sysvar | Kind | Summary |
|---|---|---|---|
| 477 | .reffixed | Sense | It is 1 if what you are looking at can't move: a bot anchored with .fixpos or a still shape. |
| 685 | .reftype | Sense | What you are looking at: 0 if it is a bot and 1 if it is a shape (an obstacle of the scenario). |
| 686 | .refmulti | Sense | It is 1 if the bot you are looking at is part of a multibot, an organism of several cells joined by ties. |
| 687 | .refshell | Sense | How much shell the bot you are looking at has: the shell stops venom and body shots. |
| 688 | .refbody | Sense | The 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 | .refxpos | Sense | The x coordinate of what you are looking at: together with .refypos and the angle operator, it lets you aim right at it. |
| 690 | .refypos | Sense | The y coordinate of what you are looking at: together with .refxpos and the angle operator, it lets you aim right at it. |
| 695 | .refvelscalar | Sense | How fast what you are looking at is moving relative to you, regardless of direction. |
| 696 | .refvelsx | Sense | How fast what you are looking at is moving to your left: it is .refveldx with the sign flipped. |
| 697 | .refveldx | Sense | How fast what you are looking at is moving sideways: positive toward your right, negative toward your left. |
| 698 | .refveldn | Sense | The speed at which what you are looking at comes toward you: it is .refvel with the sign flipped. |
| 699 | .refvel .refvelup | Sense | How fast what you are looking at moves away (positive) or comes closer (negative), in the direction you are looking and relative to yours. |
| 701 | .refup | Sense | How 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 | .refdn | Sense | How many times the DNA of the bot you are looking at writes to .dn: one number in its species signature. |
| 703 | .refsx | Sense | How many times the DNA of the bot you are looking at writes to .sx: one number in its species signature. |
| 704 | .refdx | Sense | How many times the DNA of the bot you are looking at writes to .dx: one number in its species signature. |
| 705 | .refaimdx | Sense | How many times the DNA of the bot you are looking at writes to .aimdx: one number in its species signature. |
| 706 | .refaimsx | Sense | How many times the DNA of the bot you are looking at writes to .aimsx: one number in its species signature. |
| 707 | .refshoot | Sense | How 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 | .refeye | Sense | How 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 | .refnrg | Sense | The energy of the bot you are looking at, from 0 to 32000: for choosing prey worth the trouble or well-fed mates. |
| 710 | .refage | Sense | The age in cycles of the bot you are looking at, up to 32000: for recognizing newborns. |
| 711 | .refaim | Sense | Which way the bot you are looking at is pointing, on the same scale as .aim: for knowing whether it is looking at you. |
| 712 | .reftie | Sense | How 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 | .refpoison | Sense | How much defensive poison the bot you are looking at has stored: shooting at it can send poison back at you. |
| 714 | .refvenom | Sense | How much attack venom the bot you are looking at has stored: with it, that bot can paralyze you. |
| 715 | .refkills | Sense | How 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 DNA signature.
.refup,.refdn,.refsx,.refdx,.refaimdx,.refaimsx,.refshoot,.refeyeand.reftiecount how many times certain words appear in the other bot's DNA. Bots of the same species have the same signature, so by comparing it with yours (the my* sysvars) you can tell whether it is one of your own. - The state.
.refnrg,.refbody,.refshell,.refage,.refkills,.refpoison,.refvenom,.refmultiand.reffixed. - Position and movement.
.refxpos,.refypos,.refaim,.refvel,.refveldx, their opposites.refveldnand.refvelsx, and.refvelscalar..reftypesays whether what you see is a bot or a shape.
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
stopThe full explanation of sight is in Vision and recognition step by step is in A bot that recognizes its own species.