avatar

Jakub Zika

Posted on 10th May 2024

Lisp Game Jam 2024: A Starter Guide for Clojure Devs 

news-paper Clojure | Other Languages |

The Spring Lisp Game Jam 2024, hosted by David Thompson and Technomancy, invites participants to a 10-day creative sprint starting on May 17th. During this period, developers can use any Lisp dialect to craft unique games, utilising open-source libraries and freely licensed assets. Submissions close on May 27th, followed by a three-day period where participants can play and vote on each other’s games.

So I’d create a roadmap for all Clojure and Lisp fans, to make it easier for them to choose where to start. Instead of delving deeply into individual technologies, I’ve mapped out the possibilities more broadly. You can choose between smaller libraries, something closer to a framework, or some bindings.

At Flexiana, we primarily work with Clojure, so I’ll assume that’s the language most readers are familiar with. Unfortunately, Clojure is not a language that is popular in the context of game development.

As you probably know – despite its powerful capabilities, Clojure faces hurdles in game development primarily due to its dynamic nature and JVM dependency. Its flexibility often leads to runtime errors and complicates low-level control. JVM’s automatic memory management and garbage collection can cause performance hiccups and unpredictable pauses, which can be detrimental to the smooth operation of a game. However, it’s worth noting that recent advancements in garbage collection algorithms, such as the introduction of the low-latency ZGC (Z Garbage Collector), have significantly improved the suitability of the JVM for applications that require consistent low-pause times. 

Immutable data structures are in contrast with almost every game tutorial which usually uses some mutable objects. Clojure (or rather the functional paradigm) is still waiting for its big game framework breakthrough. However, Java-based frameworks like LibGDX and JMonkeyEngine demonstrate that the JVM can still be viable for game development. 

If none of the points mentioned above bother you, and you’ve decided to use Clojure (or perhaps come up with a new library) for game development – great! Games like Alchemy, Modern Dance, Robinson, and others showed it can be done. 

And once you know one lisp, it’s not too hard to learn another, so I’ve mentioned some other libraries I know or have come across for other LISP-based languages. The ones I have tested (or recommend) are in green boxes. You may notice that I don’t have a clear recommendation for the CLJs framework. I have a feeling that JS libraries are in a much better state which is something that was outlined already almost ten years ago in this article.

Here is the diagram:

I hope to be able to attend the jam this year. If I do, I plan to try ClojureDart and Flame, or possibly Clojure with GDL. In previous years, I would have used Quil because it’s easy to design simple games and there are many tutorials available for Processing and p5.js, which Quil is based on. It is pure Clojure and it works with some differences on JVM and in Browser as well. There is also a nice small game engine written on top of Quil called Quip. There is also a similar Clojure2D, which is suitable for creating games as you can see here.

However, it’s important to keep in mind that most of the libraries I mentioned don’t offer the same capabilities as full-fledged game engines like Unity, Unreal, or Godot. If you’re familiar with Godot or Unity, you might consider using Arcadia, but I believe Unity support ended a while ago and support for Godot 4 is still in development. 

If I decide not to use Clojure, I would use Raylib in combination with Janet (Jaylib) or Fennel. Compared to Quil, you probably won’t hit performance issues, and there are a huge number of tutorials available. Janet is a language very similar to Clojure. I also recently came across Basillisp, which is essentially Clojure on top of Python, so you might find it interesting to try PyGame, another time-tested game framework, or Love2D with Fennel.

Finally, if you have never developed any game or you would like to have clear boundaries and create everything in one integrated environment without worrying about external assets, then I highly recommend Tic-80 combined with Fennel, which is a fantasy game console.

I’d love to see developers of all skill levels, from seasoned experts to those new to Lisp, participating and contributing. Whether you choose to work with smaller libraries like Quil, full-fledged frameworks like Unity with Arcadia, or bindings for game engines like Raylib, the key is to have fun, learn something new, and push the boundaries of what’s possible with Lisp in game development. So go ahead, pick your tools, and embark on an exciting journey of creativity and innovation. If you find some extra time, consider writing a blog post about your development experience. This not only serves as a valuable resource for the community but also helps demystify the process, offering practical insights and fostering a culture of sharing and collaboration. This not only serves as a valuable resource for the community but also helps demystify the process. Previous entries can be seen here.

Happy coding!

(for the adventurous types, you might also want to check out Rhombus, a new Racket dialect. The project Rhombus in the Rough showcases a 2D RPG implemented using this language which might not be considered LISP anymore.)