Blog

Blog

Clutter Board Games

Posted at 17:58 on 30 May 2010

I'm a bit of a fan of playing board games. I'm also irresistibly drawn to somehow getting computers involved in all of my hobbies. Hence in my spare time I've been working on Clutter versions of two of my favourite games.

First up is a game which for some reason I've called DFight. The game is inspired by / stolen from a real board game called Khet. Khet is best described as ‘chess with lasers’ except it's probably a lot simpler and cooler than chess. In the real game there is a board with a real laser on either end. Each player has a number of pieces, some of which have mirrored surfaces. The idea is to move your pieces in such a way that your laser beam reflects off enough pieces to hit the ‘pharaoh’ of the opposing player.

image

For the Clutter version I thought it would be fun try and use 3D models of the board and pieces rather than a flat 2D interface that Clutter would traditionally be good at. This makes use of the CoglVertexBuffer API to create actors out of the models stored in PLY files exported from blender so that they can be animated with the usual Clutter mechanisms. The code for this ended up as the basis for the Clutter-PLY library. I won't talk about that library here though because in theory I'm going to give a talk about it at GUADEC.

The game is meant to be played over a LAN with each player on a separate computer. If all goes well, it should automagically discover any other users running DFight so that a second player would see the game in their list. It's also possible to play over the Internet but there is currently no UI to make this simple and instead you have to specify the IP address of the other player using a command line option.

The implementation knows nothing about the rules of the game but instead just gives you a virtual board to play on and assumes neither of you will try to cheat. Any player can drag pieces around at any time and the pieces are moved around live on the opponents screen.

Although the implementation is good enough to play a full game, it's still a bit rough-and-ready and there are plenty of improvements to make such as:

  • The models need a bit of love as you can't currently see which side of the pieces is reflective.
  • It'd be nice to be able to discover other players over the Internet. Perhaps GGZ could be leveraged for this?
  • It doesn't know the initial board layouts so you currently have to tediously re-layout the board manually before every game (although you could argue this makes it more authentic ;)

I haven't made an actual release yet, but the code is available to try in a git repo here:

git clone git://git.busydoingnothing.co.uk/dfight.git

The second game I've been working on is called Amagramanam. It is not entirely unlike a popular tile-based crossword-style word game that you've probably heard of. For this game I've also made use of Mx which is the Clutter-based widget set Intel has been working on for MeeGo. This version is not networked but instead is meant to be played against the computer AI.

image

The ‘AI’ is not really intelligent at all but instead just uses brute force to try every possible play and picks the one with the best score. However this makes the game impossibly difficult (at least for me) so it's also possible to limit the computer's vocabulary and cap the score by clicking on the computer icon.

The game includes a copy of the Webster's Second International dictionary which I believe is out-of-copyright. Of course it's much better to play with a real Scrabble word list but I'm not sure about the legality of distributing that. However it's fairly easy to find a list via the magic of Google and any text list can be used with the game.

This game is also missing a few features. In particular, it's not possible to pass or exchange tiles, there's no blanks and it doesn't tell you when someone has won. However it's close enough to play an interesting game.

The git repo is available at:

git clone git://git.busydoingnothing.co.uk/amagramanam.git