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

Advertisements

7 comments so far

  1. Paul Sexton on

    Hi, I’m the author of cl-tcod. Very pleased to see your post. Common lisp is the Right Choice. Also, while the learning curve for Emacs is steep, you won’t regret it: SLIME is a superb IDE, probably one of the best available for any language, and you can basically run your life in Emacs if you so wish.

    Any feedback on cl-tcod is welcome.

    Regarding SBCL, you could have saved yourself some bother and downloaded precompiled builds of the latest SBCL for Windows at:

    http://cid-ab3d364d1e6a27e7.skydrive.live.com/browse.aspx/SBCL

    The other “big” free CL implementation is Clozure CL, also excellent (and not to be confused with “Clojure”).

  2. georgek on

    hi Paul, thanks for that great link to the Windows binaries — I think I was in a late night haze when I resolved to compile the latest sbcl source myself after running into problems with the older binary, and never looked back ;).

  3. Nathan D on

    I checked out your laotop work on your MotionINK page, have to say I can see where you’re coming from. I work for a game development firm and sometimes when I’m frustrated with bugs I just wish I worked on hardware…

  4. […] This post was mentioned on Twitter by Y Combinator Newest! and m.y.ikegami_bot, newsery3. newsery3 said: Getting started with game development and Common Lisp – http://bit.ly/ggbOPS – [Hacker News FH] […]

  5. Erik Winkels on

    Sorry for the late comment.

    Learning Common Lisp And Emacs at once is hard and I usually recommend people to skip Emacs at first until they’ve got their feet wet in CL. Learning CL, Emacs, Slime AND all that on Windows is rough, very rough.

    Hope you’re still at it 🙂

  6. georgek on

    hi Erik, I agree 100% :).

    That said, I found that I didn’t necessarily have to learn all that Slime and Emacs can do in the first few weeks; with a one-page Emacs/Slime cheatsheet handy it was pretty straightforward. More important I think is to have a good Emacs configuration from the start.

    Incidentally there recently was a few posts on this topic — http://xach.livejournal.com/283496.html

  7. Robert Pickering on

    Totaly usefull information, I’m just learing but i learned alot here thanks.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: