When the earth did not stand still


Triggering statue movement: slow movement, everything shakes

Ok, back from holidays, and started working on core parts of the game like ... slow-moving statues that shake the earth! There is reason to this madness: I like to challenge the codebase on how easy it is to support something that pops to mind. Sometimes solutions are easy and fit just right, sometimes they don't. This one is thankfully in the former category.

I got this idea at some point last week that my game should support this cool effect where if you solve a puzzle or if triggered via cutscene, some big statue/object moves slowly, uncovering some area, while the whole screen shakes. In my head, this existed in the introduction of Shining Force 2, but it turns out I was making stuff up. Anyway, I convinced myself that it's really important as a funky effect, adding immersion blah blah. Ok, motivation sorted, how to implement it now?

Objects like statues are considered "static" in my code, as they don't move, and you don't throw them as projectiles. Turns out, not even such objects will be static. So, first step, I knew I had to refactor all logic where entities are either "static" or "moving", to make them all moving. So I did that, and this change actually led to some optimisations and bug fixes, which is not bad at all. So now all objects are movable except background blockers (e.g. trees) and decals (e.g. blood stains). So far so good! Now I can treat the statue as a first-class citizen in terms to movement.

Another element was the movement speed. Creatures move with a standard speed, projectiles move either as fast as creatures or faster. Statues would move far slower. My per-sprite movement speed specification allocated 6 bits for a movement speed multiplier, representing from 1x to 64x. I thought I'd be better off with a 3-bit lookup table. So now I can assign speeds of 0.125x, 0.25x, 0.5x, 1x, 2x, 4x, 8x, 16x. So, the statue can be assigned 0.125x speed, so it can move slowly. Fantastic, that's sorted.

Another element was the screenshake. I thought I'd solve that in a generalisable way. I want screenshake when something really really heavy moves, like a statue. Or a giant creature! If that object or creature moves (touching the ground) and it's close enough to the sensor, then we get screenshake. That's it really! I only tested it on objects, but it should work with creatures too. Now a small parenthesis: the idea of walking creatures shaking the ground really wants to evolve to giant multi-tile creatures, and I'm trying to keep myself from adding support for those next, just to see a big-ass giant walking towards the player while the entire screen shakes. It's tempting. But there are two rabbit holes there: dungeon generation supporting wider corridors and spaces, and handling multi-tile creatures. I've thought of potential solutions to both, so the problem feels tractable, and this itself is a problem because I'm fighting the temptation.

So, after all of the above, I can move objects now (programmatically at the moment) and the movement speed and screenshake will happen accordingly.

Other updates

  • Fire objects are now light sources. This was a pending task from last week.
  • A little bit of refactoring and bug fixing
  • For whoever follows on twitter, I bothered to fix the issue where no audio existed in the typical square videos I share there, so there will be audio in the future (me clicking about frantically, usually. I should disable that microphone input)

For next time, I'm tackling a bunch of errors/warnings that I've been getting (non-critical ones) to clean things up a bit before adding Godot

Flames are now light sources

Get Sigil of Kings (aka Age of Transcendence)

Leave a comment

Log in with itch.io to leave a comment.