Skip to main content

Crate voxelize

Crate voxelize 

Source

Re-exports§

pub use webrtc::signaling::rtc_candidate;
pub use webrtc::signaling::rtc_offer;
pub use webrtc::signaling::WebRTCPeers;
pub use webrtc::create_webrtc_api;
pub use webrtc::datachannel::fragment_message;

Modules§

cpu_profiler
items
protocols
Protocol buffers generated by prost.rs.
system_profiler
webrtc

Structs§

AABB
AABBBuilder
AStar
AddrComp
WebSocket sender component for a client’s connection.
BackgroundChunkSaver
BackgroundEntitiesSaver
BaseTerrainStage
Biome
Block
BlockBuilder
BlockConditionalPart
BlockDynamicPattern
BlockFace
BlockFaces
BlockSimpleRule
BlockUtils
Bookkeeping
BoundVoxelize
A Voxelize server whose TCP socket is bound and whose HTTP accept loop is already running.
BrainComp
BroadcastSystem
BuildIdentity
Compile-time identity of the binary behind this server, surfaced on /info so tooling can prove which sources a running process was built from. Adapters stamp it via ServerBuilder::build_identity; unset fields stay UNKNOWN_BUILD_IDENTITY.
Capacity
Live-vs-cap snapshot.
ChatMessageProtocol
Chunk
ChunkGeneratingSystem
ChunkInterests
ChunkOptions
ChunkProtocol
Protocol buffer compatible chunk data structure.
ChunkRequestsComp
A list of chunks that the entity is requesting to generate.
ChunkRequestsSystem
ChunkSaveData
ChunkSavingSystem
ChunkSendingSystem
ChunkUpdatingSystem
ChunkUtils
A set of utility functions for chunk operations.
Chunks
A manager for all chunks in the Voxelize world.
CleanupSystem
Client
A client of the server.
ClientFlag
A flag for clients in the world.
ClientMessage
Send message to specific world
ClientPreferences
ClientPreferencesComp
ClientPreferencesPatch
ClientStateFlush
Everything pending for one client at flush time: the current snapshot of all state that changed since the client’s last successful flush.
CollisionsComp
Connect
New chat session is created. Returns (client_id, connection_token).
ContactResponse
A one-shot modifier for a body’s contact response, consumed by the next physics tick like forces and impulses: game systems set it before physics runs, integration applies it to any impact that tick, and it is cleared whether or not a contact happened — a stale response is unrepresentable. Powers soft surfaces (deadened rims, mud, gel pads) without the engine learning what any of those are.
CornerData
CreateWorld
Create + start a world at runtime, then register it for ticking and joins.
CurrentChunkComp
CurrentChunkSystem
DamageGate
The single choke-point damage predicate. Every damage path — hitscan, projectile, melee, contact — must call Self::try_apply; there is no other way to reduce HP. Each guard (spawn grace/shield, post-hit invuln, dash i-frames, per-tick cap) is enforced here exactly once, so anti-instagib holds no matter how many attackers cluster into one tick.
DamageRules
The immutable damage rules a DamageGate enforces. All windows are in ticks and the cap is a fraction of max HP so it survives damage retuning: change any damage number and a single tick still cannot remove more than per_tick_cap_frac of a target’s max HP.
DamageState
The per-target damage state the single predicate reads and updates. Engine- generic: it is just HP plus the timing windows every guard needs. There is deliberately no second way to mutate HP — all damage flows through DamageGate::try_apply.
DataSavingSystem
DebugStage
DescribeWorld
One world, or None.
DestroyWorld
Tear down a world. force = false respects in-flight-tick safety and may return TeardownInFlight; force = true schedules teardown to run after the in-flight tick completes (never mid-borrow).
DetRng
A single seeded, deterministic PRNG (mulberry32). This is the only randomness allowed on the sim path — the server is the single roller, and its state is carried in sim state so a replay from the same seed reproduces every roll.
DiagonalFacesBuilder
DirectionComp
The direction this entity is looking at.
Disconnect
Session is disconnected
DoNotPersistComp
A flag to prevent an entity from being persisted to disk.
ETypeComp
EncodedMessage
EncodedMessageQueue
EntitiesMetaSystem
EntitiesSaver
Takes all the metadata components, and saves them into the world saving directory by their ID’s.
EntitiesSendingSystem
EntityFlag
A flag for entities (animals) in the world.
EntityInterests
Per-client sets of entity ids currently streaming to that client. Each entry remembers the tick of the last message sent for the entity so unchanged entities can receive periodic keep-alive updates.
EntityObserveSystem
EntityProtocol
Protocol buffer compatible entity data structure.
EntitySaveData
EntityTreeSystem
Event
EventBuilder
EventProtocol
Events
EventsSystem
FixedStepClock
Fixed-timestep accumulator. Decouples sim advancement from wall-clock delivery: real elapsed time is intaken, whole DT slices are peeled off as steps (bounded by max_catchup_steps), and the leftover fraction becomes alpha — a client render-interpolation factor that never feeds back into the sim.
FixedStepConfig
Per-world knob enabling the deterministic fixed-step tick. None on a crate::WorldConfig (the default) means the world keeps today’s exact wall-clock cadence and pays nothing; Some opts the world into the accumulator + determinism rules and makes it eligible for golden tests.
FixedStepSample
A cheap, copyable snapshot of the deterministic clock for observation / replication sampling (see design §6: the snapshot accumulator samples the sim clock). Contains only render/observability inputs, never anything the sim reads back.
FixedStepState
Deterministic sim state carried on an opted-in world as an ECS resource. Bundles the authoritative clock and the single seeded roller so every system on the sim path reads sim time and randomness from one place.
FlameNode
FlatlandStage
A preset chunk stage to set a flat land.
FluidConfig
GeometryProtocol
Protocol buffer compatible geometry data structure.
GetAllWorldStats
GetLifecycleMetrics
Snapshot the lifecycle metrics.
Health
Deep health probe: tick liveness + preload state (wedged-but-bound detection).
IDComp
InboundStateBuffer
The inbound half of the state channel: peer (client position) packets staged by the network layer and applied by the world at the start of every tick, before the system dispatch.
Info
InteractorComp
What makes an entity physical in Voxelize.
InvalidWsSessionPolicy
A WsSessionPolicy that cannot drive a session: some duration is zero (which would spin or panic timers) or the timings contradict each other. The message names the offending field and observed value(s).
ItemDef
ItemDefBuilder
ItemRegistry
JsonComp
KdTree
LSystem
LSystemBuilder
LagComp
The lag-compensation resource carried on an opted-in world: the config, the derived tick length, the position-history ring, and the per-client server- measured RTT trackers. This is the one place a game asks “how far do I rewind this client’s shot?” and “where was this target then?”.
LagCompConfig
Per-world knob enabling server-side lag-compensation. None on a crate::WorldConfig (the default) means the world keeps no history ring and pays nothing; Some opts the world into recording poses and answering rewound queries. Requires the fixed-step tick (rewind is tick-anchored), so Some(..) without a fixed_timestep is rejected at config-build time.
LifecycleMetricsSnapshot
Observability snapshot: the live-world gauge plus the lifecycle event counters (§6). Cheap; safe to poll for metrics dashboards.
LightNode
Node of a light propagation queue.
LightPassInfo
Compact per-block facts consulted for every voxel in the lighting hot paths. Indexed by block ID so Lights can skip the full Block hashmap lookup, rotation decode, and dynamic-pattern probing for the overwhelming majority of voxels. Values mirror Block exactly; blocks that need the slow path (dynamic light patterns, rotatable transparency) are flagged.
LightUtils
Lights
A set of utility functions to simulate global illumination in a Voxelize world.
ListWorlds
Snapshot of all live worlds.
MeshProtocol
Protocol buffer compatible mesh data structure.
Mesher
Message
MessageBuilder
Builder for a protocol buffer message.
MessageQueues
The RELIABLE ORDERED EVENTS channel of the state replication split (see world::replication for the full taxonomy).
MetadataComp
A list of chunks that the entity is requesting to generate.
MethodProtocol
MotionGapReport
Aggregated wall-clock motion-gap distribution for one client over one reporting window: how long each tracked entity’s consecutive motion-carrying flushes were apart. Quantiles are bucket upper bounds (conservative), the max is exact.
MotionSample
One entity’s motion state as sampled from its ECS components.
NameComp
Ndarray
N-dimensional array stored in a 1D array.
Neighbors
NoiseOptions
Multi-fractal noise options.
NoiseOptionsBuilder
Idiomatic builder pattern for NoiseOptions.
OnJoinRequest
PathComp
PathFindingSystem
PathMetadataSystem
PathNode
PathValidator
A set of utility functions for pathfinding and walkability checks in a Voxelize world.
PeerProtocol
Protocol buffer compatible peer data structure.
PeerUpdate
PeersMetaSystem
PeersSendingSystem
Physics
PhysicsSystem
Pipeline
A pipeline is strictly for holding the stages necessary to build the chunks.
Pose
A recorded pose: position plus a look direction (orientation as needed). The engine stores whatever the recorder hands it; the meaning of the vectors is the game’s, not the engine’s.
PositionComp
The direction this entity is positioned.
PositionHistory
The per-world position-history ring: a set of per-entity rings, all sharing one capacity, plus the rewound spatial queries over them.
PreloadProgressResponse
QuantizedMotion
A MotionSample quantized to wire resolution. Equality of two quantized samples means the wire payloads would be identical, which is what the sending system uses to decide whether an entity’s motion “changed”.
Ray
A ray for rewound resolution. direction need not be normalized; the returned RewindHit::distance is in units of direction’s length.
Registry
A collection of blocks to use in a Voxelize server. One server has one registry and one registry only. Once a registry is added to a server, it cannot be changed.
ReplicatedStateBuffer
The outbound half of the latest-wins state channel: per-client, per-item latest-value slots for all high-frequency replicated state (entity motion and metadata, peer positions/metadata). See the module docs for why this must never become a FIFO.
Resources
RewindAnchor
A fire-time rewind anchor: the tick a shot was created and the rewind depth to apply for the shooter who fired it (already double-clamped when built via LagComp::anchor).
RewindEligibleComp
Marker component: this entity’s pose is recorded into the world’s position-history ring at the start of each fixed tick and is a candidate for rewound hit queries.
RewindHit
A hit resolved against historical positions: which entity, the tick its pose was read from, and the distance along the query (ray parameter or center distance).
RigidBody
A physical body in the Voxelize world.
RigidBodyBuilder
Builder pattern for RigidBody.
RigidBodyComp
What makes an entity physical in Voxelize.
RttEwma
The server’s exponentially-weighted moving average of a client’s measured round-trip time, in milliseconds. This is the load-bearing anti-cheat input: rewind depth is sized from this (server-measured), never from anything the client asserts. Non-finite or negative samples are ignored.
RunPreload
SeededNoise
Seeded simplex noise for Voxelize.
Server
A websocket server for Voxelize, holds all worlds data, and runs as a background system service.
ServerBuilder
Builder for a voxelize server.
SetStarted
SixFacesBuilder
SoundEffectEvent
Space
A data structure used in Voxelize to access voxel data of multiple chunks at the same time. Centered with one chunk, a Space allows developers to know what’s around a chunk.
SpaceBuilder
A data structure to build a space.
SpaceData
What kind of data does this space have/need?
SpaceOptions
Parameters of constructing a Space data structure.
SplineMap
Spline graph of Voxelize. Used to map noise values to custom values.
Stats
A general statistical manager of Voxelize.
StatsJson
StepPlan
The result of intaking real elapsed time into the accumulator: how many fixed steps to run this delivered tick, and whether the catch-up clamp fired (backlog was dropped).
SyncWorld
SystemSample
SystemStats
SystemTimer
SystemTimings
TargetComp
By adding this component, an entity has the ability to scan around and look at the closest entity.
TargetMetadataSystem
Terrain
TerrainLayer
A layer to the terrain. Consists of two spline graphs: height bias and height offset graphs. Height bias is how much terrain should be compressed as y-coordinate increases, and height offset is by how much should the entire terrain shift up and down.
TimedDispatcherBuilder
Drop-in replacement for specs’ DispatcherBuilder that times every system.
TimedSystem
Wraps a system so its run duration is recorded under name every tick.
TransportLeaveRequest
Tree
TreeBuilder
TreeRng
Deterministic splitmix64 parameter stream. One instance is seeded per generated tree, and every stochastic decision (rule selection, turtle jitter) pulls from it in walk order, so the same seed always grows the same tree.
TreeVariance
Per-individual variation ranges for a tree species. Every draw comes from the tree’s position-seeded stream, so the same world seed always grows the same forest. The neutral defaults are bit-exact no-ops: species that configure nothing generate exactly as before.
Trees
UV
Serializable struct representing a UV coordinate.
UpdateProtocol
Protobuf buffer compatible update data structure.
UpdateStatsSystem
Vec2
Vector2 implementation for Voxelize.
Vec3
Vector3 implementation for Voxelize.
VoxelComp
The direction this entity is positioned.
VoxelPacker
Voxelize
VoxelizeHandle
A cloneable handle to a booted Voxelize engine.
WORLD_TIMINGS
WalkTowardsSystem
WaterloggingRules
Per-world waterlogging policy derived from the block registry.
World
A voxelize world.
WorldCapacity
Live count vs hard cap. Cheap; safe to poll for metrics / backpressure.
WorldConfig
World configuration, storing information of how a world is constructed.
WorldConfigBuilder
Builder for a world configuration.
WorldHandle
Immutable, cheaply-cloneable descriptor of a live world, snapshotted at query time. The authoritative player count lives in the world; this is a server-side snapshot derived from the connection registry.
WorldInfo
WorldStatsResponse
WorldSystemTimer
WorldTimingContext
WsSender
A per-connection sender with two priority lanes.
WsSessionPolicy
Timing policy for a canonical WebSocket session.

Enums§

BlockRotation
BlockRule
BlockRuleLogic
ChunkStatus
ClientFilter
A filter for clients, used for specific broadcasting.
DamageBlock
Why a damage attempt was blocked or capped, reported by the single predicate so callers (and tests) can see exactly which guard fired.
DamageOutcome
The outcome of a damage attempt through the single predicate.
GcPolicy
Per-world garbage-collection policy.
HeldObject
InterestTransition
How an entity’s distance to a client should change that client’s tracked set, given the hysteresis band between the visible and release radii.
LightColor
MotionProtocol
How a client receives entity motion, negotiated at JOIN time.
ProtocolReject
Why a protocol handshake was refused. The engine turns this into a terminal close (PROTOCOL_MISMATCH_CLOSE_CODE) so the client can treat it as non-retryable.
ResetPolicy
How a pooled slot is made clean for reuse.
SlotContent
SupportRequirement
Serializable struct representing block data.
TargetType
WorldLifecycleError
Typed, exhaustive failure mode for every lifecycle op. No panics, no strings-as-errors on the lifecycle path.
YRotatableSegments

Constants§

CHUNK_FILE_VERSION
Bumped whenever a chunk file needs a one-time migration on load.
DEFAULT_RTT_EWMA_ALPHA
Default smoothing factor for the server’s per-client RTT EWMA. Passed as a constructor parameter to LagComp::new so it can be overridden per world; this documented default is used by the world wiring. A moderate value tracks genuine latency shifts without letting a single spiky sample swing the rewind depth.
DEFAULT_TICK_STALL_THRESHOLD_MS
Default max age of the last completed world tick before /health is unhealthy.
MAX_PENDING_INBOUND_PER_CLIENT
Hard cap on inbound state packets buffered per client between ticks. At a 16ms tick and a typical 20-60Hz client send rate this holds 1-4 entries; the cap only bites on a misbehaving client, where dropping the oldest packets is safe because newer ones supersede them.
MAX_STATE_SLOTS_PER_CLIENT
Hard cap on latest-value slots per client. The structure is already bounded by the client’s interest set, so this is a backstop against pathological interest sizes; overflowing entity updates are dropped (the keep-alive cycle re-sends them) and a counter is exposed through perf tracing.
METADATA_MAX_AGE_MS
Wall-clock max age of a pending METADATA-lane slot. Metadata is low-frequency (paths, text, game JSON), so it tolerates more staleness than motion, but it is still bounded — a changed path must not hide behind a busy motion lane forever.
MOTION_PROTOCOL_V1
Version byte of the current motion payload layout.
MOTION_V1_CAPABILITY
The JOIN capability string a client sends to opt into MOTION_PROTOCOL_V1.
NX_ROTATION
NY_ROTATION
NZ_ROTATION
PROTOCOL_MISMATCH_CLOSE_CODE
WebSocket close code sent when a client is refused for a protocol mismatch. In the 4000–4999 application range. The client treats it as terminal (client_outdated): it never retries and never burns reconnect grace. Derived from the same shared protocol-version.json.
PROTOCOL_MISMATCH_REASON
Machine-readable reason attached to the terminal reject so the client can distinguish an outdated build from a transient error.
PROTOCOL_VERSION
Wire protocol version. Snapshot + delta replication and the deterministic join handshake are pinned to this. Bump it once in protocol-version.json; both the Rust server and the TS client pick the new value up automatically. A deterministic world rejects any client that does not match exactly.
PX_ROTATION
PY_ROTATION
PZ_ROTATION
ROTATION_MASK
SCENARIO_ID_METADATA_KEY
Metadata key that marks an entity as owned by a test scenario (stamped by test:spawn-style methods). Scenario entities are live-only: they spawn and despawn normally, but persisting them would litter the world save with one orphaned JSON file per test run, so spawn_entity_with_metadata hands them a DoNotPersistComp and the saving system never sees them.
SIX_FACES_NX
SIX_FACES_NY
SIX_FACES_NZ
SIX_FACES_PX
SIX_FACES_PY
SIX_FACES_PZ
STAGE_MASK
STATE_FLUSH_MAX_SOCKET_BACKLOG
How many messages may sit unread in a client’s WebSocket channel before the state flush for that client is skipped for the tick. Reliable events are unaffected (they must queue); state simply keeps coalescing in its slots and the client receives one fresh snapshot once the socket drains. A small value keeps a slow client’s view of the world current instead of complete-but-late.
UNKNOWN_BUILD_IDENTITY
Value reported on /info for any build-identity fact that could not be established. A visible “unknown” — never a fabricated stand-in — so a binary without a stamped identity is unmistakable to tooling.
VOXELIZE_BUILTIN_SOUND_EFFECT_EVENT
Y_ROTATION_MASK
Y_ROT_SEGMENTS

Traits§

AABBServerExt
ChunkStage
A stage in the pipeline where a chunk gets populated.
ItemComponent
ItemComponentName
VoxelAccess

Functions§

apply_client_preferences_patch
apply_client_swim_pose_state
approx_equals
Test if two numbers are equal within a given tolerance, which by default is 1e-5.
attachment_support_offset
The voxel offset a rotation-mounted block leans on, matching the rotation that placement derives from the clicked face normal: a block placed against the +x face of a wall carries PX, so its support sits at -x.
beer_lambert_transmit
Apply Beer-Lambert transmission through a medium with the given optical density. optical_density is block light_attenuation (leaves=1, water=2).
between
build_health_value
Build a /health JSON payload from live server + world preload state.
check_protocol
Fail-closed, strict-equality protocol assert for a deterministic world’s join. There is deliberately no 0/missing bypass: an absent version is a reject, not a pass. This is the load-bearing lesson of the motion field-5 silent-skip incident — never silently accept an unknown/absent field on the deterministic path.
clamp_dly_ms
The first dly clamp (§2.3): clamp a client-reported render delay to [floor_ms, ceil_ms] on receipt. Non-finite input clamps to the floor. This bounds the only value a client contributes to lag comp before it is used; the window clamp then bounds it again.
classify_interest
clear_timing_data_for_world
create_fluid_active_fn
create_rtc_senders
decode_message
Decode protocol buffers into a message struct.
decode_motion
Decode a motion.v1 payload back into world-space floats. The server only needs this for tests; the shipping decoder is the client’s, in packages/core/src/core/network/workers/decode-utils.ts (kept in sync with this layout by the round-trip tests below).
default_client_parser
The default client metadata parser, parses PositionComp and DirectionComp, and updates RigidBodyComp. Position updates are clamped to a maximum per-message delta so clients cannot teleport past server reach checks (mine/place/stations).
encode_message
Encode message into protocol buffers with LZ4 frame compression for large messages.
find_path
Run the voxel A* search from start to goal.
get_all_world_names
get_timing_summary_for_world
health_route
GET /health — readiness/liveness probe.
info_route
GET /info — server info snapshot. A failed server actor mailbox is a structured 503, never a panic.
is_peer_relevant
Whether a peer’s state should replicate to a client, given the squared distance between them. None (the default) replicates every peer to every client — there is no wire-level “peer left your view” signal, so games must opt into radius culling via WorldConfig::peer_visible_radius, knowingly accepting that out-of-range players freeze at their last known position on the client.
is_profiling
is_scenario_owned
motion_max_age_for
Proximity-scaled motion max age: the nearest entities refresh twice as fast as the configured bound, scaling linearly out to the full bound at (and beyond) the visible radius. Distance modulates PRIORITY, never eligibility — the far edge still holds the configured wall-clock bound.
ndarray
Create a new n-dimensional array.
parse_preferences_patch
record_timing
rewind_ticks
The server-side rewind-depth formula (§2.3): clamp(round((rtt/2 + interp) / tickMs), 0, max_ticks), in ticks.
round
Round a float to a certain number of decimal places.
run_ws_session
Drive one canonical WebSocket session to completion.
sample_random_ticks
Run one random-tick pass. Returns how many samples were taken (not how many blocks actually opted in / were marked active).
set_position
start_profiling
state_flush_budget
Per-client flush budget in (approximate payload) bytes, derived from the socket’s live state. Returns None when the socket is genuinely backed up and the flush must be skipped for the tick.
stop_profiling_json
sweep
trace
trace_solids
Distance along direction to the first face of anything a swept body collides with, or None when max_d of open space lies ahead. The cell filter is sweep’s own — fluid, empty, and passable blocks never collide — and inside a surviving cell the ray is tested against the block’s actual rotated AABBs. Cell flags alone cannot answer this question: the water beside a waterlogged wave-maker housing or between coral pillar columns is open to a body while the furniture itself is not, and both truths live in one cell. Panics on a zero direction, like trace.
voxel_has_solid_support_below
Shared support test used by SupportRequirement::SolidBelow and game code.
voxel_has_solid_support_toward
Shared support test used by SupportRequirement variants and game code.
ws_route
GET /ws/ — upgrade to the canonical WebSocket session.

Type Aliases§

Clients
EType
EntityIDs
EntityOperation
FluidTicker
FluidUpdater
GetVoxel
MessageType
RtcSenders
Transports
VoxelUpdate