GAME RULES


'Eubots' is inspired by quite a few things, but mostly my pharmeceuticals-deprived imagination.
Suggestions have been integrated into the game rules.

Definitions:

Introduction:

  1. Each player controls an army of little pixel-sized units, all alike.

  2. Two or more players do battle upon a miniature landscape, consisting of blank spaces, walls, and enemy units.

  3. Every turn, every player is called upon to provide a set of orders for all of their units.

  4. When either all orders have been received or the time allowed has run out, the Arena program takes all received sets of orders and resolves the arena state.

  5. Those players that do not return their orders in the allowed time will not have them processed.

  6. Once the arena state has been resolved, the Arena calls each player again to get the next set of orders.

  7. Whether a unit's orders succeeded or not will be available in the next turn.

  8. If a player has no units left to command it will not be called upon to provide orders.

  9. When there is only one player left, that player is deemed to have won the match. It will receive 1 point for each unit it has left alive.

  10. In the extremely unlikely event of two players wiping one another out in a single turn, the match is a draw, and neither program will receive points. (Although in the event of a points tie, it is considered better to have drawn than lost)

  11. If all unit metrics remain constant for 500 turns, or all players command only a single unit, a stalemate is said to occur. If a stalemate occurs, each player is given points according to the number of units it has left and the match is drawn.

Metrics:

  1. A metrics sequence contains all the particular details about the current match:

  2. The only elements of the sequence that change during a match are TOTAL_UNITS and UNITS_REMAINING.

  3. This sequence is available to the player.

Map:

  1. The arena is rectangular, metrics[WIDTH] squares wide, and metrics[HEIGHT] squares high.

  2. The map sequence contains the contents of each grid square. It is a 2 dimensional array with the dimensions metrics[WIDTH] x metrics[HEIGHT].

  3. A unit at the cartesian coordinate {5,7} can be found at map[5][7].
    NOTE: {x,y} = map[x][y]. NOT map[y][x]!

  4. Each grid square contains one of the following:

  5. The area outside the rectangle defined by {1,1}, {metrics[WIDTH],metrics[HEIGHT]} is impassable, and should be treated as WALL.

  6. This sequence is available to the player.

Units:

  1. Each unit in the game, is identified by a unit handle. If alive, that unit handle can be found somewhere in the map, and the properties for that unit can be found at units[unit_handle].

  2. The structure of the units sequence is units[unit_handle][unit_property]
    The different properties are:

    Success or Failure depends on the order given.
    If a MOVE order was given, success is dependent on that unit not being blocked.
    If an ATTACK order was given, success depends on the attacked unit dying.
    If a WAIT order was given, it always succeeds.
    The value of S_FLAG will be positive if the order succeeded, or a negative value otherwise.
    NOTE: On the first turn, every S_FLAG will contain WAIT_SUCCESS.

  3. Units are homogenous. In a turn, each can inflict 1 point of damage, and withstand 2. A single unit is therefore useless - winning a battle requires teamwork!

  4. If a unit is killed, The element its handle refers to becomes 0, rather than the structure described above.
    NOTE: If you want to check whether a unit successfully moved, you must first check it is still alive.

  5. The entirety of the index is public. You may view details of other player's units using this index.

  6. The length of the index is constant, and will be equal to the initial value of metrics[TOTAL_UNITS].

  7. This sequence is available to the player.

Orders:

  1. Each unit may by supplied with one order per turn:

  2. If the unit fails to undertake the order given, it will WAIT. (S_FLAG depends on the order)

  3. If the unit is not given an order, it will WAIT. (And S_FLAG will be INVALID)

  4. If the unit is given more than one order, it will WAIT. (And S_FLAG will be INVALID)

  5. 'Adjacent square' is defined as the nearest square from the unit in any of these 8 directions;
    DIR_E, DIR_NE, DIR_N, DIR_NW, DIR_W, DIR_SW, DIR_S, DIR_SE

  6. An order is a 3-element sequence: {unit_handle, action_type, direction}:

  7. NOTE: The translation that each direction corresponds to is available to the player, but the direction must be returned, not the translation.

Turns:

  1. At the start of each turn, the Arena program triggers code inside eubots.ew to update the game variables, and call get_moves().

  2. When the player's get_moves() function is called, that function should calculate the orders for each unit, and return them.

  3. Code inside eubots.ew returns those orders to the Arena program.

  4. The orders are collated and resolved to find the new state of the arena.

  5. The map is displayed on the screen, and new data is sent to each player so they can calculate their next orders.

Resolving orders:

At this stage, orders have been obtained from every player that responded in time.

  1. Each order is checked for correct structure, data variables and correct owner.

  2. Each order is sorted into WAIT, MOVE, ATTACK, and INVALID buckets.

  3. Those orders in the WAIT and INVALID buckets are not used anymore, but their S_FLAG is set appropriately.

  4. Then, the ATTACK and MOVE buckets are resolved in phases.

  5. NOTE: The attack phase is completely resolved before the move phase is resolved.

    -=Attack Phase=-

    (For each unit ordered to ATTACK)
    1. If the attacked square does not contain an enemy unit, the attack wil fail.
    2. The unit that has been attacked has 1 point subtracted from its defence points.
    3. If a unit has less than 1 point remaining, it dies at the end of the attack phase. This means that it still inflicts damage if it was attacking, but if it were trying to MOVE away, it would die before it could move.
    4. At the end of the attack phase, any units that are no longer living are removed from the arena, and their units index element is set to -1.

    -=Movement Phase=-

    (For each surviving unit ordered to MOVE)
    1. If the destination square is a WALL, the move will fail.
    2. If a surviving unit of any team is in the destination square already and does not move from it this turn, the move will fail.
    3. If two or more surviving units of any team are attempting to move to the same destination square, all those moves will fail.
    4. If the movement is successful, the unit moves to that new square.

  6. The resolving routine returns the new arena state.

Results:

  1. This sequence contains data about the outcome of a match, that a learning program might find useful.
  2. The contents of this sequence are not meaningful, until the framework calls the cleanup() procedure.
  3. This sequence is available to the program.

Back to index
Page is copyrighted - Patrick Barnes 2004. Contact me