DomainScoreCursor Rules
GitHub

1/23/2025

A turn-based ASCII simulation game where players observe the rise and fall of ancient nations. The game features a 10x10 grid with nested 10x10 sub-grids, random map generation, resource management, and dynamic nation interactions including trade, war, and peace. The game is designed to be balanced, with no technology tree, and focuses on strategic resource allocation and territorial expansion.



# ASCII Simulation Game

# ASCII Simulation Game: Ancient World Dynamics

## Overview
This is a turn-based simulation game where players observe the dynamics of ancient nations on a 10x10 grid, with each square containing a nested 10x10 sub-grid. The game emphasizes strategic resource management, territorial expansion, and nation interactions such as trade, war, and peace. The game is designed to be balanced, with no technology tree, and focuses on the strategic allocation of resources and the expansion of territories.

## Game Features
- **Random Map Generation**: The map is randomly generated, with resources and terrain features like mountains, rivers, and oceans dynamically placed. Nations spawn at a minimum distance from each other.
- **Resource Management**: Resources are spread across the map, with their value based on rarity. Nations must manage resources like gold, wood, food, and metal to build armies and develop land.
- **Nation Dynamics**: Nations can trade resources, go to war, or make peace. They expand towards resources they lack and away from resources they have in abundance.
- **Armies and Territories**: Armies are the primary means of territorial expansion. They can be used to attack, defend, or conquer squares. Armies require resources to be created and maintained.
- **Towns and Cities**: Population collects in towns and cities, which grow over time. Towns have a radius for gathering resources, and cities can spawn higher-level armies.
- **CRT Monitor Effects**: The game features CRT monitor-like effects to enhance the retro ASCII aesthetic.
- **Conway's Game of Life Influence**: Nations behave like organisms in Conway's Game of Life, reacting to each other and to resources dynamically.
- **Logs and Charts**: The game provides detailed logs of all actions and a chart page to track various game metrics.

## Game Mechanics
- **Turn-Based System**: The game progresses in turns, with nations making decisions based on their current state and the map's resources.
- **Resource Allocation**: Resources are spread across the map, encouraging nations to expand into new squares. Gold must be transported via roads to where it is spent.
- **Army Levels**: Armies range from level 1 to 10, with higher levels requiring more funding. Battles are resolved using a RISK-esque dice roll mechanic influenced by army level.
- **Terrain Features**: Mountains are impassable but provide metal at reduced efficiency. Rivers act as food sources and allow faster army movement. Oceans separate continents and slow army movement.
- **Neutral Land**: Neutral land can be claimed by any nation and is randomly generated each game.

## Development Guidelines
- **Coding Standards**: Use functional components and hooks, prioritize `const` over `let`, and follow camelCase for variables and PascalCase for components.
- **Preferred Libraries**: Use Next.js for navigation and server-side rendering, Tailwind CSS for responsive design, and Shadcn/UI for UI components.
- **File Structure**: Organize files into `components`, `app/[locale]`, `data`, `lib`, and `public` directories for clarity and maintainability.
- **Performance Optimization**: Use `React.memo` for pure components, implement lazy loading for routing components, and optimize `useEffect` dependencies.
- **Testing Requirements**: Write unit tests with Jest and React Testing Library, achieve at least 80% test coverage, and use snapshot testing for UI components.
- **Documentation**: Use JSDoc for function and component comments, include PropTypes validation, and provide README.md files in both English and Chinese.
- **Error Handling**: Use `try/catch` blocks for asynchronous operations and implement a global error boundary component.

## Conclusion
This ASCII simulation game offers a unique blend of strategy, resource management, and nation dynamics, all within a retro ASCII aesthetic. The game is designed to be balanced, engaging, and replayable, with a focus on strategic decision-making and dynamic interactions between nations.