group2 0.1.0
CSE 125 Group 2
Loading...
Searching...
No Matches
registry_serialization::Loader Class Reference

Deserializes registry snapshots received from the server and applies them locally. More...

#include <RegistrySerialization.hpp>

Public Member Functions

 Loader (entt ::registry &registry)
 Construct a Loader bound to the given registry.
void apply (const uint8_t *data, size_t size, std::optional< entt::entity > localPlayerServerEntity=std::nullopt, uint32_t *outServerAckedClientTick=nullptr)
 Apply a serialized registry snapshot to the local registry.
entt::entity map (entt::entity e) const
 Map a server-side entity ID to its local equivalent.

Private Attributes

entt::registry & registry
entt::continuous_loader loader

Detailed Description

Deserializes registry snapshots received from the server and applies them locally.

Constructor & Destructor Documentation

◆ Loader()

registry_serialization::Loader::Loader ( entt ::registry & registry)
inlineexplicit

Construct a Loader bound to the given registry.

Parameters
registryThe local ECS registry to update.

Member Function Documentation

◆ apply()

void registry_serialization::Loader::apply ( const uint8_t * data,
size_t size,
std::optional< entt::entity > localPlayerServerEntity = std::nullopt,
uint32_t * outServerAckedClientTick = nullptr )

Apply a serialized registry snapshot to the local registry.

Parameters
dataPointer to the serialized data buffer.
sizeSize of the data buffer in bytes.
localPlayerServerEntityOptional server-side entity ID of the local player (excluded from remote input application).
outServerAckedClientTickOptional out-param. If non-null, receives the tick field from the local player's InputSnapshot in the server's remote-input list — the most-recently-applied client input tick the server has processed. Used by Phase 5b reconciliation to know how far forward to replay client predicted inputs after the snapshot apply. Set to 0 if the local player has no input record in this snapshot (e.g. no inputs sent yet).

◆ map()

entt::entity registry_serialization::Loader::map ( entt::entity e) const
nodiscard

Map a server-side entity ID to its local equivalent.

Parameters
eThe server-side entity.
Returns
The corresponding local entity, or entt::null if not mapped.

Member Data Documentation

◆ loader

entt::continuous_loader registry_serialization::Loader::loader
private

◆ registry

entt::registry& registry_serialization::Loader::registry
private

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