RoboWar II

A Quick Attempt At Documentation

By Mark Wagner



Known bugs

The modification dates for the robot components aren't displayed properly.
The icon factory can be slow to redraw.
The icon factory scroll bar doesn't work properly.
The beep opcode only beeps if your computer has an internal speaker.
If an error occurs while saving a robot when the program is exiting, the program still exits.
The "slow" and "normal" combat speeds are not neccessarily as fast as they should be.

Unimplemented features

Password protection of robots is not implemented.
Sound is not implemented.
The debugger is not implemented.

Contents

Introduction
Program stations
Language & Robot Design
Hardware
Operators
Registers
Interrupts
RoboWar Tournaments
A History of RoboWar


Introduction



Stations

Arena

This is where robots fight it out.

Combat


Scoring
Under the default rules a robot gets one point for each non-teammate robot it kills by any means. It also gets one point for surviving to the end of combat.

Drafting Board

This is where you edit the source code of your robot.

Hardware Store

This is where you set the hardware options for your robot.

Icon Factory

This is where you create icons to represent your robot.

Recording Studio

This is not implemented yet.


An Introduction to Robot Design and the RoboTalk language


Coordinate system
The RoboWar coordinate system is based on the coordinate system used by computer monitors. (0,0) is at the top left corner of the arena, with x increasing to the right, and y increasing downwards. Angles are measured in degrees, with 0 degrees being up (in the -y direction), and 90 degrees being to the right (in the +x direction).
           ^
          0|-y
           |
           |
 -x        |        +x
<----------+---------->
 270       |        90
           |
           |
        180|+y
           v
RoboWar directions and angles

Under the standard RoboWar II rules, the arena coordinates go from (0,0) at the top-left corner to (300,300) in the lower-right corner.

Numbers
All numbers used in RoboWar are integers. This means that, for example, 5 2 / results in 2 rather than 2.5. Numbers specified in a program's source code cannot be smaller than -2,000,000,000 or larger than 2,000,000,000. It's perfectly possible to write a program that generates numbers outside that range, but the results can be unpredictable.

Variables
<Technical Stuff>
Internally, variable names are represented as numbers. This allows techniques such as computed addressing:
a' 3 + recall places the contents of d on the stack
and indirect addressing:
q' a' store
a recall
places the contents of q on the stack. The second line could also be written as a' recall recall
</Technical Stuff>

Operators

Comments
Comments are descriptive text added to a robot to help people understand what the program is doing. Comments don't have any effect on the robot's program. RoboTalk has two types of comments: single-line comments that begin with a # character and extend to the end of the line, and extended comments that begin with a { character and continue to the next } character. Extended comments can be nested within each other, for example:
{Now inside comment one {This comment is nested two deep}Back in comment one}

Compiler directives

Compiler directives provide additional information to the compiler about how to compile programs.
#!!define
Allows you to created named constants, user-defined variable names, and similar things.

For example, suppose you wanted your robot to to travel at a speed of 15. You'd have lines like 15 speedx' store and 15 speedy' store in a number of places in your code. Now suppose you found that, when moving at a speed of 15, your robot was running out of energy whenever it changed direction, and you decided to slow it down to a speed of 10. You'd need to go through your program and change every single one of those 15s to 10s. A better way to do this would be to put a line like:
#!!define MoveSpeed 10
at the beginning of your program, and then, wherever you had 15 speedx' store or 15 speedy' store, replace the 15 with MoveSpeed. Then, if you later wanted to change the robot's speed, say, up to 12, you'd just change the one line to #!!define MoveSpeed 12.

User-named variables

Now, let's say your robot changes it's speed in response to events in the arena, for example, speeding up when a robot gets too close. You'd store the robot's speed in one of the user variables, for example, a. Then you'd need to remember what a was every time you modified the robot. Or, you could use #!!defines to give a a more memorable name:
#!!define RobotSpeed a
#!!define RobotSpeed' a'

This would allow you to use RobotSpeed as a variable name in exactly the same way you'd use any other variable. It's important to remember that this does not create new variables, it just allows you to give new names to old ones.


A good example of the use of #!!defines is the CornerBot 4 sample robot.


Maximum size limitations:
A robot program can have no more than two billion instructions, no more than 10,000 labels of unlimited length, and the source code can be no larger than four gigabytes. Extended comments may be nested no more than four billion deep.

RoboWar II's size limitations are so large you probably will never run into them. However, there may be limitations placed by the tournament director. For example, the official tournaments don't allow robots with more than 5000 instructions.


Hardware

Weapons: RoboWar II has ten types of weapon:

Bullets. Essentially the same as normal bullets from the original RoboWar. They travel at 12 pixels/chronon, and do damage equal to the energy invested in them.

Mines. They just sit there, and any robot unfortunate enough to hit one takes damage equal to five times the energy invested.

Lasers. They hit every robot in the direction they are fired the chronon after they are fired, doing damage equal to 1/3 the energy invested.

Homing missiles. Homing missiles turn towards the robot closest to being straight in front of of them by 2 degrees per chronon. Homing missiles travel at 5 pixels/chronon and do damage equal to one and a half times the energy invested.

Rocket grenades. Rocket grenades explode when they hit a wall or a robot, creating an explosion that expands at 12 pixels/chronon for 3 chronons. At the end of the expansion, every robot within the blast radius takes damage equal to one and a half times the energy invested. Rocket grenades travel at 5 pixels/chronon.

Feedback Gun. A feedback gun fires projectiles that cause catastrophic collapse of the shields of any robot hit. A feedback projectile travels at 13 pixels/chronon and does damage equal to three times the energy invested, to a maximum of the shield level of the target robot.

Flamethrower. It creates a wall of flame 20 pixels thick, extending 20 degrees to either side of the robot's turret. It moves outward at 10 pixels/chronon for 10 chronons, doing damage equal to the energy invested for each chronon a robot is caught in the flames.

Glueballs. These travel at 14 pixels/chronon, and cause any robot hit to be stuck in place for one chronon for every three energy invested in the glueball. A robot hit by a glueball can still use movex and movey to teleport out of danger.

Paintballs. Similar to glueballs, these blind a robot's sensors for energy/3 chronons.

Reflectors. These cost 1 energy to fire, and can be set to travel at any speed. They do no damage to a robot that gets hit, but since they look like any other weapon, they can clog up the robot's radar and cause it to not see the real danger.

RoboWar II introduces a new concept in hardware: Armor. A robot's armor gives it complete protection against certain types of attacks. There are seven types of armor:

Reactive armor, which protects against mines,
Impact armor, which protects against bullets and collisions with other robots,
Thermal armor, which protects against flamethrowers,
Photocell armor, which protects against lasers, and adds 1/5 the energy used for the laser to the robot's energy banks,
Camoflage armor, which keeps homing missiles from tracking the robot, and protect against damage should the robot be hit,
Flak armor, which protects against grenade explosions, and
Liquid armor, which protects against glueballs and paintballs.

To keep robots from becoming invincible, a robot may have no more than one type of armor equipped.

Operators:


The RoboTalk operators are as follows:
+          -          *          /          =
!=         <          <=         >          >=
^          
abs        and        arenax     arenay     arccos
arcsin     arctan     beep       call       chs
cosine     debugger   dist       drop       dropall
duplicate  eor        flushint   fstore     frecall
getint     getparam   hstore     hrecall    icon       
if         ife        ifeg       ifg        inton      
intoff     jump       max        min        mod        
nop        not        or         pull       print      
recall     return     roll       rti        sendsignal 
setcode    setint     setparam   sign       sine       
sound      sqrt       srecall    store      swap       
sync       tangent    trecall    vrecall    vstore

Many of these commands have abbreviations. dup is an abbreviation for duplicate, debug for debugger, xor for eor, sin for sine, cos for cosine, tan for tangent, and sto for store.

+
Adds the two numbers on the top of the stack, removes them, and replaces them with the result. E.g. 5 4 + leaves 9 on the stack.

-
Subtracts the top number from the second number on the stack, removes them, and replaces them with the result. E.g. 10 5 - leaves 5 on the stack.

*
Multiplies the two numbers on the top of the stack, removes them, and replaces them with the result. E.g. 3 4 * leaves 12 on the stack.

/
Divides the second number by the top number on the stack, removes them, and replaces them with the result, truncated to the nearest integer. E.g. 16 5 / leaves 3 on the stack.

=
Checks to see if the two numbers on the top of the stack are equal, removes them, and places 1 on the stack if they are equal, 0 if they are not. E.g. 1 1 = leaves 1 on the stack.

!=
Checks to see if the two numbers on the top of the stack are not equal, removes them, and places 1 on the stack if they are not equal, 0 if they are. E.g. 1 1 != leaves 0 on the stack.
For compatibility with the original RoboWar, ! is a synonym for !=

>
Checks to see if the second number on the stack is larger than the top number, removes them, and places 1 on the stack if it is, 0 if it isn't. E.g. 2 1 > leaves 1 on the stack.

>=
Checks to see if the second number on the stack is larger than or equal to the top number, removes them, and places 1 on the stack if it is, 0 if it isn't. E.g. 1 1 >= leaves 1 on the stack.

<
Checks to see if the second number on the stack is smaller than the top number, removes them, and places 1 on the stack if it is, 0 if it isn't. E.g. 2 1 < leaves 0 on the stack.

<=
Checks to see if the second number on the stack is smaller than or equal to the top number, removes them, and places 1 on the stack if it is, 0 if it isn't. E.g. 1 2 <= leaves 0 on the stack.

^
Raises the second number on the stack to the power of the top number of the stack, removes them, and places the result on the stack. E.g. 2 3 ^ leaves 2*2*2 or 8 on the stack.

abs
Removes the top item on the stack, and replaces it with the absolute value of that item. E.g. -3 abs leaves 3 on the stack.

and
Boolean "and". Removes the top two numbers from the stack, and places 1 on the stack if both numbers are non-zero. If either number is zero, places 0 on the stack. E.g. 2 3 and leaves 1 on the stack.

arenax
Places the width of the arena on the stack. Useful for robots meant to operate in a variety of arena sizes.

arenay
Places the height of the arena on the stack. Useful for robots meant to operate in a variety of arena sizes.

arccos
Inverse cosine. Computes the principal inverse cosine of the top number divided by the second number. Returns the result in degrees in the range of 0 to 180. Note that you may have to convert the result to the appropriate coordinate system before using it to set the aim register or such. E.g. 1000 707 arccos leaves 45 on the stack.

arcsin
Inverse sine. Computes the principal inverse sine of the top number divided by the second number. Returns the result in degrees in the range of -90 to 90. Note that you may have to convert the result to the appropriate coordinate system before using it to set the aim register or such. E.g. 1000 707 arcsin leaves 45 on the stack.

arctan
Inverse tangent. Computes the inverse tangent of the ratio of the top two numbers. The y value must be the top operand; the x value must be the second operand. arctan removes the top two operands and returns the arctangent of y/x. The result is in degrees between 0 and 359, with 0 degrees pointing up, just as with aim angles. Also remember that the positive x values are on the right side of the arena, while positive y values are on the bottom of the arena. E.g. -5 0 arctan leaves 270 on the stack.

beep Beeps once. Does nothing to the stack. Takes zero chronons to execute. Useful for debugging a robot.

call Jumps to the instruction number or label on the top of the stack, removes that number, and places the address of the instruction after the call instruction on the stack.

chs
Removes the top item on the stack, multiplies it by -1, and puts the result on the stack. E.g. 5 chs leaves -5 on the stack.

cosine
The top item on the stack should be the hypotenuse of the triangle, and the second item should be the angle. Removes the top two numbers, and replaces them with the hypotenuse times the cosine of the angle. Note that cosine uses the standard trig coordinate system (e.g. the cosine of 90 is 0). E.g. 30 100 cos leaves 86 (100*cos(30)) on the stack.
cos can be used as a synonym for cosine.

debugger
If the robot is selected for debugging, acts like a sync instruction, and pauses the battle. If the robot is not selected for debugging, the debugger instruction does nothing and takes no time to execute.

dist
Calcuates the distance from the origin to a point (x,y). The top two elements of the stack are x and y, they are removed and replaced with the distance. E.g. 5 12 dist leaves 13 on the stack.

drop
Removes the top item from the stack. E.g. 1 2 3 4 drop leaves 1 2 3 on the stack.

dropall
Empties the stack. Useful primarily for interrupt routines that may not return to where they were called, and for sloppy programmers who tend to let junk accumulate on the stack. E.g. 1 2 3 4 5 6 dropall leaves nothing on the stack.

duplicate
Places a copy of the top item on the stack on the stack. E.g. 2 3 4 dup leaves 2 3 4 4 on the stack.
dup can be used as a synonym for duplicate.

eor
Boolean "exclusive or". Removes the two numbers on the stack, and places 1 on the stack if one or the other is non-zero. If both are zero, or both are non-zero, places 0 on the stack. E.g. 2 0 eor leaves 1 on the stack. 2 2 eor leaves 0 on the stack.
xor can be used as a synonym for eor.

flushint
Clears the interrupt queue.

fstore
Stores a number in a vector (1-dimensional array) that is shared among all members of a team. The top element of the stack specifies the element of the vector (0 to 100), while the second item is the number to store. Both numbers are removed from the stack. E.g. 23 1 vstore stores 23 in element 1 of the shared vector.

frecall
Recalls a number from the shared team memory. The top number on the stack is the element to recall; it is removed and replaced with the contents of that item in the vector. Memory locations are initialized to zero; locations outside the range of 0 to 100 also return 0.

getint
Recalls the interrupt procedure associated with a given interrupt. The top element of the stack must be the name of the register corresponding to the interrupt.

getparam
Recalls the parameter controlling when an interrupt occurs. The top element of the stack must be the name of the register corresponding to the interrupt.

hstore
Stores a number in the history vector. The contents of the history vector, unlike any other register or vector, are preserved between battles. The history registers are:
    1) Number of battles fought
    2) Kills made in previous battle
    3) Kills made in all battles so far
    4) Survival points from previous battle
    5) Survival points in all battles so far
    6) 1 if the last battle timed out, 0 otherwise
    7) Reserved for future use
    8) Reserved for future use
    9) Damage points left at the end of the last battle
    10) Chronons elapsed in the last battle
    11) Chronons elapsed in all previous battles
    12) ID of the robot that killed you in the last battle, or -1 if not killed by a robot
    13-30) Reserved for future use
    31-100) Available for use by robots
History vector elements default to 0. Attempting to write to a reserved element has no effect, any other element can be written to. History is cleared when robots are added to or removed from the arena.

hrecall
Read from a history register. Reading from an element outside the range 0 to 100 returns 0.

icon
Sets the robot's icon to that specified by the number on the top of the stack, and removes that number from the stack. Icons are numbered starting with 0. For example, 3 icon will display icon 3 (the fourth icon displayed in the icon factory). If an invalid icon is specified, the robot will go buggy. -1 icon re-enables automatic icon display if you had used icon before. icon takes no time to execute, and if the instruction immediately preceding the icon instruction is a number, that number takes no time to execute as well. E.g. 3 icon leaves nothing on the stack, displays icon 3, and takes zero cpu cycles to execute. 2 2 + icon leaves nothing on the stack, displays icon 4, and takes three cpu cycles to execute.

if
If-then command. Checks the second element of the stack. If it is non-zero, jumps to the label or address specified on the top of the stack, removes the top two items on the stack, and places the address of the instruction after the if operand on the stack.

ife
If-then-else command. Checks the third element of the stack. If it is non-zero, jumps to the label or address specified by the second element on the stack. If it is zero, jumps to the label or address specified by the top element on the stack. Removes all three elements, and places the address of the instruction after the ife operand on the stack.

ifg
If-then-go command. Works like if, but does not leave a return address on the stack.

ifeg
If-then-else-go command. Works like ife, but does not leave a return address on the stack.

inton
Turns interrupts on. Does nothing to the stack.

intoff
Turns interrupts off until the next inton or rti command is executed. Interrupts are still added to the interrupt queue, but are not called until interrupts are turned back on. Does nothing to the stack.

jump Jumps to the instruction number or label on the top of the stack, and removes that element from the stack. Does exactly the same thing as return.

max
Removes the two items from the top of the stack, and puts the larger of the two back on the stack. E.g. 37 92 max leaves 92 on the stack.

min
Removes the two items from the top of the stack, and puts the smaller of the two back on the stack. E.g. 37 92 min leaves 37 on the stack.

mod
Places the remainder from dividing the second number by the top number on the stack. Unlike mod in the original RoboWar, mod in RoboWar II always returns a positive number. E.g. 16 5 mod leaves 1 on the stack.

nop
Does nothing whatsoever except take up time and space. Useful for timing purposes, to ensure that specific operations take place at specific times during a chronon.

not
Boolean "not". Removes the top number on the stack, and replaces it with 0 if it is non-zero, 1 if it is zero. E.g. 2 not leaves 0 on the stack.

or
Boolean "or". Removes the two numbers on the top of the stack, and places 1 on the stack if either number is not zero. If both numbers are zero, places 0 on the stack. E.g. 2 0 or leaves 1 on the stack.

pull
Pops the top item off the stack and uses that to determine what item on the stack to bring to the top. E.g. 2 4 6 2 pull will bring 4 to the top of the stack, resulting in the stack being 2 6 4.

print
Displays the top element on the stack in a dialog box. Does nothing to the stack, and takes no time to execute. Useful for debugging purposes; does nothing during a tournament.

recall
Recalls a number from a register and places it on the stack. Useful mainly for advanced programmers, since the compiler automatically adds a recall statement after any unquoted variable. See the section on registers for more information.

return Jumps to the instruction number or label on the top of the stack, and removes that element from the stack. Does exactly the same thing as jump.

roll
Rolls the second element of the stack back by the number of places specified by the top element, then pops the top element off the stack. E.g. 2 4 6 8 2 roll leaves 2 8 4 6 on the stack.

rti
Return from Interrupt. Turns interrupts on, then jumps to the address on the top of the stack. Does exactly the same thing as an inton followed by a return, but does it in a single instruction.

sendsignal
Triggers the signal interrupt for all other robots on the robot's team. Does not trigger it for the robot itself.

setcode
Sets the instruction of the robot's program at the location specified on the top of the stack to the value on the second location of the stack, then removes both items from the stack. The location being modified must be greater than or equal to zero, and less than the length of the robot's code; it cannot be used to make a robot's program longer. This allows for self-modifying code in robots. Note: it is recommended that only advanced RoboWar programmers use this feature, as it can lead to unbelievably hard-to-find bugs in robots.

setint
Sets an interrupt procedure to execute when an interrupt occurs. The top element of the stack must be the name of the register corresponding to the interrupt, and the second element must be the label or address to jump to when the interrupt occurs. E.g. leave radar' setint leaves nothing on the stack, and when the radar interrupt is triggered, execution will jump to the instruction after the leave: label.

setparam
Sets the parameter controlling when an interrupt occurs. The top of the stack must be the name of the register corresponding to the interrupt, and the second item is the parameter to set. E.g. 100 radar' setparam sets the radar interrupt to trigger when a munition is within 100 pixels of the robot.

sign
Removes the top item from the stack, and replaces it with 1 if the number is positive, -1 if the number is negative, and 0 if the number is 0. E.g. -17 sign leaves -1 on the stack.

sine
The top item on the stack should be the hypotenuse of the triangle, and the second item should be the angle. Removes the top two numbers, and replaces them with the hypotenuse times the sine of the angle. Note that sine uses the standard trig coordinate system (e.g. the sine of 90 is 1). E.g. 30 100 cos leaves 50 (100*sin(30)) on the stack.
sin can be used as a synonym for sine.

sound
Plays the sound specified by the top element of the stack. Takes no time to execute, and if the previous instruction was a number, placing that number on the stack takes no time as well. E.g. 5 sound plays sound 5, and takes no time to execute.

sqrt
Removes the top number from the stack, and replaces it with its square root. If the number is negative, the robot self-destructs. E.g 10 sqrt leaves 3 on the stack.

srecall
Scan the nearest robot in the direction of aim, placing the result of the scan on the stack. Use like recall (eg. damage' srecall). The registers available for scanning are speedx, speedy, aim, damage, shield, energy, and armor. Any robot can execute armor' srecall, to recall the other scanner registers, scanners must be equipped in the hardware store.
Scanning armor' reads what armor the other robot has equipped. 0 = no armor, 1 = reactive armor, 2 = impact armor, 3 = thermal armor, 4 = photocell armor, 5 = camoflage armor, 6 = flak armor, 7 = liquid armor.

store
Stores the second number on the stack in the register specified by the top element of the stack, and removes both items from the stack. The top item must be a quoted variable, or an error occurs. See the section on registers for more information.
sto can be used as a synonym for store

swap
Swaps the top item on the stack with the second item. E.g. 3 4 swap leaves 4 3 on the stack.

sync
Stops executing code for the rest of the chronon. The next instruction will be executed at the beginning of the next chronon. Does nothing to the stack.

tangent
Computes the tangent function in the same way sine or cosine work. The top element of the stack should be a distance, the second element should be an angle. If the result is outside the range -2,000,000,000 to 2,000,000,000, it is clipped to that range.
tan can be used as a synonym for tangent.

trecall
If the robot is on a team with exactly one other member, recalls the register on the top of the stack from the teammate's memory and places that on the stack. Otherwise, places 0 on the stack. E.g. aim' trecall places the contents of the teammate's aim register on the stack.

vstore
Stores a number in a vector (1-dimensional array). The top element of the stack specifies the element of the vector (0 to 100), while the second item is the number to store. Both numbers are removed from the stack. E.g. 23 1 vstore stores 23 in element 1 of the vector.

vrecall
Recalls a number from the vector. The top number on the stack is the element to recall; it is removed and replaced with the contents of that item in the vector. Memory locations are initialized to zero; locations outside the range of 0100 also return 0.

Registers:


The RoboTalk registers are as follows:
a-z        aim        approach   armor      bottom     
chronon    collision  damage     deflection doppler    
energy     feedback   fire       flame      follow     
friend     glueball   grenade    id         left       
look       laser      mine       missile    movex      
movey      nearest    paintball  radar      random     
range      reflector  right      scan       shield     
signal     speedx     speedy     teammates  top        
wall       x          y

a-z (except x and y)
User variables. These variables can be used to store whatever the robot wants. May be read or written.

aim
This is the direction the robot's turret is pointing. May be read or written. Returns an angle in the range 0 to 359. The angle, like all RoboWar angles, is in degrees, with 0 degrees pointing straight up and 90 degrees pointing to the right. All moving munitions are fired in the direction the turret is pointing.

approach
The velocity parallel to the robot's line of sight of the nearest munition visible to radar. Velocities greater than 0 indicate movement towards the robot; velocities less than 0 indicate movement away.

armor
This register is used exclusively for scanners. No effect if read or written.

bottom
This register is used exclusively for interrupts. No effect if read or written.

chronon
Returns the number of chronons since the current battle began. No effect if written.

collision
When read, returns 1 if the robot is colliding with another robot. Returns 0 if there is no such collision. No effect if written.

damage
Returns the robot's damage rating -- the amount of damage the robot can take before being destroyed. No effect if written.

deflection
When read, returns the cross-range velocity -- the velocity perpendicular to the robot's line of sight -- of the nearest munition visible to radar. No effect when written.

doppler
When read, determines the cross-range velocity of the nearest robot in the direction of aim+look, or 0 if no robot is visible. No effect when written.

energy
When read, returns the robot's current energy level. No effect when written.

feedback
Fires the robot's feedback gun. When written, fires a feedback projectile with an amount of energy equal to the number written. The energy expended may exceed the robot's current energy level, placing it into negative energy and immobilizing it, but may not exceed the robot's energy maximum -- the energy level specified in the Hardware Store. If a negative number or 0 is written, no projectile is fired. A feedback projectile travels across the screen at 13 pixels per chronon, and when it hits a robot, it does damage equal to 3 times the energy invested, to a maximum of the shield level of the robot hit.
A robot must have purchased a feedback gun in the Hardware Store to fire feedback projectiles.

fire
Fires a bullet. When written, fires a bullet with an amount of energy equal to the number written. The energy expended may exceed the robot's current energy level, placing it into negative energy and immobilizing it, but may not exceed the robot's energy maximum -- the energy level specified in the Hardware Store. If a negative number or 0 is written, no bullet is fired. Bullets travel across the screen at 12 pixels per chronon, and do damage equal to the amount of energy expended.
A robot must have purchased bullets in the Hardware Store to fire bullets.
When using the standard RoboWar II rules, bullet is a synonym for fire.

flame
Creates a flamewall. When written, creates a flamewall with an amount of energy equal to the number written. The energy expended may exceed the robot's current energy level, placing it into negative energy and immobilizing it, but may not exceed the robot's energy maximum -- the energy level specified in the Hardware Store. If a negative number or 0 is written, no flamewall is created. A flamewall extends 20 degrees to either side of the robot's turret, is 20 pixels thick, and moves outward at 10 pixels per chronon for 10 chronons. A flamewall does damage equal to the energy expended for each chronon a robot spends in the flames.
A robot must have purchased a flamethrower in the Hardware Store to create flamewalls.

follow
When written, keeps track of the robot with the ID written. When read, returns the angle to that robot after the manner of nearest. Returns 0 if the robot is blind, the robot to be followed is dead or non-existant, or the robot is following itself. Returns 360 if the robot being followed is right on top of the robot. Defaults to following the robot with ID 0.

friend
When read, returns 1 if, during a collision, at least one of the robots you are colliding with is a teammate. If the robot is not in a collision, or none of the robots involved is a teammate, returns 0. No effect if written.

grenade
Fires a rocket grenade. When written, fires a rocket grenade with an amount of energy equal to the number written. The energy expended may exceed the robot's current energy level, placing it into negative energy and immobilizing it, but may not exceed the robot's energy maximum -- the energy level specified in the Hardware Store. If a negative number or 0 is written, no rocket grenade is fired. A rocket grenade travels across the screen at 5 pixels per chronon, and when it hits a robot or the arena walls, it creates an explosion that expands for 3 chronons at 12 pixels/chronon, doing damage on the third chronon equal to 1.5 times the energy invested to any robot caught in the blast.
A robot must have purchased rocket grenades in the Hardware Store to fire them.

glueball
Fires a glueball. When written, fires a glueball with an amount of energy equal to the number written. The energy expended may exceed the robot's current energy level, placing it into negative energy and immobilizing it, but may not exceed the robot's energy maximum -- the energy level specified in the Hardware Store. If a negative number or 0 is written, no glueball is fired. A glueball travels across the screen at 14 pixels per chronon, and when a glueball hits a robot, that robot cannot move using speedx/speedy for one chronon for every 3 energy invested in the glueball.
A robot must have purchased glueballs in the Hardware Store to fire glueballs.
glue can be used as a synonym for glueball.

id
When read, returns the robot's arena ID -- a number that uniquely identifies the robot in the arena. The robot's ID number will remain constant from one battle to another, but not between rounds of a tournament, and may change when robots are added to or removed from the arena. No effect when written.

left
This register is used exclusively for interrupts. No effect if read or written.

look
The targeting offset from Hardware Store. If a negative number or 0 is written, no laser is fired. Lasers have an apparent velocity equal to 1/2 the distance to the nearest robot in the direction of aim, and the chronon after they are fired, do damage equal to 1/3 the amount of energy expended to every robot in the direction of fire.
A robot must have purchased lasers in the Hardware Store to fire lasers.

mine Drops a mine. When written, drops a mine with an amount of energy equal to the number written. The energy expended may exceed the robot's current energy level, placing it into negative energy and immobilizing it, but may not exceed the robot's energy maximum -- the energy level specified in the Hardware Store. If a negative number or 0 is written, no mine is dropped. Mines are created at the robot's current location, do not move, and become active 5 chronons after they are placed. Mines do damage equal to 5 times the energy invested.
A robot must have purchased mines in the Hardware Store to place mines.

missile
Fires homing missiles. When written, fires a homing missile with an amount of energy equal to the number written. The energy expended may exceed the robot's current energy level, placing it into negative energy and immobilizing it, but may not exceed the robot's energy maximum -- the energy level specified in the Hardware Store. If a negative number or 0 is written, no missile is fired. A homing missile travels across the screen at 5 pixels per chronon, and turns towards the robot closest to straight in front of the missile at a rate of 2 degrees per chronon. When a homing missile hits a robot, it does damage equal to 1.5 times the energy invested.
A robot must have purchased homing missiles in the Hardware Store to fire them.

movex, movey
When written, teleports the robot in the direction specified (x or y) by the specified amount, at an energy cost equal to twice the amount moved. When read, returns 0.

nearest
When read, returns the angle to the nearest live non-teammate robot in the range 1 to 360, or 0 if the robot is blinded or there are no other live non-teammate robots in the arena. Returns 360 if the nearest robot is right on top of the robot. No effect when written.

paintball
Fires a paintball. When written, fires a paintball with an amount of energy equal to the number written. The energy expended may exceed the robot's current energy level, placing it into negative energy and immobilizing it, but may not exceed the robot's energy maximum -- the energy level specified in the Hardware Store. If a negative number or 0 is written, no paintball is fired. A paintball travels across the screen at 14 pixels per chronon, and when a paintball hits a robot, that robot is blinded for one chronon for every 3 energy invested in the glueball. For a blinded robot, the doppler, radar, range, deflection, follow, and nearest registers, and the srecall operator, will return 0.
A robot must have purchased paintballs in the Hardware Store to fire paintballs.
paint can be used as a synonym for paintball.

radar
When read, scans an arc extending 20 degrees to either side of aim+scan, and returns the distance to the nearest munition in this area, or 0 if none is visible. No effect if written.

random
When read, returns a random number between 0 and 359 inclusive. No effect when written.

range When read, returns the distance from the center of the robot to the nearest part of the nearest robot in the direction of aim+look, or 0 if no robot is visible. Has no effect when written.

reflector
Fires a reflector. When written, fires a reflector at a speed equal to the number written. A reflector does no damage to a robot that gets hit by one, but it looks like any other munition, and so can be used to fool another robot's radar. Firing a reflector uses 1 energy, regardless of the speed it is fired at.
A robot must have purchased reflectors in the Hardware Store in order to use them.

right
This register is used exclusively for interrupts. Returns 0 if read, no effect if written to.

scan
The radar offset from aim. radar looks in the direction aim+scan. If not otherwise set, scan defaults to 0. May be read or written.

shield
The robot's current shield level. May be read or written. When read, returns the current shield level. When written, sets the robot's shields to that level, using 1 energy point for each point above the robot's current shield level. If the number written is below the robot's current shield level, the robot gains 1 energy for every point the shields are lowered. Shields can absorb damage from flamewalls, bullets, mines, and lasers, reducing the shield level by 1 for each point of damage the weapon would do otherwise. Shields have no effect on glueballs and paintballs. If a robot's shields are above the level of shield hardware purchased in the Hardware Store, they decay by 2 points per chronon. Shields at or below the level purchased do not decay. Shields start out a battle charged to the level purchased in the Hardware Store.

signal
This register is used exclusively for interrupts. Returns 0 if read, no effect if written to.

speedx, speedy
When written, sets the robot's velocity in the x or y direction to the value written, for a maximum speed of 20. Speeding up costs 2 energy points per unit of speed, while slowing down returns 1 energy point to the robot's energy stores per unit of speed. E.g. A robot going from speedx 0 to speedx 5 would use 10 energy. If it then turned around and started moving with a speedx of -3 it would recover 5 energy points from slowing down to a stop, and spend 6 for going from speed 0 to speed -3, for a net expenditure of 1 energy.
When read, returns the robot's velocity in the x or y direction.

teammates
When read, returns the number of live robots on the same team as the robot. No effect when written.

top
This register is used exclusively for interrupts. Returns 0 if read, no effect if written to.

wall Returns 1 if the robot is currently colliding with a wall, 0 if not. No effect if written to.

x, y When read, returns the robot's current x or y position. No effect when written.


Interrupts:


In the original RoboWar, it was essential that a robot use interrupts if it was to perform well in tournaments. A robot simply couldn't think fast enough to find the other robots in time. With the introduction of the nearest register in RoboWar II, it is possible to make a decent robot without the use of interrupts. However, interrupts are still quite useful.

collision
Triggered at the beginning of each chronon where the robot is colliding with another robot. Setparam has no effect for this interrupt.

wall
Triggered at the beginning of each chronon where the robot is colliding with a wall. Setparam has no effect for this interrupt.

damage
Triggered whenever the robot takes damage and the robot's remaining damage is below the level set by setparam. The default for setparam is the robot's damage maximum, as set in the Hardware Store.

shield
Triggered whenever the robot's shield drops below the level set by setparam. The default for setparam is the robot's shield maximum, as set in the Hardware Store.

top
Triggered every time the robot moves in the y direction and the y coordinate of its location is less than the value set by setparam, by default, 20.

bottom
Triggered every time the robot moves in the y direction and the y coordinate of its location is greater than the value set by setparam, by default, 280.

left
Triggered every time the robot moves in the x direction and the x coordinate of its location is less than the value set by setparam, by default, 20.

right
Triggered every time the robot moves in the x direction and the x coordinate of its location is greater than the value set by setparam, by default, 280.

radar
Triggered at the beginning of a chronon or whenever the aim or scan registers change and the value of the radar register is less than the value specified by setparam. The default for setparam is the diagonal distance across the arena, so it will trigger on anything.

range
Triggered at the beginning of a chronon or whenever the aim or look registers change and the value of the range register is less than the value specified by setparam. The default for setparam is the diagonal distance across the arena, so it will trigger on anything.

teammates
Triggered whenever one of the robot's teammates is killed. Setparam can be used to specify the number of teammates below which the interrupt should trigger; the default is the size of the team.

robots
Triggered whenever a robot is killed. Setparam can be used to specify the number of robots below which the interrupt should trigger; the default is the number of robots in the arena.

signal
Triggered when another robot on the robot's team executes a sendsignal instruction. Setparam has no effect for this interrupt.

chronon
Triggered each chronon starting on the chronon specified by setparam. The default for setparam is 0.

Interupt Priority and the Interrupt Queue

The range and radar interrupts are never queued. The collision and wall interrupts are removed from the queue at the beginning of each chronon.

Tournaments




During a tournament, the debugger is disabled, error messages aren't printed, and the "print" instruction is ignored.
Tournament scoring:
Group scores are normalized so that a robot's group and solo scores are counted equally towards the total score.

History:


Robowar II came about as a result of a discussion on the RoboWar mailing list. Robowar 5.0 had been promised to be out "real soon now" for the last three years, and JRobowar, a Java version of RoboWar with a plugin-based system for weapons, had been "just about complete" for a while. There was a mention that there hadn't been a new paradigm in Robowar since around Tournament 10, and that a new Robowar, with all-new weapons, would give people a chance to be creative again. This was in mid-December of 2001. The first beta version of Robowar II came out three months later, on March 18, 2002.

Version 1.0 escaped to the public on May 18, 2002.

Version 1.0.1, released on December 26, 2002

Version 1.1

Splashscreen and program icon made using MegaPOV 0.2, an unofficial version of POV-Ray.

Copyright (c) 2002 Mark Wagner