Category Archives: Devastro2

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.

D2 log 056 – Voice recording

The first voice recording session for Devastro 2 is over! 200 lines of dialog, 2 different characters, 30 minutes of voice recorded.

The session took place in a professional studio and was handled by Tomáš Karásek aka gaex. Both characters were voiced by the talented James Harries.

Big thanks to you guys!

To keep track of everything, I have a Google Sheets table with extra information about each line, such as the character name, output filename and a number of “tags” that connect the line to in-game events or other dialog lines. This metadata is exported into the game and helps me build dynamic conversations or reactions at runtime.

There’s also a column to generate the audio using the “say” command. I can run all of them in a batch and get all the audio spoken by a synthetic voice for testing before going to the studio.


D2 log 055 – Title update

I played with the main menu title a little bit. To hammer home the “gun being loaded” idea, I set the materials on the “2” to resemble a bullet. Small change but something new to look at every time I launch the game.

I’m still planning to do another pass on the whole thing, fix letter spacing and add a few more details.

D2 log 054 – Subtitles

Currently I’m working on the dialogs for the game. After watching some footage from Call of Duty: Black Ops Cold War, I knew I had to have subtitles just like that.

Here’s how it works: if a subtitle comes to an empty screen, it goes to the top line. The second one will go to the line below. Any following subtitles push the existing ones up; the top one disappears. After a short delay any subtitle simply fades out.

Getting this right was quite a challenge. It took me over 3 hours to figure out all the edge cases and make the animations robust enough to handle them. I had a lot of fun making this and I’m happy to have such a nice little system in the game.

D2 log 053 – Meta tiles

Until recently, all the map tiles were created in Photoshop (or Pixelmator, or Affinity Photo, let’s not get into that now) and exported as flat images. Multiple combinations of ground × road × water × dirt all had to be done up front and each new one took additional memory and disk space.

I created a new meta tile system that improves this. Each tile now consists of multiple layers which are combined at runtime.

The first “naive” implementation simply draws all the layers on top of each other, which isn’t super efficient but I have an improved version in the works which uses multiple texturing units and a shader which combines them in a single pass.

Using the new tile editor I can create any combination of water / ground / road layers I need and the game and level editor will start using it immediately.

D2 log 052 – Picking things up at one place and carrying them to another place

You can now pick up some special items and deliver them to designated locations to trigger an action.

There are currently two items you can pick up:

  • 6-pack of Cola
  • Fuel canister

Here’s how it works: walk over an item to pick it up. You will see it float above your head because obviously that’s how humans carry things. While carrying an item you cannot shoot but you can drop it anytime, do your business and pick it back up. The goal is to deliver it to an area which “accepts” it and triggers some action. It can spawn new objects, start dialogs or simply change the state to “mission completed”.

D2 log 051 – Fixing my timestep

In Superforce, it was safe to assume that the game would run at a constant rate of  60 frames per second. This was thanks to

  • predictable hardware and software environment
  • fast, simple rendering and game update logic

The game logic could thus be directly locked to the framerate. This assumption is not valid for Devastro 2. I have no idea what machines it will run on. I don’t even know if VSYNC works on all of them.

There’s a great article called “Fix your timestep” which describes a good way to decouple game updates from rendering.

After making a few changes in my code, I have indeed fixed my timestep. Toggling VSYNC causes a big FPS increase and yet gameplay keeps running normally.

I was not able to fully implement the last step from the article, which is interpolation. It would require more substantial changes to the game and I just didn’t have time for that. I may or may not do that later as the… next step.

I might add interpolation for the camera position, which could smooth things out even more without too much work.