RoboWar

I first encountered RoboWar as a teenager in high school. It let you program circular “robots” that would battle each other in a small arena. The unpaid shareware version only allowed 100 instructions—barely enough to move and shoot—so my robots weren’t great, but it was a lot of fun anyway and the programming language was a completely new paradigm for me. I’ve been looking for an activity for my local programming club and thought it would be fun to revisit. Since most of the original documentation has vanished from the web, I wrote this article to restore it.

RoboTalk Programming Language

RoboTalk is a stack-based language using postfix (Reverse Polish) notation. Instead of writing 5 + 3, you write 5 3 +. Values are pushed onto a stack, and operators consume values from the stack and push results back.

Basic Syntax

  • Labels are defined with a colon, e.g Main:
  • Comments start with # or are enclosed in { }
  • Variables are read by name and written with a quote: aim reads the aim register, aim' writes to it
  • Storing values uses the pattern: 90 aim' sto (stores 90 in aim)
Arithmetic Operators
Operator Description
+ Addition
- Subtraction
* Multiplication
/ Division
MOD Modulo (remainder)
Math Functions
Operator Description
SIN / SINE Sine
COS / COSINE Cosine
TAN / TANGENT Tangent
ARCSIN Inverse sine
ARCCOS Inverse cosine
ARCTAN Inverse tangent
SQRT Square root
ABS Absolute value
CHS Change sign (negate)
MAX Maximum of two values
MIN Minimum of two values
DIST Distance calculation
Comparison Operators
Operator Description
> Greater than
< Less than
= Equal to
! Not equal to
Logical Operators
Operator Description
AND Logical AND
OR Logical OR
XOR / EOR Exclusive OR
NOT Logical NOT
Stack Manipulation
Operator Description
DROP Remove top value from stack
DROPALL Clear entire stack
DUP Duplicate top value
SWAP Exchange top two values
ROLL Rotate stack values
NOP No operation
Control Flow
Operator Description
IF Conditional jump (saves return address)
IFG Conditional goto (no return address)
IFE Conditional jump if equal
IFEG Conditional goto if equal
JUMP Unconditional jump
CALL Call subroutine
RETURN Return from subroutine
RTI Return from interrupt

The IF statement works like this: value1 value2 operator label IF. For example, range 0 > ShootEm if means “if range > 0, jump to ShootEm and save the return address.”

Variables (A-Z)

You have 26 general-purpose variables named A through Z. Read them by name, write to them with a quote suffix:

sample label code
1
2
3
10 a' sto    # Store 10 in variable A
a 5 + b' sto # Store A + 5 in variable B

Note: X and Y are special—they return the robot’s coordinates and are read-only.

Robot State Registers

These registers let you read and control your robot:

Robot State Registers
Register Description
X Robot X coordinate (read-only)
Y Robot Y coordinate (read-only)
AIM Turret aim angle (0-359 degrees)
SPEEDX Horizontal velocity (-20 to 20)
SPEEDY Vertical velocity (-20 to 20)
ENERGY Current energy level
DAMAGE Current health
SHIELD Current shield level
Sensor Registers
Register Description
RANGE Distance to robot in line of sight (0 if none)
RADAR Distance to nearest bullet (0 if none)
LOOK Direction being scanned
SCAN Scan for targets
WALL Distance to wall
ROBOTS Number of robots remaining in arena
RANDOM Random number
COLLISION Collision detection
DOPPLER Doppler shift (for leading shots)
Communication Registers
Register Description
CHANNEL Communication channel
SIGNAL Signal value
FRIEND Friendly robot detection
TEAMMATES Teammate count
ID Robot ID (0-5)
Other Registers
Register Description
PROBE Probe sensor data
HISTORY Battle history
KILLS Kill count
CHRONON Current game tick
NEAREST Nearest object

Weapon Commands

Write to these registers to fire weapons:

Weapon Commands
Command Description
FIRE' Fire current weapon
BULLET' Fire bullet
MISSILE' Fire missile
LASER' Fire laser
HELLBORE' Fire hellbore
STUNNER' Fire stunner
MINE' Deploy mine
DRONE' Deploy drone
NUKE' Fire tactical nuke
MEGANUKE' Fire mega nuke

The value you write determines the energy spent (and thus damage dealt): 15 fire' sto fires with 15 energy.

Movement Commands
Command Description
MOVEX' Set horizontal movement
MOVEY' Set vertical movement
SPEEDX' Set horizontal speed
SPEEDY' Set vertical speed
Interrupt Control
Command Description
INTON Enable interrupts
INTOFF Disable interrupts
FLUSHINT Flush interrupt queue
SETINT Set interrupt handler
Display and Debug
Command Description
PRINT Display value
DEBUG / DEBUGGER Enter debug mode
BEEP Play sound
ICON0 - ICON9 Display robot icons
SND0 - SND9 Play sounds
SYNC Synchronize
END End program

Hardware Configuration

When building a robot, you spend Hardware Points on various attributes and weapons. The total determines your robot’s class.

Robot Classes
Points Class
0-2 Little Leaguer
3-9 Mortal
10-23 Titan

Most competitive play uses the 9-point “Mortal” class.

Energy Capacity
Max Energy Cost
150 3 points
100 2 points
60 1 point
40 0 points
Damage Capacity (Health)
Max Damage Cost
150 3 points
100 2 points
60 1 point
30 0 points
Shield Capacity
Max Shield Cost
100 3 points
50 2 points
25 1 point
0 0 points

Processor Speed

This determines how many instructions your robot executes per chronon (game tick):

Processor Speed
Cycles Cost
50 4 points
30 3 points
15 2 points
10 1 point
5 0 points

Bullet Types

Choose one (mutually exclusive):

Bullet Types
Type Cost Damage
Explosive 2 points Energy × 2
Normal 1 point Energy × 1
Rubber 0 points Energy ÷ 2

Weapons

Each weapon costs 1 Hardware Point. Choosing the right weapons for your strategy is crucial.

Bullets (FIRE / BULLET)

Bullets are your primary weapon and don’t cost extra hardware points—they’re included with every robot. They travel at speed 12 and deal damage based on your bullet type (Explosive, Normal, or Rubber). Bullets are versatile and energy-efficient, making them the workhorse weapon for most robots. Use the BULLET' command when you have explosive bullets but want to fire a normal shot to avoid splash damage at close range.

  • Damage: Depends on bullet type (Explosive: Energy × 2, Normal: Energy × 1, Rubber: Energy ÷ 2)
  • Speed: 12
  • Best for: General combat, consistent damage output

Missiles

Missiles are slow but devastating. They travel at only speed 5, making them easy to dodge at long range, but they deal double damage (Energy × 2). Missiles excel at close-range combat where the enemy has less time to react, or against stationary/predictable targets. The slow speed makes leading shots more difficult—you need to anticipate where the enemy will be much further in advance.

  • Damage: Energy × 2
  • Speed: 5
  • Cost: 1 hardware point
  • Best for: Close-range brawling, high-damage ambushes

Hellbores

Hellbores are unique because their speed equals the energy you put into them. Fire with 4 energy and it moves at speed 4; fire with 20 energy and it moves at speed 20. This makes them incredibly versatile—slow and powerful or fast and light. The tradeoff is you must fire between 4-20 energy per shot (no tiny plinks or massive blasts). Advanced robots use hellbores to vary their projectile timing and confuse enemies that try to dodge predictable shots.

  • Damage: Energy × 1
  • Speed: Equal to energy invested (4-20)
  • Cost: 1 hardware point
  • Best for: Unpredictable attacks, skilled players who can exploit variable timing

Lasers

Lasers hit instantly—no travel time, no leading required. Point at an enemy, fire, and they take damage immediately. The catch? They only deal 1/5 of the energy invested as damage, making them very energy-inefficient. Lasers also require line-of-sight to a living robot; you can’t fire into empty space. They’re ideal for finishing off weak enemies or for robots that struggle with leading shots.

  • Damage: Energy ÷ 5
  • Speed: Instant
  • Cost: 1 hardware point
  • Best for: Guaranteed hits, finishing blows, simple aiming logic

Stunners

Stunners don’t just damage enemies—they temporarily freeze them in place, stopping their program execution. This gives you time to line up follow-up shots or escape. The damage is low (Energy ÷ 4), so stunners work best as a tactical tool rather than a primary weapon. Stun an enemy, then blast them with missiles while they can’t dodge.

  • Damage: Energy ÷ 4
  • Speed: 14
  • Cost: 1 hardware point
  • Best for: Crowd control, setting up kills, disabling dangerous enemies

Mines

Mines are deployed at your current location and sit there until an enemy touches them. They’re defensive weapons—drop them while retreating or place them in areas enemies are likely to pass through. The damage formula (2 × (Energy - 5)) means you need at least 6 energy to deploy one, with 5 energy as overhead. Mines are great for area denial and punishing aggressive pursuers.

  • Damage: 2 × (Energy - 5)
  • Minimum energy: 6
  • Cost: 1 hardware point
  • Best for: Defense, area denial, punishing chasers

Drones

Drones are autonomous homing projectiles. Once launched, they track and chase the target robot for 100 chronons before expiring. They deal half damage (Energy ÷ 2) but don’t require you to aim—the drone does the work. Drones are excellent against evasive enemies and let your robot focus on dodging while the drone handles offense. The downside is their limited lifespan and reduced damage.

  • Damage: Energy ÷ 2
  • Lifespan: 100 chronons
  • Cost: 1 hardware point
  • Best for: Fire-and-forget attacks, fighting evasive enemies, multitasking

TacNukes (Tactical Nukes)

TacNukes explode at your current position, dealing area damage to nearby enemies. They’re suicide weapons in a sense—you need to get close to use them effectively, and you might catch yourself in the blast. They’re best used as a desperation move when you’re about to die anyway, or by robots designed around hit-and-run tactics.

  • Damage: Energy × 1 (area effect)
  • Cost: 1 hardware point
  • Best for: Desperation attacks, close-range specialists, mutual destruction

MegaNukes

MegaNukes are larger, more powerful versions of TacNukes with a 20-unit blast radius and 1.5× damage multiplier. They’re the ultimate area denial weapon but share the same risks—you need to be close, and you might hurt yourself. Use them when surrounded or when you’ve cornered an enemy and want to ensure the kill.

  • Damage: Energy × 1.5 (area effect)
  • Blast radius: 20 units
  • Cost: 1 hardware point
  • Best for: Large area attacks, ensuring kills, last stands

Probes

Probes aren’t weapons—they’re sensors that reveal enemy information. When you have probes equipped, you can query a target robot’s stats: their remaining damage (health), current energy, shield level, ID, aim direction, and more. This intelligence lets you make smarter decisions: focus fire on wounded enemies, avoid well-shielded ones, or predict where they’re aiming.

  • Damage: None (sensor only)
  • Cost: 1 hardware point
  • Best for: Intelligence gathering, target prioritization, advanced tactics

Probe Modes

When you have probes equipped, write a mode value to query enemy stats:

Probe Modes
Mode Returns
0 Target’s Damage
1 Target’s Energy
2 Target’s Shield
3 Target’s ID
4 Teammate Count
5 Target’s Aim
6 Target’s Look
7 Target’s Scan

Game Mechanics

Movement

  • Maximum speed: 20 in any direction
  • Movement cost: 2 × speed in energy per chronon
  • Reversing direction costs double (going from +4 to -4 costs 16 energy)
  • Speed persists until changed
  • Arena boundaries: 0-300 on both X and Y axes

Weapon Speeds

For leading your shots, you need to know projectile speeds:

Weapon Speeds
Weapon Speed
Bullets 12
Stunners 14
Missiles 5
Hellbores Energy invested
Lasers Instant

Leading Shots

To hit a moving target, use the doppler register with arctan:

leading calculation code
1
2
3
doppler -12 arctan aim + aim' sto  # Lead for bullets
10 fire' sto

The formula compensates for target movement based on the weapon’s speed.

Example Robot

Here’s a simple robot that demonstrates the basics:

Simple Robot
1
2
3
4
5
6
7
8
9
10
11
# Simple robot that rotates and shoots

Main:
  range 0 > ShootEm if    # If we see a robot, shoot it
  aim 5 + aim' sto        # Otherwise, rotate turret 5 degrees
  Main jump               # Loop forever

ShootEm:
  10 fire' sto            # Fire with 10 energy
  return                  # Return to scanning

This robot continuously rotates its turret. When range returns a non-zero value (meaning there’s a robot in the line of fire), it jumps to ShootEm and fires.

A More Advanced Robot

Advanced Robot
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# Robot with movement and leading shots

Main:
  5 speedx' sto           # Start moving right

Scan:
  range 0 > Attack if     # Found a target?
  aim 7 + aim' sto        # Rotate turret
  Scan jump

Attack:
  doppler -12 arctan      # Calculate lead angle
  aim + aim' sto          # Adjust aim
  15 fire' sto            # Fire!

  # Dodge after shooting
  speedy chs speedy' sto  # Reverse vertical direction
  Scan jump

This robot moves while scanning, leads its shots using doppler compensation, and reverses direction after each shot to make itself harder to hit.

Tips for Writing Robots

  1. Manage your energy: Don’t fire with more energy than you can spare. Running out of energy means you can’t move or shoot.
  2. Keep moving: A stationary robot is an easy target. Even simple oscillating movement helps.
  3. Lead your shots: Moving targets require aim compensation. The doppler register tells you how much to adjust.
  4. Use interrupts: Set up interrupt handlers for collisions and low damage to react quickly to threats.
  5. Know your class: A 9-point Mortal robot needs careful tradeoffs between firepower, speed, and survivability.
  6. Test against variety: A robot that beats one opponent might lose to another. Test against different strategies.

I compiled this documentation with help from Claude reviewing the RoboWar source code.