|
| void | Take (World &land, uint32_t id, const protocol::Input &input) |
| void | Apply (const std::function< World *(uint32_t)> &land_of) |
| | Each player's next waiting keys, a tick's worth, in their land.
|
| std::optional< uint32_t > | acked (uint32_t id) const |
| | The last of the player's numbered inputs applied, if any.
|
| void | Leave (uint32_t id) |
| | Forgets a player who's left.
|
What each player's inputs do to the world, whoever runs it: a world server, or a client that plays on its own. A numbered input's keys wait for their tick, so that the client knows which tick each of its inputs moved it in.
Definition at line 22 of file inputs.h.
| std::size_t nanommo::Inputs::kMostBehind = 3 |
|
staticconstexpr |
A client sends one a tick, but a slow frame sends two or three together, so up to three waiting is a client a little ahead of our tick. More means some came late and we're behind it, so each tick skips one, until we've caught up.
Definition at line 33 of file inputs.h.
| std::chrono::milliseconds nanommo::Inputs::kMostRewind {200} |
|
staticconstexpr |
A numbered input says when, on our clock, its client drew everyone else, and its player's blows on a duel opponent are checked against where the opponent was then. A client draws them 100 milliseconds before the newest world it has, and the world's way to it and the input's way back are a round trip more, so this is enough for a round trip of up to 100. A time further back is taken as this, so that a client can't hit its opponent wherever they once were, and a time ahead of ours as now.
Definition at line 50 of file inputs.h.
| std::size_t nanommo::Inputs::kMostSteady = 2 |
|
staticconstexpr |
Inputs come in as fast as they go out, so a queue a burst filled stays that full, each input a tick late for each one ahead of it. If two or more waited at the start of each tick for a second, the queue's kept more than it needs, and it drops one, until one waiting is the most it keeps for long.
Definition at line 40 of file inputs.h.