Design document of the MVP version of the game - Miol-Mor/battle-game GitHub Wiki

Battle game

Minimum viable product version.

Game process:

Two players. Each player has an army of units. Units from each army fight on the battlefield against units from another army. Players make turns one after another. First player (in the left side) starts. Game ends when one of armies is completely destroyed (all the units died).

Battlefield:

Field with hexagonal cells. Grid is visible. Cells may be of 2 types:

  • Empty - units can move through. Filled with background color.
  • Wall - units can't move through. Filled with black color.

Walls can be everywhere except of the most left and the most right cell in each line.

Units start position:

First players army located in the left side of the field. First unit appears in the upper left corner. The second - just below (in the second line of field, left cell). Third - just below the second...

Second players army located in the right side of the field. First unit appears in the lower right corner. The second - just above, third - just above the second...

Number of units in each army can't be more, than battlefield's height.

Units display:

Each unit displays as image inside the cell he located in. Each unit of the first army looks like the same red sprite. Each unit of the second army looks like the same blue sprite. Blue and red sprites should be different (at least color).

On hover units characteristics appear.

Unit's characterisctics:

  • Damage (from - to) - random value (3 - 5).
  • HP (10).
  • Speed (5).

Game turn:

Player chooses the unit he wants to move this turn (one turn - one unit) by clicking on it. After units move ends, turn passes to another player.

Units move:

Units move consists of 2 parts:

  • Moving
  • Atack

Moving:

Unit can go to the adjacent cell. He can repeat this maneuver times his speed is. Also unit can stay at current cell. Player just clicks the final cell he wants to move unit. He can click on the cell unit stayed at. Unit moves to this cell. Now it's sprite located in the new cell. (no animation)

Atack:

Unit can attack each adjacent cell if the enemy unit locates there. Player chooses the cell to attack by clicking on it. If the emeny unit locates there, current unit attacks the enemy. Else - there is no attack this turn.

Attack:

Each attack damage calculates by random. Attacking unit's damage is taken from enemy's HP. (no animation) If enemy's HP is 0 or less, enemy dies. So, this unit leaves the game and its sprite disappears from the field, cell he stayed at is empty.

Game parameters:

(set in program code)

Field size (M x N)

M - width, N - height.

Field:

2d-array M x N with 0 and 1. Generates by random:

  • Percent of walls

Or by hands.

Armies:

2 arrays of units. May be set by hands. Each unit parameters:

  • Damage
  • HP
  • Speed

May be generated by random automatically - need additional parameters:

  • Number of units in each army (may be 2 different numbers)
  • HP of each unit (lower and upper bounds)
  • Damage of each unit (lower and upper bounds)
  • Speed of each unit (lower and upper bounds)

Start locations:

May be set by hands:

  • Each units coordinates

Demonstration

Go and see