Skip to main content

On Sale: GamesAssetsToolsTabletopComics
Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines

Common Lisp game template

A topic by Andrew created May 23, 2023 Views: 460 Replies: 7
Viewing posts 1 to 2
Submitted (1 edit) (+1)

Hey guys.

As a way to give back to Lisp community, I’ve made a template for the Common Lisp game. It allows you to pick a supported middleware library of your liking (liballegro, raylib or SDL2), includes barebones code to display FPS counter and contains an Github Action to build the binaries for Windows and Linux (MacOS support is underway). If you have any questions, ideas or bug reports, feel free to drop them in comments below or in the issues section on Github.

Have a nice jam y’all 😊

Submitted(+1)

It's so pretty and sophisticated!

While I plan to keep studying your template, this is my own small brain splatter from the start of this jam: https://gopher.floodgap.com/gopher/gw.lite?=tilde.institute+70+312f7e73637265777...

What kinda ideas go into a template like yours?

Submitted (1 edit)

Thank you!

I can see your code is quite interesting as well, since it intermixes C code with CL code. What kind of FFI package do you use to achieve that?

My template, on the other hand, just relies on existing bindings for three aforementioned libraries (all of which are based on the ol’ boring CFFI). The idea was to just make minimal project skeleton with choice of available C middleware libraries, with automated builds included — I kinda geek about CI pipelines and stuff 😅

Submitted (5 edits)

Ah yeah I didn't put #-ecl(error "This is ECL only") in there yet. That's a day 1 thing ;p. I'm using the low level embeddable common lisp compiler sffi package, which is basically just this:

```

(ffi:clines "#include <stdio.h>")

(let ((some 0) (variables "!"))

 (declare (:string variables) (:int some))

 (ffi:c-progn (some variables)

  "printf(\"%d %s\", #0++, #1);" ; ugh, yes, you have to ennumerate them in C

  (print `(,some ,variables))))

;;(I should double check I got the string <-> automatic cstring thing right)

```

I have found that just using the ECL compiler (common lisp but it's just a C library) is more reliably portable than the c2ffi based cffi, which doesn't have a port to openbsd for example. So we are kind of opposite, in that yours preserves behaviours against many backends right? Whereas mine is just a minimally serviceable seat-of-the-pants.

Submitted

Oh cool, I didn’t know ECL allows that. It is very resourceful CL implementation ineed ☺️

Well yes, my template tries to offer the same minimum functionality (that is black screen and FPS counter with custom font) on different backends, but surely they have some differences.

Having ultra-thin ECL-based skeleton is nice too 😊 I would argue that it would also be a notch faster than any CFFI-based solution.

Submitted

On the other hand you end up using a lot of void pointers. But yes, I like it a lot. I guess the ideal outcome would be to grow an ECL quicklisp package to the point where it could be included in your template, which would be a lot of work!

Submitted

I would definitely have a deeper look at ECL option afterwards. Also looking forward to your entry, I hope I’ll learn a thing or two :)

Submitted(+1)

the feeling is mutual!