
Welcome to the Metruvia Content Creator Audio and Soundset Guide. Visuals may attract a player to your mod, but audio is what grounds it in reality. The mechanical chug of a steam piston, the high-frequency whine of an electric traction motor, and the heavy clatter of a freight car on jointed rails are what make Transport Fever 2 feel alive.
However, audio is notoriously unoptimized in amateur modding. In the PC-exclusive realm, modders often pack their vehicles with massive, uncompressed stereo files. When migrating to the Mod.io ecosystem to target PlayStation 5 and Xbox Series X|S, this approach is a guaranteed failure. Audio files are stored in the console’s unified memory pool. A poorly optimized soundset will consume more memory than your 3D models and textures combined, leading to catastrophic memory leaks and automated QA rejections.
This masterclass will deconstruct the Transport Fever 2 audio engine. We will explore the strict file format requirements for console optimization, the mathematics of spatial attenuation, the architecture of a soundset .lua script, and the techniques for building dynamic, engine-reactive soundscapes.
The Console Audio Bottleneck: File Formats & Compression
Before you write a single line of code, your raw audio files must be formatted correctly. Consoles have hardware-level audio decoding limits, and Urban Games QA enforces strict file hygiene to prevent memory exhaustion.
1.1 The Mono Mandate
This is the most common reason for an audio-related rejection. All 3D spatial sounds must be Mono, not Stereo.
When a vehicle drives past the camera, the game engine calculates the panning (left ear vs. right ear) dynamically based on the camera’s position relative to the 3D model. If you provide a Stereo file, you are doubling the file size for zero audible benefit, as the engine will aggressively downmix it to Mono anyway to calculate spatial placement.
1.2 Sample Rates and Bit Depth
High-resolution audio is wasted on environmental game sounds. You must downsample your .wav files before packaging your mod.
Hero Sounds (Horns, Whistles): Render at 44,100Hz, 16-bit. These sounds pierce the environment and require high-frequency clarity.
Engine Loops & Rolling Noise: Render at 22,050Hz, 16-bit. The deep rumble of a diesel engine does not contain high-frequency data. Halving the sample rate cuts the memory footprint in half.
Background Ambience: Render at 22,050Hz, 16-bit.
1.3 The .wav Format Requirement
Transport Fever 2 expects standard, uncompressed .wav files (PCM). Do not use .mp3, .ogg, or .flac. While compressed formats are smaller on your hard drive, the console CPU must decompress them in real-time, causing latency and CPU spiking during dense gameplay scenes.
2. Anatomy of a Soundset (.lua Script)
Your audio files are useless without a soundset script to orchestrate them. A soundset is a Lua configuration file located in res/config/sound_set/ that maps audio files to specific mechanical states.
2.1 The tracks Table
The tracks array defines continuous, looping sounds. This is where you configure the engine rumble, the electrical hum, and the noise of the wheels on the track.
tracks = {
{ name = “vehicle/train/my_diesel_idle.wav”, refDist = 15.0 },
{ name = “vehicle/train/my_diesel_fast.wav”, refDist = 15.0 },
{ name = “vehicle/train/wheels_clatter.wav”, refDist = 15.0 }
}
2.2 The events Table
The events array defines one-shot sounds triggered by specific player actions or game states.
clack: The sound of wheels crossing a track switch or joint.
horn / bell: Triggered manually by the player or automatically near stations.
openDoors / closeDoors: Triggered when passengers board.
events = {
horn = { names = { “vehicle/train/my_custom_horn.wav” }, refDist = 50.0 },
clack = { names = { “vehicle/train/track_clack.wav” }, refDist = 15.0 }
}
3. Spatial Audio: Controlling the Bleed
Spatial audio configuration is critical for console QA. If a player places fifty of your custom locomotives in a rail yard, the console cannot render all fifty engine loops simultaneously without crashing the audio thread.
3.1 The refDist (Reference Distance)
The refDist value dictates the distance (in meters) at which the sound is heard at 100% of its native volume.
If refDist is set to 15.0, the sound will be perfectly clear when the camera is 15 meters away from the train.
If you set this value too high (e.g., 500.0 for an engine loop), the sound will bleed across the entire map, creating a chaotic, deafening wall of noise for the player.
3.2 The Attenuation Curve
Transport Fever 2 uses logarithmic attenuation. As the camera moves further than the refDist, the volume drops rapidly.
Horns: Use a refDist of 50.0 to 100.0. Horns are designed to be heard from far away.
Engine Loops: Use a refDist of 10.0 to 15.0.
Doors / Brakes: Use a refDist of 5.0 to 8.0. You should only hear the pneumatic hiss of a door opening if you are zoomed in closely.
4. Dynamic Audio: The Power of modifiers
A static engine loop sounds artificial. In reality, a locomotive’s engine pitch and volume change dramatically based on speed and load. You control this using the modifiers block, manipulating pitch and gain (volume) based on internal game variables.
4.1 The Input Variables
The game feeds specific real-time data into your soundset script:
speed: The current velocity of the vehicle.
weight: The total mass of the vehicle and its cargo.
4.2 Interpolation Curves
modifiers = {
{
— Modifying the first track (idle sound)
track = 0,
— As speed increases from 0 to 10, reduce the volume (gain) to 0
gain = curve({
{ -0.1, 1.0 }, — At 0 speed, volume is 100%
{ 10.0, 0.0 } — At 10 speed, volume is 0%
})
},
{
— Modifying the second track (fast sound)
track = 1,
— As speed increases from 0 to 25, increase pitch from 0.8x to 1.2x
pitch = curve({
{ 0.0, 0.8 },
{ 25.0, 1.2 }
})
}
}
By cross-fading the gain of your idle track and your fast track, and subtly shifting the pitch based on speed, you create the illusion of a complex, reactive engine utilizing only two small audio files.
5. Advanced Mechanics: Synthetic Engine Loads
To achieve top-tier realism, especially for diesel-electric or steam locomotives, speed is not enough. You must calculate the “Load.” A train moving 10 km/h uphill under full throttle should sound drastically louder and heavier than a train moving 10 km/h downhill while braking.
5.1 Utilizing the power Node
Instead of tying your engine roar entirely to the speed variable, map the gain of a heavy bass rumble track to the power variable.
When the AI driver applies maximum tractive effort to climb a gradient, the power variable spikes to 1.0, triggering your bass rumble track. When the train crests the hill and begins coasting, the power variable drops to 0.0, silencing the rumble, even though the speed variable remains high.
5.2 Steam Chuff Synchronization
For steam locomotives, the “chuff” must synchronize perfectly with the rotation of the driving wheels. This is handled automatically by the engine if you define a chuff event in your soundset, but you must manually configure the chuff_step variable in your vehicle’s .mdl configuration block to match the physical circumference of your wheel mesh. If the math is off, the chuff audio will desync from the visual piston animations, breaking immersion instantly.
6. Summary: The Pre-Publish Audio Audit
Before you package your vehicle for Mod.io submission, verify your soundset against this console hygiene checklist:
The Mono Check: Are all spatial .wav files mixed down to a single Mono channel?
The Sample Rate Check: Are massive background loops correctly downsampled to 22,050Hz to preserve unified memory?
Format Verification: Are you strictly using uncompressed 16-bit PCM .wav files (no MP3s)?
Radius Discipline: Are your refDist values contained? (Engines < 20.0, Horns < 100.0).
Cross-Fade Logic: Have you mapped your curve tables to smoothly transition between idle and running states without sudden volume snapping?
By treating your audio footprint with the same mathematical rigor as your polygon budget, you will deliver a deeply immersive, sensory experience that passes console certification flawlessly.


Leave a Reply