Files
kinect/.omo/design/architecture.md
T
kinect-botandsisyphus-dev-ai b38c7bcd82
ci / Linux C++ core (cmake + ctest) (push) Canceled after 0s
ci / Python tracker (pytest) (push) Canceled after 0s
chore(scaffold): project layout, cross-platform build, CI
Co-authored-by: sisyphus-dev-ai <sisyphus-dev-ai@users.noreply.github.com>
2026-11-25 03:23:45 -05:00

4.7 KiB

Architecture recommendation (referenced by the work plan as architecture.md)

Source: advisory architect consult. Grounded in the Kinect v1 NUI model, Windows DLL search order, and prior art (TinyTinni/KinectFaker proves a drop-in Kinect10.dll proxy works with no host recompile; spice2x's "Kinect bypass" patch only defeats the boot check, not gameplay data).

Verdict

The DLL-shim + separate-tracker split is a sound boundary for the API-shim fallback, but the center of gravity is (a) matching the game's exact NUI call pattern and (b) producing depth/skeleton accurate enough for the scorer. De-risk by instrumenting the real game's calls first. NOTE for this plan: the PRIMARY approach is device-level (virtual Kinect USB device), where the real host stack computes the skeleton; the shim is the per-OS fallback. The split/testing/record-replay guidance below applies to both.

Module boundaries

Shared cross-platform core (unit-testable off-Windows): joint mapping + coordinate transform + smoothing; depth/player-index/color synthesis; the frozen IPC data-contract structs. Thin OS-specific layers: the USB-attach shims (Linux usbip/vhci, Windows virtual bus) for the device path, and the NUI export/ABI layer + session/event state machine for the Windows NUI-shim fallback. Keep ABI shape separate from timing/behavior.

Transport

Frame transport = lock-free single-slot (double/triple-buffered) shared memory, newest-wins, with a sequence counter; a named pipe/socket carries only control-plane (handshake, config, calibration, heartbeat). The game consumes the latest frame at its own cadence and never wants a stale queue; sub-ms reads, no blocking the NUI thread. Freeze/version the IPC struct contract from commit one (static_assert sizes/offsets) because post-split drift is silent corruption, not a compile error.

Build/test around the Linux-dev / Windows-run split

Push logic into pure POD functions so "on Windows" shrinks to ABI + Win32 eventing + end-to-end QA. Off-Windows (Linux/WSL2 CI): mapping/transform/smoothing math, mask->depth packing/projection, IPC layout (static_assert), cross-toolchain struct-offset diff. On Windows: NUI ABI/export correctness, Win32 event/threading, end-to-end QA. Topology: a cross-platform static lib (synth+mapping+contract) unit-tested on Linux; a thin Windows DLL shell linking it with MSVC authoritative (MinGW/clang-cl for fast local cross-compile only - MinGW C++ ABI quirks around COM/SEH can bite). Build a record/replay harness (capture tracker output to a fixture, replay deterministically) and a mock NUI host early - the highest-leverage test assets; they let the DLL be tested with no webcam/tracker and reproduce any in-game failure frame-for-frame.

Top risks

A. Wrong call pattern - kill first with a pass-through logging shim + dumpbin on gamekdm.dll (exact imports, init flags, streams, resolutions, event-vs-poll, bitness). B. 32 vs 64-bit mismatch - project-ending; a 64-bit DLL won't load into a 32-bit game. Verify via dumpbin /headers on day one; SDK 1.8 ships both. C. DLL search-order shadowing may not fire (fully-qualified path / SxS / KnownDLLs / COM-by-CLSID / spice2x loader hooks) - confirm with the logging shim that your module is the one loaded. D. Skeleton coordinate accuracy vs the scorer (highest SILENT risk) - MediaPipe z is monocular, scale-ambiguous, Z-weak. Calibrate scale/floor/origin; derive the Kinect-only joints consistently; A/B real vs synthetic in-game via record/replay to measure the scorer's Z-sensitivity. E. NUI event/threading fidelity - a dedicated producer thread at a fixed 30Hz must signal exactly the events the app registered; getting contents right but signaling wrong looks like an unrelated hang. F. Depth/player-index vs skeleton-only need - the silhouette likely needs player-index packed depth; keep it behind a flag, ship skeleton-first, add depth per the spike. G. ABI exactness - NUI C exports are __stdcall/WINAPI; match decoration, calling convention, struct packing, enum values, COM vtable order to SDK 1.8 headers bit-for-bit; static_assert struct sizes/offsets.

Blast radius

Confined to the game's own directory (shim) or the virtual USB device (device path); nothing patches the game binary and nothing touches the OS Kinect install. Worst case is the game process, never the system. The riskiest coupling is the frozen IPC frame contract - version it from commit one.

Sequencing (cheapest risk-retirement order)

  1. Logging pass-through shim -> learn call pattern + bitness (A,B). 2. Record/replay harness + a golden reference capture (D baseline). 3. Skeleton-only replay in-game -> confirm scoring accepts synthetic skeletons (D/E early). 4. Live MediaPipe tracker behind the shared-memory contract. 5. Depth/player-index synthesis if the flags/QA require it (F). 6. Calibration + accuracy tuning.