Files
skills/plugins/document-navigator/docs/foundation/bitpacker/bitpacker-game/README.md
admin 9bf56a806b Move docs/ package mirror into document-navigator plugin
Relocate the ~6k-file docs tree from the repo root into
plugins/document-navigator/docs/ so the plugin is self-contained and
portable. docs/superpowers/ (specs and plans) stays at the repo root.

Moved via cp+rm rather than git mv because directory rename() fails with
EPERM on this WSL /mnt DrvFs mount; git rename-detection pairs the
identical-content files at commit time.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-05-30 01:10:00 +01:00

21 KiB

@suaveplan/bitpacker-game - Bitpacker game plugin

Summary

Game state utilities: quantization, prediction, interpolation, and client-server reconciliation.

Documentation tree

  • bitpacker — (no submodules)
  • integration-manager — (no submodules)
  • interpolation — (no submodules)
    • index — Path: src/interpolation/interpolation.ts Export: GameInterpolator
    • interpolation — (no submodules)
  • otel — (no submodules)
  • prediction — (no submodules) - rotation-predictor — Path: `bitpacker-game/src/…
    • index — Path: src/prediction/ Exports: PositionPredictor, RotationPredictor, motion math, Kalman filter, predicti…
    • kalman-filter — Path: bitpacker-game/src/prediction/kalman-filter.ts Export: See source for details.
    • motion-math — Path: bitpacker-game/src/prediction/motion-math.ts Export: See source for details.
    • position-predictor — Path: bitpacker-game/src/prediction/position-predictor.ts Export: See source for details.
    • prediction-algorithms — Path: bitpacker-game/src/prediction/prediction-algorithms.ts Export: See source for details.
    • prediction — (no submodules) - rotation-predictor — Path: `bitpacker-game/src/…
    • rotation-predictor — Path: bitpacker-game/src/prediction/rotation-predictor.ts Export: See source for details.
  • quantization — (no submodules)
  • reconciliation — (no submodules)
    • index — Path: src/reconciliation/reconciliation.ts Export: StateReconciliation
    • reconciliation — (no submodules)
  • register-schemas — Idempotent integration with @suaveplan/schema-registry for the @suaveplan/bitpacker-game package. Exposes `register…
    • register-schemas — Idempotent integration with @suaveplan/schema-registry for the @suaveplan/bitpacker-game package. Exposes `register…
  • schema-factory — (no submodules)
  • schemas — (no submodules)
  • state-manager — (no submodules)
  • types.schema — Zod schemas for the public configuration types of @suaveplan/bitpacker-game: the three sub-options bundles (`Predicti…
    • types.schema — Zod schemas for the public configuration types of @suaveplan/bitpacker-game: the three sub-options bundles (`Predicti…
  • index — Path: bitpacker-game/src/index.ts Export: See source for details.
  • types — Path: src/types.ts Export: All game-related type definitions and enums
- [bitpacker](./src/bitpacker/bitpacker.md) — _(no submodules)_- [integration-manager](./src/integration-manager/integration-manager.md) — _(no submodules)_- [integration-manager](./src/integration-manager/integration-manager.md) — _(no submodules)_- [interpolation](./src/interpolation/interpolation.md) — _(no submodules)_- [index](./src/interpolation/index.md) — **Path:** `src/interpolation/interpolation.ts` **Export:** `GameInterpolator`
  • interpolation — (no submodules)- otel — (no submodules)- instruments — (no submodules)- prediction — (no submodules)- rotation-predictor — Path: `bitpacker-game/src/…
  • index — Path: src/prediction/ Exports: PositionPredictor, RotationPredictor, motion math, Kalman filter, predicti…
  • kalman-filter — Path: bitpacker-game/src/prediction/kalman-filter.ts Export: See source for details.
  • motion-math — Path: bitpacker-game/src/prediction/motion-math.ts Export: See source for details.
  • position-predictor — Path: bitpacker-game/src/prediction/position-predictor.ts Export: See source for details.
  • prediction-algorithms — Path: bitpacker-game/src/prediction/prediction-algorithms.ts Export: See source for details.
  • prediction — (no submodules)- rotation-predictor — Path: `bitpacker-game/src/…
  • rotation-predictor — Path: bitpacker-game/src/prediction/rotation-predictor.ts Export: See source for details.
  • quantization — (no submodules)- quantization — (no submodules)- reconciliation — (no submodules)- index — Path: src/reconciliation/reconciliation.ts Export: StateReconciliation
  • register-schemas — Idempotent integration with @suaveplan/schema-registry for the @suaveplan/bitpacker-game package. Exposes `register…
  • types — Path: src/types.ts Export: All game-related type definitions and enums
  • types.schema — Zod schemas for the public configuration types of @suaveplan/bitpacker-game: the three sub-options bundles (`Predicti…
  • bitpacker — (no submodules)- integration-manager — (no submodules)- integration-manager — (no submodules)- interpolation — (no submodules)- index — Path: src/interpolation/interpolation.ts Export: GameInterpolator
    • interpolation — (no submodules)- otel — (no submodules)- instruments — (no submodules)- prediction — (no submodules)- rotation-predictor — Path: `bitpacker-game/src/…
    • index — Path: src/prediction/ Exports: PositionPredictor, RotationPredictor, motion math, Kalman filter, predicti…
    • kalman-filter — Path: bitpacker-game/src/prediction/kalman-filter.ts Export: See source for details.
    • motion-math — Path: bitpacker-game/src/prediction/motion-math.ts Export: See source for details.
    • position-predictor — Path: bitpacker-game/src/prediction/position-predictor.ts Export: See source for details.
    • prediction-algorithms — Path: bitpacker-game/src/prediction/prediction-algorithms.ts Export: See source for details.
    • prediction — (no submodules)- rotation-predictor — Path: `bitpacker-game/src/…
    • rotation-predictor — Path: bitpacker-game/src/prediction/rotation-predictor.ts Export: See source for details.
  • quantization — (no submodules)- quantization — (no submodules)- reconciliation — (no submodules)- index — Path: src/reconciliation/reconciliation.ts Export: StateReconciliation
  • register-schemas — Idempotent integration with @suaveplan/schema-registry for the @suaveplan/bitpacker-game package. Exposes `register…
  • types — Path: src/types.ts Export: All game-related type definitions and enums
  • types.schema — Zod schemas for the public configuration types of @suaveplan/bitpacker-game: the three sub-options bundles (`Predicti…
  • bitpacker — (no submodules)- integration-manager — (no submodules)- integration-manager — (no submodules)- interpolation — (no submodules)- index — Path: src/interpolation/interpolation.ts Export: GameInterpolator
    • interpolation — (no submodules)- otel — (no submodules)- instruments — (no submodules)- prediction — (no submodules)- rotation-predictor — Path: `bitpacker-game/src/…
    • index — Path: src/prediction/ Exports: PositionPredictor, RotationPredictor, motion math, Kalman filter, predicti…
    • kalman-filter — Path: bitpacker-game/src/prediction/kalman-filter.ts Export: See source for details.
    • motion-math — Path: bitpacker-game/src/prediction/motion-math.ts Export: See source for details.
    • position-predictor — Path: bitpacker-game/src/prediction/position-predictor.ts Export: See source for details.
    • prediction-algorithms — Path: bitpacker-game/src/prediction/prediction-algorithms.ts Export: See source for details.
    • prediction — (no submodules)- rotation-predictor — Path: `bitpacker-game/src/…
    • rotation-predictor — Path: bitpacker-game/src/prediction/rotation-predictor.ts Export: See source for details.
  • quantization — (no submodules)- quantization — (no submodules)- reconciliation — (no submodules)- index — Path: src/reconciliation/reconciliation.ts Export: StateReconciliation
  • register-schemas — Idempotent integration with @suaveplan/schema-registry for the @suaveplan/bitpacker-game package. Exposes `register…
  • types — Path: src/types.ts Export: All game-related type definitions and enums
  • types.schema — Zod schemas for the public configuration types of @suaveplan/bitpacker-game: the three sub-options bundles (`Predicti…
  • bitpacker — (no submodules)- integration-manager — (no submodules) - integration-manager — (no submodules)- interpolation — (no submodules) - index — Path: src/interpolation/interpolation.ts Export: GameInterpolator
    • interpolation — (no submodules)- otel — (no submodules) - instruments — (no submodules)- prediction — (no submodules) - index — Path: src/prediction/ Exports: PositionPredictor, RotationPredictor, motion math, Kalman filter, predicti…
    • kalman-filter — Path: bitpacker-game/src/prediction/kalman-filter.ts Export: See source for details.
    • motion-math — Path: bitpacker-game/src/prediction/motion-math.ts Export: See source for details.
    • position-predictor — Path: bitpacker-game/src/prediction/position-predictor.ts Export: See source for details.
    • prediction-algorithms — Path: bitpacker-game/src/prediction/prediction-algorithms.ts Export: See source for details.
    • prediction — (no submodules) - rotation-predictor — Path: bitpacker-game/src/prediction/rotation-predictor.ts Export: See source for details.
  • quantization — (no submodules) - quantization — (no submodules)- reconciliation — (no submodules) - index — Path: src/reconciliation/reconciliation.ts Export: StateReconciliation
  • register-schemas — Idempotent integration with @suaveplan/schema-registry for the @suaveplan/bitpacker-game package. Exposes `register…
  • types — Path: src/types.ts Export: All game-related type definitions and enums
  • types.schema — Zod schemas for the public configuration types of @suaveplan/bitpacker-game: the three sub-options bundles (`Predicti…

Install

bun add @suaveplan/bitpacker-game

Usage

import {
    GameStateManager,
    quantizeVector,
    dequantizeVector,
    PositionPredictor,
    RotationPredictor,
    GameInterpolator,
    StateReconciliation,
    PredictionAlgorithm,
    InterpolationMethod,
} from "@suaveplan/bitpacker-game";

// Quantization for network compression
const quantized = quantizeVector({ x: 0.5, y: -0.25, z: 0.75 }, 16);
const restored = dequantizeVector(quantized, 16);

// Position prediction
const predictor = new PositionPredictor({ algorithm: PredictionAlgorithm.ADAPTIVE });
predictor.addPosition({ x: 0, y: 0, z: 0 }, 0);
predictor.addPosition({ x: 10, y: 0, z: 0 }, 1000);
const futurePos = predictor.predictPosition(100); // predicted position at t=100ms

// Interpolation
const interp = new GameInterpolator({ method: InterpolationMethod.HERMITE });
const midPos = interp.interpolatePosition({ x: 0, y: 0, z: 0 }, { x: 10, y: 0, z: 0 }, 0.5);

// Client-server reconciliation
const reconciliation = new StateReconciliation();
const seq = reconciliation.processInput({ moveX: 1, moveY: 0, rotateYaw: 0, rotatePitch: 0, actions: [] }, Date.now());

Modules

  • src/index.ts — GameStateManager, quantizeVector, dequantizeVector
  • src/types.ts — Vector3, Rotation, PlayerState, PredictionAlgorithm, InterpolationMethod, etc.
  • src/prediction/ — PositionPredictor, RotationPredictor, motion math, Kalman filter, prediction algorithms
  • src/interpolation/ — GameInterpolator with 9 interpolation methods
  • src/reconciliation/ — StateReconciliation for client prediction + server reconciliation