Chunk/WorldWorker/Entities 渲染管线重构优化
- Dominant language
- JavaScript
- Stars
- 1
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
Chunk/WorldWorker/Entities 架构重构计划
背景
在解决 Chunk 切割 entities 问题的过程中发现,当前代码实现不够清晰和健壮。主要问题包括:
1. Chunk.js 职责过重:单个类承担了渲染管理、数据管理、碰撞管理、实体管理、持久化、合并优化、动态方块处理、跨
Chunk 支持、Face Culling 等过多职责
2. 调用顺序混乱:addBlockDynamic() 函数长达 300+ 行,逻辑分支复杂
3. 跨 Chunk 处理冗余:belongsToStructure() 在多处重复定义,regenerateCrossChunkColliders() 有两套逻辑
4. Face Culling 双重实现:Worker 和主线程都有计算逻辑,职责不清
重构目标
- 不改变现有功能逻辑
- 不降低 FPS 性能
- 让 entities 渲染、Chunk 渲染、玩家互动后的方块存储和优化的执行调用顺序清晰合理
- 让 face culling、consolidation、instancedMesh 管理机制简单、清晰、可靠
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by mapping the responsibilities and call order around Chunk.js, especially addBlockDynamic(), belongsToStructure(), and regenerateCrossChunkColliders(). Compare the Worker and main-thread face-culling paths, then define how entity rendering, chunk rendering, storage, consolidation, and instancedMesh management should be separated. Done means existing behavior is preserved, FPS does not regress, and the execution order is clear and reliable.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- game-dev
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100