DEV Community

Cover image for my entry for the autumn 2019 lisp game jam
Tony Colston
Tony Colston

Posted on

my entry for the autumn 2019 lisp game jam

Let me clearly say I am not a lisp programmer but I like to learn. So I made a game for the Autumn 2019 lisp game jam. https://itch.io/jam/autumn-lisp-game-jam-2019

I used Fennel and tic80 for my entry. I have written other games in pico8 and played with tic80 a lot so I felt this would keep me out of needing to write low level things and just concentrate on the lisp part (which I did not know well at all).

The code is open and available here: https://github.com/tonetheman/autumn_lisp_jam_2019

At first it was a struggle to write anything in Fennel/lisp. The fact that Fennel transpiles down to lua was helpful when I was first starting the project. I could write what I thought to be correct code and then look at the lua that Fennel generated and look for problems.

The jam was only 10 days but towards the end of it I can say that I did not need to look up Fennel syntax at all. One of the great things about lisp like languages is how the syntax is orthogonal. See here if that term seems odd: https://en.wikipedia.org/wiki/Orthogonality_(programming)

Tic80 has a straight-forward if not sparse game loop. You have 1 function that is called in a tight loop. If you look at game.fnl I split that out into a more traditional update and draw but that is just function organization.

I also have a SceneManager which I liberally stole that concept directly from Phaser. My main loop is just the SceneManager pushing the update and draw out to a concrete object. That gives you the ability to switch, pause and control scenes. This same construct also lets you separate the code to separate scene files that have nothing to do with each other. You can see examples of this in loadingscene.fnl and gamescene.fnl in the code.

I would say the rest of the code is fairly obvious and gross.

There are still all sorts of bugs. I am sure there is some weirdness with the way I am detecting mouse clicks but I could not nail that down.

All in all the game jam was fun. I learned Fennel lisp and got a game out of it.

https://fennel-lang.org/
https://tic.computer/

Latest comments (0)