We will construct a frame-agnostic world replace as a result of we will get the present time in milliseconds originally of every body replace. Which means we will calculate how a lot actual time has handed for the reason that final body replace and recalculate the brand new world state (physics, animation, VFX, motion, lighting, UI, and so forth.). Thus, if it’s been 15 milliseconds for the reason that final body, we all know to advance the state of the world by 15 milliseconds. If we drop a bunch of frames and uncover it’s been 160 milliseconds for the reason that final body replace, we will nonetheless advance the state of the world by 160 milliseconds to maintain timing constant.
This scales completely properly when growing the body charge. As a result of we’re doing extra frames, the body time decreases and we get larger constancy as a result of we see extra body updates than earlier than. For the reason that world state progresses in actual time, including extra frames makes the whole lot really feel higher at little to no price. However what occurs when the alternative scenario occurs? As an alternative of including extra frames per second, let’s take into account the scenario the place {hardware} is burdened, inflicting body time to extend and body charge to drop.
Issues come from having to parse and deal with inputs relative to the world state. What happens between body updates is successfully atomic – if gamers press a button after which launch it in between body updates, there is no such thing as a approach for the sport to register that each occasions occurred whereas updating the world state. When a body replace occurs, we will solely register a button enter as both on or off, regardless of how a lot time has handed in between frames. This may trigger some critical frustration when the sport drops frames!
Think about that an enemy throws a short-fused grenade in the midst of a giant visually explosive battle. The sport drops a bunch of frames due to all the stuff on display screen. On the following body replace a half second later, the sport calculates the fuse timer on the grenade has expired and that the grenade has already exploded, killing the participant who has not moved as a result of there was no approach for the participant to see the grenade coming and dodge in response to it. To the participant, the sport froze for a half second after which she was useless.
We will keep away from the dropped frames drawback if the world state is tied to the body charge. When the participant is assured to see each body, she will be able to nonetheless see each sport occasion coming – even when the sport’s body charge slows to 30, 20, 15, and even 10 fps. The participant is all the time given an opportunity to react to in-game occasions by locking the world replace to the body charge. Because of this many video games that pushed {hardware} limitations and nonetheless selected to lock a decrease body charge (e.g. 30 fps) on the time of launch most well-liked to lock the world state to the body charge – it was to protect in opposition to the conditions the place the {hardware} was pushed to its limits and builders didn’t wish to add extra frustration to an already traumatic scenario.
[Join us on Discord] and/or [Support us on Patreon]
Bought a burning query you need answered?
