jumpy
jumpy copied to clipboard
Performance: Optimize frame time of network correction
Description
While profiling in a networked match in dev-optimized profile, client often rewinds / resims during correction after receiving another players input when predicted ahead.
A rewind/resim that advances four steps may sometimes take 30ms+, reducing framerate of game from target of 60fps. These times are worse when correction requires simulating more than four frames. Our max prediction window is 8 frames, and I often see corrections simulating 5-6 frames with frame times pushing 40+ms.
Below is screenshot of network update loop.
On average, advancing game single frame takes ~4.5ms, load gaming state for rewind takes ~2.7ms, saving game state takes ~2.6ms. Average cost of each frame in correction is roughly ~7ms. Improving times in any of these scopes should improve conditions here.