postmortemish babble


This is mostly a note to my future self. But you're welcome to read it.

I've been kicking this idea around for a long time. I think it started out as a little throwaway toy system when I was learning Rust. Then later I wrote a quick and dirty prototype in Godot, where it picked up the moving-a-card-around-a-grid mechanic.

This version uses Defold. But I wrote the core/model in straight Lua. I made several levels, a bunch of tests, and an automatic (but dumb) "player" before adding Defold to the mix. The automatic player was very useful in helping me quantify how "hard" a level is.

One downside of this approach that I found was that the cool data structures I'd built were not convenient to use with Defold's message passing. You can pass tables through messages. (In Lua, all data structures are tables.) But they get serialized and then deserialized. So even if your structures are serializable (no lambdas!), they're probably too big. Globals are really unavoidable. 

Another downside of building the model to work independently of Defold is that Defold needs all Lua modules to be in the "assets" folder of the project. Also Defold replaces the nice Lua module loader, so you can't do any path stunts. So I have this terrible script that copies my lua modules into the Defold project, using sed to do the right replacement everywhere one file "require"s another.

Similarly, my level data (a bunch of json files) needs to be copied into the Defold project. (No, Defold won't follow symlinks.) All this preprocessing stuff led me to Defold's "lifecycle hooks". They let you run scripts at important times, one being right before a build starts. Very useful.

There's a boatload of stuff in this project's backlog (on Trello). The most compelling stuff there is probably more levels and several new card types.

Leave a comment

Log in with itch.io to leave a comment.