Skip to main content

Module prelude

Module prelude 

Source
Expand description

Helpful types and macros when writing simulation logic

Re-exports§

pub use crate::SimulationInitOptions;

Macros§

debug
Logs a message at the debug level.
error
Logs a message at the error level.
info
Logs a message at the info level.
multiplayer_tradeoff
Although all game logic code is meant to be interpreted as server authoritative and from the server’s top-down perspective controlling everything, you as the game developer can choose how each of your game mechanics feel, on a spectrum between “responsive+potentially incorrect” to “laggy+definitely correct”. Game state is always eventually consistent, but this macro lets you decide when and where to execute logic in order to fine-tune game feel. This is possible because the engine executes each simulation tick multiple times across the server and all connected clients, requiring game logic to be deterministic depending on the chosen trade-off.
warn
Logs a message at the warn level.

Structs§

DiffSerializer
All state-mutating function signatures that the code generator produces require this struct to be passed in. It follows the opaque handle pattern, so everything Just Works™. Internally, it’s capturing and serializing the before and after values, allowing the value to be both rolled back and transmitted to clients.
GameContext
Immediate
TickInfo
WaitForConsensus
WaitForServer

Traits§

AnyTradeOff
ImmediateOrWaitForServer
Interpolate
Classic lerp/slerp helper for various simple math primitives

Type Aliases§

TickID
isize32
usize32

Attribute Macros§

server