Before making any changes, create a new git branch dedicated to mobile support, loading, and performance optimization.
Use ultracode throughout.
Perform a full /loop optimization pass over the Battle of Hoth Three.js/WebGL2 implementation.
The project already has performance instrumentation, quality presets, resolution scaling, touch controls, and a coarse-pointer mobile fallback. Improve and extend what exists rather than replacing it.
Prioritize measurable bottlenecks:
- Startup/loading time, asset fetching/decoding, shader compilation, GPU warm-up
- FPS and frame-time spikes
- Render-target and post-processing cost
- Shadows, depth prepass, SSR, TAA, DoF, shafts, bloom
- Terrain/deformation simulation
- Walkers, speeder, particles/VFX and draw calls
- GPU memory, texture sizes, allocations, and unnecessary per-frame work
Profile first and attack the largest costs. Preserve visual quality on capable desktop hardware.
For mobile/low-end devices, build a more aggressive adaptive quality path that can dynamically reduce resolution, shadow quality, post effects, particles, deformation detail, LOD/detail, and other expensive systems when needed.
Review the existing touchControls.js implementation and make the flying experience feel genuinely good on phones/tablets. Do not merely confirm that buttons exist... test steering, looking, firing, boost/actions, HUD layout, safe areas, multi-touch, responsiveness, and accidental input.
Also improve perceived loading:
- Parallelize independent work where appropriate
- Avoid loading/decoding assets that are not immediately needed
- Reduce blocking work before entering the battle
- Preserve necessary shader/pipeline warm-up so the first gameplay moments do not hitch
Fan out sub-agents across non-overlapping areas: loading/assets, rendering/post, terrain/physics, VFX/entities, mobile controls/UX, and profiling.
After every implementation, send it to a separate extremely harsh performance/mobile reviewer using /loop.
The reviewer must look for regressions, visual degradation, frame spikes, bad mobile controls, memory issues, unnecessary GPU work, loading stalls, and optimizations that only improve synthetic metrics while hurting gameplay.
Fix everything it finds and repeat.
Do not stop until desktop quality is preserved, loading is meaningfully faster, low-end/mobile performance is substantially improved, mobile controls feel intentional, and the reviewer is genuinely impressed.
Use ultracode throughout.