Ingesting unmodified games
The headline capability: vgai’s editor can load and edit a three.js game it didn’t author, without modifying the game’s code.
The render-accessor trap
Section titled “The render-accessor trap”IngestGameAdapter (packages/editor/src/authoring/ingest-game-adapter.ts) captures an
unmodified game’s live scene + camera via the render-accessor trap — it observes the
game’s own renderer.render(scene, camera) call to grab the objects, with zero edits to the
game. It returns a MountedGame that drives its own loop.
Editing the live tree (anti-shim)
Section titled “Editing the live tree (anti-shim)”IngestAuthoringAdapter implements the AuthoringAdapter directly over the live Object3D
tree — it does not fabricate a SceneEntity. Nodes get structural-path ids (stable
across reloads) so selection/transform/inspector work on the foreign objects as-is.
Overlay persistence
Section titled “Overlay persistence”Because you can’t rewrite the game’s source, edits persist as an overlay
(ingest-overlay.ts): each edit is keyed by its structural-path id and written to a
.vgai/overlays/<game>.json file. After the game rebuilds its scene on reload, the overlay is
re-applied — so your edits survive without touching the original.
iframe tiers
Section titled “iframe tiers”For games that can’t share the editor’s three instance, the iframe ingest path
(ingest-iframe-adapter.ts, mountIngestGameEmbed) hosts them in a sandboxed iframe. Two tiers:
- embed-only — an opaque bundle is hosted and disposed, but not introspected or paused (a sandboxed opaque iframe can’t be controlled).
- reachable-three — the iframe shares the editor’s
three, enabling in-realm editing (with documented cross-realm gizmo limitations).
See also
Section titled “See also”- The adapter architecture — the interfaces this builds on.
- Capstone ports — first-party ports done by mapping onto vgai’s model.