In 2018, I wrote a post surveying the Common Lisp games landscape and sharing some of the tools we were using to create Spycursion. Parts of that post were dedicated to explaining why we chose Lisp in the first place; those parts have not changed (much), so I won’t rehash them here. Instead, I’ll update you on our own contribution to Lisp game development and how we got here.
If you’ve been following Spycursion for a while, you know that our first gameplay trailers were built on top of CEPL and QTools. After revealing those trailers, the most common criticisms were about graphics/aesthetics*. For that reason, among others, we knew that we wanted to redesign the client and move away from CEPL and QTools. The big question — the question on which we expended copious team discussions — was what to move to. I won’t get into the options that we looked at and ruled out. In the end, we were most excited by Raylib.
(* Fun fact: I screen recorded those videos on a machine that couldn’t handle the load, and had to reduce quality to prevent stuttering. Mea culpa.)
Raylib is a set of lightweight, open-source game libraries. It is well-documented (with examples!), actively developed with stable releases, runs on at least five operating systems plus HTML5, and has nine years of bug fixes under its belt. For us, there was only one glaring problem: Raylib is written in C. (I apologize for making you throw up in your mouth a little bit just now.) We surveyed the existing Lisp bindings for Raylib, concluded none were where we needed them to be, and decided to wrap our own. Hence, Claylib was born!
Claylib is designed to be a Lispy, beginner-friendly game toolkit. Let’s unpack those two bolded terms, because they’re both important:
Lispy means that Claylib tries to smooth over Raylib’s C semantics as much as is feasible. It is not simply a wrapper around Raylib (though you can use it for that if you prefer). Personally, I like to write Lisp, not “C in Lisp syntax.” That’s why Claylib abstracts C structs into CLOS objects and can manage memory for you using scenes (which do not exist in Raylib).
Beginner-friendly means that Claylib aims to be a fun way to learn Common Lisp, or game development, or both! Raylib itself has a similar stated goal — minus the Lisp, for some silly reason. Arguably, we didn’t have to make Claylib beginner-friendly, but understand that one of our long-term goals is to help boost the community of developers using Lisp and other “esoteric” (but powerful) languages. What better way to do that than by showing off how easy it can be to use Lisp for games, which are some of the most complex software in existence?
At the moment, Claylib is still beta quality and doesn’t have a stable release. It does have a number of examples and some high-level documentation to help you get the gist of it. If you don’t mind “writing C in Lisp syntax,” the wrapper layer that I alluded to above should have feature parity with Raylib. That includes the core, math, and GUI libraries; audio will be coming next.
Finally, for completion, a quick list of non-Claylib CL game engines:
– Trial is probably best known for being the game engine behind Kandria. Clearly suitable for a 2D game, though I don’t have any information about its 3D support. The more your game resembles Kandria (or one of the other example games they list), the better an option Trial is likely to be.
– Virality Engine has some impressive 3D demos. Its GitHub page showed no activity for awhile, but does have a few recent commits, so I hope that trend continues.
– alien-works is a framework of a number of libraries, some in CL, some with C/C++ wrappers. It focuses on performance but appears to be in an earlier stage of development than the other two.
If you decide to give Claylib a whirl, let us know how it goes! We’re excited to see what Lispers and non-Lispers alike can do with it.