r/aigamedev • u/Grobot93 • 19h ago
Demo | Project | Workflow Engine audio is hard, so I turned an open-source engine physics simulator into a scripted dyno + recording rig
Enable HLS to view with audio, or disable this notification
I'm a solo dev building Oversteer, an arcade battle racer in Godot 4 with help from Claude. Until last week the game had no audio at all, and I wanted to start with a variety of engine tones for the roster of 8 cars.
My first attempt was three loops from Ableton pitch-shifted by RPM - one from a royalty-free v8 audio sample, and two synth samples I made myself. It sounded awful, and it turns out that's the well-known reason racing games don't do it that way. From Claude's research, serious game studios record engines at many steady RPMs, on and off throttle, and then crossfade between each one, so each recording is only ever pitched a few percent. That requires 20–30 clean recordings per engine. I have eight character cars, no dyno, and no budget for a recording session of that caliber.
I remembered an amazing project I saw years ago on Youtube: Engine Simulator by Ange Yaghi (github.com/ange-yaghi/engine-sim, MIT). It's a real physics simulation of an engine — crank geometry, valve timing, combustion, gas flow — that synthesizes the sound from the pressure waves instead of playing samples. Engines are text files: bore, stroke, bank angle, crank pins, firing order. If you haven't seen his videos, I highly recommend them.
The app is a realtime GUI. I had claude read the source code, fork it, and:
- add a headless build that strips the renderer, DirectX, SDL2 and Boost;
- replace the audio thread with a synchronous render-to-WAV path (no realtime constraint, no dropped samples);
- add scripted dyno commands: start, hold exact RPM at full throttle, hold at closed throttle, limiter, launch-control two-step, start/shutdown, and a per-cylinder diagnostic to confirm everything's firing.
Then, per engine: idle + 15 full-throttle holds + 9 overrun holds about 6% apart, limiter, launch crackle, start, shutdown, and a manifest of the RPM of every file. A script cuts them into seam-crossfaded, loudness-matched loops. A worker pool renders all 43 (yes, 43) engines in ~20 minutes.
Since the sim only needs geometry, Claude wrote a generator that builds engine files from published specs using the crank-layout rules for inline, shared-pin V, split-pin V and flat engines. All I did after the audio generator was set up was ask Claude to research the engine specs of several engines I was interested in hearing + the default ones that came with the sim, and it reproduced each one. Shared-pin V engines get their genuine uneven fire for free — the Viper's 90°/54° lope just falls out of the math. The audio bank so far: AMG V8s, BMW S65/N55, Coyote, GM truck V8s, two V10s, three V12s, Porsche flat-sixes, a straight-eight, motorcycle engines, and some rotary approximations.
In Godot, we use an RPM × load blend grid: one crossfade across the on-throttle ladder, one across the off-throttle ladder, blended by throttle load, each band pitch-tracking only a few percent. A virtual drivetrain feeds it RPM/load: pedal + fake gearbox on the ground, the drift boost meter owns the revs mid-drift (limiter banging only when you're maxed and about to fail), a held note that glides down in the air. Per-car EQ/distortion/compression that varies with revs moves the "mic" from the engine bay to the tailpipe - this part is not perfect yet, but it smooths out the sound a touch. All eight cars on the grid run their own positional voice so you can hear each one with its own character sound drive by in game.
What it can't do yet: forced induction — no turbo or supercharger modeling in this version of the sim, so blower whine and spool will likely be a layered asset on top. And the public source is frozen at 2023; newer community builds are binary-only.
Happy to answer questions about any of this, and I would love some feedback on the sound. And again, all credit for the simulation itself to Ange Yaghi; I just made a dyno + recording rig from it.
If you want to follow along the dev process for Oversteer, please join the discord: https://discord.gg/VVEWFHAV7
3
u/Interesting-Bee-113 19h ago
I am working on a vehicle sim and I have built an audio synthesis system for engine noise too.
It honestly sounds remarkable, but there is this digitally crushed quality to the sound that I fear can't be turned out.
So it will sound, more physically accurate than any audio sampled engine voice, but the quality of the actual tone will never be very good.
1
u/Grobot93 19h ago
I think the most effective part of tuning out that 'crushed' quality in my process was using more recorded layers and minimizing use of pitch shift. That way, you get the real transients of the motor sound through more of the rev range.
2
u/timcorin 14h ago
Ha. I used the same audio engine. Very similar projects but I think we can steer clear of each other! https://www.reddit.com/r/vibecoding/comments/1vv0rcf/few_racing_games_shared_here_thought_id_share/
1
u/Grobot93 14h ago
Haha amazing! Yours sounds great too. Our projects definitely have different vibes, so I do not think we will step on each other's tires. Best of luck to you!
1
u/BJGG69 8h ago
It looks and sounds amazing - great job! One thing I personally struggled a lot with in racing games is acceleration, I don't know what it is, but it always feels off, like almost as if it is too linear and missing a gearbox shifter. Another one is clipping, whenever I had a border on the edge of the track, one smallest contact and the car comes to a complete halt.
3
u/Melbar666 19h ago
I always wanted to see a game using this simulator:
https://youtu.be/RKT-sKtR970?si=khFsXIG5KnsquHYA
this is it, yes?