Kelyje II · verified · week of
The C++ rewrite now matches the original, frame for frame
Reading a rewrite of old code will not tell you it is right. Run it inside the original, one batch of functions at a time, and compare every frame. Mine now matches on 1,000 of 1,000 frames of a scripted drive, with all 5,227 functions swapped in.
Kelyje II: the Lithuanian release of Rig'n'Roll, a truck game from 2000. I am rewriting it as C++ a person can read · kelyje2.lt
Code recovered from a 2000 binary still runs, but nobody can maintain it. Rewriting it as C++ with clear names is only worth doing if the result still behaves exactly like the original.
Swap some functions, keep the rest
The rewrite is built as a DLL and loaded next to the original game. Each replaced function is patched to jump to its C++ version. Everything else stays original, so the game still runs with only part of it rewritten.
original game C++ rewrite (DLL) +------------+ +------------+ | function A-+--jump-->| function A | | function B | | | | function C-+--jump-->| function C | +------------+ +------------+ B still runs as the original
What "matches" means here
The reference is the original game on a scripted drive: a fixed 20 ms step, a fixed random seed, and the same key presses every time. On each of 1,000 frames the test writes down the player's truck (velocity, spin, position, gear), the money and the game clocks, as raw float bits. The rewrite has to produce the same 1,000 lines, bit for bit.
That is a sample of the game's state. It proves the truck, the money and the clocks on that one drive, and says nothing about paths the drive never takes.
Growing it in steps
I grew it in four steps: 19 functions on the first run, then 23 source files (484 functions), 79 files (2,696) and all 108 (5,227). Small steps keep failures findable: when one breaks, the cause is among the functions added since the last good run.
With all 5,227 swapped in, 1,000 of 1,000 frames equalled the original. The first thing that broke on the way was 104 classes with misplaced methods; that is the next entry.
I'm Ovi. I recompile old Windows games to run in a browser, build a virtual GPU for Windows XP, and write tools for my own machines, with AI since 2020. Projects and the latest log