Optimize performance, add textures, mobile controls, and production polish#1
Merged
Merged
Conversation
Performance: - Replace O(n log n) per-frame getTerrainHeight() with analytical O(1) formula (was iterating 6561 grid points per entity per frame) - Use InstancedMesh for grass (500), stones (100), tree trunks (45) and tree foliage (~1125 spheres), cutting ~1700 draw calls to ~5 - Device-aware quality: mobile/low-power auto-caps pixel ratio, shadow size, grass/stone/cloud/tree counts, and floor tessellation - FPS counter with auto-drop to low quality when FPS < 28 for sustained period - Pause render loop when tab hidden Textures: - Added procedural canvas textures as defaults: grass, bark, leaves, stone wall, rock, character armor, chungi weave - Portal-uploaded textures continue to override these defaults Mobile controls: - Robust UA + touch + width detection - Larger circular action buttons, bigger pause button on mobile - Mobile hint banner shown briefly on start - Haptic feedback on jump/dash/throw/hit/bot elimination/victory Production polish: - 3-hit health system with invulnerability frames, damage flash, knockback - Persistent score with best-score localStorage - Minimap (canvas) with bots, chungi, player facing - Persistent graphics settings in localStorage, UI reflects saved state - Loading overlay during init - Bot meshes disposed properly on elimination (no leaks) - Music gracefully retries if autoplay blocked Co-Authored-By: Gamer33xz <razzacharya6@gmail.com>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Massive overhaul of
index.htmlto make Chungi Hunter 3D production-ready: big perf fixes, procedural textures, real mobile support, and gameplay polish. No external assets are required — all new textures are generated procedurally at runtime.Performance (the big wins)
getTerrainHeight()that iterated all 6,561 grid points for every entity. This alone removed ~70k ops per frame across player/8 bots/chungi/camera.InstancedMeshfor scenery: grass (500), stones (100), tree trunks (45), and tree foliage (~1,125 spheres) are now drawn in just a handful of draw calls instead of ~1,700.Textures
portal.htmlcontinue to override the procedural defaults exactly as before.Mobile
maxTouchPoints+ viewport width) sets abody.is-mobileclass.navigator.vibrate) on jump, dash, throw, bot elimination, player hit, and victory.Production polish
localStorage.localStorage, restored on load.Review & Testing Checklist for Human
portal.htmltexture uploads still override the new procedural defaults (floor/wall/tree/player/bot/chungi).Notes
<script>already inindex.html.index.htmlwere normalized from CRLF to LF as part of the edit;portal.htmlwas intentionally left as-is to keep the diff focused.terrainHeightsgrid array is gone — terrain height is now purely analytical and matches the generated mesh exactly.Link to Devin session: https://app.devin.ai/sessions/5b14cc25db654389a1752fce6fbdfb83
Requested by: @alimohomad