Skip to content

The inklib standard, the template and the compliance tables - #1

Merged
OctoAlgo merged 5 commits into
mainfrom
claude/youthful-allen-lou30t
Nov 1, 2026
Merged

OctoAlgo merged 5 commits into
mainfrom
claude/youthful-allen-lou30t

Conversation

@OctoAlgo

@OctoAlgo OctoAlgo commented Oct 31, 2026 •

Copy link
Copy Markdown
Owner

What this adds

  • SPEC.md: the inklib standard, version 1 (draft).
    1. Naming
    2. The core C API and the ABI rules
    3. Units: native units inside, a shared convention (metres, seconds, radians, Z up) through a small conversion layer
    4. Collision callbacks and surface flags
    5. Determinism: the same bits on every machine, through integer maths or strict float rules. The shared replay format stores a state hash.
    6. Rollback support, required in every lib and free unless called:
      • state_size, save_state, load_state, state_hash
      • event id and tick
      • sticks quantised to steps of 1/127
    7. Camera
    8. Provenance
    9. Data rules
    10. Packaging
    11. Docs
    12. Optional modules (the later inklib-arena set)
    13. inklib-net, an optional add-on, spec only: GGPO-style rollback, desync checks, mixed tick rates on one host clock
  • TEMPLATE/: a lib you copy, with the placeholder prefix tpl_ (rename.sh <prefix> <Name>).
    • Core: netstandard2.1, Units conversion layer, DetMath (deterministic sin, cos, atan2 and sqrt), snapshot code.
    • Native: NativeAOT exports, tpl.h, tpl.def, a C test and a minimal example host.
    • Tests (47 xunit tests):
      • provenance, header sync, units, world behaviour
      • rollback: save, step, load, step again gives the same bytes; resimulated events keep their ids
      • determinism: a scan for platform maths, golden bits for DetMath
      • replays: each one checks a stored hash:
    • The C test checks the same replay hash through the native library.
    • Also: UPM package, data check, CI, CLAUDE.md, and stubs for Docs/PLAN, RESEARCH, MEASURE and REPLAY.
    • All template numbers are UNVERIFIED placeholders.
  • COMPLIANCE.md: one table each for libfc and libray3, with the rollback rows.
    • libfc comes from its description only, because its repo is private.
    • libray3 comes from its repo at 484385e.
  • CI (.github/workflows/template.yml):
    • dotnet test on Linux x64, Windows x64 and macOS arm64, so the replay hashes must match on all three
    • native build, C test and example host on linux-x64, win-x64 and osx-arm64
    • the data check and the Unity pack step
    • copy, rename and build again

Checked locally (Linux)

  • dotnet test: 47/47 pass.
  • native/build_and_test.sh: the C test passes, including the snapshot round trip and the cross-check of the replay hash.
  • A copy renamed with rename.sh demo Demo builds and passes too.

Provenance

  • No gameplay numbers became VERIFIED. All template numbers are UNVERIFIED placeholders.

Not decided

  • Licence: TODO for octo.

🤖 Generated with Claude Code

https://claude.ai/code/session_011dFkrWqBVAw1kojJ7PN58H

SPEC.md: naming, the core C API shape, units (native + shared), collision
callbacks and surface bits, determinism and the shared replay format,
camera, provenance, data rules, packaging, optional modules.

TEMPLATE/: a copyable lib with prefix tpl_ (rename.sh). Core
(netstandard2.1, provenance attributes and tests), NativeAOT exports,
tpl.h, tpl.def, C test, example host, replays, CI, CLAUDE.md and Docs stubs.
All template numbers are UNVERIFIED placeholders.

COMPLIANCE.md: libfc (from its description) and libray3 (from its repo).

Licence left as a TODO for octo.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dFkrWqBVAw1kojJ7PN58H
NativeAOT sets a relative install name, so the C test could not load
libtpl.dylib on osx-arm64. Set it to @rpath and re-sign.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dFkrWqBVAw1kojJ7PN58H
SPEC.md:
- Section 6 (new): state_size, save_state, load_state, state_hash are
  required in every lib, free unless called. Snapshots are complete,
  little-endian and checked (magic, format, tuning hash). Events carry an
  id that is stable under resimulation, plus their tick. Sticks are
  quantised to steps of 1/127.
- Section 5: same bits on every machine, by integer maths or strict float
  rules (doubles, DetMath, no platform maths, no FMA or SIMD). Replays store
  the state hash.
- Section 13 (new): inklib-net, GGPO-style rollback as a separate add-on
  (spec only). Later sections are renumbered.

TEMPLATE: DetMath, snapshot and hash, event ids, stick quantisation,
RollbackTests and DeterminismTests (forbidden-call scan, golden bits),
hash lines in the replays (also checked through the C API), and
dotnet test on macOS arm64 in CI.

COMPLIANCE.md: rollback rows for libfc and libray3.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dFkrWqBVAw1kojJ7PN58H
- Tuning.TickSeconds / TPL_TICK_SECONDS: the game time one tick simulates,
  separate from TPL_TICK_RATE (how often the host calls). Shared-unit
  velocities use it.
- Tuning.InputDelayTicks / TPL_INPUT_DELAY_TICKS (template: 1): the game
  reads the pad late, as the original does; TPL_CHAR_NO_INPUT_DELAY turns it
  off per character. Delayed inputs are in the snapshot.
- TPL_SIM_BITS (64 here): the real type the simulation computes in.
- tpl_units_info gains tick_seconds, input_delay_ticks, sim_bits.
- Regression replays recorded again (the delay moves them), new hash in the C test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dFkrWqBVAw1kojJ7PN58H
… state

- Section 5: closeness to the original first. TICK_RATE (host pacing) and
  TICK_SECONDS (the game's real step, e.g. Rayman 3 PC 16 ms at 60 Hz) are
  separate. The game's input delay is reproduced by default; a char flag
  turns it off.
- Strict float rules allow float32 when the game used it (SIM_BITS in the
  header), with the same determinism rules.
- Section 6: a lib may own world state of its character's rules behind a
  store interface with a default store (in the snapshot) or a host store
  (host rolls it back); big state may be stored as deltas.
- COMPLIANCE.md: libray3's measured time model and its 13 platform-maths
  call sites at 79f17a3; libfc tick/delay row.
- CLAUDE.md (new) with the Next list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011dFkrWqBVAw1kojJ7PN58H
@OctoAlgo
OctoAlgo merged commit 7a93c7d into main Nov 1, 2026
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants