Brief an agent optimizing a deterministic game loop

Vibe codingHard30 min

Your task

You spent a week with an agent cutting the frame time of your C++ game engine's simulation loop, from 14 ms to 10 ms. The target is 8 ms. A teammate will now run the agent on the rest of the work while you move to another project. The engine has rules the code does not show: systems update in a fixed order, and replays need the simulation to be bit-for-bit deterministic.

Write the brief the agent will start every session with.

What you know:

  • physics must run before collision resolution, and AI after both
  • a replay stores only player inputs and plays them back on the same build, so the same inputs must give the same state on every machine
  • tests/replay/ holds 40 recorded matches with their final state hashes for each platform build
  • 3 ideas already failed: reordering systems for cache locality, -ffast-math, and running physics islands on threads
  • the profiler shows 2 ms still spent in Broadphase::update
  • the game ships on Windows and Linux, built with different compilers

Then, in a few sentences: why will a fresh agent propose your failed ideas first?