The adapter seam (game, authoring & system adapters)
The reason one editor can drive a first-party .vscn scene, 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:
GameAdapter<K>(mount a game — generic over the world kind, default'threejs'), the kind-taggedMountedWorldhandles (MountedThreeWorld— whichMountedGamepermanently names —MountedPixiWorld,MountedReactWorld), andHostContext(canvas/loop/systems the host provides) — the host knows nothing about.vscnorGameComponent. - First-party + system adapters:
VgaiSceneGameAdapter/fromSetup(the default game adapter) and the system-adapter factories —createRapierPhysicsAdapter,createColyseusNetworkingAdapter,createInputManagerAdapter,createVgaiAssetAdapter,createAnimationAdapter,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),ingest-authoring-adapter+ingest-game/iframe(foreign games),world2d-authoring-adapter(2D),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
- GameAdapter/MountedGame/HostContext = host⇄runtime contract (host knows no .vscn)
- 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