Participating in the Spring Lisp Game jam, why and how
Please participate in the jam!
If you’re on this webpage, there’s a good chance you’re already into lisp, or that the new notation will not scare you. The link to the jam: https://itch.io/jam/spring-lisp-game-jam-2024. Read ahead if you’re interested in participating, I have some game engine options you might like!
Why I love the concept
I’m a big lisp-head, with my longtime editor being emacs, and my current preferred language for doing tasks being Common Lisp. This is why I was chuffed to hear about the tradition of Lisp Game Jams, even though I’ve never made a game before.
What should you use to participate?
For someone who has never made a video game, it’s best to use a game engine/library to handle the nitty-gritty of game code and just focus on the ideas you are bringing.
Game engines and libraries for classic lisps
-
Trial, a Common Lisp game engine that has already been used to make a commercial game, Kandria.
-
Chickadee, a game development library (as the author clarified) for Guile Scheme, a language that would be familiar to users of the Guix package manager.
I like both of these options, but at first I dismissed them because there is no way to distribute these games on the web in the form of HTML5 games.
Godot
Godot is a classic game engine with a GUI, sort of reminiscent of something like Unity or Unreal, but much better because it’s free and open source. It supports a lot of languages, one of which is a native lisp called GDLisp.
Use this if you like Graphical interfaces, and would love to have way more tutorials than all of the other options combined.
Javascript game frameworks
There are two ways to compile a lisp to JavaScript, ClojureScript, and Parenscript.
ClojureScript is the whole clojure language that compiles to javascript, and has lispy bindings available to a lot of javascript libraries. I found the setup a bit compilcated, but it’s a great choice. More information about a setup here: https://github.com/trevordilley/phaser-cljs-template (it is a bit out-dated so you can shoot me an email on clojure @ this domain if you want help)
Parenscript is a common lisp library that allows you to use macros to generate javascript. In this method we would just write lisp with an eye on the javascript being generated as we go, as this is not a language proper. The mailing list is incredibly helpful: https://common-lisp.net/cgi-bin/mailman/listinfo/parenscript-devel
Alright, now that we know how to use lisps to generate javascript, here’s a couple libraries you can use:
-
https://phaser.io: Seems to be the most popular JS game library, and has a module available for Clojure
-
https://melonjs.org/: Has a bit simpler of an API, but is not as popular.
Lua land
Fennel is a lispy layer over Lua that is compiled out to plain Lua. I don’t particularly like it because it is a very leaky abstraction exactly due to the fact that it does not have a runtime, you sort of have to learn Lua to actually use it. This limitation comes with a great benefit though, you can use it wherever you can use lua.
-
Love2D, a 2D (duh) game engine that uses Lua, and games made here can be compiled to absolutely any platform, including the browser, which makes it a great choice for game jams, where you want as many people to be able to play your game as possible.
-
TIC-80, a fantasy console that is a self-contained application for making games, with a built-in code editor, audio workstation, map, and sprite editor. Probably the best choice for making a tiny game and supports fennel as well. The only possible drawback might be the retro limitations on code size, sound channels, 4-bit colour, etc.
This is what I would recommend if you don’t have an irrational hate of fennel like I do. (Errata: Janet is a much nicer lisp in my opinion, and available on TIC-80, according to this helful exchange: https://akko.wtf/objects/2c650088-c38f-41e6-84fd-b8b00183f6d0. It also has raylib bindings and can be compiled to an executable)
Web with Scheme
Guile Hoot is a toolchain that compiles scheme to webassembly. Last year, two games for the lisp game jam were using this stack, using an earlier version and loads of boilerplate. This year, all of that work is done for you already, using the HTML5 Canvas API for drawing things to the screen. Learn more about it at spritely’s blog post: https://spritely.institute/news/make-a-game-with-hoot-for-the-lisp-game-jam.html
Dark horse: Python!?
PyGame is a very simple game library that runs absolutely anywhere you could run python. I use python for my dayjob, and I love it very much.
Coming to how to use it with lisp, Hy is a lisp that runs on python and can use any python library. It feels much nicer to use than Fennel, and any leakiness in the implementation is not an issue for me, since I’m quite good at python.
There are many ways to bundle python scripts into self contained applications, which need you to have the platforms on hand to actually do it for different operating systems, which is also not an issue for me since I have access to all three major operating systems.
The issue with this is you can’t compile for the web without uploading a whole python interpreter using WebAssembly, which sounds like something I do not want to do.
Other useful tools:
- Tiled, a map editor natively supported by many engines
- LibreSprite, a great sprite editor.
- Milkytracker, an old school audio workstation.