A projectile attack and HUD. Both are placeholders until I figure out what I’m doing.
Work Since Last Devlog
I implemented the player’s session counters (remaining lives and continues, score), the ability to lose a life and restart the map, a game over state with the option to continue, and support for a full session reset when returning to the title screen and beginning a new game.
I tied spawnpoints to the current difficulty setting, so that they only load on a map if they have matching difficulty tags. I also added a deny list for map spawn points so that defeated enemies don’t spawn back in until another mechanism resets the list. The list can block spawnpoints on multiple maps, so you could have minor backtracking sequences without all defeated creatures reappearing, but bring them all back if the player loses a life.
I got checkpoints basically working, though they need testing. They’re not all that difficult to implement, but I had some trouble getting it done, since they depend so much on what the overall game is like, and the overall game isn’t really there yet. For this game, I’m going with a pretty standard / classic system:
- Every map change should count as a checkpoint
- Maps can have interior checkpoints (for example, you might want to set a checkpoint before and after a mini-boss fight that takes place in the middle of a larger map)
- Lose all lives and continue -> back to the level’s starting map, at a designated start point.
- Every map should have a start point defined, even if the level doesn’t begin there, to serve as a fallback in case updating the checkpoint state fails.
I tried attaching a subscene to the main gameplay area to standardize and reuse parallax-scrolling background layers, but ran into a couple of issues:
- 1: Overhead: with VSync disabled, it drops the framerate from over 400fps to around 350fps on my system. Not the end of the world, but more crucially:
- 2: Removing the existing backgrounds in my Tiled maps makes it a lot harder to picture how the map is going to look in-game!
So I’ll be leaving those statements commented out for the time being.
A few weeks ago, I started writing a ‘service’ interface to make commonly used actor logic more modular and easier to start up / tear down. At the time, this pretty much only applied to the platformer toolkit. I’ve expanded the interface so that multiple modules can be loaded, with the ability to load dependencies first. For example, the platformer movement / physics service needs to have optional collision methods attached to an actor in order to operate on it, but we don’t want to go through the bother of attaching those methods with a special call in every single game object that does platformer stuff. So make attaching those methods a service, and put svc_collision into the platformer service’s dependencies list.
I put together some mockups for attacks based around manipulation of a heavy spherical projectile. I’m not fully committed to it though, as up until this week, there was no combat logic in the engine. (Hibernator was a “passive” game: you could lose by touching hazards, but you had no way to stop those hazards directly.) To get things moving, I added a basic projectile attack for the player. That’s not truly where my heart lies right now, but it gives me the required environment to work on the player engaging other creatures. Who knows, maybe it’ll grow on me.
Maintenance / Other
Removed hard-coded screen dimensions from the core codebase.
Rewrote the draw priority system for actors. Before, they got a priority number, but were always drawn between background layers 2 and 3. Now they can be drawn between any of the background layers, or completely in front. I realized I needed this after seeing that my work-in-progress HUD was being drawn behind waterfalls.
Ran a search on the codebase for “WIP” and “TODO”, got about 70 results. Reduced it to about 50, mostly targeting things that are easy to fix or which are no longer relevant.
Troubleshooting Wild Goose Chase
Ran into a few concerning bugs related to how actors are added and removed in a scene:
- Intermittent crashes when switching scenes because of a nil index. Tracked down the issue with debug-printing: on the frame when a map load occurs, any actors that are removed just before the change were getting double-removed. Fixed.
- Intermittent crashes when actors being removed incidentally create additional actors in their cleanup scripts. Fixed, though I can’t remember what I actually did to resolve it, because I encountered it in the middle of the next one.
- If a set of actors are removed on the same tick, and they all create new actors in their cleanup code, the new actors get double slots in the stat order, causing their tick code to run twice per tick. I was very lucky in catching this: I just happened to have the placeholder projectile attack set up to spawn 16 pixels apart from each other, which is the same distance as the width of tiles on the map. When shooting staircase-like structures of solid wall, I could see that some of the smoke plumes spawned during the projectile impact were animating twice as quickly. Getting from there to the real culprit took some time, as I had to rule out the sprite system and table pooling first. Anyways, FIXED.
Whoa, it’s starting to feel like a real game now.
Early in the week, I ran out of tasks on my immediate engine / core todo list. That’s never happened before since starting this project last October. I kind of feel like I’m going to wake up and still be dealing with sloped terrain issues.
I spent some time this weekend thinking about how the project should look as a finished game, and made mild progress, but I still don’t have a clear picture. I’ll start with eight levels with eight bosses, and reel it back in if it’s too much work.
Plans For Next Post
- Unfortunately I am out of steam as I write this and can’t come up with coherent next actions. But hey, this is turning around. I guess… add more test enemies, and deliver their shared logic through the services system. Also get tasks up for November on the wiki.