nengi.Instance historian

rough draft

The historian stores the state of entities every frame. The historian is an object located on the instance, e.g. instance.historian.

historian.getLagCompensatedArea(timeAgo, area) returns a collection of past entity states that existed in the area. It is important to note that these past entity states are shallow copies of entities that may or may not still exist. Past state should be treated immutably.

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!
})