Expand description
Remote Procedure Call (RPC) system for game events.
RPCs are named, typed, network-dispatched function calls. They are
registered centrally in RpcRegistry, dispatched via RpcQueue, and
can be targeted at a single client, a team, or all peers.
§Flow
- Server/client calls
RpcQueue::enqueue(call). - Transport drains the queue and serialises all pending calls into one
or more UDP packets (via
RpcBatcher). - Remote side deserialises, looks up the
RpcIdinRpcRegistry, and invokes the registeredRpcHandler. RpcSecurityvalidates the caller and rate-limits calls per client.RpcReplayoptionally records every call for debugging / replay.
Structs§
- Recorded
Call - Records RPC calls with timestamps for debugging and replay.
- RpcBatcher
- Combines multiple
RpcCalls into a single packet payload when possible. - RpcCall
- A fully-formed RPC call ready for serialisation and dispatch.
- RpcId
- Compact 16-bit identifier for a registered RPC.
- RpcQueue
- Accumulates outgoing RPC calls for batched network dispatch.
- RpcRegistry
- Central registry mapping
RpcId↔ name ↔ handler. - RpcReplay
- RpcSecurity
Enums§
- RpcError
- Errors from the RPC system.
- RpcParam
- Dynamically typed RPC parameter.
- RpcTarget
- Who should receive and execute this RPC call.
Constants§
- RPC_
CAMERA_ SHAKE - RPC_
CHAT_ MESSAGE - RPC_
DAMAGE_ NUMBER - RPC_
DIALOGUE - RPC_
ENTITY_ STATUS - RPC_
FORCE_ FIELD - RPC_
GAME_ EVENT - RPC_
PARTICLE_ BURST - RPC_
PLAYER_ JOINED - RPC_
PLAYER_ LEFT - RPC_
PLAY_ SOUND - RPC_
SCREEN_ EFFECT
Functions§
- rpc_
camera_ shake - Build a
camera_shakeRPC call. - rpc_
chat - Build a
chat_messageRPC call. - rpc_
damage_ number - Build a
damage_numberRPC call. - rpc_
dialogue_ trigger - Build a
dialogue_triggerRPC call. - rpc_
entity_ status - Build an
entity_statusRPC call. - rpc_
force_ field - Build a
force_field_spawnRPC call. - rpc_
game_ event - Build a
game_eventRPC call. - rpc_
particle_ burst - Build a
particle_burstRPC call. - rpc_
play_ sound - Build a
play_soundRPC call. - rpc_
player_ joined - Build a
player_joinedRPC call. - rpc_
player_ left - Build a
player_leftRPC call. - rpc_
screen_ effect - Build a
screen_effectRPC call.
Type Aliases§
- RpcHandler
- A boxed, type-erased RPC handler function.
- RpcResult
- Return value from an RPC handler.