Most of you have already seen this but I’m posting it for posterity. Piers and myself have been working on a game engine for a module we’re working on. The engine allows you to write games using a mixture of Java Classes (for custom rules) and JSON files.
The base game
The games are played on hex grids so I thought I’d re-create an old dos game I used to play when I was little - Hexxagon. For those of you not familiar with the game, two players take it in turns to make moves, on their turn a player can either clone (place a new piece next to an existing one they own) or jump (move one of their pieces two tiles). Once the move is complete, all the pieces around the new one get converted to the current player’s pieces.
Just because I could I replaced one of the teams with my hackergotchi. I showed Bruce and he made two planes and his pigeon avatar into pieces. This is the resulting game:
So while the images might be a little silly - the reason behind choosing to implement this game was because it’s very different from the kinds of games that we’d previously looked at (and designed the engine around).
Firstly, the game engine was designed for civ-style games where you control lots of units and each unit makes a move on your turn. In Hexxagon you’re only allowed to move one piece a turn. To get round this, the game uses the engine’s resource system to award a ‘time’ resource when a player makes a move. The game will then refuse to execute a move if the player’s time resource is greater than the current game turn.
to express them as game rules:
Clone: if you have less than $turn_number time resource then create a clone at a position adjacent to your current position and set the player’s time resource to $turn_number+1.
Jump: If you have less than $turn_number time resource then set this entity’s position to a position which has a distance of 2 and set the player’s time resource to $turn_number+1.
The code is on my work machine - I’ll update this post tomorrow with a link to the git repo.
We’ve also managed to implement basic timers in a similar way - but that’s a post for another time.