Skip to main content

Module c_move_entity

Module c_move_entity 

Source
Expand description

Packets for entity movement updates.

These packets use fixed-point encoding for position deltas. The client maintains a VecDeltaCodec for each entity which tracks the “base” position. Deltas are computed as encode(current) - encode(base) where encode multiplies by 4096 and rounds.

The server must track what the client’s base position is (PositionCodec) to compute correct deltas and know when the delta would overflow i16 bounds.

Structs§

CMoveEntityPos
Updates an entity’s position with a delta from its current position.
CMoveEntityPosRot
Updates an entity’s position and rotation.
CMoveEntityRot
Updates an entity’s rotation only.
PackedEntityDelta
A fixed-point entity movement delta encoded as a protocol i16.

Constants§

MAX_DELTA 🔒
Maximum delta value that fits in i16.
MIN_DELTA 🔒
Minimum delta value that fits in i16.
TRUNCATION_STEPS 🔒
Fixed-point encoding multiplier (1/4096 block precision).

Functions§

calc_delta
Calculates the delta for entity movement.
encode_position
Encodes a position component to the protocol’s fixed-point format.
to_angle_byte
Converts degrees to a protocol angle byte (0-255 representing 0-360 degrees).