Sunday, September 26, 2010

Net

While I was bored a few days ago I thought I'd have a look at how terminal based GUI applications work, as I was wanting to see the nitty gritty of it I decided that it would be more educational to work directly with ANSI codes.

The project I ended up with was writing a terminal based version of the game Netwalk, probably best known from Simon Tatham's Portable Puzzle Collection. This was inspired by playing around with the box drawing characters, making a grid and thinking, "hey, that looks like Net!"

Thus, I have created a fairly simple version of the game, the source is on my GitHub page. If you want to try playing it then you can download it from there and compile it with g++. Alternatively if you have an account on codd (the Warwick compsoc server) then you can run it directly from /home/zed0/programming/net/netgame .

The game seems to run without issue through PuTTY, on the condition that you are using UTF-8. The only other configuration I've tried it with is Cygwin, which compiles and runs fine, however, assuming you're using the default Cygwin terminal, you'll need to change the font to one which has the box drawing characters.

As this was made in the space of a few hours there are quite a lot of improvements to be made.
My current todo list includes:
Adjusting the drawing methods so that it only updates the bits of the screen it needs to.
Adding wrapping as the game is fairly trivial without it.
Writing a better map generation algorithm.

On that last point I haven't really got many ideas. Writing an algorithm to generate a tree which takes up the entire map is fairly trivial, however I have no idea how to ensure that the map has a unique solution which would be desirable. If any mathsy people know how to do this then please comment.

Feel free to suggest other features or report bugs. Multiplayer has been suggested, which I may, at some point, try to implement.