Archive for November, 2010|Monthly archive page

getting started with game development and Common Lisp

Things have been on a slow simmer here for a while. I kept up the small weekly ritual of my IF news report IFURLs, and read a fair bit, but I hadn’t been too satisfied with doing things with a computer, playing, or making games this summer. This is still sticking around some — playing IF on a computer at a desk is increasingly less appealing (making things like this more and more attractive) — but, and I don’t know if it’s the turn to Fall that’s stoking the fire, I’ve spent more time in the cave lately so to speak, and capped by a long session last night I sort of feel like I’m ‘back’.

The thing keeping me up last night was compiling Steel Bank Common Lisp for Windows. Mostly a straightforward job thanks to the fine folks working on sbcl and the msys/MinGW build environment, but if you ever need to do the same thing, just put the sbcl source directory in a path without spaces before you compile — trust me on this one.

The other wrinkle not really mentioned in the sbcl install docs is you’ll probably have to explicitly set the sbcl home variable if you don’t usually work as the Windows admin user, and then reboot your system for the path changes to take full effect.

What led me to compiling sbcl rather than using the slightly older Windows binary was a problem loading cl-tcod from within Emacs+SLIME using Quicklisp (a nicer alternative to the older asdf-install package loading library for the language Common Lisp).

If you’ve read stuff here before you may recognize the tcod initials — cl-tcod is a binding for the great roguelike library libtcod. Not only is libtcod a great roguelike library, but the community has grown so much that it now has bindings for many different languages. For a language aficionado like myself, that makes it a great handle to learn new languages that I’m interested in — which brings me full circle back to the title of this post, game development, and Lisp.

It may sound weird, but I feel like going to the land of Lisp is an inevitable part of my programming bildungsroman. It started back in May with some prompt or another, I don’t remember exactly what, which led to trying out Racket, a dialect of Scheme. Racket is quite nice, and I found Michele Simionato’s The Adventures of a Pythonista in Schemeland an excellent guide along the way.

But in the end, even though there is of course a Racket binding to libtcod, I felt there wasn’t enough support in terms of a game development environment with Racket. However it did look like there was a lot of activity on the other side of the fence so to speak, with Common Lisp, once I discovered the Lisp Games Wiki — and so I was lured over.

It seems like Lisp is a whirlpool — once I went for Common Lisp, diving into Emacs and SLIME followed soon after. The problem with something like this is the complexity just exploded. It’s nothing like first working with Python, where getting a development environment set up fast is relatively trivial. With the Lisp bindings to libtcod, I found myself really using msys for the first time, compiling the latest libtcod in svn, then compiling sbcl, working my way through the right choice of a package installer for Common Lisp, setting up SLIME, getting the package installer configured correctly, and on and on. Much of this friction comes from working in Windows, and I suppose I accept that willingly given the trade offs.

Then you have Lisp itself, and especially Common Lisp — a 40 something year old legacy and all the cruft that entails. Seriously, some of this stuff almost makes me cry working through it — the influence of Lisp on Python is obvious, and it’s a bloody trail hacked out of the Forest of Lisp! Good guides here have been Practical Common Lisp and Successful Lisp. The Common Lisp Cookbook is a good companion too.

Despite the complexities and the cruft, there’s something about Lisp that’s positively endearing — I can’t put my finger on it yet. It just feels worth it.

Of course I have a roguelike game idea I’m working on in Common Lisp, and I’ll record the progress of that here for anyone else who might learn from it.

So this is (again) the first step. To put all the links in one place, if you want to follow along:

Getting started with game development and Common Lisp

* msys/MinGW
* SBCL
* Emacs
* SLIME
* Quicklisp
* Lisp Games Wiki
* Practical Common Lisp
* Successful Lisp
* cl-tcod
* libtcod
* Common Lisp Cookbook