Wednesday, 2 February 2011

Celebrating 30 Years of Color Robot Battle

Color Robot Battle
Color Robot Battle is one of the earliest commercial programming games, published 30 years ago for the TRS-80 Color Computer by The Image Producers.

The game is played by writing programs to control a robot's movement, sensors and weapons. Programs are written in a hybrid of the BASIC / Logo programming languages. Two robots enter an arena with the survivor being declared the winner.

I asked the designer and programmer of Color Robot Battle what inspired the game:

“Well, the Apple II program did along with the feeling I could do it better. All of these were initially inspired by Core Wars, I believe. I did want to make the language complete enough to have quite a bit of control and flexibility over the robots.”
-- Glenn Sogge

“The robot controlling programming language was based on BASIC. Prior to working on CRB, I'd written a simple BASIC interpreter for the PDP-11, so it was a natural choice.”
-- Del Ogren


Color Robot Battle is a fantastic example of compact code. The game, compiler and full screen editor are all written in 6809 assembly language and somehow manage to fit on a 4K ROM.

Although the language of CRB only takes a few minutes to learn, a whole range of strategies are possible. There are four types of command available:

  • movement: followed by a number. Movement commands are F(orwards), B(ackwards), L(eft), R(ight), H(alt), T(urn), D(irection).
  • conditional: detect what the robot is facing. =(true) or #(false) followed by R(obot), W(all), M(issile), L(aser), S(omething - any direction), ?(random).
  • flow control: C(all) or G(oto) a label. Labels are defined at the beginning of a line and terminated by a >.
  • attack: XL to fire the laser or XM to fire a missile.

The program starts at the label START>. Multiple commands on one line are separated by a colon :. If a condition fails the rest of the line is skipped.

Here's a simple example that manages to win a few battles:

*SIMPLE              ; robot name
START>               ; start here
F5                   ; move forward 5
=W:T1                ; if facing a wall, turn 45°                
=?:T1                ; randomly turn 45°
=R:XL                ; if facing a robot, fire laser
GSTART               ; repeat from start

Thanks to the simplicity of the language, CRB makes the perfect introduction to programming games. So, does anyone fancy a tournament? ;-)


Color Robot Battle's editor

7 comments:

  1. This is similar to Robocode.

    ReplyDelete
  2. And this is a modern day version http://www.cs.technion.ac.il/~nhershko/Swarm/Swarm.html

    ReplyDelete
  3. I don't understand 2 rules. 1. What's the difference between a laser and a missile? 2.How exactly is random defined?

    ReplyDelete
  4. anonymous: a missile take more energy to fire than a laser and also does more damage. In the screenshot the missile is white, the laser is red.

    Random is either =? or #? and has a 50/50 chance of skipping the rest of the line.

    ReplyDelete
  5. Just found your blog and I like it. This takes me back to the 80's. It's like a museum. Thanks for posting all this and I'll be back.

    ReplyDelete
  6. Probably uncouth to ask this, but does anyone know of a .ROM image for Robot Battle online? My Coco is long gone and this game brings back fond memories of my first programming experiences. Would be neat to try again.

    ReplyDelete
  7. Here's a link describing my Basic language variation for the TRS-80 MC-10:
    http://jimgerrie.blogspot.ca/2013/01/battle-bots-rules-and-version-notes.html#!/2013/01/battle-bots-rules-and-version-notes.html

    ReplyDelete