aether-shards/.cursor/rules/RULE.md
Matthew Mone a7c60ac56d Implement Research system and enhance mission management
- Introduce the ResearchManager to manage tech trees, node unlocking, and passive effects, enhancing gameplay depth.
- Update GameStateManager to integrate the ResearchManager, ensuring seamless data handling for research states.
- Implement lazy loading for mission definitions and class data to improve performance and resource management.
- Enhance UI components, including the ResearchScreen and MissionBoard, to support new research features and mission prerequisites.
- Add comprehensive tests for the ResearchManager and related UI components to validate functionality and integration within the game architecture.
2026-01-01 09:18:09 -08:00

1.7 KiB

description globs alwaysApply
High-level technical standards, file structure, and testing requirements for the Aether Shards project. src/*.js, test/*.js** true

General Project Standards

Tech Stack

  • Engine: Three.js + Vanilla JavaScript (ES Modules).
  • UI: LitElement (Web Components).
  • State: Custom State Managers (Singletons).
  • Persistence: IndexedDB (via Persistence.js).
  • Testing: @web/test-runner + @esm-bundle/chai + sinon.

File Structure

  • src/core/: The main loop, state management, and input handling.
  • src/grid/: Voxel data structures and rendering logic.
  • src/units/: Entity classes (Explorer, Enemy).
  • src/managers/: Logic controllers (UnitManager, MissionManager).
  • src/systems/: Gameplay logic (TurnSystem, EffectProcessor, AI).
  • src/generation/: Procedural algorithms.
  • src/ui/: LitElement components.
  • assets/data/: JSON definitions (Classes, Items, Missions).

Testing Mandate (TDD)

  1. Test First: All logic must have a corresponding test suite in test/.
  2. Conditions of Acceptance (CoA): Every feature must define CoAs, and tests must explicitely verify them.
  3. Headless WebGL: Tests involving Three.js/WebGL must handle headless contexts (SwiftShader) gracefully or use mocks.
  4. No Global Side Effects: Tests must clean up DOM elements and Three.js resources (dispose()) after execution.

Coding Style

  • Use ES6 Modules (import/export).
  • Lazy load at need, only staticly import if something is needed at load, prior to user interaction.
  • Prefer const over let. No var.
  • Use JSDoc for all public methods and complex algorithms.
  • No Circular Dependencies: Managers should not import GameLoop. GameLoop acts as the orchestrator.