![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
How fast a client turns wall time into ticks, so the server's queue of its commands holds a small cushion rather than running dry or deep. More...
#include <pacing.h>
Public Member Functions | |
| void | report (uint32_t lowWater, float roundTrip, float tickRate) |
| Take one snapshot's reading of the queue. | |
| float | scale () const |
| How much faster than wall time to run ticks. | |
| float | depth () const |
| The low water as smoothed over the last few snapshots, in commands. | |
| float | target () const |
| The low water this is steering toward, in commands. | |
Static Public Attributes | |
| static constexpr float | MAX_DILATION = 0.05f |
| The most the pacing bends either way. | |
How fast a client turns wall time into ticks, so the server's queue of its commands holds a small cushion rather than running dry or deep.
The two clocks drift: a fast client fills the queue until it is trimmed (dropped input), a slow one drains it until a tick runs on a repeat (a misprediction). So the client steers NetCommandBuffer::lowWater toward a cushion of a command or two, widened by the reading's jitter.
Proportional plus integral (the integral holds a steady drift). Both gains scale with the loop's delay - a round trip - and the tick rate; fixed gains swing between the bounds on a long link. Only ticks per wall second bend, by at most MAX_DILATION; the tick step does not, so replays are unaffected. Exactly one until a snapshot has said anything.
| void Vkm::Engine::NetPacing::report | ( | uint32_t | lowWater, |
| float | roundTrip, | ||
| float | tickRate ) |
Take one snapshot's reading of the queue.
| lowWater | Fewest commands waiting at any tick since the previous snapshot; at most NET_QUEUE_DEPTH_MAX. |
| roundTrip | Round trip now, in seconds; zero before one is measured. |
| tickRate | Ticks a second, which is commands a second. |
|
inline |
How much faster than wall time to run ticks.
|
staticconstexpr |
The most the pacing bends either way.
Covers clock drift and a frame loop running a little short, under what a player notices in their character's speed.