Nov. 7th, 2025

jack: (Default)
rust tile game

I split my rust tile game into two. That was a slog but very satisfying. The base engine stores a map with objects, each game specialises the objects and the interaction logic. Originally "push blocks, avoid enemies" and I want to add "follow user's flow-chart like program" instead.

That's compile-time templating not run-time polymorphism. Rust made me realise that for many many purposes those are conceptually incredibly similar. I think the difference is, almost all the types in the engine need to be templated on game-specific data because an Engine containing a Map containing an Obj they likely all need to be compiled knowing how many bytes Obj's Property struct uses.

git shortcuts

I also updated my git shortcuts with something I wanted to add for ages:

`git extract commithash path1 path2`

Rebases a commit on the current branch, to split the changes in those paths out into a separate commit. I often find myself accidentally combining a comment change in a different place, or wanting to separate out a piece of functionality which is all in one module, and it seems to take half a dozen steps to do it manually.

I made a bunch of shortcuts for me, common ones:

g a: git add, but add everything if no paths are given
g c: git commit
g d: diff, sometimes with some extra info
g dh: diff to HEAD
g l: log of current branch from fork point
g ls: log, showing file names with --stat
g lp: log, showing diff with -p
g r: rebase onto given branch, *or* else rebase interactive from current fork point.
g t: Add a tag with current branch name and date and comment