How gibs are generated in Brigador Killers
Author: dudeglove,
published 1 year ago,
For this month we’re going to explain how the Brigador Killers engine handles the emission of gib sprites from entities during gameplay. In other words, this.
[img]https://i.imgur.com/gsoDAtW.gif[/img]
We’ve established in previous news posts that [url=https://store.steampowered.com/news/app/274500/view/3662024223190614902][b]all you’re looking at on screen are flat 2D sprites[/b][/url] and that BK’s systems can [url=https://store.steampowered.com/news/app/903930/view/3681170860476936341][b]overlap in interesting ways to create unexpected outcomes[/b][/url], but we haven’t touched on the data end of these things.
First off, to save on space, both the Brigador and the BK engine store all assets in a large collection of compressed data called a pack file which has the exciting name of [b]assets.pack[/b]. By using the game’s debug panel, we can look up these assets via the Pack file tab. At time of writing there are roughly 19 thousand assets categorized into 60+ different “resources”. Sometimes these assets are .png image files (such as the various sprite sheets for all the building props and characters) but a large portion of them are JSON files which allow us to specify the values of all sorts of various things in a human readable manner. Most of the screenshots in this post are of the game’s debug panel, which is [b][url=https://github.com/ocornut/imgui]a version of Dear Imgui[/url][/b] that among other things allows us to look up and iterate on data values during a game’s runtime [i]without[/i] having to make a new build of the game.
[img]https://i.imgur.com/QYhtPFj.png[/img]
The JSON for a specific unit can be made up of several JSONs itself. For instance, let’s look at foot_loy_bd_01.json, which is the JSON file for a typical enemy infantry unit, and which turns out to be made out of a lot of JSONs.
[img]https://i.imgur.com/dujG4X4.png[/img]
The keen of eye will notice that, yes, infantry in Brigador Killers are all [i]technically[/i] mechs behind the scenes - anything in assets/data/vics/units is a mech, be it the player in a carmine suit or an NPC-controlled forklift truck. This is just how the game data is organized. From this list of JSONs, we want to inspect the unit’s [b]salvage[/b], which is a file called salvage_foot_01.json.
[img]https://i.imgur.com/BtjT36L.png[/img]
Here you can see not only [i]even more[/i] JSONs attached to this one, but also the types of values that can be assigned to its salvage “hulk”. A unit’s “hulk” is what is left over after its health has been fully depleted. Vehicles that have been destroyed will leave a wreck, which is usually just the top part of the same model but desaturated to give the appearance of burned out armor. From the above menu most of the values are set to zero, as the hulk left over is for a body instead of a chunk of metal, but for purposes of player reactivity, hulks will still have some amount of health. Tangentially, infantry units as seen from the opening GIF will go through a series of animations as they are being attacked, which is not handled in this menu - that’s part of what’s called Flinch, Suppression, Flop and Weapon Stability, which looks like this:
[img]https://i.imgur.com/3POlAxe.png[/img]
Getting back to the gib sprites, we look at what’s assigned for the [b]on_damage_pyro[/b], which is pyro_blood_mist_01.json, which is emitted by infantry-type NPCs and is a pyro-type resource.
[img]https://i.imgur.com/oK0rpc4.png[/img]
Within [i]that[/i] JSON we look for the [b]gibs[/b] assigned to that pyro, which leads us to gibs_blood_mist_01.json. Explosion layers and lights are for “bigger” pyro effects. For instance, a gas station blowing up will need a fireball attached. Three layers down we have arrived at the resource that handles the attributes of blood sprites that an infantry NPC will emit on receiving damage: gibs_blood_mist_01.json
[img]https://i.imgur.com/ExrYQcH.png[/img]
Here we can see what type of sprite has been assigned and how the animation for that sprite is set to play. We also get to decide how many blood mist sprays shoot out from the unit and at what speed, height, angle etc. These numbers are kept low for infantry gibs but, if we want to get silly, we can crank the numbers up and end up with something like this.
[img]https://i.imgur.com/usFe1V0.gif[/img]
Again, the use case for more flamboyant gibs would be the destruction of a bigger entity like a heavy vehicle or a building prop that will have their own pyro and gib effects. Note again like in the first GIF at the top of the post an entity will do more than just shoot out a blood mist spray - just like a practical effect in movies, a “[b][url=https://en.wikipedia.org/wiki/Bullet_hit_squib]squib[/url][/b]” also plays out to leave a blood stain on the ground. But [i]unlike[/i] movie FX, we have to account for more situations than a carefully staged scene. Therefore one of the many other things to bear in mind with making these gib effects is that they have to have different “spreads” depending on what caused the hit. Here for instance is what happens if we put a bunch of infantry NPCs in a straight line and attempt to drive a heavy caliber round through them.
[img]https://i.imgur.com/6ap2FLN.gif[/img]
On top of the fireball explosion sprite and the bloom of light for the explosive bullet, you’ll notice that there’s some uniformity to the ground spatter. This is because the sprites will only shoot out from an entity a limited number of ways. It would be too expensive (and a waste of time) to have our artists render out every single possible angle. Instead, the hope is that the gibs are done in [i]just enough[/i] ways that the player fantasy is maintained.
Thanks for reading, and happy halloween!
[img]https://clan.cloudflare.steamstatic.com/images//35158356/4fd9e804fa50da6118470627366a885dc2eee180.png[/img]