Category Archives: Devastro2

D2 log 064 – Audio improvements

Before recording new sound effects and adding music, I want to improve the audio engine a little bit.

In this first part, I implemented some fundamentals.

  1. Envelopes. Automated adjustments of gain, pitch or pan etc. Already replaced old code for fading music in and out.
  2. Audio bus hierarchy. Apply parameters to all related sounds in one place.
  3. Lowpass/highpass filter. This has been on my wishlist since Superforce and I finally got around to it. I used this article as inspiration but the code is 100% rewritten for clarity & performance.
  4. Limiter. Safety guard to avoid clipping.

The big payoff for these features will be ducking. To make important sounds stand out, I want to suppress the less important ones. This can be done with gain but also applying the lowpass filter could make it sound even better.

D2 log 063 – Ammo box

Recently I ran into a design problem. Some enemies in the game will be immune to bullets and you’ll have to use grenades. Of which you can only carry a few. What if you miss and run out? You’d have to restart the level.

For a moment I considered loot drops. For something you’d be required to get they seemed too random and potentially frustrating. Instead I shamelessly copied Half-Life and added a grenade dispenser!

It’s a box full of… grenades. Just walk up to it and get a refill. The lid opens automatically to indicate you’re not supposed (or able) to break it like the regular ammo crates.

D2 log 062 – Menu navigation

I’d love to see the game running on Steam Deck one day. Until then, I’m using an Xbox controller for testing.

Some menus were impossible to navigate with the gamepad or keyboard. I’m not building any sort of generalized UI framework but this needed to be fixed.

Each menu item contains links to its neighbors and pressing ←↑↓→ changes focus accordingly. In most simple cases, such as the main menu, the autogenerated links were enough but in more complex layouts some were omitted. So added a way to create the missing links manually.

Now I can get right into the game using just the controller, which is cool.

D2 log 060 – Smoking barrels

Exploding barrels are a nice addition to any game. Devastro 2 already had some but I wanted to make them more fun. Decided to add a burning phase that would indicate a barrel is about to explode.

The fire animation was created in Blender and the smoke is a particle system running live in the game.

Explosion chains are now much more fun too.

D2 log 058 – Alien AI

The alien AI was a mess. It tried too hard to be clever. The code was fragile and the behaviour unstable.

I threw it all out and implemented a simple flock / boid algorithm. The aliens will stick together and try to approach the player in natural looking groups.

A* pathfinding is gone too. Instead, the player character drops invisible scent markers with a limited lifetime. If aliens cannot get a clear line-of-sight to the player, they will look for the scent dots and follow them. That can eventually lead them back to the player, even around corners etc. It makes it look like the aliens know what they’re doing. Which, of course, they don’t.

D2 log 057 – Tiles, pt.2

The new tileset is coming together nicely. I made a “master sheet” with all the tiles to keep things organized.

I implemented a new material system for tiles. In addition to the visible texture, each tile had a lower resolution bitmap which defined the material at a given spot. This was used for special FX like bullet impacts that vary based on the ground material they hit.

I got rid of that and switched to a polygon based approach which plugs into Box2D. Material polygons are created as invisible objects in Blender and exported into the game.

I also changed the way fences are placed on the map. They are now baked into tiles, so map editing is much easier.

The metatile system is still in place but without the editor. I get enough variety from Blender & Pixelmator alone, so it wasn’t so useful. However I now use its multi-layer feature to draw the fences, because they need to have separate ground / shadow / foreground layers for proper z-ordering.