A WebGPU-native, TypeScript-first open-source engine for large-scale real-time 3D worlds.
Horizon is a data-oriented game engine built for the modern web platform. It targets WebGPU as the primary rendering backend and uses TypeScript throughout — runtime, tooling, and gameplay systems alike.
- GitHub:
https://github.com/RobVanProd/HorizonEngine
The engine is organized into isolated subsystem packages:
| Package | Description |
|---|---|
@engine/memory |
SharedArrayBuffer pools, typed stores, binary schema utilities |
@engine/ecs |
Archetype-based Entity Component System with SoA storage |
@engine/platform |
Browser capability detection, WebGPU context, input abstraction |
@engine/scheduler |
Frame loop, phase-based scheduling, job dispatch |
@engine/profiler |
CPU timing, GPU profiling, metrics collection |
@engine/renderer-webgpu |
WebGPU device management, render pipelines, WGSL shaders |
@engine/core |
Engine bootstrap and subsystem orchestration |
@engine/audio |
Spatial audio system (WebAudio, 3D positional, ECS integration) |
@engine/assets |
Asset loading (glTF/GLB, FBX, HDR, textures) |
@engine/animation |
Skeletal animation, skinning, clip playback |
@engine/world |
Procedural world generation (terrain, splines, biomes, scatter) |
@engine/effects |
Particle effects (Niagara-like emitters, spline/terrain-aware) |
@engine/ai |
AI integration (LLM command API, ML inference, scene/world commands) |
@engine/devtools |
Developer tools (perf dashboard, debug draw, entity inspector) |
@engine/editor |
Scene editor (viewport, hierarchy, properties, assets, gizmos) |
- Node.js >= 20
- pnpm >= 9
- A browser with WebGPU support (Chrome 113+, Edge 113+, Firefox Nightly)
pnpm install
pnpm check # Type-check all packages
pnpm test # Run tests
pnpm dev # Start benchmark example dev serverpnpm dev # Benchmark scene
pnpm dev:large # Large-scene example
pnpm dev:pbr # PBR materials demo
pnpm dev:anim # Animation + audio + AI demo
pnpm dev:editor # Scene editor with procedural terrain, FBX support, and AI commandsThe editor demo loads a boot intro video, then opens the scene editor. With the nature pack present, it now loads a lightweight demo level system and starts with first-nature-expedition: a seeded procedural level with a meandering trail, carved clearings, lake-style water placement, clustered vegetation, objective-gated quest beacons, a native stylized grass field with wind animation, and a small quest-driven narrative loop. The renderer can now keep HDR image-based lighting for reflections while drawing a procedural visible sky, which avoids the blurry photo-probe look in outdoor scenes. With the construction pack in downloaded stuff/unfinished_building_high/ (subdirs with .fbx files), it loads procedural terrain, a road spline, and lays out assets in a grid. Without either pack, it falls back to the Fox glTF demo. Click Play to enter play mode and walk the level in first person. This game demo ships with the engine to showcase what can be built.
- WebGPU renderer with PBR materials, image-based lighting, shadows, and environment maps
- Lighting baseline slice with manual exposure, analytic outdoor fog, and resolution-aware directional shadow filtering
- ECS runtime with transform hierarchy, scheduler phases, and data-oriented component storage
- Asset pipeline for glTF/GLB, FBX, HDR environments, and textures
- Skeletal animation and skinned rendering
- Spatial audio integrated into ECS
- Procedural world generation: terrain, splines, biomes, scatter rules, seed-based reproducibility
- Particle effects with spline- and terrain-aware spawning
- AI command APIs: scene (spawn, list, inspect, setLabel), world (terrain, spline, scatter), editor (viewport, overlays), VFX, geometry stats
- AI Control Plane v0 slice:
scene.read.entities,scene.read.entity,scene.previewPlan, andscene.applyPlanfor safe create/rename/transform planning with structured validation, diffs, and editor-grouped undo - AI benchmark support: a minimal control-plane benchmark harness for replayable preview/apply create, rename, and transform tasks, plus an initial forest-stress metrics surface
- Forest stress benchmarking: a v0 runner for the
first-nature-expeditionforest scene withlow/medium/high/extremedensity labels and structured JSON run records - In-engine devtools plus a scene editor with hierarchy, properties, assets, viewport controls, and transform gizmos
- Play mode with game demo: collect orbs, objective HUD, ships with engine
- The editor demo now resolves levels through a small level-definition contract instead of directly hardcoding one scene path.
first-nature-expeditionis the current procedural first level: seeded terrain, a spline-guided trail, explicit meadow clearings, a localized spring/lake water surface, and a collectible route layered on top.- The renderer environment config now supports choosing a procedural background sky independently from the lighting probe, so HDR reflections do not force a photographic skybox.
- The renderer now includes a dedicated stylized grass material path for merged blade fields with wind animation, field-space color variation, and a dense 5-vertex blade layout inspired by the Three.js grass demo approach; the first level now pushes that path to very high meadow coverage instead of sparse prop density.
- The procedural visible sky now targets a cleaner blue outdoor look and supports engine-side sun-aware cloud shaping in the generated sky cubemap, so outdoor scenes no longer need to rely on a photographic backdrop.
- The WebGPU bootstrap now requests the adapter's higher
maxBufferSizelimit when available, which keeps large merged showcase meshes such as dense meadow fields from failing on the default 256 MB device limit. - Directional shadows now follow and stabilize around the active camera focus instead of a fixed origin-centered light box, which keeps outdoor shadow coverage usable across the playable area instead of only in the middle of the map.
- The first lighting-baseline implementation slice is now in the renderer path:
SceneLightingsupports manual exposure, analytic fog, and shadow normal-bias tuning, exposure is applied before the existing ACES tone mapper, and shadow PCF sampling now derives its texel size from the actual shadow-map resolution instead of assuming2048. - The AI/editor integration now exposes
editor.captureViewportfor direct viewport PNG capture with optional temporary camera overrides or presets, andscene.layoutSummaryfor a compact top-down occupancy/landmark summary, which gives engine-facing agents much better scene context than raw entity lists alone. - The AI package now also includes a reusable
SceneContextLoop, which automatically records the latest live viewport capture, a generated occupancy map, and the matchingscene.layoutSummarypayload behindengine.getSceneContext/engine.captureSceneContext. Real top-down viewport capture remains available on demand so the background loop does not visibly disturb the editor camera. - The AI package now also includes a minimal benchmark harness for the current control-plane slice, so create/rename/transform plan preview/apply behavior can be replayed and measured before the action surface expands; the first forest-scaling spec lives in
docs/roadmap/forest-stress-benchmark-v0.md. - The benchmark package now also includes a concrete Forest Stress Benchmark Runner v0. The first selected scene is
first-nature-expedition, and the four density tiers are produced by parameter scaling against the same seeded scene rather than four separately authored forest maps. Current real benchmark metrics are limited to entity count, mesh count, material count, and renderer frame counters when available. - A browser-accessible entrypoint for that workflow now lives at
examples/editor-demo/forest-benchmark.html. Runpnpm --filter @engine/editor-demo dev, open/forest-benchmark.html, and the page will executelow,medium,high, andextremesequentially on fresh engine instances, log each run as JSON in the console, expose the full array onwindow.__HORIZON_FOREST_BENCHMARK_RESULTS__, and allow downloading the four-run JSON bundle. - Saved forest benchmark bundles can now be compared with the lightweight
@engine/aicomparison helpers inpackages/ai/src/benchmark/forest-stress-compare.ts. The comparison accepts two JSON arrays in the existing run shape, compareslow/medium/high/extremedeterministically, and reports deltas only for the currently real metrics. /forest-benchmark.htmlnow also includes a tiny browser-side comparison helper: paste a baseline JSON bundle into the first textarea, paste a candidate bundle into the second, clickCompare Saved Runs, and the structured comparison JSON is rendered directly on the page. Parse/input errors are shown inline without disrupting the benchmark runner.- The assets package now bridges
@dgreenheck/ez-treeinto engine-native meshes and materials, and the editor exposes those presets as draggable procedural tree assets plus aneditor.addProceduralTreecommand so teams can opt into generated trees instead of authored tree packs. - The world runtime exposes reusable scatter exclusions (
avoidSpline,avoidCircles) so levels can keep trails and landmarks readable without special-case scene code. - The world runtime also exposes water placement controls (
waterScaleX,waterScaleZ, offsets, and material overrides) so a level can ask for a pond, spring, or broad sheet instead of only a full-terrain plane. - The gameplay layer now includes a reusable quest-chain helper for authored step progression, story text, HUD updates, and objective-gated marker visibility. The current slice uses it for camp discovery, seed recovery, shrine restoration, and overlook completion.
- The intent is to keep the demo as a proving ground for engine-facing APIs that AI tools can call and build on, not as a one-off scripted sample.
packages/ Engine subsystems
examples/ Runnable demos and validation apps
Contributions are welcome. See CONTRIBUTING.md for development workflow and expectations.
- WebGPU-first, not WebGL-first
- Data-oriented runtime over object-heavy abstraction
- Multithreaded by design, not as an afterthought
- Modern lighting and visibility pipelines as core systems
- Tooling and profiling are product features, not extras
- Phased technical proof over feature-list theater
- Open-source core with clear subsystem boundaries
- Phase 0 — Foundation and feasibility ✓
- Phase 1 — GPU-driven rendering prototype ✓
- Phase 2 — Runtime and simulation core ✓
- Phase 3 — Lighting and materials ✓
- Phase 4 — Animation and world systems ✓
- Phase 5 — Audio, tooling, and AI integration ✓
- Phase 6 — Scene editor and engine vertical slice ✓
- Phase 7 — Viewport observability, gizmos, asset layout ✓
- Phase 8 — Procedural world foundations, VFX core, lighting, geometry scalability ✓
- Phase 9 — Play mode: first-person exploration (WASD + mouse look, pointer lock) ✓
- Phase 10 — Game demo: collectible exploration, play HUD, ship with engine (current)
Detailed next-program planning and progress tracking now live in docs/roadmap/phase-next.md.
The current design packets for the next implementation slices live in docs/architecture/ai-control-plane-v0.md and docs/architecture/lighting-baseline-v0.md.
The current first-nature-expedition lighting validation preset now uses shadowBias: 0.0024, shadowNormalBias: 0.0012, exposure: 0.98, and lighter fog (color: [0.78, 0.86, 0.93], density: 0.0095, heightFalloff: 0.065, startDistance: 24, maxOpacity: 0.22) to improve canopy readability without changing the renderer feature set.
Do not chase engine theater. Ship proof.
MIT. See LICENSE.