aether-shards/.cursor/rules/RULE.md
Matthew Mone a9d4064dd8 Implement Marketplace system and enhance game state management
- Introduce the Marketplace system, managed by MarketManager, to facilitate buying and selling items, enhancing player engagement and resource management.
- Update GameStateManager to integrate the new MarketManager, ensuring seamless data handling and persistence for market transactions.
- Add specifications for the Marketplace UI, detailing layout, functionality, and conditions of acceptance to ensure a robust user experience.
- Refactor existing components to support the new marketplace features, including dynamic inventory updates and currency management.
- Enhance testing coverage for the MarketManager and MarketplaceScreen to validate functionality and integration within the game architecture.
2025-12-31 13:52:59 -08:00

1.6 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).
  • 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.