Unnamed Unreal Engine game
The game the scripting VM exists for. Also unnamed, mostly because naming it would make it feel real.
- A small stack-based virtual machine in Rust, ported out of C++, with a compiler for the gameplay scripting language.
- The point is to hot-reload game logic without rebuilding the whole project.
- Written while learning Rust, so it gets rewritten roughly every other month.
- Rust
- C++
- Unreal Engine
The game is unnamed and early, and most of what I can honestly say about it right now is about its tooling rather than the game itself.
the iteration loop problem#
Gameplay logic in Unreal means C++, and C++ means a rebuild every time I change a number. Not a long rebuild — just long enough that I stop trying things. A tool that makes you reluctant to experiment has failed at the only thing that matters this early in a project.
So the game has its own scripting language, compiler and bytecode VM. Gameplay logic lives in scripts, and the plan is to swap a function's bytecode mid-frame without restarting anything.
why that VM is in Rust#
It started in C++, which was the obvious choice — the engine is C++, so the VM could reach straight into game state. That also meant it could corrupt game state straight from a script, and the crash would surface several frames away from the cause.
Porting it to Rust was meant to be a way to learn Rust. What it actually did was force a boundary: the borrow checker wouldn't let me hand the VM a pointer to everything, so the script asks and the host answers. That interface is the best part of the design and I didn't come up with it — the compiler did.
There's more detail in writing a scripting VM in rust, including what's still missing.