R-Type
Distributed multiplayer game engine in C++
Loading...
Searching...
No Matches
server::GameStateSerializer Class Reference

Serializes and deserializes game state for network transmission. More...

#include <GameStateSerializer.hpp>

Collaboration diagram for server::GameStateSerializer:
Collaboration graph

Static Public Member Functions

static GameStateSnapshot createFullSnapshot (ecs::wrapper::ECSWorld &world, uint32_t serverTick)
 Create a full game state snapshot.
 
static GameStateSnapshot createDeltaUpdate (ecs::wrapper::ECSWorld &world, uint32_t serverTick, const GameStateSnapshot &lastSnapshot)
 Create a delta update (changed entities only)
 
static EntitySnapshot serializeEntity (ecs::wrapper::ECSWorld &world, uint32_t entityId)
 Serialize entity to network format.
 

Detailed Description

Serializes and deserializes game state for network transmission.

Responsibilities:

  • Create full game state snapshots
  • Generate delta updates (only changed entities)
  • Serialize entity components to network format
  • Ensure deterministic entity ordering

Network Efficiency:

  • Full snapshots sent on connect or major state changes
  • Delta updates sent every frame (only changed entities)
  • Position/health deltas with compression

Definition at line 61 of file GameStateSerializer.hpp.

Member Function Documentation

◆ createDeltaUpdate()

GameStateSnapshot server::GameStateSerializer::createDeltaUpdate ( ecs::wrapper::ECSWorld world,
uint32_t  serverTick,
const GameStateSnapshot lastSnapshot 
)
static

Create a delta update (changed entities only)

Parameters
worldECS world wrapper
serverTickCurrent game tick
lastSnapshotPrevious snapshot for comparison
Returns
Delta snapshot with only changed entities

Definition at line 45 of file GameStateSerializer.cpp.

References createFullSnapshot().

Here is the call graph for this function:

◆ createFullSnapshot()

GameStateSnapshot server::GameStateSerializer::createFullSnapshot ( ecs::wrapper::ECSWorld world,
uint32_t  serverTick 
)
static

Create a full game state snapshot.

Parameters
worldECS world wrapper
serverTickCurrent game tick
Returns
Complete game state snapshot

Definition at line 22 of file GameStateSerializer.cpp.

References server::GameStateSnapshot::activePlayerCount, server::GameStateSnapshot::entities, ecs::wrapper::ECSWorld::query(), serializeEntity(), and server::GameStateSnapshot::serverTick.

Referenced by createDeltaUpdate().

Here is the call graph for this function:

◆ serializeEntity()


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