Back

Gamedev in Lisp. Part 2: Dungeons and Interfaces

219 points8 hoursgitlab.com
maxwelljoslyn3 hours ago

This is what all technical tutorials should look like. Well-composed and generally free of grammatical errors, spends just the right amount of time explaining each new topic as it is introduced, comes with full code samples, and includes visual samples of what the code does. Also, lengthy enough to treat the material in depth, while still being sufficiently self-contained that I can follow along -- without having read part 1 and without more than a few months of Common Lisp under my belt from a couple years back (tho I've done a decent amount of Clojure and Emacs Lisp.)

Bravo, awkravchuk/Andrew :^)

(Crossposted from https://mxjn.me/2024/10/17/1)

varjag2 hours ago

Seconded! Top notch longform programming material.

fredrikholm7 hours ago

Few (tech) things pull at the heart string more than great projects/articles about Common Lisp. Man what a treat!

Read the first part when it came back, really excited to read this one. Kudos to the author!

awkravchuk7 hours ago

Thanks mate, I appreciate it :)

ertucetin3 hours ago

This is a very good read. I’m developing a multiplayer, third-person, spell-based shooter game using Lisp (ClojureScript). It’s a 3D web-based game. I’ll also be writing a blog post about my journey, including the tools and abstractions I created for the project. If you’re interested, here’s a demo link: https://wizardmasters.io

fire_lake3 hours ago

Jon Blow tried to make a game like this way back. It might be worth learning how/why it failed.

tines3 hours ago

Link to any video or anything on the subject?

adamrezich2 hours ago

Unless I'm mistaken, I think fire_lake might be referring to a wholly unrelated first-person RPG spellcasting game project wherein the player would draw glyphs with their mouse in order to cast spells, and then there would be a surprise later in the game based on this mechanic (which was later repurposed for The Witness).

modernerd2 hours ago

Yes, it reminded me of his talk on prototyping:

https://www.youtube.com/watch?v=ISutk1mauPM&t=426s

mark_l_watson5 hours ago

Wow! Your package.sh and in general managing builds for three operating systems is a master class in itself - reading through the GitHub repo was a good learning experience.

I usually build command line Common Lisp apps in SBCL or LispWorks, but I might do the next one in ECL because having builds for both macOS and Linux would be cool, and it would be fun to try something new.

awkravchuk5 hours ago

Oh thanks! I've been building that CI stuff on top of CL infrastructure for a few years now, and it constantly breaks :D

xixixao2 hours ago

This is super solid, but the setup in Part 1 (CL itself, Python, C, lots of steps) I think is indicative of why CL is not super popular, especially with young programmers. Which is a shame. Would be awesome if someone felt like putting in the work to make the language more approachable (installation wise).

dunefox7 hours ago

Nice, just this week I started developing a roguelike in Python, but Lisp might be cool as well.

awkravchuk7 hours ago

There's also this full-fledged Lisp-based roguelike tutorial: https://nwforrer.github.io/posts/roguelike-tutorial-part1

varjag2 hours ago

There's also Langband: a fairly complete Angband clone written in CL by my late friend. Including SDL/tiled version; however the code is pre-Quicklisp and it'd probably would be some work to get it to run again.

https://github.com/fufie/lambdarock

0xEF4 hours ago

I feel tricked. I came to learn to make a simple game, ended up learning tons about computing.

Love it!

sourcepluck7 hours ago

I was only looking back over Part 1 yesterday! What timing!

davexunit6 hours ago

I didn't know that bit of history about A* and Lisp! All roads lead to Lisp, it seems.

As mentioned at the end of the article, the next Lisp Game Jam starts next week on the 25th. Join in here: https://itch.io/jam/autumn-lisp-game-jam-2024

awkravchuk6 hours ago

I also learned it by chance while preparing the article :)

Guthur7 hours ago

The event loop is brilliant example for how much `loop` is a full blown iteration DSL... love it or hate it ;)

awkravchuk7 hours ago

I used to scoff at it at first, but after a few years of CL programming loop is one of my favourite CL constructs :)

taeric6 hours ago

I'm with you there. Is a bit of a mind bend, as I really disliked it the first few times I saw it.

For an even sillier mind bend, I'm using tagbody to be able to directly transcribe some of Knuth's algorithms as I am learning them.

awkravchuk6 hours ago

Cool! Using tagbody feels like writing supercharged C or even assembler to me (not that I've used it much, but still).

CyberDildonics6 hours ago

I don't understand why turning a simple loop into a 'mindbend' is considered good. The downfall of programming is complexity, if you're getting your mind blown by a loop how are you going to do the rest of the program?

+2
zelphirkalt6 hours ago
taeric6 hours ago

The mindbend was more of my approach to the construct. It began with disdain before even really using it much. Looking back, I really couldn't articulate what I disliked about it.

medo-bear2 hours ago

Simple minds loop simply

0xdeadbeefbabe5 hours ago

He started with a bent mind though.

BoingBoomTschak5 hours ago

Why loop when you can https://iterate.common-lisp.dev/ instead? No s-expr-less alien syntax, no need for `do` to switch to back to Lisp syntax, normal `if`/`when` without the ugly `else`/`end` and generally useful features added.

shawn_w57 minutes ago

If I used Common Lisp more I'd probably have a go at copying Racket's `for` forms[1]; they're really nice because you can usally tell at a glance what they're going to return - `for/list` returns a list for example. No having to scan the body for a `collect`.

But in the meantime since discovering iterate I've barely used `loop`. It just feels so much more lispy and I find myself running to the documentation less often.

[1]: https://docs.racket-lang.org/reference/for.html

BoingBoomTschak35 minutes ago

Interesting concept, but it visually has the same problem as loop IMO, using keywords to implement a new syntax instead of seamlessly blending with Lisp (at the cost of needing code walking, though).

And it seems to lack all the iterations drivers (incl. builtin destructuring) that make half of loop/iterate's usefulness and "reads like English" comfy factor; especially liking

  (for (i j) on list [by #'cddr])
  (for i initially init-expr then then-expr)
  (for prev previous i [initially init-expr])
  (for i in-{file,stream} [using #'reader])
The two lasts are iterate goodies and I often use the last with these custom readers: https://git.sr.ht/~q3cpma/cl-utils/tree/master/item/src/read...
Jtsummers4 hours ago

Have they fixed the problem in Iterate yet where it breaks any uses of the built-in count function?

BoingBoomTschak2 hours ago

Sadly no. Biggest bug in there, "fortunately". Easy to patch, though.

edem3 hours ago

This reminds me of "Caves of Clojure": https://stevelosh.com/blog/2012/07/caves-of-clojure-01/

zelphirkalt6 hours ago

I like the SICP references.

the_gorilla6 hours ago

[dead]