Rewind Lag-compensation

rough draft

Rewind lag-compensation refers to the ability of to ascertain the positions of objects from the perspective of a client at a specific point in time. For example, rewind lag-compensation seeks to answer questions such as "when the player with 250 ms latency fired their laser what exactly was infront of them..?"

The nengi instance.historian holds this job. The historian knows the past states of entities.

Being able to perform collision checks on the server allows us to maintain server authority instead of going down the rabbit hole of letting the game client report its hits.

const pastEntityStates = instance.historian.getLagCompensatedArea(
    latency + interp, // how long ago?
    { x: 0, y: 0, halfHeight: 1000, halfWidth: 1000 } // in which area?

pastEntityStates.forEach(pastEntityState => {
    // see if we hit it!

A lot more can be done with the historian than just fighting cheaters while making the game feel like it has no latency (although that's good enough, isn't it?). The historian allows for the option to honor a player's experience inspite of latency-related contention. Did the player with 250 ms of latency cast fireball before the NPC casted invulnerability? I've never heard of a game that sought to answer that question, but the historian intrinsically knows.