I’m in the process of writing my own game that’s somewhat roguelike, but is multiplayer and focused on arena-style tactics. I’ve been writing the game in C#, but I always have this curiosity about Haskell that draws me to it. This led me to LambdaHack.
I’ve been unable to find much information about it on the interwebs, just passing references to it as a game “written by an experienced Haskeller for teaching purposes.” There’s a few other Haskell games that I run into a lot: frag, MazesOfMonad, and roguestar. You can see a more complete listing on hackage.
My first test is getting the game installed and running. I still feel new to Haskell despite on-and-off attempts to learn the language over the last few years. Even this step, however, has been a source of problems for me in the past. For this series of posts I’ll be using my favorite distro: Arch Linux.
Arch has many packages available that were built from hackage. This means you can often use your favorite AUR helper (yaourt, or, my favorite, packer) to install the Haskell package in The Arch Way. I still prefer to install most things via cabal manually so I wipe everything out and start fresh easily.
The first thing is to install some basic Haskell software through pacman. Gtk2hs is listed, though this tutorial will build LambdaHack with the curses library instead, making it possibly unnecessary.
Now use cabal to install LambdaHack. Make sure that your PATH environment variable is updated to include “~/.cabal/bin” so executables built with cabal can be found by your shell.
cabal install -fcurses lambdahack
The -fcurses flag tells cabal to use the Display.Curses package instead of the default GTK one (which fails to build for me). After the binary is installed with cabal, you can find the source package in a subdirectory of “~/.cabal/packages/hackage.haskell.org/LambdaHack/” corresponding to the version installed. You can extract this to a different directory for viewing purposes.
With the source extracted to your favorite subdirectory, it’s time to do some basic analysis. We’ll use SourceGraph for this.
This will crunch for a little bit, then produce this output.
The next part in this series will give a high-level outline of the source code.
Edits: Apr 01, 2010: Changed the pacman command to only install GHC and cabal-install. This should let everything get built in cabal. Also, if you get a bunch of “resource vanished” errors, you may want to make sure you have the prerequisites installed – like graphviz.