refactor(core): 代码结构优化 & 添加独立 ECS 框架文档 (#316)

Core 库优化:
- Scene.ts: 提取 _runSystemPhase() 消除 update/lateUpdate 重复代码
- World.ts: 可选链简化、提取 _isSceneCleanupCandidate() 消除重复条件
- Entity.ts: 移除过度设计的 EntityComparer
- 清理方法内部冗余注释,保持代码自解释

文档改进:
- 为 core 包创建独立 README (中英文)
- 明确 ECS 框架可独立用于 Cocos/Laya 等引擎
- 添加 sparse-checkout 命令说明,支持只克隆 core 源码
- 主 README 添加 ECS 独立使用提示
This commit is contained in:
YHH
2025-12-23 18:00:21 +08:00
committed by GitHub
parent 828ff969e1
commit 58f70a5783
11 changed files with 983 additions and 744 deletions

View File

@@ -29,6 +29,8 @@
---
> **Just need ECS?** The core ECS framework [`@esengine/ecs-framework`](./packages/core/) can be used standalone with Cocos Creator, Laya, or any JS engine. [View ECS Documentation](./packages/core/README.md)
## Overview
ESEngine is a cross-platform 2D game engine built from the ground up with modern web technologies. It provides a comprehensive toolset that enables developers to focus on creating games rather than building infrastructure.
@@ -238,13 +240,24 @@ pnpm tauri:dev
```
esengine/
├── packages/ # Engine packages (runtime, editor, platform)
├── docs/ # Documentation source
├── examples/ # Example projects
├── scripts/ # Build utilities
└── thirdparty/ # Third-party dependencies
├── packages/
│ ├── core/ # ECS Framework (@esengine/ecs-framework)
│ ├── math/ # Math library (@esengine/math)
│ ├── engine-core/ # Engine lifecycle management
│ ├── sprite/ # 2D sprite rendering
│ ├── tilemap/ # Tilemap system
│ ├── physics-rapier2d/ # Physics engine
│ ├── behavior-tree/ # AI behavior trees
│ ├── editor-app/ # Desktop editor (Tauri)
│ └── ... # Other modules
├── docs/ # Documentation source
├── examples/ # Example projects
├── scripts/ # Build utilities
└── thirdparty/ # Third-party dependencies
```
> **Looking for ECS source code?** The ECS framework is in `packages/core/`
## Documentation
- [Getting Started](https://esengine.cn/guide/getting-started.html)