Project Bolero Devlog 10

Work Since Last Devlog

  • Combined maps and sets of actors into scenes, and added functions to append a new scene to a project list, and to switch the currently-viewed scene. While not strictly necessary for Up High, where the game world is just a large and contiguous tilemap, scene-switching is a must for just about any other kind of game. This is basically done, though it needs to be thoroughly cleaned up and tested.
  • Separated most of the Up High project code from the core Bolero code. This proved to be a mess, but it was good to do now rather than later, when it would be so much harder to disentangle.
  • As part of the project-engine separation, I moved actor behavior out of the main loop, and into functions that are called from the scene processor based on an actor’s ID. I also gave every actor two additional tables: actor.data, to consolidate user-defined variables, and actor.stack, for receiving and processing messages from other actors. Each actor behavior table can optionally have ‘startup’, ‘per-tick’, ‘read-messages’, and ‘remove’ functions, or none at all.
  • Messages can be sent to a single actor, to multiple actors sharing the same name-string, or broadcast to every actor in the scene. Actor message stacks are opt-in, and incoming messages can be disabled or enabled by setting a boolean. Inter-scene messaging isn’t in yet, but wouldn’t be too hard to add I think. (For example, if an actor needs to communicate with a UI element that resides in a different scene container.)
  • Forgot to decouple animation update rates from delta time. The counter increment function is now called within the tick update.
  • Removed hard limits on the number of actors in a scene. While testing, I was able to get about 9500 coin actors running without overloading the CPU, though after making various changes, this threshold fell down to about 4900 coins. This is still about 50 times more than what I see myself needing out of this engine… I really, really underestimated Lua and LÖVE’s performance.
  • While doing these tests, I noticed that my update / timestep handler coped very poorly with being overtaxed. I changed the update function so that if a certain amount of time has passed in the tick processing loop before it’s finished, it resets the catch-up timer and breaks out of the loop. This potentially causes slowdown, but keeps the interface (somewhat) responsive to user input, prevents the update loop from hopelessly trying to catch up to the present time, and it can still recover from small hiccups. For now, I have this threshold set to 1/4th of a second.

Thoughts

Visually, there is very little difference between this devlog snapshot and the one from last week. Most of my efforts lately have been organizing the core (scene, actor, maps, animations) so that it can be used across multiple projects. Bolero‘s main loop is a lot cleaner and easier to understand now, and even though the project code related to Up High is still a mess, it can now be worked on separately from the core.

I really don’t know where the message stack thing came from, or why I avoided class inheritance. It’s not something I planned on doing at all, but it seems like it’s working OK, at least as a proof of concept. Maybe I’ll tear it all out next week? I guess I’ve had ZZT on my mind too much lately.

I am committing to a prototype release of what I have on or before March 31st. That should give me time to follow up on any other restructuring that needs to be done, and also time to  make an actual game out of this stuff. As a response to my previous devlog: spending time  on the engine core was absolutely worth it.

I still didn’t get that font replaced, but did some reading on bitmap font usage in games and made a few small ones as a test.

Plans For Next Post

Whoops, I’m writing this a bit too late to set appropriate goals here. I’ll need to review my project notes and sort out what needs to be looked at next. Here are some odds and ends that need to be looked at in the meantime:

  • Include a draw order property for actors
  • Add sin/cos angle displacement for actors
  • Replace that font… still.

Leave a Comment