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

What one connection is known to hold, so the next snapshot says less. More...

#include <snapshot.h>

Classes

struct  Confirmed
 One component of one entity, as this connection last confirmed it. More...
struct  Pending
 What a written snapshot claimed, held until it is acknowledged. More...

Public Member Functions

const Confirmed * find (EntityId entity, uint32_t type) const
 What is confirmed for entity's component type, or null.
void hold (Pending &&pending)
 Hold what a snapshot said until it is confirmed or given up on.
void confirm (uint16_t sequence)
 Fold the snapshot sequence said into what is confirmed.
void expire (uint16_t sequence)
 Give up on everything older than sequence by more than the window an acknowledgement can still arrive in.
void gatherLost (const Scene &scene, std::vector< EntityId > &out) const
 Entities this connection was told about that are no longer alive.
void clear ()
 Forget every entity and every unconfirmed snapshot.

Detailed Description

What one connection is known to hold, so the next snapshot says less.

A component is sent, whole, when its encoded bits differ from what this connection has confirmed receiving: the delta is on presence, never on values, so every entry decodes from the packet alone and a joiner's first snapshot is the whole world by the same rule.

Confirmed, not sent, or a lost packet would never be resent: what a snapshot said is held until acknowledged. Per connection, since clients lose different packets. Comparing encoded bits lets a settled world go quiet.

Member Function Documentation

◆ find()

const Confirmed * Vkm::Engine::NetBaseline::find ( EntityId entity,
uint32_t type ) const

What is confirmed for entity's component type, or null.

By entity, not slot: a slot can be reused before the old occupant's record is freed, and the new one would be taken as already held.

Parameters
entityThe occupant asked about.
typeThe component's index in the schema.
Returns
The confirmed record, or null when none is held for that occupant.

◆ confirm()

void Vkm::Engine::NetBaseline::confirm ( uint16_t sequence)

Fold the snapshot sequence said into what is confirmed.

A change is folded only when newer than what the slot holds, so a late acknowledgement cannot write stale bytes over fresh.

Parameters
sequenceThe acknowledged snapshot; one not held is ignored.

◆ expire()

void Vkm::Engine::NetBaseline::expire ( uint16_t sequence)

Give up on everything older than sequence by more than the window an acknowledgement can still arrive in.

What they said is never confirmed, so the next snapshot says it again.

Parameters
sequenceThe snapshot about to be written.

◆ gatherLost()

void Vkm::Engine::NetBaseline::gatherLost ( const Scene & scene,
std::vector< EntityId > & out ) const

Entities this connection was told about that are no longer alive.

Reported until confirmed, which makes destruction reliable. By entity, not slot: a slot reused between snapshots is alive both times.

Parameters
sceneThe world, to ask what is still in it.
outFilled with the entities, ascending by slot.

◆ clear()

void Vkm::Engine::NetBaseline::clear ( )
inline

Forget every entity and every unconfirmed snapshot.

For a world replaced under a live session: a replacement reuses slot and generation, defeating find's guard.


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