Skip to main content

4 posts tagged with "determinism"

View All Tags

The Rounding Mode Nobody Restored — and Three More Things That Weren't Missing

· 25 min read
reverse-engineering → modernization

Deep in Tiberian Sun's executable there is a helper that converts a floating-point number to an integer. Every game does this thousands of times a second. This one begins by loading a specific x87 control word — the register that tells the floating-point unit how to round — and then it never puts the old one back.

That is not a bug you would ever notice. The control word it loads says round toward zero, and a function whose entire job is truncation wants exactly that. The helper works perfectly. It just leaves the machine in that state afterwards, forever, for every other calculation the game does.

We spent two sessions finding out how much that costs.

Where the Turrets Go

· 16 min read
reverse-engineering → modernization

If you've ever watched a skirmish AI in Red Alert 2 quietly ring its base with prism towers on exactly the side you were massing tanks, you've seen this week's subject in action. We spent the day dissecting the routines that decide where defensive structures go, when the AI is even allowed to want them, and the ancient trigonometry humming underneath both — the last unmapped pieces of the AI's base-building brain, and the functions standing between us and a bit-exact port of that entire decision path.

Taking the Wheel of the Original Engine

· 6 min read
reverse-engineering → modernization

Last time, the original engine gave us a second opinion: we ran small pieces of its actual code in a sandboxed emulator and compared answers. That was the engine as a witness. Today it became something more — a car we can drive. Code of ours now runs inside the live game, steps its simulation forward frame by frame on command, reads its state between steps, and hands us ground truth no amount of careful reading can match. It promptly caught two real mistakes that every static check had blessed.