Skip to content

Struct Engine::NetworkComponent

ClassList > Engine > NetworkComponent

Declarative networking metadata for a replicated entity. More...

  • #include <NetworkComponent.hpp>

Public Attributes

Type Name
std::string authority = "Server"
std::uint64_t networkId = 0
std::string prefabPath
int snapshotPriority = 0
bool syncSprite = false
bool syncTransform = true

Detailed Description

Attach this to an entity (usually on a prefab) to make it networked. The replication system reads these fields to decide who simulates the entity and which components sync — gameplay scripts never hand-roll spawn/broadcast.

Authority models: * Server: the server simulates and broadcasts (enemies, physics bodies). * Client: the owning client sends input; the server validates and simulates. Used for per-player entities. * Shared: not synced. Every machine builds it from the same scene (level geometry, walls).

Public Attributes Documentation

variable authority

std::string Engine::NetworkComponent::authority;

variable networkId

std::uint64_t Engine::NetworkComponent::networkId;

Network id, assigned on spawn by the replication system. 0 = unassigned.


variable prefabPath

std::string Engine::NetworkComponent::prefabPath;

When set, spawn this prefab instead of a bare entity on connect/spawn.


variable snapshotPriority

int Engine::NetworkComponent::snapshotPriority;

Snapshot cadence: 0 = every tick, 1 = every tick, 2 = every other tick.


variable syncSprite

bool Engine::NetworkComponent::syncSprite;

Sync SpriteComponent (path, offset, scale, flip).


variable syncTransform

bool Engine::NetworkComponent::syncTransform;

Sync Position + Rotation each tick.



The documentation for this class was generated from the following file /home/runner/work/r-type/r-type/Engine/include/Components/NetworkComponent.hpp