Introduce the HubScreen as the main interface for managing resources, units, and mission selection, integrating with the GameStateManager for dynamic data binding. Implement the MissionBoard component to display and select available missions, enhancing user interaction with mission details and selection logic. Update the GameStateManager to handle transitions between game states, ensuring a seamless experience for players. Add tests for HubScreen and MissionBoard to validate functionality and integration with the overall game architecture.
1.3 KiB
1.3 KiB
| description | globs |
|---|---|
| Standards for Three.js integration, VoxelGrid, and the Game Loop. | src/core/*.js, src/grid/*.js** |
Game Engine Standards
The Game Loop
- Responsibility: The GameLoop is the "God Object" responsible for tying systems together. It owns the Scene, Renderer, Grid, and Managers.
- Phases: The loop must respect the current phase: INIT, DEPLOYMENT, COMBAT, RESOLUTION.
- Input Routing: The loop routes raw inputs from InputManager to the appropriate system (e.g., MovementSystem vs SkillTargeting) based on the current Phase.
Voxel System
- Separation of Concerns:
- VoxelGrid.js: Pure Data. Stores IDs in Uint8Array. Handles physics queries (isSolid). No Three.js dependencies.
- VoxelManager.js: Rendering. Reads VoxelGrid and updates THREE.InstancedMesh. Handles materials and textures.
- Performance:
- Never create individual THREE.Mesh objects for terrain. Use InstancedMesh.
- Hide "Air" voxels by scaling them to 0 rather than removing them from the InstanceMatrix (unless refactoring for chunking).
- Coordinates:
- Use {x, y, z} objects for positions.
- Y is Up.
- Grid coordinates are integers.
Input
- Use InputManager for all hardware interaction.
- Support Mouse, Keyboard, and Gamepad seamlessly.
- Raycasting should return integer Grid Coordinates.