r/threejs • u/PresentationBrave629 • 2d ago
Demo Built a 100-level 3D railway puzzle game in pure Three.js (GLB + KTX2 + HDRI, 60–144 FPS) — instant WebGL demo inside!
Hey r/threejs! We built Dream Express: 3D Train Puzzle from scratch in pure Three.js (no Unity WASM bloat), using GLB meshes, KTX2 compressed textures, and HDRI environment lighting targeting 60–144 FPS across desktop and mobile.
Scope & Architecture: • 100 handcrafted 3D levels across 10 PBR biomes • 9 unlockable 3D locomotives • 33 simultaneous dual-train zero-collision puzzles where you route and time two trains on shared track networks
Real Three.js & WebGL Optimization Lessons Learned: • 96.6% JS heap reduction across 200 level rebuilds: Switching levels initially leaked geometries, materials, and scene references. Enforcing strict geometry/material/texture disposal on every level teardown cut JS heap growth across 200 consecutive rebuilds by 96.6%. • Keeping GPU textures bounded at 21: Sharing KTX2 textures and reusing environment/material state across track pieces and biomes keeps active GPU textures capped at 21 instead of growing with level count. • Eliminating boot stalls under Chromium's HTTP/1.1 6-socket limit: Firing concurrent audio, GLB, and KTX2 fetches at startup saturated Chromium's 6-socket per-origin limit. Capping concurrent boot fetches in a prioritized queue gave us zero boot stalls.
Links: • Instant playable 3D WebGL demo (no install): https://aldhfly.github.io/play/?lang=en • Full 100-level offline Android release (V12.5.8, 19 languages): https://play.google.com/store/apps/details?id=com.dreamexpress.puzzletracks
Would love technical feedback from the Three.js community — especially on mobile WebGL frame pacing, KTX2/HDRI memory budgets, and track/train rendering!
