YHH
bdbbf8a80a
feat(ecs): 添加 @NetworkEntity 装饰器,支持自动广播实体生成/销毁 ( #395 )
...
* docs: add editor-app README with setup instructions
* docs: add separate EN/CN editor setup guides
* feat(ecs): add @NetworkEntity decorator for auto spawn/despawn broadcasting
- Add @NetworkEntity decorator to mark components for automatic network broadcasting
- ECSRoom now auto-broadcasts spawn on component:added event
- ECSRoom now auto-broadcasts despawn on entity:destroyed event
- Entity.destroy() emits entity:destroyed event via ECSEventType
- Entity active state changes emit ENTITY_ENABLED/ENTITY_DISABLED events
- Add enableAutoNetworkEntity config option to ECSRoom (default true)
- Update documentation for both Chinese and English
2025-12-30 16:19:01 +08:00
YHH
1f297ac769
feat(ecs): ECS 网络状态同步系统 | add ECS network state synchronization ( #390 )
...
## @esengine/ecs-framework
新增 @sync 装饰器和二进制编解码器,支持基于 Component 的网络状态同步:
- `sync` 装饰器标记需要同步的字段
- `ChangeTracker` 组件变更追踪
- 二进制编解码器 (BinaryWriter/BinaryReader)
- `encodeSnapshot`/`decodeSnapshot` 批量编解码
- `encodeSpawn`/`decodeSpawn` 实体生成编解码
- `encodeDespawn`/`processDespawn` 实体销毁编解码
将以下方法标记为 @internal,用户应通过 Core.update() 驱动更新:
- Scene.update()
- SceneManager.update()
- WorldManager.updateAll()
## @esengine/network
- 新增 ComponentSyncSystem 基于 @sync 自动同步组件状态
- 将 ecs-framework 从 devDependencies 移到 peerDependencies
## @esengine/server
新增 ECSRoom,带有 ECS World 支持的房间基类:
- 每个 ECSRoom 在 Core.worldManager 中创建独立的 World
- Core.update() 统一更新 Time 和所有 World
- onTick() 只处理状态同步逻辑
- 自动创建/销毁玩家实体
- 增量状态广播
2025-12-29 21:08:34 +08:00
YHH
afdeb00b4d
feat(server): 添加可插拔速率限制系统 | add pluggable rate limiting system ( #388 )
...
* feat(server): 添加可插拔速率限制系统 | add pluggable rate limiting system
- 新增令牌桶策略 (TokenBucketStrategy) - 推荐用于一般场景
- 新增滑动窗口策略 (SlidingWindowStrategy) - 精确跟踪
- 新增固定窗口策略 (FixedWindowStrategy) - 简单高效
- 新增房间速率限制 mixin (withRateLimit)
- 新增速率限制装饰器 (@rateLimit, @noRateLimit)
- 新增按消息类型限流装饰器 (@rateLimitMessage, @noRateLimitMessage)
- 支持与认证系统组合使用
- 添加中英文文档
- 导出路径: @esengine/server/ratelimit
* docs: 更新 README 添加新模块 | update README with new modules
- 添加程序化生成 (procgen) 模块
- 添加 RPC 框架模块
- 添加游戏服务器 (server) 模块
- 添加事务系统 (transaction) 模块
- 添加世界流送 (world-streaming) 模块
- 更新网络模块描述
- 更新项目结构目录
2025-12-29 17:12:54 +08:00
YHH
61a13baca2
feat(server): 添加可插拔认证系统 | add pluggable authentication system ( #386 )
...
* feat(server): 添加可插拔认证系统 | add pluggable authentication system
- 新增 JWT 认证提供者 (createJwtAuthProvider)
- 新增 Session 认证提供者 (createSessionAuthProvider)
- 新增服务器认证 mixin (withAuth)
- 新增房间认证 mixin (withRoomAuth)
- 新增认证装饰器 (@requireAuth, @requireRole)
- 新增测试工具 (MockAuthProvider)
- 新增中英文文档
- 导出路径: @esengine/server/auth, @esengine/server/auth/testing
* fix(server): 使用加密安全的随机数生成 session ID | use crypto-secure random for session ID
2025-12-29 16:10:09 +08:00
YHH
3b978384c7
feat(framework): server testing utils, transaction storage simplify, pathfinding tests ( #384 )
...
## Server Testing Utils
- Add TestServer, TestClient, MockRoom for unit testing
- Export testing utilities from @esengine/server/testing
## Transaction Storage (BREAKING)
- Simplify RedisStorage/MongoStorage to factory pattern only
- Remove DI client injection option
- Add lazy connection and Symbol.asyncDispose support
- Add 161 unit tests with full coverage
## Pathfinding Tests
- Add 150 unit tests covering all components
- BinaryHeap, Heuristics, AStarPathfinder, GridMap, NavMesh, PathSmoother
## Docs
- Update storage.md for new factory pattern API
2025-12-29 15:02:13 +08:00
YHH
d4cef828e1
feat(transaction): 添加游戏事务系统 | add game transaction system ( #381 )
...
- TransactionManager/TransactionContext 事务管理
- MemoryStorage/RedisStorage/MongoStorage 存储实现
- CurrencyOperation/InventoryOperation/TradeOperation 内置操作
- SagaOrchestrator 分布式 Saga 编排
- withTransactions() Room 集成
- 完整中英文文档
2025-12-29 10:54:00 +08:00
YHH
fb8bde6485
feat(network): 网络模块增强 - 预测、AOI、增量压缩 ( #379 )
...
- 添加 NetworkPredictionSystem 客户端预测系统
- 添加 NetworkAOISystem 兴趣区域管理
- 添加 StateDeltaCompressor 状态增量压缩
- 添加断线重连和状态恢复
- 增强协议支持时间戳、序列号、速度
- 添加中英文文档
2025-12-29 10:42:48 +08:00
YHH
0662b07445
chore: update pathfinding, add rpc/world-streaming docs, refactor world-streaming location ( #376 )
2025-12-28 19:18:28 +08:00
YHH
b6f1235239
feat(server): 添加游戏服务器框架 | add game server framework ( #366 )
...
**@esengine/server** - 游戏服务器框架 | Game server framework
- 文件路由系统 | File-based routing
- Room 生命周期 (onCreate, onJoin, onLeave, onTick, onDispose)
- @onMessage 装饰器 | Message handler decorator
- 玩家管理与断线处理 | Player management with auto-disconnect
- 内置 JoinRoom/LeaveRoom API | Built-in room APIs
- defineApi/defineMsg 类型安全辅助函数 | Type-safe helpers
**create-esengine-server** - CLI 脚手架工具 | CLI scaffolding
- 生成 shared/server/client 项目结构 | Project structure
- 类型安全的协议定义 | Type-safe protocol definitions
- 包含 GameRoom 示例 | Example implementation
**其他 | Other**
- 删除旧的 network-server 包 | Remove old network-server
- 更新服务器文档 | Update server documentation
2025-12-28 12:23:55 +08:00
YHH
7940f581a6
feat(rpc,network): 新增 RPC 库并迁移网络模块 ( #364 )
...
* feat(rpc,network): 新增 RPC 库并迁移网络模块
## @esengine/rpc (新增)
- 新增类型安全的 RPC 库,支持 WebSocket 通信
- 新增 RpcClient 类:connect/disconnect, call/send/on/off/once 方法
- 新增 RpcServer 类:Node.js WebSocket 服务端
- 新增编解码系统:支持 JSON 和 MessagePack
- 新增 TextEncoder/TextDecoder polyfill,兼容微信小游戏平台
- 新增 WebSocketAdapter 接口,支持跨平台 WebSocket 抽象
## @esengine/network (重构)
- 重构 NetworkService:拆分为 RpcService 基类和 GameNetworkService
- 新增 gameProtocol:类型安全的 API 和消息定义
- 新增类型安全便捷方法:sendInput(), onSync(), onSpawn(), onDespawn()
- 更新 NetworkPlugin 使用新的服务架构
- 移除 TSRPC 依赖,改用 @esengine/rpc
## 文档
- 新增 RPC 模块文档(中英文)
- 更新 Network 模块文档(中英文)
- 更新侧边栏导航
* fix(network,cli): 修复 CI 构建和更新 CLI 适配器
## 修复
- 在 tsconfig.build.json 添加 rpc 引用,修复类型声明生成
## CLI 更新
- 更新 nodejs 适配器使用新的 @esengine/rpc
- 生成的服务器代码使用 RpcServer 替代旧的 GameServer
- 添加 ws 和 @types/ws 依赖
- 更新 README 模板中的客户端连接示例
* chore: 添加 CLI changeset
* fix(ci): add @esengine/rpc to build and check scripts
- Add rpc package to CI build step (must build before network)
- Add rpc to type-check:framework, lint:framework, test:ci:framework
* fix(rpc,network): fix tsconfig for declaration generation
- Remove composite mode from rpc (not needed, causes CI issues)
- Remove rpc from network project references (resolves via node_modules)
- Remove unused references from network tsconfig.build.json
2025-12-28 10:54:51 +08:00
YHH
8605888f11
docs: restructure documentation with modular sub-pages ( #363 )
...
* docs: split Entity docs into sub-modules and fix Starlight CI
- Split monolithic entity.md into 4 focused sub-documents:
- guide/entity/index.md - Overview and basic concepts
- guide/entity/component-operations.md - Component API operations
- guide/entity/entity-handle.md - EntityHandle system for safe references
- guide/entity/lifecycle.md - Lifecycle and persistence management
- Created bilingual versions (Chinese and English)
- Updated sidebar configuration in astro.config.mjs
- Fixed CI workflow for Starlight migration:
- Updated docs.yml to upload from docs/dist instead of .vitepress/dist
- Updated package.json scripts to use pnpm filter for docs
- Added docs directory to pnpm-workspace.yaml
- Renamed docs package to @esengine/docs
- Documented missing Entity APIs:
- createComponent() method
- addComponents() batch method
- getComponentByType() with inheritance support
- markDirty() for change detection
* docs: split Network docs and fix API errors
- Split network module into focused sub-documents:
- modules/network/index.md - Overview and quick start
- modules/network/client.md - Client-side usage
- modules/network/server.md - Server-side GameServer/Room
- modules/network/sync.md - Interpolation and prediction
- modules/network/api.md - Complete API reference
- Fixed incorrect API documentation:
- localClientId → clientId
- ENetworkState enum values (strings → numbers)
- connect() method signature
- Removed non-existent localPlayerId property
- Fixed onConnected callback signature
- Created bilingual versions (Chinese and English)
- Updated sidebar configuration
- Updated pnpm-lock.yaml for docs workspace
* docs(worker-system): split into focused sub-modules
Split 773-line worker-system.md into 5 focused documents:
- index.md: Core features and quick start
- configuration.md: IWorkerSystemConfig and processing modes
- examples.md: Complete particle physics implementation
- wechat.md: WeChat Mini Game limitations and solutions
- best-practices.md: Performance optimization tips
Updated sidebar config to reflect new structure.
Created both Chinese and English versions.
* docs(scene): split into focused sub-modules
Split 666-line scene.md into 7 focused documents:
- index.md: Overview and quick start
- lifecycle.md: Scene lifecycle methods
- entity-management.md: Entity creation, find, destroy
- system-management.md: System add, remove, control
- events.md: Event system usage
- debugging.md: Stats, performance monitoring
- best-practices.md: Design patterns and examples
Updated sidebar config to reflect new structure.
Created both Chinese and English versions.
* docs(plugin-system): split into focused sub-modules
Split 645-line plugin-system.md into 7 focused documents:
- index.md: Overview and quick start
- development.md: IPlugin interface and lifecycle
- services-systems.md: Register services and add systems
- dependencies.md: Dependency management
- management.md: Plugin management via Core/PluginManager
- examples.md: Complete plugin examples
- best-practices.md: Design guidelines and FAQ
Updated sidebar config to reflect new structure.
Created both Chinese and English versions.
* docs(behavior-tree): add English docs and expand sidebar navigation
- Add 12 English behavior-tree documentation pages
- Update sidebar config to show behavior-tree sub-navigation
- Include: overview, getting-started, core-concepts, custom-actions,
editor-guide, editor-workflow, asset-management, advanced-usage,
best-practices, cocos-integration, laya-integration, nodejs-usage
* docs(modules): split spatial and timer module docs
Spatial module (602 lines -> 5 files):
- index.md: Overview and quick start
- spatial-index.md: Grid index, range queries, raycasting API
- aoi.md: Area of Interest management
- examples.md: Combat, MMO sync, AI perception examples
- utilities.md: Geometry detection, performance tips
Timer module (481 lines -> 4 files):
- index.md: Overview and core concepts
- api.md: Complete timer and cooldown API
- examples.md: Skill cooldowns, DOT, buff systems
- best-practices.md: Usage tips, ECS integration
Also includes English versions and sidebar navigation updates.
* docs: split FSM, pathfinding, blueprint, procgen module docs
- FSM: Split into index, api, examples (3 files)
- Pathfinding: Split into index, grid-map, navmesh, smoothing, examples (5 files)
- Blueprint: Split into index, vm, custom-nodes, nodes, composition, examples (6 files)
- Procgen: Split into index, noise, random, sampling, examples (5 files)
- Added English versions for all split modules
- Updated sidebar navigation with sub-menus for all modules
2025-12-27 20:35:54 +08:00
YHH
d57a007a42
docs: split Entity docs into sub-modules and fix Starlight CI ( #362 )
...
* docs: split Entity docs into sub-modules and fix Starlight CI
- Split monolithic entity.md into 4 focused sub-documents:
- guide/entity/index.md - Overview and basic concepts
- guide/entity/component-operations.md - Component API operations
- guide/entity/entity-handle.md - EntityHandle system for safe references
- guide/entity/lifecycle.md - Lifecycle and persistence management
- Created bilingual versions (Chinese and English)
- Updated sidebar configuration in astro.config.mjs
- Fixed CI workflow for Starlight migration:
- Updated docs.yml to upload from docs/dist instead of .vitepress/dist
- Updated package.json scripts to use pnpm filter for docs
- Added docs directory to pnpm-workspace.yaml
- Renamed docs package to @esengine/docs
- Documented missing Entity APIs:
- createComponent() method
- addComponents() batch method
- getComponentByType() with inheritance support
- markDirty() for change detection
* docs: split Network docs and fix API errors
- Split network module into focused sub-documents:
- modules/network/index.md - Overview and quick start
- modules/network/client.md - Client-side usage
- modules/network/server.md - Server-side GameServer/Room
- modules/network/sync.md - Interpolation and prediction
- modules/network/api.md - Complete API reference
- Fixed incorrect API documentation:
- localClientId → clientId
- ENetworkState enum values (strings → numbers)
- connect() method signature
- Removed non-existent localPlayerId property
- Fixed onConnected callback signature
- Created bilingual versions (Chinese and English)
- Updated sidebar configuration
- Updated pnpm-lock.yaml for docs workspace
2025-12-27 13:28:49 +08:00
YHH
89cdfe396b
docs: migrate documentation from VitePress to Starlight ( #361 )
...
- Replace VitePress with Astro Starlight for documentation
- Reorganize document structure with better hierarchy
- Split large documents into sub-modules for better readability
- Add new sections: component, entity-query, serialization, system
- Support both Chinese (default) and English documentation
- Add responsive design and improved navigation
2025-12-27 12:54:53 +08:00