← Back to Documentation Index

Backend Runtime Structure

Nova64 now treats runtime/ as the stable public/runtime layer and moves renderer-specific implementation into backend folders.

Sponsor

Folder Layout

runtime/
  api-3d.js
  gpu-threejs.js
  gpu-babylon.js
  api-3d/
  backends/
    threejs/
    babylon/
  shared/

Ownership

Public Compatibility Rules

Backend Surface Contract

runtime/shared/backend-surface.js defines the shared backend surface used to keep Three.js and Babylon aligned.

It currently separates:

This contract is used to:

Capability Flags

Each backend exposes explicit capability flags:

Use capability checks for behavior that is intentionally unsupported instead of silent no-ops. Current examples include Babylon particles, post-processing, and dithering behavior.

Cart Reset Lifecycle

Nova64 now has a shared cart-reset pipeline so cart loads do not depend on scattered one-off cleanup calls.

Primary pieces:

The default browser/runtime reset sequence now covers:

Why this exists:

Rule for future runtime work:

Tests That Guard This Split

Public Backend Entry Points

Babylon Notes

The Babylon backend implementation is grouped into focused modules. The main implementation areas are:

Current Babylon design rules:

Babylon Compatibility Layer

runtime/backends/babylon/compat.js is the normalization layer for Babylon objects that need to satisfy long-standing Three-style cart expectations.

It currently provides parity shims for:

Design rules for this layer:

Recent Babylon Rendering Work

Recent parity work focused on the places where carts were still clearly broken under Babylon:

Current visual status:

Focused Validation

These are the most useful narrow checks for the current Babylon parity surface:

Use the WAD-specific visual and regression slices first when touching Babylon WAD rendering, UVs, materials, lights, or compatibility shims. Use the voxel-focused regression and backend-parity slices first when touching runtime/api-voxel.js or runtime/backends/babylon/voxel.js. Use the XR/AR slice first when touching runtime/xr.js, runtime/mediapipe.js, or demos that call WebXR/MediaPipe APIs. Use the TSL Galaxy slice first when touching Babylon post-processing, procedural shader materials, particle glow, or the tsl-showcase cart.

Remaining Babylon Work

Remaining Babylon parity work is tracked in ../BACKLOG.md. Keep this document focused on backend architecture, runtime contracts, and validation guidance rather than a second backlog.

Extending The Runtime

When adding a new cart-facing 3D API:

  1. Add the function to the appropriate backend module(s).
  2. Update runtime/shared/backend-surface.js if it is required or capability-gated.
  3. Expose it through the public wrapper layer.
  4. Add or update parity coverage in Playwright.

When behavior is backend-specific:

  1. Add an explicit capability flag.
  2. Fail safely instead of throwing in normal cart usage.
  3. Cover the limitation with a focused regression or compatibility test.