System cleanup work and some audio


Mish-mash of not-so-fun items this weekend: Been looking to implement modifiable 'regions' in the world, so I can have the player place objects.

Aiming to have the player's 'home' region specifically - and then I can start saving those changes. Critically I want to get to the point where I have a chest with a modifiable inventory, and some kind of workbench or other object that triggers object creation.

I've made progress towards this but it has been a messy set of internal changes: 

  • Trying to make collision stateless, so I don't need to create and destroy collision bodies
    • Which makes it much easier to add/remove objects from the world
  • For the first time adding the proper concept of an object ID. I had been leaning on collision handles for this, but because of the above, I needed to figure out a better solution
    • This needs more work to unify how IDs are set in the level editor, and how they persist in save games
  • Actually implementing the idea of a 'region' - which so far has a state containing its objects and items. When the world loads up it can now put new objects into a catch-all outdoor region:
    • Regions can also be modified at runtime, and this will hopefully now facilitate the player putting down items in the world
    • The intention is to eventually partition the outdoor region into subsections 
    • Each interior area will have its own region loadable on demand (and again- need to track and save changes to it as persisted part of the savegame)

This hasn't been a particularly pleasant set of changes to implement, and the returns are rather uninteresting looking right now:


The notable thing in this image is that:

  • Chest objects exist and they are able to have working collision bodies without any creation/teardown step
  • The chest on the right was spawned at runtime, but the top two were actually placed in the level editor:

So... dull, but kind of important technical steps. I'm kind of doing janitorial work on some subsystems that were lacking previously, and are now starting to hold the game back (a.k.a "technical debt")

Audio

Because this wasn't too fun to work on I took the edge off a bit by getting basic sound working in the game. Nothing terribly complicated, but it's nice to have it in the background ready to use.

I'm only playing back samples and there isn't streamed music playback yet - but I did add super crude distance volume modulation as per the video (these are all royalty free placeholder sounds that aren't appropriate - don't be judging the audio here, it's just the tech behind it)

Leave a comment

Log in with itch.io to leave a comment.