robocode engine: how to design (write) the runtime engine -- the robot world
Posted
by Bob
on Stack Overflow
See other posts from Stack Overflow
or by Bob
Published on 2010-01-12T18:52:56Z
Indexed on
2010/03/09
11:06 UTC
Read the original article
Hit count: 659
IBM has (had) a free learn-Java program called RoboCode, in which custom robots could be written that would then do battle in a 2D space. I would like to write the environment that supports such robots, but don't know what pattern or design to use. Each robot is a thread. Each thread is given a certain (indeterminate) amount of run-time by the JRE. A robot world engine would start by building a list of the players/robots, then enter a loop that allows each player in turn to do whatever it likes: move forward, turn left, fire toward the northwest corner, whatever. Each robot is also informed of events of interest: an enemy or several enemies are within range, it has been hit by a bullet, etc.
The combination of handling threads that are also event listeners (are they also producers?) confuses me; it seems that there's more to the game engine. Even some general ideas would help. TIA.
© Stack Overflow or respective owner