072dec03b4
🔍 Lint / 🪄 Check lint (pull_request) Has been cancelled
🔍 Lint / 🎨 Check format (pull_request) Has been cancelled
🔍 Lint / 🔎 Typecheck (pull_request) Has been cancelled
📊 Quality / 🔒 Security Audit (pull_request) Has been cancelled
📊 Quality / 📋 Dependency Freshness (pull_request) Has been cancelled
📊 Quality / 📦 Bundle Size (pull_request) Has been cancelled
🔍 Lint / 🏗 Build (pull_request) Has been cancelled
2.6 KiB
2.6 KiB
Map Performance Notes
This document tracks the current map-rendering performance pass.
Current Runtime Path
public/map.jsonis the source of map transforms.src/world/GameMap.tsxrenders regular visual map nodes.src/world/vegetation/VegetationSystem.tsxalready instances dense vegetation.src/world/map-instancing/MapInstancingSystem.tsxinstances selected repeated static map assets.src/world/GameMapCollision.tsxkeeps terrain collision separate for the player octree.
Main Bottlenecks Found
The most important signal is draw calls, not only triangle count.
| Model | Instances | Meshes / primitives | Notes |
|---|---|---|---|
generateur |
3 | 3152 | Worst draw-call offender. Needs asset-side mesh merging. |
lafabrik |
4 | 56 | Moderate draw calls, heavy 2048 texture set. |
ecole |
1 | 107 | One material but many primitives; should be merged. |
fermeverticale |
3 | 1 | Geometry is fine; textures are large for the visible complexity. |
generateur is especially expensive because three visible instances can multiply thousands of primitives into thousands of draw calls. Instancing reduces repeated instance cost, but the source asset still needs a cleaner export.
Current Code-Side Optimization
Repeated static assets are configured in:
src/world/map-instancing/mapInstancingConfig.ts
Those names are excluded from the regular GameMap clone path, then rendered by MapInstancingSystem with THREE.InstancedMesh.
This keeps the existing map authoring format while reducing repeated draw calls for selected assets.
Asset-Side Follow-Up
Design/export should prioritize:
- Merge
generateurmeshes from 3152 primitives to a small number of material groups. - Reduce
lafabriktexture count and downscale flat/low-detail maps. - Merge
ecoleprimitives because it uses a single material. - Prefer runtime
.glbor compressed runtime textures when the pipeline supports it.
Safety Rules
- Do not instance
terrainfor player collision without validatingOctree.fromGraphNodesupport. - Do not replace repair-game models with optimized map models unless repair node names are preserved.
- Dispose only GPU resources created locally. Do not dispose textures or geometries owned by
useGLTF's cache.