FANDOM


This page offers a list of keywords that, in a side file, help you utilize the hardware on your side's bots. Some are recognized as special variables you can use to get a better picture of the environment and your own bot/side. Others are procedures called to use weapons or perform other actions.

BasicsEdit

Variable Type Comment
world-size Vector The size of the world.
world-width Real The width of the world.
world-height Real The height of the world.
position Vector Current position of this bot.
velocity Vector Current velocity of this bot.
radius Real Radius of this bot.
mass Real Mass of this bot.
speed Real Speed of this bot (not velocity).
side Integer ID of this side.
type Integer ID of this bot's type.
id Integer ID of this bot, unique within the side.
parent-id Integer ID of this robot's parent (0 if it was seeded).
processor
remaining Integer Instructions remaining this frame.
engine-power Real The engine's current power output. Writeable.
engine-max-power Real The maximum engine power output.
engine-velocity Vector The velocity the engine will seek.
collision Integer Number of robots or walls this cell is currently touching.
friendly-collision Integer Number of friendly robots this cell is currently touching.
enemy-collision Integer Number of enemy robots this cell is currently touching.
food-collision Integer Number of foods this cell is currently touching.
shot-collision Integer Number of shots this cell is currently touching.
wall-collision Integer Number of walls this cell is currently touching.
flag Integer Variable visible to other robots, for communication.
Operator Stack diagram Comment
seek-location x y -- A convenient way to set engine-velocity to go toward a location, or stop if close. Typical use: food-position seek-location.
seek-moving-location x y vx vy -- Like seek-location, but seeks a moving target. Typical use: robot-position robot-velocity seek-moving-location.
restrict-position x y walldist -- x y Move position to stay walldist awy from the walls.
die -- Blows up the robot. Useful for missiles and maybe apoptosis.
write value address -- Write value to address in shared memory. Addresses range from 1 to 1000.
read address -- value Read value from address in shared memory.
vwrite vector address -- Write vector to address and address + 1.
vread address -- vector Read vector from address and address + 1.
messages channel -- n Return the number of messages waiting on the given channel.
send message length channel -- A message-passing style communications system. Each of the 10 channels contains a queue of up to 50 messages, each of which can be up to 8 values long. Typical use: food-position time 3 1 send.
receive channel -- message length Length returned is zero if no message is available. Length 0 messages are prohibited to avoid confusion. The following code goes to the location specified in the message if the timestamp included in the message is recent. (This assumes that all messages on channel 1 are food-position / time pairs, length in this example is used only to decide if a message was received. Reliable code might want to check to see if the length is as expected): 1 receive if time 50 - > if seek-location else 2drop then then
clear-messages channel -- Skips over (for this cell) all messages currently waiting on the given channel.
skip-messages n channel -- Skips over up to n messages.
type-population type-id -- n return the number of cells of the given type.

Energy-relatedEdit

Variable Type Comment
energy Integer How much energy this bot is storing.
max-energy Integer The maximum amount of energy that can be stored.
solar-cells N/A Constructor.
eater N/A Constructor.
eaten Integer How much food was eaten this frame.
syphon-max-rate Integer The maximum syphon rate.
syphon-range Integer The maximum syphon distance.
syphon-distance Integer The current syphon distance.
syphon-direction
syphon-rate Integer How fast (and which way) to move energy. Set to zero to turn off the syphon.
syphoned Amount of energy the syphon provided last frame. Negative if energy was given instead of taken.

ConstructorEdit

Variable Type Comment
constructor-max-rate Integer How fast the constructor can run.
constructor-rate Integer How fast the constructor is running.
constructor-type Integer ID of the child's type. Upon birth, this is automatically reset to 0.
constructor-progress Integer How much energy we've put into the child so far.
constructor-remaining Integer How much energy is needed to finish the child.
child-id Integer ID of the last child created, or 0.
Operator Stack diagram Comment
autoconstruct -- Turn the constructor on if we have plenty of energy. Start a new child if necessary.
balance-type fraction type -- Sets constructor-type if type's fraction of population is less than fraction.

SensorsEdit

Only robot sensor is shown here; the food and shot sensors are identical except where noted.

Variable Type Comment
robot-sensor-range
robot-sensor-firing-cost
robot-sensor-time Time the sensor was last fired.
robot-found Integer Number of robots seen. May be more than num-robot-results.
robot-position Vector Coordinate location of the active sensor contact
robot-velocity Vector
robot-position-overall Vector Average position of all robots seen.
robot-relative-position Vector Position of sensed robot in relation to the sensor
robot-distance
robot-direction
robot-distance-overall Distance to robot-position-overall.
robot-direction-overall Direction of robot-position-overall.
robot-side ID, or 0 if neutral.
robot-type For robots, the type's ID. For shots, 1 = blaster, 2 = grenade, 3 = syphon, 4 = enemy-syphon, 5 = forcefield, 0 otherwise. Not available for food.
robot-id Only for robots.
robot-radius
robot-mass Not available for shots.
robot-energy Not available for shots.
robot-flag For robots only, the cell's flag variable.
shot-power How powerful the shot is. Units depend on the type of shot. Only for shots.
robot-shield-fraction The fraction of damage that will get through the robot's shield. Only for robots.
robot-bomb How large a bomb the robot has. Only for robots.
robot-reloading Whether the robot has fired a weapon lately. Only for robots.
num-robot-results Number of available sensor results.
current-robot-result Current sensor result (0 to num - 1). Writeable.
robot-sensor-sees-friends Boolean Whether the sensor will see friendly bots. False by default. Writeable. No equivalent for food.
robot-sensor-sees-enemies Boolean Whether the sensor will see enemy bots. True by default. Writeable. No equivalent for food.
robot-sensor-focus-distance Results are sorted by distance from the focus, which is (awkwardly) in polar coordinates relative to the robot firing the sensor.
robot-sensor-focus-direction
Operator Stack diagram Comment
fire-robot-sensor --
next-robot -- success Advances to the next sensor result. If there are no more results, returns to the first result. Returns 0 if wraparound occured, 1 otherwise. Suggested use: robot-found if do process sensor result next-robot while-loop then
periodic-robot-sensor period -- fired? If the sensor hasn't fired in (period - 1) frames, fire it and sync. Return whether we fired.

DefensesEdit

Variable Type Comment
armor Armor remaining.
max-armor Maximum (= initial) armor.
repair-rate Current repair power. Writeable.
max-repair-rate
shield Shield setting. Writeable.
max-shield
shield-fraction Fraction of damage that will get through the shield.
last-hit ID of the last side that damaged this cell, or 0.

WeaponsEdit

Variable Type Comment
blaster-damage
blaster-range
blaster-speed
blaster-lifetime
blaster-reload-time
blaster-firing-cost
blaster-cooldown How many frames before the blaster can fire again.
grenades-damage
grenades-range
grenades-speed
grenades-lifetime
grenades-reload-time
grenades-firing-cost
grenades-cooldown How many frames before the grenade launcher can fire again.
grenades-radius The radius of the explosion the grenade will make.
force-field-max-power
force-field-range
force-field-distance Writeable.
force-field-direction Writeable.
force-field-power Current setting. Writeable.
force-field-angle Direction the field pushes in. Writeable.
force-field-radius The radius the forcefield will have at the current power.
enemy-syphon-max-rate
enemy-syphon-range Maximum distance the syphon can reach.
enemy-syphon-distance Current distance.
enemy-syphon-direction
enemy-syphon-rate How fast (and which way) to move energy. Set to zero to turn off the syphon.
enemy-syphoned Amount of energy the syphon provided last frame. Negative if energy was given instead of stolen.
Operator Stack diagram Comment
fire-blaster direction --
fire-grenade distance direction --
lead-blaster target-position target-velocity -- Fires at a moving target, if the target will still be in range when the shot hits.
lead-grenade target-position target-velocity --
set-force-field position angle -- Turns the forcefield on at full power at the given location and angle.

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.