At its core, the game is about designing airships and fighting with them. Ships are put together out of modules, and the layout of modules matters a great deal: everything on board is done by individual airsailors who need to run around, ferrying coal, ammunition, water and repair tools - and sometimes their fallen comrades.
When you start upgrading the visuals of your game, some parts start sticking out like a sore thumb. In this case, I'm really unhappy with the way damaged armour looks, so I'm going to outline a way to make it look better. This is a bit involved, but there is a really cool picture at the end...
Currently, each type of armour has a series of five appearances, from "unblemished" to "destroyed". When undamaged, the armour tiles nicely and looks quite nice, especially with the lighting effects now applied. The problem comes when there's heavy damage: since there's only one picture for a destroyed armour tile, this gets tiled and looks very bad: a regular series of holes with the exact same shape.
The obvious way to fix this is to add more pictures for damaged armour tiles, but this doesn't fix one problem: a damaged tile may be right next to an unharmed one, which means that the hole can't quite extend to the edge without a sudden and obvious transition from one tile to the next. So I'd still up with a grid of holes, just of different shapes.
I could add pictures for all the configurations of tile adjacency, but this produces a combinatorial explosion: including diagonal adjacency, each tile has eight neighbours that could be damaged or fine, which means that I'd need to draw two to the power of eight different tiles. I am not drawing 256 armour tiles for each type of armour if I can help it!
So instead I've hit upon a different idea to make the armour drawing look really good. Unsurprisingly, this involves a clever shader. (I get this feeling that more and more of the game is moving to shaders, until eventually the entire thing will just run on your graphics card.)
Note that I haven't actually implemented what I'm about to describe, so it's perfectly possible that I'll have to abandon it because it's too hard, or too slow, or just looks bad. Normally, when I write dev blogs I do retrospectives where I can describe what I ended up doing, leaving out all the false starts and dead ends, which makes me look more clever than I really am.
On to the idea: per-airship damage maps. Each airship gets an associated grayscale image of where its armour has been damaged: white means undamaged, black means the armour's been punched through. Impacting shots draw splashes of damage onto this image, bigger and darker for stronger projectiles.
This damage map is then used in the shader to put together the look of each tile. In places where the map is nearly white, it draws the normal look of the armour. In places where it's grey, it draws an alternate, damaged look, which comes from a second armour picture that looks all roughed up. Finally, in places where the damage map is black, it doesn't draw the armour at all, leaving a hole.
The result is that each airship gets its unique patterning of armour damage and holes, going across tile boundaries with no visible transition.
What's more, the shader can also calculate the lighting for that tile using a few bits of extra information. First, it needs a height map for the undamaged armour. This is different from the bump map described in the lighting post. A height map shows where the armour sticks out. A bump map is the derivative of a height map: it shows where the height map changes.
The shader combines the height map of the undamaged armour with the damage map for the tile, which results in a new height map that shows what remains of the armour after the damage has been done. Then it derives the bump map and uses it for the lighting calculations.
The result should be pretty awesome: armour that can be blasted off pixel-by-pixel and dynamically lit at the same time, so flashes of light will play across the jagged edge of the holes, making splinters of still-unblemished metal light up.
Can I pull it off? As you can tell, I've got the logic of the shader pretty much worked out. The bigger question is whether it's feasible to attach a damage map to each ship, update it, and feed it to the shader in the correct way with all the offsets set up properly.For now I will leave you with this amazing piece of Airships fan art created by Jenny Thorne:
(Oh, and remember to vote for Airships on IndieDB! Only a few hours left!)
Latest tweets from @zarkonnen_com
Mount Doom is a real place, on Titan: T.co
16hours 28mins ago
T.co is pretty interesting.
Dec 17 2014, 2:55pm
@Emberheartgames Wow, that's very early, though it had been rising at extreme speed, so I can see why. :)
Dec 17 2014, 1:49pm
Dec 17 2014, 1:41pm
RT @JonasKyratzes: If you thought The Talos Principle was awesome, and are looking for a writer, do feel free to contact me. I'd enjoy anot…
Dec 17 2014, 11:25am
@FullColorPlanet Jede Stimme hilft. :)
Dec 17 2014, 10:17am
@FullColorPlanet Vielen Dank! :D
Dec 17 2014, 10:14am