What the robot knows: state
Everything the sensors picked up in the last turn.
scan() returns the state, with what the robot knows at the start of the turn:
state.me: your robot (position, health, energy, shield, parts and attributes).state.scanned: the enemies the radar is seeing, with the angles ready for aiming. Turning the body bybearing(this.turn(enemy.bearing)) points the gun at them.state.events: what happened in the last turn (shots that hit, collisions…). See Events.state.hazards: the announced scenery events, with the place and the turn of the strike.
The arena can be round or square, small (44), medium (58) or large (90 units). Use me.distanceToEdge for the real edge and me.centerBearing to head back to the center. me.parts and me.specs describe your build.
Every field
| JavaScript / TypeScript | Python / Ruby / Lua | What it does |
|---|---|---|
| specialReady | special_ready | True when health is at 30% or less and the special attack hasn't been used yet. |
| items | items | Your items (up to 3, declared in the class with items). Each one: id, usable, ready, cooldown, charges, running, temporary and expires. |
| usable | usable | The item has an ability for use_item (passive-only ones don't). |
| ready | ready | use_item would work now: no cooldown, uses and energy left. |
| cooldown | cooldown | Ticks until the item can be used again. |
| charges | charges | The item's uses left; nil/None = unlimited. |
| running | running | Ticks left of the item's effect (nitro, bubble, cloak, overcharge). |
| temporary | temporary | A temporary item from a mystery box: one use, vanishes in expires ticks. |
| helpers | helpers | On the robot: the instances declared in helpers (new Drone()...), always in the same order. In me: your living helpers (data). In the state: enemy helpers the radar saw (with owner, distance and bearing); they don't go into scanned. |
| alive | alive | The helper is still in the battle; false once destroyed (it stays in the helpers list). |
| enemies | enemies | In a helper's state: enemies the owner's radar or its own sensor sees, nearest first. |
| enemyHelpers | enemy_helpers | In a helper's state: enemy helpers within the sensor's range. |
| owner | owner | The id of a helper's owner robot. |
| mode | mode | The Drone's mode: follow, attack, guard or repair. |
| navigation | navigation | Navigation at the start of the tick: status idle/moving/arrived/failed, target and reason. goTo returns immediate acceptance; arrived confirms the arrival. |
| status | status | The navigation's state: idle, moving, arrived or failed. |
| target | target | The destination asked of the navigation, with x and z; null when there is none. |
| reason | reason | Failure: outside_map (includes lack of room), obstacle or no_path; null without failure. |
| map | map | The robot's static grid (this.map/self.map/map): rows[z][x], 0=empty, 1=floor, 2=obstacle. |
| rows | rows | The bitmap's rows; each character is a cell: 0, 1 or 2. |
| cellSize | cell_size | The size of a cell in world units. |
| origin | origin | The bitmap's starting corner. Cell center = origin + (index + 0.5) × cellSize. |
| arena | arena | The arena's shape and dimensions (width, height). Navigation uses the same sensors in every shape. |
| centerBearing | center_bearing | How much to turn the body to point at the center: turn(me.centerBearing). Works in any shape. |
| specs | specs | The effective attributes of your own assembly: speed, acceleration, range, recharge and costs. bulletSpeed multiplies (1.2 − 0.2 × power). |
| shape | shape | The arena's shape: circle or square. |
| width | width | The arena's width in engine units. |
| height | height | The arena's height on the XZ plane, in engine units. |
| maxVelocity | max_velocity | The assembly's effective maximum speed (units per tick). |
| bulletSpeed | bullet_speed | Shot speed multiplier: (1.2 − 0.2 × power) × bulletSpeed. |
| charging | charging | Whether it's standing still preparing or recharging the battery. |
| rechargeRemaining | recharge_remaining | Preparation ticks left; zero during the gradual recharge. |
| tick | tick | The current tick number (30 per second). |
| arenaRadius | arena_radius | The arena's radius; beyond it the robot falls and is out. |
| others | others | Enemies still alive. |
| me | me | Your robot. |
| scanned | scanned | Enemies in the radar's arc, nearest first. |
| events | events | What happened to you in the last tick. |
| supplies | supplies | Drone deliveries: health, energy or a surprise chest (it may explode). Collect after land; vanishes at end. |
| hazards | hazards | Announced scenery events (lava bomb, hail, lightning, meteor, geyser, rolling boulder). |
| kind | kind | The event's kind: lavaBomb, firePool, hail, lightning, meteor, geyser or boulder. |
| radius | radius | The radius of the event's strike. |
| impact | impact | The tick the event strikes (before that it's only the warning). |
| x | x | x position. |
| z | z | z position. |
| heading | heading | The body's direction (radians): it's where it shoots. |
| radarHeading | radar_heading | The radar's direction. |
| velocity | velocity | Units per tick (at most 0.26 with treads; depends on the body). |
| strafeVelocity | strafe_velocity | Sideways speed (positive = right). |
| punchCooldown | punch_cooldown | Ticks until it can punch again (0 = ready). |
| health | health | Health: shots and collisions take it; at 0 the robot is destroyed. |
| maxHealth | max_health | Maximum health (depends on the body). |
| energy | energy | Energy: actions use it; recharge() waits 1 s standing still and recovers 1.75 per tick with the default battery. |
| maxEnergy | max_energy | Maximum energy (depends on the battery). |
| shield | shield | Shield (shield armor): absorbs damage before health and recharges. |
| maxShield | max_shield | Maximum shield (30 with the shield armor, otherwise 0). |
| outsideTicks | outside_ticks | Ticks off the arena so far (spider legs hold on for a while). |
| edgeGrace | edge_grace | How many ticks the robot can stay off the arena (spider: 30, others: 0). |
| parts | parts | The enemy's effective parts (body, head, torso, weapon, armor). |
| body | body | Locomotion base: wheels (explorador, operario, batedor, oficina), treads (guardiao, carregador, engenheiro, transporte), legs (mecanico, assistente, forca, tita) or spider (aranha, pesquisador, resgate, coletor). |
| weapon | weapon | The right forearm's cannon: cannon, railgun, shotgun or minigun. Each weapon has its own 3D model; it replaces the right hand. |
| armor | armor | Armor: none, plating, shield or reactive. |
| head | head | Head and built-in sensors: the full ID, such as pesquisador.head. Sets range, arc, turning and cost. |
| torso | torso | Torso with built-in energy, recharge and ability: the full ID, such as mecanico.torso. |
| gunHeat | gun_heat | The cannon only fires with gun_heat at 0. |
| remainingMove | remaining_move | How much is left to move. |
| remainingTurn | remaining_turn | How much the body will still turn. |
| remainingStrafe | remaining_strafe | How much is left to strafe. |
| remainingRadarTurn | remaining_radar_turn | How much the radar will still turn. |
| distanceToEdge | distance_to_edge | Distance to the arena's edge (below 0, it fell). |
| distance | distance | Distance to the enemy. |
| bearing | bearing | How much to turn the body (and the cannon, which is on the arm) to aim at the enemy: turn(target.bearing). |
| absoluteBearing | absolute_bearing | Absolute angle from you to the enemy. |
| radarBearing | radar_bearing | How much to turn the radar to keep seeing the enemy. |
| id | id | The robot's identifier. |
| name | name | The robot's name. |