diff options
Diffstat (limited to 'posts')
-rw-r--r-- | posts/2024-06-01-lisp-icing-or-cake.md | 62 |
1 files changed, 32 insertions, 30 deletions
diff --git a/posts/2024-06-01-lisp-icing-or-cake.md b/posts/2024-06-01-lisp-icing-or-cake.md index a565ad0..771ec1d 100644 --- a/posts/2024-06-01-lisp-icing-or-cake.md +++ b/posts/2024-06-01-lisp-icing-or-cake.md @@ -50,9 +50,9 @@ lot of people took us up on it! Very cool! The next most popular language, which is typically *the* most popular language in these jams, is [Fennel](https://fennel-lang.org/). Fennel -is a Lisp that compiles to Lua. It’s very cool! +is a Lisp that compiles to Lua. It’s very cool, too! -Also of note, at least to me as a Schemer, is that 3 games used +Also of note, at least to me as a Schemer, is that three games used [S7](https://ccrma.stanford.edu/software/snd/snd/s7.html). Hmm, there might be something relevant to this post going on there. @@ -126,25 +126,25 @@ Lisp Game Jam and evaluate their icing/cake-ness. [love2d](https://love2d.org/) has been a popular choice for solo or small team game development for many years. It is a C++ program that -embeds a Lua interpreter, which means its a perfect target for Fennel. -Most Linux distributions package love2d, so it’s easy to run `.love` -files natively. Additionally, thanks to emscripten, love2d games can -be deployed to the web. Thus, most Fennel games use love2d. +embeds a Lua interpreter, which means it’s a perfect target for +Fennel. Most Linux distributions package love2d, so it’s easy to run +`.love` files natively. Additionally, thanks to emscripten, love2d +games can be deployed to the web. Thus most Fennel games use love2d. [./soko.bin](https://jleightcap.itch.io/sokobin) and [Gnomic Vengeance](https://alexjgriffith.itch.io/gnomic-vengeance) are two games that use this stack. Fennel + love2d is a perfect example of Lisp as icing. Fennel sits at -the very top of the stack, but there’s not really path to get Lisp -into the layers below. It is also the most successful Lisp games -software stack to date. +the very top of the stack, but there’s not really a path to spread +Lisp into the layers below. It is also the most successful Lisp game +development stack to date. ### S7 + raylib This stack is new to me, but two games used it this time around: [GhostHop](https://gcmas.itch.io/ghosthop) and [Life Predictor](https://illusion-fisherman.itch.io/life-predictor). (You -really gotta play, GhostHop, btw. It’s a great little puzzle game and +really gotta play GhostHop, btw. It’s a great little puzzle game and it is playable on mobile devices.) [Raylib](https://www.raylib.com/) is a C library with bindings for many higher-level languages that has become quite popular in recent years. S7 is also implemented in C and @@ -169,12 +169,13 @@ fonts, but it is written in pure Scheme. All the matrix and vector math is in Scheme. Chickadee comes with a set of rendering primitives comparable to love2d and raylib but they’re all implemented in Scheme. I’ve even made progress on rendering vector graphics with Scheme, -something that most other Lisp game libraries call out to C to do. -Chickadee has pushed the limits of Guile’s compiler and virtual -machine, and Guile has been improved as a result. But it’s the long -road. Chickadee is mostly developed by just me in my very limited -spare time, so it is taking a long time to reach feature parity with -more popular game development libraries. +whereas most other Lisp game libraries use a C library such as +[nanosvg](https://github.com/memononen/nanosvg). Chickadee has pushed +the limits of Guile’s compiler and virtual machine, and Guile has been +improved as a result. But it’s the long road. Chickadee is mostly +developed by me, alone, in my very limited spare time. It is taking a +long time to reach feature parity with more popular game development +libraries, but it works quite well for what it is. ### Hoot + HTML5 canvas @@ -186,9 +187,9 @@ written entirely in Scheme. Unlike C programs compiled with emscripten that target Wasm 1.0 with linear memory, Hoot targets Wasm 2.0 with GC managed heap types. This gives Hoot a significant advantage: Hoot binaries **do not ship a garbage collector** and thus -are much smaller than Lisp runtimes compiled via emscripten. -Cirkoban’s Wasm binary weighs in at < 2MiB whereas `love.wasm` is -almost 6MiB when I checked. Hoot programs can also easily +are much smaller than Lisp runtimes compiled via emscripten. The Wasm +binary for my game weighs in at < 2MiB whereas the love2d game I +checked had a nearly 6MiB `love.wasm`. Hoot programs can also easily interoperate with JavaScript. Scheme objects can easily be passed to JavaScript, and vice versa, as they are managed in the same heap. With all of the browser APIs just a Wasm import away, an obvious @@ -200,10 +201,12 @@ rendering. Dungeon](https://fluxharmonic.itch.io/lambda-dungeon). Hoot + HTML5 canvas is mostly dense cake with a bit of icing. On one -hand, it took a year and significant funding to boot Hoot. We said -“no” to emscripten, built a completely separate toolchain, and -extended Guile’s compiler. It's Lisp all the way until you hit the -browser runtime! We even have a Wasm interpreter that runs on the +hand, it took a year and significant funding to [boot +Hoot](https://wingolog.org/archives/2024/05/16/on-hoot-on-boot). We +said “no” to emscripten, built [our own +toolchain](https://wingolog.org/archives/2024/05/24/hoots-wasm-toolkit), +and extended Guile’s compiler. It's Lisp all the way until you hit +the browser runtime! We even have a Wasm interpreter that runs on the Guile VM! Hoot rules! It was a risk but it paid off. On the other hand, the canvas API is very high level. The more cake thing to do would be to use Hoot’s JS FFI to call WebGL and/or WebGPU. Indeed, @@ -220,13 +223,12 @@ Even the tallest of Lisp cakes sits atop an even larger cake made mostly of C. All modern Lisp systems bottom out at some point. Emacs rests on a C core. Guile’s VM is written in C. Hoot runs on mammoth JavaScript engines written in C++ like V8. Games on Hoot currently -render with HTML5 canvas rather than the lower level WebGL/WebGPU. -Good luck using OpenGL without libGL; Chickadee uses guile-opengl -which uses the C FFI to call into libGL. Then there’s libpng, -FreeType, and more. Who the heck wants to rewrite all this in Lisp? -Who even has the resources? Does spending all this time taking the -scenic route matter at all, or are we just deluding ourselves because -we have fun writing Lisp code? +render with HTML5 canvas rather than WebGL/WebGPU. Good luck using +OpenGL without libGL; Chickadee uses guile-opengl which uses the C FFI +to call into libGL. Then there’s libpng, FreeType, and more. Who the +heck wants to rewrite all this in Lisp? Who even has the resources? +Does spending all this time taking the scenic route matter at all, or +are we just deluding ourselves because we have fun writing Lisp code? I think it *does* matter. Every piece of the stack that can be reclaimed from the likes of C is a small victory. The parts written |