4#include <unordered_map>
8#include "net/transport/connection.h"
9#include "net/wire/schema.h"
11namespace Vkm::Engine {
34 std::vector<uint8_t> bytes;
46 std::vector<uint8_t> bytes;
50 uint16_t sequence = 0;
51 std::vector<Change> changes;
56 NetBaseline() =
default;
57 ~NetBaseline() =
default;
59 NetBaseline(
const NetBaseline& other) =
delete;
60 NetBaseline& operator=(
const NetBaseline& other) =
delete;
62 NetBaseline(NetBaseline && other) =
delete;
63 NetBaseline& operator=(NetBaseline && other) =
delete;
123 size_t knownEntities()
const {
return m_entities.size(); }
124 size_t pendingSnapshots()
const {
return m_pending.size(); }
127 struct EntityRecord {
129 std::vector<Confirmed> components;
133 std::unordered_map<uint32_t, EntityRecord> m_entities;
134 std::vector<Pending> m_pending;
221 std::vector<EntityId>* touched =
nullptr,
222 std::vector<EntityId>* lost =
nullptr
Reads back what a BitWriter wrote, in the same order.
Definition bit_stream.h:145
Packs values to the bit into a byte buffer.
Definition bit_stream.h:19
What one connection is known to hold, so the next snapshot says less.
Definition snapshot.h:30
const Confirmed * find(EntityId entity, uint32_t type) const
What is confirmed for entity's component type, or null.
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...
void clear()
Forget every entity and every unconfirmed snapshot.
Definition snapshot.h:118
void gatherLost(const Scene &scene, std::vector< EntityId > &out) const
Entities this connection was told about that are no longer alive.
void hold(Pending &&pending)
Hold what a snapshot said until it is confirmed or given up on.
static constexpr size_t MAX_PAYLOAD
The most one packet carries past its header: what a datagram leaves.
Definition connection.h:43
What the server's slots name on this end, so a client can make entities of its own.
Definition names.h:23
The ordered list of what replicates, agreed by both ends before play.
Definition schema.h:84
netSilence for every entity of a world, classified in one pass.
Definition silence.h:65
Central registry managing entities and an open set of component types.
Definition scene.h:29
Names one entity of one Scene, for as long as that slot holds it.
Definition entity.h:23
One component of one entity, as this connection last confirmed it.
Definition snapshot.h:33
bool folded
A change, a removal included, is confirmed.
Definition snapshot.h:37
bool held
The receiver holds the component.
Definition snapshot.h:36
uint16_t sequence
Which snapshot established it.
Definition snapshot.h:35
What a written snapshot claimed, held until it is acknowledged.
Definition snapshot.h:41
std::vector< EntityId > forgotten
Occupants reported as gone.
Definition snapshot.h:52
How much of the world one snapshot may describe.
Definition snapshot.h:143
EntityId owner
The connection's own entity, which is never the one deferred.
Definition snapshot.h:156
uint32_t bytes
Bytes one snapshot body may occupy.
Definition snapshot.h:149
What one snapshot said, for the session's status line.
Definition snapshot.h:165
uint32_t entitiesWritten
Of those, the ones that differed from the baseline.
Definition snapshot.h:167
uint32_t bytesWritten
The body's size, headers excluded.
Definition snapshot.h:171
uint32_t entitiesLost
Announced as gone: the receiver holds them, the scene does not.
Definition snapshot.h:170
uint32_t componentsWritten
Component records inside them.
Definition snapshot.h:168
uint32_t entitiesDeferred
Left out for want of budget; first in line next snapshot.
Definition snapshot.h:169
uint32_t entitiesConsidered
Entities in the world walked.
Definition snapshot.h:166