Skip to content

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 captures the game's live scene; edits persist as a structural-path overlay
Capture the live scene, edit it directly, persist as an overlay.

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.

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.

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.

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).