Skip to main content

Module wire

Module wire 

Source
Expand description

The wire format of the navmesh data server (messages 3, 4 and 5).

All integers and floats are little-endian. This module parses and encodes message payloads; the frame (u32 length, u32 messageId) belongs to the transport. WorldParams::parse_message takes a payload that starts with the protocol version, WorldParams::parse one without it.

The readers check every count against the bytes left before they allocate, so a hostile payload cannot make them allocate more than a small multiple of its own size.

Structs§

CellClass
One cell class: the voxel grid resolution of a tile (spec 3.4).
LinkClass
One link class: an off-mesh jump or climb link type (spec 3.4).
TileGroup
One geometry group of a tile: an area id, its parts and its vertices.
TileInput
A tile input message (id 5): one tile’s geometry.
TilePart
One part of a tile group: an object (or a door state) and where its vertices start.
WorldBlock
The 84-byte world block of the world params message (spec 3.4).
WorldParams
The world params message (id 4): world block, cell classes and link classes.

Constants§

DEFAULT_PORT
The default TCP port of the data server.
PROTOCOL_VERSION
The protocol version of the world params message.

Functions§

encode_tile_request
Encodes a tile request (message 3, spec 3.3): tile x and z, then the tile’s min and max x and z as float(x) * tileWidth, float(z) * tileHeight, float(x + 1) * tileWidth and float(z + 1) * tileHeight.