Crate net

Source
Expand description

Bounded, versioned network protocol shared by native and browser game clients.

The protocol never accepts client positions or client-selected time steps. Native UDP is intentionally a thin primitive: authentication, encryption, browser transports, and NAT traversal are outside this prototype.

Modules§

delta
Versioned byte snapshot differences. Callers acknowledge exact baselines before using a delta.
history
Bounded authority history and clock estimates; rendering and transport are independent.
reliable
Bounded ordered event delivery over an unreliable transport. This is not encryption.
udp
Native sockets are optional by target; packet codecs remain available on wasm.

Structs§

InputFrame
InputQueue
Deduplicates input redundancy and bounds per-client simulation backlog.
PlayerSnapshot
Snapshot

Enums§

ClientPacket
ProtocolError
ServerPacket

Constants§

BUTTON_FIRE
BUTTON_JUMP
BUTTON_RELOAD
MAX_INPUTS_PER_PACKET
MAX_PACKET_BYTES
MAX_PITCH
MAX_PLAYERS
MAX_QUEUED_INPUTS
PROTOCOL_VERSION
Version 2 adds session-bound reliable events and individual acknowledgments.

Functions§

decode_client
decode_server
encode_client
encode_server
sequence_newer
RFC-1982-style comparison. Exactly half a sequence space is ambiguous and rejected.