game design – engineering – narrative

Overview

As part of my aerial firefighting prototype, I had to design and implement a damage pipeline that conveyed the experience I wanted. The pillars I was aiming for were:

  • Risk taking is rewarded
  • … but not utter recklessness
  • Gameplay feels tactile

I’m using a standard Gameplay Ability System implementation as well, which imposes some requirements and limitations. In broad strokes, I have to shape things in ways that are compatible with GAS, even if I do stretch things out a little here and there. Since it’s multiplayer-based, I also have to be mindful of how much information is going over the wire, client authority issues and the like, which further shapes the design space I’ve got to play in.

Here are the goals I had for this damage pipeline:

  • Fire is an AoE coming from a volume the player flies through.
  • Fire has intensity, which is an analogue for temperature, fuel source, etc.. The higher it is, the more likely it’ll ignite a part of the airplane
  • Discrete airplane components can catch fire and burn independently from the others.
  • Components that burn are more likely to catch fire again until they’re completely burnt out.
  • The likelihood of the plane catching fire in the first place is dependent on the aggregate chance that any of its components are likely to catch fire.

Structure

In pursuit of those goals, I put together a system that has the following entities:

  • Fire Manager
    • Owns the individual fire volumes
    • Has an Ability System Component that will apply effects to the airplane as it flies through its fire volumes
    • Receives OnOverlap events from its fire volumes
    • Manages the fire intensity of each fire volume independently.
  • Fire Volume
    • Has a bounding box that detects overlaps from the airplane actor
    • Controls its own VFX emitters, which run on the basis of its fire intensity, which the fire manager controls.
  • Fireboss Aircraft
    • Player controlled
    • Has its own Ability System Component that will receive effects from the fire manager
      • Has attributes for each distinct component of the aircraft, which use a threshold-based calculation to affect the performance of each component
      • Each component has two attributes, component integrity and component durability.
      • Component integrity affects the functionality of the component. Component durability affects how easily that component catches fire, and contributes to the overall durability of the aircraft.
    • Has an AircraftState component, which has thresholds per component for Damaged and Disabled states.

Logic

This is the flow of how damage is applied:

Flowchart depicting aircraft fire-field simulation: fire-field overlap is reported, fire intensity is applied, components are randomly selected and added to or create a stack, then integrity is degraded until a damage threshold is crossed and a new physics state is set.

And some snippets of the logic of the random rolls. I’ll deal with the magic numbers soon (promise).

This is the logic at the first decision point, checking against the aircraft’s overall durability.

How it’s GAS’d

The flow for this to operate in GAS is parallel to the logic flow for its damage.

The BaseFireEffect uses the UFireCanExecute::CanApplyGameplayEffect_Implementation code to do its random roll and challenge the aircraft’s durability. If that check passes, we apply the effect, which applies the “Catch Fire” tag, thereby triggering a corresponding ability.

This is the code that chooses the component to set on fire with its random weighted check, using a tag to fire off gameplay cues.

These effects then apply the corresponding damage to the component’s attribute pair.

And this is the actual damage application logic. Note that it acts on a pair of attributes, namely the component’s integrity and durability, with different values.

Tooling – The Gas Tester

Given the complexity of this system, along with the subtlety that it relies on a two-step system to inflict damage, and another for that damage to matter, getting an idea of its actual behavior. This led me to develop a tool that simulates the whole interaction in a clinical environment.

This is GasTester, an Editor Utility Widget connected to an Editor Utility Actor:

Unreal Engine editor window showing EUW Gas Tester configuration with gameplay effect settings and actor attribute logs.

It allows me to deploy a renderless world with all of Unreal’s subsystem’s firing, spawn a couple of actors with ability system components, attributes, gameplay effects and abilities, and then use one to apply gameplay effects to the other. It allows for the applied gameplay effect’s spec to be configured with SetByCallers and so on.

Dark-themed code editor showing Unreal Engine C++ code applying a gameplay effect to a target actor and forcing a tick for event logging.

The log that it spits out is the state of both actors, logged on every tick of the test world it spawns for itself. I can take that log, plug it into a google sheet with some scripts, and it outputs a chart like this one:

Line chart titled Unreal GAS Attribute Telemetry & Effect Events, showing attribute values over ticks with event markers and multiple colored durability and capacity series.

This chart on its own doesn’t really tell the story, but over multiple runs it’s shown me some of the character and tenor of the system.

The main lesson was this:

  • Anything below 50 fire intensity is mostly harmless. Players can fly through low intensity fire fields almost indefinitely
  • Anything higher than 80 is extremely dangerous. Fields of that intensity can easily max out the damage effect stack of multiple components before the player is done crossing them

Gameplay-wise it feels like a good start to keep refining. And in the future I’ll be able to use this tool to have a solid set of data from which to make decisions.

Leave a Reply