Skip to content

API Reference

The Lattice public surface is a single, stable, pure-C ABI in reference/include/lattice/lattice.h. Everything an engine binding (Unity / Unreal / Godot / web) or a native integrator compiles against is reachable only through this extern "C" header — no C++ types, STL containers, or exceptions ever cross the boundary (design 02 §19).

This reference is generated against the current header (268 entry points) and is grouped by area. Every signature is copied verbatim from lattice.h; nothing here is invented.

Universal ABI rules — they hold for every function on every page

  • Opaque handles. lattice_runner*, lattice_bitwriter*, lattice_bitreader* are forward-declared incomplete types. Never dereference them.
  • POD only across the line. Structs are fixed-layout POD, passed by value or pointer.
  • Caller-owned buffers. Everything you pass in is caller-owned; the core copies anything it retains (type descriptors, field arrays, key strings, initial state, payloads).
  • Little-endian wire. Byte-aligned scalars are little-endian; bit-packed fields are MSB-first within each byte, consistently on both ends.
  • Synchronous callbacks. All callbacks fire synchronously inside lattice_runner_tick() on the calling thread. Do no blocking work in them; never let an exception propagate into the core.
  • Status codes, not exceptions. Fallible functions return lattice_result; render a code with lattice_result_str.

Coverage map

The areas below are the complete public ABI. new marks the ABI added since the original 08-server-client-api reference (anti-cheat, async jobs, web fetch, embedded store, custom events) — fully documented here.

Area Page Entry points Status
Runner lifecycle & pump Runner lattice_runner_create/destroy/set_callbacks/start/listen/connect/tick/state, lattice_module_version core
Type registration & objects Types & objects lattice_register_type, lattice_spawn, lattice_despawn, lattice_object_state, lattice_object_mark_dirty, lattice_object_count/at, lattice_type_content_hash core
RPC RPC lattice_rpc core
Custom events Events lattice_send_event, on_event new
Authority & ownership Authority lattice_request_authority, lattice_object_owner, lattice_object_authority_tick, on_authority_changed new
Anti-cheat Anti-cheat lattice_ac_configure, lattice_ac_score, on_violation, lattice_ac_config, lattice_ac_violation new
Async jobs & web fetch Jobs & fetch lattice_http_configure/request/poll, lattice_jobs_*, on_http_result, lattice_http_* enums new
Embedded store Store lattice_store_open/close/configure/get/put/delete/poll/build_key, lattice_store_* introspection, on_store_result new
BitWriter / BitReader Serialization lattice_bw_* (21), lattice_br_* (19) core
Callbacks, enums, results Callbacks & enums lattice_callbacks, all enums, lattice_result, lattice_result_str core
Engine bindings & SDKs Bindings Unity / Unreal / Godot / web idiomatic API + the managed-sim surface sdk

Test-only hooks are intentionally excluded

lattice.h also contains a large family of lattice_test_* symbols (NetSim, the loopback "wire", the reliability/RPC/event/snapshot/prediction/interpolation/fragment/congestion/crypto/ lag-comp/AoI/shared-authority/anti-cheat/job/store test harnesses). They exist only so the conformance harness can drive internal deterministic machinery without an internal header. They are not part of the supported binding surface, are namespaced lattice_test_* so they are obviously distinct, and a shipping build may strip them. Do not bind against them. They are deliberately omitted from this reference.

The two serialization paths

A registered type reaches the wire one of two ways — both documented in Types & objects:

flowchart LR
  T[lattice_type_desc] -->|serialize/deserialize == NULL| D[Declarative path<br/>lattice_field_desc array<br/>core bit-packs each field]
  T -->|serialize/deserialize set| M[Manual path<br/>INetworkSerializable<br/>you write bits via lattice_bw_*]
  D --> W[wire]
  M --> W[wire]

Next steps