4#include <unordered_map>
8#include "net/transport/connection.h"
9#include "net/wire/schema.h"
11namespace Vkm::Engine {
32 std::vector<uint8_t> bytes;
43 std::vector<uint8_t> bytes;
46 uint16_t sequence = 0;
47 std::vector<Change> changes;
52 NetBaseline() =
default;
53 ~NetBaseline() =
default;
55 NetBaseline(
const NetBaseline& other) =
delete;
56 NetBaseline& operator=(
const NetBaseline& other) =
delete;
58 NetBaseline(NetBaseline && other) =
delete;
59 NetBaseline& operator=(NetBaseline && other) =
delete;
119 size_t knownEntities()
const {
return m_entities.size(); }
120 size_t pendingSnapshots()
const {
return m_pending.size(); }
123 struct EntityRecord {
125 std::vector<Confirmed> components;
129 std::unordered_map<uint32_t, EntityRecord> m_entities;
130 std::vector<Pending> m_pending;
215 std::vector<uint32_t>* touched =
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:28
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:114
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
The ordered list of what replicates, agreed by both ends before play.
Definition schema.h:39
netSilence for every entity of a world, classified in one pass.
Definition silence.h:64
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:31
uint16_t sequence
Which snapshot established it.
Definition snapshot.h:33
What a written snapshot claimed, held until it is acknowledged.
Definition snapshot.h:38
std::vector< EntityId > forgotten
Occupants reported as gone.
Definition snapshot.h:48
How much of the world one snapshot may describe.
Definition snapshot.h:139
EntityId owner
The connection's own entity, which is never the one deferred.
Definition snapshot.h:152
uint32_t bytes
Bytes one snapshot body may occupy.
Definition snapshot.h:145
What one snapshot said, for the session's status line.
Definition snapshot.h:161
uint32_t entitiesWritten
Of those, the ones that differed from the baseline.
Definition snapshot.h:163
uint32_t bytesWritten
The body's size, headers excluded.
Definition snapshot.h:167
uint32_t entitiesLost
Announced as gone: the receiver holds them, the scene does not.
Definition snapshot.h:166
uint32_t componentsWritten
Component records inside them.
Definition snapshot.h:164
uint32_t entitiesDeferred
Left out for want of budget; first in line next snapshot.
Definition snapshot.h:165
uint32_t entitiesConsidered
Entities in the world walked.
Definition snapshot.h:162