feat: add initial implementation of ECS architecture and systems
- Introduced a minimal Entity-Component-System (ECS) framework in `ecs.ts` with basic entity management and component handling. - Created `World` class to manage entities and components, including methods for creating, adding, retrieving, and removing components. - Implemented unit tests for the `World` class in `ecs.test.ts` to ensure functionality. - Developed input handling with `InputSystem` to capture keyboard events. - Added `PhysicsSystem` for movement and collision detection. - Created `RenderSystem` to handle drawing entities on the canvas. - Set up a main game loop in `main.ts` to integrate systems and manage game state. - Added SVG icons and images for UI elements. - Included CSS styles for layout and theming. - Configured TypeScript settings in `tsconfig.json` for project compilation. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
# ZAMNY Client
|
||||
|
||||
Vite + TypeScript + Canvas 2D + ECS game client for _Zombies Ate My Neighbors_ browser edition.
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
npm install
|
||||
npm run dev # http://localhost:5173
|
||||
npm test # vitest (ECS tests)
|
||||
npm run build
|
||||
```
|
||||
|
||||
## Structure
|
||||
|
||||
```txt
|
||||
src/
|
||||
engine/
|
||||
ecs.ts # World, Entity, Component, System base
|
||||
ecs.test.ts # 6 unit tests (green)
|
||||
systems/
|
||||
InputSystem.ts # keyboard/touch stub
|
||||
RenderSystem.ts # Canvas 2D stub
|
||||
PhysicsSystem.ts # movement/collision stub
|
||||
main.ts # 60 FPS game loop + system orchestration
|
||||
```
|
||||
|
||||
## Key Points
|
||||
|
||||
- ECS core: `createEntity`, `addComponent`, `query`, `destroyEntity`
|
||||
- Systems extend `System` and implement `update(world, dt)`
|
||||
- Target: 60 FPS, offline single-player works without server
|
||||
- Nickname UI, NetworkClient, sprite rendering: TODO
|
||||
|
||||
## Testing
|
||||
|
||||
- Vitest + jsdom
|
||||
- `npm test` runs `ecs.test.ts`
|
||||
- Coverage target: 70% (documented in ARCHITECTURE.md §10)
|
||||
|
||||
See root [README.md](../README.md) and [ARCHITECTURE.md](../ARCHITECTURE.md) for full design.
|
||||
Reference in New Issue
Block a user