A Chevrolet 454 big-block, simulated in real time — pistons pumping, crank spinning, exhaust waveform dancing, gauges sweeping to redline. Rendered natively through Metal.
engine-sim by AngeTheGreat is a real-time
internal-combustion-engine simulation that generates its own engine audio from a physical
model of the gas dynamics, combustion, and valvetrain — you build an engine in a small script
language and hear it idle, rev, and hit the limiter.
The catch: it only runs on Windows, through DirectX 11. redline brings it to Apple
Silicon macOS with a native Metal renderer, SDL2 for windowing/input/audio, a modern
2026 toolchain, the long-standing rendering bugs fixed, and a proper double-clickable .app.
It's a toy for making engine sounds and exploring engine response — not a scientific engineering tool.
A Metal port already existed — boxofbox/engine-sim-APPLE_ARM
had done the hard work of writing a native Metal backend (metal-cpp) into engine-sim's
renderer, delta-studio. But it went dormant in early 2023: it no longer builds on a modern
macOS toolchain, and it shipped with three known rendering bugs. redline revives it —
builds on macOS 26 (Tahoe) / CMake 4 / Apple clang 21 / Boost 1.90, fixes the bugs, and
packages it as a real app.
Two of the three bugs were HiDPI point-vs-pixel mistakes. The interesting one was the
scrambled engine cross-section: engine-sim renders the engine into a sub-region of the
screen (its own viewport) while the UI is drawn full-screen — but in the Metal backend the
sub-render-target functions were stubs, and SetRenderTarget's signature didn't even match
the one the render loop calls. So the engine, projected for its little box, was drawn across the
whole screen, on top of the gauges. Implementing the viewport fixed it:
The valuable core — the physics and the audio synthesis — is portable C++ and untouched.
redline only replaces the platform layer: the renderer (→ Metal) and windowing/audio (→ SDL2).
# arm64 Homebrew (/opt/homebrew)
brew install cmake boost bison sse2neon sdl2 sdl2_image flex
git clone https://github.com/cleoanka/redline.git
cd redline
export PATH="/opt/homebrew/opt/bison/bin:/opt/homebrew/opt/flex/bin:/opt/homebrew/bin:$PATH"
cmake -B build -S . -DCMAKE_BUILD_TYPE=Release -DCMAKE_POLICY_VERSION_MINIMUM=3.5 -DDISCORD_ENABLED=OFF
cmake --build build --target engine-sim-app -j
cd build && ./engine-sim-app # run from build/ so it finds ../assetscmake --build build --target redline-app # -> dist/redline.app
open dist/redline.app # or double-click it in FinderMinimal, keyboard-driven:
| Key | Action | Key | Action |
|---|---|---|---|
| O / P | Change engine (prev / next) | Enter | Reload engine script |
| A | Toggle ignition | S | Hold for starter |
| D | Enable dyno | H | RPM hold (needs dyno) |
| Q W E R | Throttle presets | Space | Fine throttle (+scroll) |
| ↑ / ↓ | Shift gear up/down | Shift | Clutch |
| Z/X/C/V/B + scroll | Audio mix | Tab | Change screen |
| M / , | View layer up/down | F | Fullscreen |
| 1–5 | Time-warp (slow-mo) | Esc | Quit |
Change the engine live with O (previous) and P (next) — cycles through 16 built-in engines (Chevy 454 V8, Hayabusa I4, 2JZ I6, LFA V10, Merlin V12, radials, …). No file editing. (
[/]also work on a US keyboard.)
Plug in an Xbox (or any SDL-recognised) controller — hot-plug works, no config:
| Control | Action | Control | Action |
|---|---|---|---|
| Right trigger | Analog throttle | Left trigger | Clutch |
| A | Starter (hold) | B | Ignition |
| X | Dyno | Y | Reload engine |
| RB / LB | Next / previous engine | D-pad ↑/↓ | Shift gear |
| Left stick ↕ | Volume | Right stick ↕ | Time-warp |
| Start | Pause |
Keyboard and gamepad compose — either works at any time.
Headless capture & demo knobs (how the GIFs above were made)
The macOS sandbox this was developed in has no Screen-Recording permission, so redline
grew a way to record itself — the app reads back its own Metal drawable:
| Env var | Effect |
|---|---|
REDLINE_CAPTURE=<path> |
dump a frame as raw BGRA8 (int32 w, int32 h, then pixels) |
REDLINE_CAPTURE_FRAME=<n> |
which single frame (default 90) |
REDLINE_CAPTURE_SEQ=start,stride,count |
dump a sequence → <path>.000, .001, … |
REDLINE_AUTORUN=1 |
crank + rev the engine unattended (for demos / captures) |
All are no-ops unless set. The GIFs on this page are REDLINE_AUTORUN=1 +
REDLINE_CAPTURE_SEQ assembled with Pillow.
redline stands on a chain of open-source work — thank you to everyone in it:
- ange-yaghi/engine-sim — the original
simulator and the
delta-studioengine. © 2022 Ange Yaghi (MIT). - phire/delta-studio @ clang_linux — DirectX→OpenGL, MSVC→clang.
- bobsayshilol/engine-sim @ gcc-fixes — gcc/clang portability.
- boxofbox/engine-sim-APPLE_ARM
— the Apple-Silicon port with the native
metal-cppMetal backend redline continues.


