CoD: WWII Enemy Tanks

Using a proprietary C# based scripting language, I created a system to handle audio playback behavior for the enemy tanks in the CoD: WWII campaign.

First, I perform a check to see if the tank entity is alive and not null. If not alive, do nothing.

If it is alive, then thread an init tank audio function to kick things off:

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

{

  • If tank entity is null, then do nothing

  • else, thread init_enemy_tank_audio();

  • // threaded methods branch off the parent function, and remaining logic in parent function

  • // is not dependent on the threaded methods’ behavior carrying out through completion

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

  • Initiate static data, such as:

    • Sound mapping tables with data used to establish distance-based playback behavior (close idle engine sounds vs. distant idle engine sounds, etc.)

      • Some of these table parameters include min and max distances, fade in and out durations

    • Initial tank entity values such as initial speed, health, etc., to compare against current values on first iteration

  • Initiate dynamic data such as:

    • Engine, tread, and metal wronk/groan handler methods

  • I requested getter methods from a gameplay engineer to periodically obtain data about the tank and update behavior accordingly, for example:

    • Current tank health

    • Current player distance from tank

    • Current tank speed

    • Current tank cannon rotation value

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

init_enemy_tank_audio()

{

  • thread init_static_tank_data(); // sound mapping tables, initial entity values

  • thread init_dynamic_tank_data(); // engine handler, treads handler, metal wronk handler, etc.

}

/* the dynamic content is obtained while the tank is alive, so each piece of data in its own threaded function with recurring checks to manage what sounds play */

Engine handler() // example with abstract explanation of logic design below

{

  •  get current speed()

  •  If current speed > 0, play tank movement sound (if not already playing)

    • If prev speed == 0, also play lurch sound (mvmt sound is ducked based on parameter behavior handled in asset spreadsheet)

    • else, do nothing

  • else, play idle sound (if not already playing)

    • if prev speed > 0, also play stopping sound

  • prev speed = current speed

}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

A similar treatment is given to the cannon rotation sounds, using a start one shot, a rotation loop, and an end/outro sound.

If the tank dies, then:

  • Stop any sound currently playing

  • Play breaking down sounds

  • Delete and clean up audio data