vkmEngine 1.0.0
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
Vkm::Engine::NetRewind Class Reference

Where every player was, for as long as it takes a shot to arrive. More...

#include <rewind.h>

Public Member Functions

void record (EntityId entity, uint32_t tick, const glm::vec3 &position, const glm::quat &rotation)
 Remember where entity was on tick, in the server's own clock.
bool poseAt (EntityId entity, double tick, glm::vec3 &position, glm::quat &rotation) const
 Where entity was at tick, which may fall between two.
void forget (EntityId entity)
 Forget entity, for a seat changing hands.

Static Public Attributes

static constexpr size_t HISTORY_TICKS = 64
 Ticks of history kept per player.

Detailed Description

Where every player was, for as long as it takes a shot to arrive.

A player aims at a moment already past, so the server keeps recent player poses and puts them back for one query. Only players: anything else is judged against the present and can miss for that reason.

Member Function Documentation

◆ poseAt()

bool Vkm::Engine::NetRewind::poseAt ( EntityId entity,
double tick,
glm::vec3 & position,
glm::quat & rotation ) const

Where entity was at tick, which may fall between two.

Fractional: a client's render clock draws between ticks.

Parameters
entityThe player asked about.
tickThe moment wanted, in the server's own clock.
positionFilled with where it was.
rotationFilled with how it was turned.
Returns
False when nothing is remembered for that entity; a moment outside what is kept gets the nearest one kept.

◆ forget()

void Vkm::Engine::NetRewind::forget ( EntityId entity)

Forget entity, for a seat changing hands.

A stale ring would rewind the next player to the last one's positions.

Parameters
entityThe departed player's entity.

Member Data Documentation

◆ HISTORY_TICKS

size_t Vkm::Engine::NetRewind::HISTORY_TICKS = 64
staticconstexpr

Ticks of history kept per player.

A second at Config::DEFAULT_TICK_RATE, covering a 400 ms round trip plus the interpolation delay.


The documentation for this class was generated from the following file: