Skip to main content

Module rpc

Module rpc 

Source
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

  1. Server/client calls RpcQueue::enqueue(call).
  2. Transport drains the queue and serialises all pending calls into one or more UDP packets (via RpcBatcher).
  3. Remote side deserialises, looks up the RpcId in RpcRegistry, and invokes the registered RpcHandler.
  4. RpcSecurity validates the caller and rate-limits calls per client.
  5. RpcReplay optionally records every call for debugging / replay.

Structs§

RecordedCall
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_shake RPC call.
rpc_chat
Build a chat_message RPC call.
rpc_damage_number
Build a damage_number RPC call.
rpc_dialogue_trigger
Build a dialogue_trigger RPC call.
rpc_entity_status
Build an entity_status RPC call.
rpc_force_field
Build a force_field_spawn RPC call.
rpc_game_event
Build a game_event RPC call.
rpc_particle_burst
Build a particle_burst RPC call.
rpc_play_sound
Build a play_sound RPC call.
rpc_player_joined
Build a player_joined RPC call.
rpc_player_left
Build a player_left RPC call.
rpc_screen_effect
Build a screen_effect RPC call.

Type Aliases§

RpcHandler
A boxed, type-erased RPC handler function.
RpcResult
Return value from an RPC handler.