![]() |
vkmEngine 1.0.0
A C++ game engine · vkmengine.com
|
The commands one player has sent that the server has not yet run. More...
#include <command.h>
Public Member Functions | |
| void | accept (const InputCommand &command) |
| Take one command, ignoring a sequence already seen. | |
| InputCommand | take (uint32_t tick) |
| The command to run on the tick about to happen. | |
| uint32_t | newestRunTick () const |
| The newest command tick actually run, in the client's numbering. | |
| uint32_t | newestSequence () const |
| The newest sequence this buffer has accepted. | |
| size_t | pending () const |
| How many commands are waiting. | |
| size_t | lowWater () const |
| The fewest commands waiting at any take() since restartLowWater(). | |
| void | restartLowWater () |
| Start measuring lowWater() again, once it has been said. | |
| uint32_t | repeatedTicks () const |
| Ticks that ran on a repeat because nothing was waiting, since clear(). | |
| uint32_t | skippedCommands () const |
| Commands passed over unrun, since clear(): skipped down to MAX_DEPTH, or pushed out of a queue at MAX_QUEUED. | |
Static Public Attributes | |
| static constexpr size_t | MAX_DEPTH = 10 |
| Commands the queue may hold before the oldest are skipped, all at once. | |
| static constexpr size_t | MAX_QUEUED = 256 |
| Most commands held at once, however fast they arrive. | |
| static constexpr uint32_t | REPEAT_TICKS = NET_COMMAND_REDUNDANCY * 2 |
| Ticks a repeat may stand in for before it stops moving the body. | |
The commands one player has sent that the server has not yet run.
One command per tick, in the player's order, each exactly once: the client predicted tick N with command N, so the server must run it as one whole tick. Queued, not addressed by tick: the two ends' tick clocks are unrelated. A duplicate is run once, or an edge fires twice.
Empty, the tick still runs on the last command's axes with its edges cleared. Past MAX_DEPTH the oldest are skipped in one tick, since a backlog is latency. NetPacing keeps the queue just above empty, from lowWater.
| InputCommand Vkm::Engine::NetCommandBuffer::take | ( | uint32_t | tick | ) |
The command to run on the tick about to happen.
A repeat claims the client tick it stood in for, so a snapshot's confirmation matches its pose; the real command for that tick is discarded when it turns up.
| tick | The server's own tick, stamped on what comes back. |
|
inline |
The newest command tick actually run, in the client's numbering.
Not the server's clock. A snapshot carries it so the client knows which prediction to hold the snapshot against.
|
inline |
The newest sequence this buffer has accepted.
What arrived, ahead of newestRunTick() by the queue's depth. A snapshot carries it so the client stops resending (see firstCommandToSend).
|
inline |
How many commands are waiting.
|
inline |
The fewest commands waiting at any take() since restartLowWater().
Counted before the take, so zero is a tick that ran on a repeat. The lowest point, because the depth now depends on whether a packet just landed.
|
inline |
Ticks that ran on a repeat because nothing was waiting, since clear().
Counted from the first command that ran.
|
inline |
Commands passed over unrun, since clear(): skipped down to MAX_DEPTH, or pushed out of a queue at MAX_QUEUED.
|
staticconstexpr |
Commands the queue may hold before the oldest are skipped, all at once.
A queue is input delay. Skipped edges are folded in; the same number bounds how far repeats may stand in, so the two cannot drift apart. NetPacing sets the standing depth; this is for a burst after a stall, set above the pacing cushion by its jitter again so a jittering link is never trimmed.
|
staticconstexpr |
|
staticconstexpr |
Ticks a repeat may stand in for before it stops moving the body.
Twice the redundancy window: that long with nothing means every copy of every recent command was lost, a link gone rather than jittering.