viernes, 19 de abril de 2013

Trizz

A new game in this forgotten blog. This time I wanted to introduce something different and experiment with websockets. So I came with the idea of making a multiplayer game.
The game is called Trizz and consists of a competition between two players to see who finishes the puzzle before.
To play the game you can either create or join a session. In case you create a session you need to share the session ID with you opponent. Once your opponent joins, you can start moving with the arrow keys and picking squares with the space bar. These are the rules of the game:

  • The board is divided in four zones, a home base and puzzle zone for each player.
  • The creator of the session is the red player and plays on the left, the joined player is the blue player and plays on the right.
  • The first player to fill the orange delimited zone of its puzzle zone with grey squares wins. There cannot be any grey square in the puzzle zone outside the orange delimited zone.
  • For the puzzle to be considered finished the player must not be holding any square.
  • The player can enter into the opponent puzzle zone but only if he is holding a square.
  • The player can then leave the square and pick one of the squares in the opponent's puzzle zone, this square can only be dropped in the player zones.
  • Squares taken from one player's field to the other change their color.
  • The player can never enter the opponent's home base.
  • New squares appear periodically on the broken line zone in the player's home base but only if the cell is empty

Of course you need two players to play but you can check what it looks like by opening two windows of your browser.
If you try to access from Chrome you should not have any problem. If you are trying to access from Firefox the websocket communication is by default not allowed. You can enable it by going to about:config and then setting network.websocket.allowInsecureFromHTTPS to true.

I have hosted the server in www.nodejitsu.com, right now I have a free account so the game will only be available for a month.
You can check the code here https://github.com/kdlevin/Trizz
The game can be played here.