|
| 1 | +Toolbox Aid |
| 2 | +David Quesenberry |
| 3 | +04/05/2026 |
| 4 | +debug-surfaces-external-integration.md |
| 5 | + |
| 6 | +# Debug Surfaces External Integration |
| 7 | + |
| 8 | +## Audience |
| 9 | +Engine consumers, sample/game maintainers, and tool integrators that need to adopt the debug platform safely without coupling to internals. |
| 10 | + |
| 11 | +## Public Integration Path |
| 12 | +Use sample/game composition-level wiring only: |
| 13 | +1. Resolve debug flags/mode at entry (`dev|qa|prod`). |
| 14 | +2. Initialize debug integration only when debug is enabled. |
| 15 | +3. Pass integration into the scene layer as an optional dependency. |
| 16 | +4. Invoke update/render hooks only when integration exists. |
| 17 | +5. Dispose integration on scene exit/teardown. |
| 18 | + |
| 19 | +Reference implementation: |
| 20 | +- `samples/Phase 12 - Demo Games/Demo 1205 - Multi-System Demo/main.js` |
| 21 | +- `samples/Phase 12 - Demo Games/Demo 1205 - Multi-System Demo/MultiSystemDemoScene.js` |
| 22 | + |
| 23 | +## Production-Safe Contract |
| 24 | +- Debug is opt-in. |
| 25 | +- `prod` defaults to disabled. |
| 26 | +- Runtime query override is explicit (`?debug=1`). |
| 27 | +- No debug integration object means no console/overlay update or render overhead. |
| 28 | + |
| 29 | +## Build/Config Flags |
| 30 | +Entry-level build/config flags: |
| 31 | +- `BUILD_DEBUG_MODE` |
| 32 | +- `BUILD_DEBUG_ENABLED` |
| 33 | + |
| 34 | +Runtime overrides: |
| 35 | +- `debug` query param (`0|1|true|false|on|off|yes|no`) |
| 36 | +- `debugMode` query param (`dev|qa|prod`) |
| 37 | + |
| 38 | +## Performance-Safe Overlay Rules |
| 39 | +- Overlay and console are not initialized when debug is disabled. |
| 40 | +- Scene update/render checks remain guarded by optional integration presence. |
| 41 | +- Debug surfaces render last only when enabled. |
| 42 | + |
| 43 | +## Boundaries |
| 44 | +- No engine-core mutation required for adoption. |
| 45 | +- No direct access to private runtime state from integration consumers. |
| 46 | +- Track G (network) and Track H (3D) extensions are intentionally outside this contract. |
0 commit comments