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