The adapter seam (game, authoring & system adapters)
The reason one editor can drive a first-party TSX/R3F world, an unmodified ingested three.js game, and a 2D PixiJS scene — with the same hierarchy/inspector/gizmo — is a small set of adapter contracts. This is a terminal tour of that seam (real captured output below).
# transcript pending capture — run: node site/media/capture-cli.mjs site/media/capture-cli.mjs -
The runtime adapter seam.
@vgai/engine/adapterexports two layers:- Host⇄runtime:
RootAdapter<K>(mount a root — generic over the adapter surface, default'three'), the surface-taggedMountedRoothandles (MountedThreeRoot— whichMountedRootpermanently names —MountedPixiRoot,MountedReactRoot), and the per-surface host contexts —HostContextBase(the root handle +headless, all any surface is promised) plusThreeHostContext(three, renderer, surface, asset cache),CanvasHostContextandDomHostContext, selected byHostContextFor<K>somount’s PARAMETER is kind-typed too.HostContextis a permanent alias of the three one. The host knows nothing about any document format or engine-specific component class. - First-party + system adapters:
SetupThreeRootAdapter/fromSetup(the default game adapter) and the system-adapter factories —createRapierPhysicsAdapter,createColyseusNetworkingAdapter,createAudioSystemAdapter,createNavigationAdapter— one per subsystem.
- Host⇄runtime:
-
The editor authoring adapters. The editor edits through a neutral
AuthoringAdapter; thelsshows its implementations:vgai-scene-authoring-adapter(first-party),live-three-authoring-adapter(any liveObject3Dtree, first-party or foreign — ingested games included),pixi-authoring-adapter(any livePIXI.Containertree, first-party or ingested — one class, parameterized by identity and write target),react-world-authoring-adapter(React), andcomposite(multi-root). Same contract → the hierarchy/inspector work everywhere.
Recap
New functionality
- Listed the runtime adapter seam
- Listed the editor authoring adapters
New concepts & skills
- RootAdapter/MountedRoot/HostContext = host⇄runtime contract (host knows no document format)
- system-adapter factories wrap each subsystem (physics/net/input/asset/animation/nav)
- one neutral AuthoringAdapter drives first-party, ingest, 2D, and UI uniformly
Next lesson → Ingest an unmodified game