# scorzy/idleant2 architecture

> Architecture diagram of the GitHub repository scorzy/idleant2, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-09-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/scorzy/idleant2
- Repository: https://github.com/scorzy/idleant2

## Overview

IdleAnt2 is a browser-based idle strategy game. Players manage bug populations and production, spend resources on units and research, unlock automation, and progress through world, prestige, and mastery systems; they can also save or restore a run. The Angular routes expose these game screens, while MainService owns the game loop and local save handling. The graph reflects the documented game identity, routes, and sampled model/service code; some model subsystems are represented by their exact enclosing directories because their implementations were not sampled.

Main entry points: [`src/app/main.service.ts`](https://github.com/scorzy/idleant2/blob/master/src/app/main.service.ts) (Game Service), [`src/app/app.routes.ts`](https://github.com/scorzy/idleant2/blob/master/src/app/app.routes.ts) (Game Routes), [`src/app/model/game.ts`](https://github.com/scorzy/idleant2/blob/master/src/app/model/game.ts) (Game State), [`src/app/app.component.ts`](https://github.com/scorzy/idleant2/blob/master/src/app/app.component.ts) (Application Shell)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_experience["Game Experience"]
  node_app["Application Shell<br/>[app.component.ts]"]
  node_routes["Game Routes<br/>[app.routes.ts]"]
  node_unit_ui["Unit Screens"]
  node_home_ui["Home Screen"]
  node_research_ui["Research Screen"]
  node_lab_ui["Laboratory"]
  node_world_ui["World Travel"]
  node_save_ui["Save Options"]
end

subgraph group_economy["Game Economy"]
  node_game_model["Game State<br/>[game.ts]"]
  node_unit_groups["Bug Units"]
  node_materials["Materials<br/>[materials.ts]"]
end

subgraph group_progression["Progression Systems"]
  node_research["Research<br/>[research.ts]"]
  node_auto_buy["Auto-buy"]
  node_world_model["World State<br/>[world.ts]"]
  node_prestige["Prestige"]
  node_mastery["Masteries"]
end

subgraph group_platform["Run Management"]
  node_main_service["Game Service<br/>[main.service.ts]"]
  node_options["Player Options<br/>[options.service.ts]"]
end

node_player(("Player"))
node_browser_store[("Browser Storage")]
node_playfab["PlayFab Cloud"]

node_player -->|"plays"| node_app
node_app -->|"starts loop"| node_main_service
node_app -->|"hosts screens"| node_routes
node_routes -->|"routes to"| node_unit_ui
node_routes -->|"routes to"| node_home_ui
node_routes -->|"routes to"| node_research_ui
node_routes -->|"routes to"| node_lab_ui
node_routes -->|"routes to"| node_world_ui
node_routes -->|"routes to"| node_save_ui
node_unit_ui -->|"reads game"| node_main_service
node_research_ui -->|"reads game"| node_main_service
node_main_service -->|"updates"| node_game_model
node_main_service -->|"loads and saves"| node_browser_store
node_main_service -->|"uses settings"| node_options
node_game_model -->|"assembles"| node_unit_groups
node_game_model -->|"tracks resources"| node_materials
node_game_model -->|"manages"| node_research
node_research -->|"refreshes list"| node_auto_buy
node_lab_ui -->|"reads game"| node_main_service
node_world_ui -->|"reads game"| node_main_service
node_game_model -->|"tracks current"| node_world_model
node_game_model -->|"manages"| node_prestige
node_game_model -->|"manages"| node_mastery
node_save_ui -->|"saves or loads"| node_main_service
node_main_service -.->|"cloud save"| node_playfab

click node_app "https://github.com/scorzy/idleant2/blob/master/src/app/app.component.ts"
click node_routes "https://github.com/scorzy/idleant2/blob/master/src/app/app.routes.ts"
click node_unit_ui "https://github.com/scorzy/idleant2/tree/master/src/app/unit-tabs"
click node_home_ui "https://github.com/scorzy/idleant2/tree/master/src/app/home"
click node_main_service "https://github.com/scorzy/idleant2/blob/master/src/app/main.service.ts"
click node_game_model "https://github.com/scorzy/idleant2/blob/master/src/app/model/game.ts"
click node_unit_groups "https://github.com/scorzy/idleant2/tree/master/src/app/model/units"
click node_materials "https://github.com/scorzy/idleant2/blob/master/src/app/model/units/materials.ts"
click node_research "https://github.com/scorzy/idleant2/blob/master/src/app/model/research.ts"
click node_research_ui "https://github.com/scorzy/idleant2/blob/master/src/app/research/research.component.ts"
click node_auto_buy "https://github.com/scorzy/idleant2/blob/master/src/app/model/autoBuy/auto-buy-manager.ts"
click node_lab_ui "https://github.com/scorzy/idleant2/tree/master/src/app/laboratory"
click node_world_ui "https://github.com/scorzy/idleant2/tree/master/src/app/world"
click node_world_model "https://github.com/scorzy/idleant2/blob/master/src/app/model/world.ts"
click node_prestige "https://github.com/scorzy/idleant2/tree/master/src/app/model/prestige"
click node_mastery "https://github.com/scorzy/idleant2/tree/master/src/app/model/masteries"
click node_save_ui "https://github.com/scorzy/idleant2/tree/master/src/app/options-nav/save"
click node_options "https://github.com/scorzy/idleant2/blob/master/src/app/options.service.ts"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_app,node_routes,node_unit_ui,node_home_ui,node_research_ui,node_lab_ui,node_world_ui,node_save_ui toneBlue
class node_game_model,node_unit_groups,node_materials,node_browser_store toneAmber
class node_research,node_auto_buy,node_world_model,node_prestige,node_mastery toneMint
class node_main_service,node_options toneRose
class node_player,node_playfab toneIndigo
```

## Components

### Game Experience

- [Application Shell](https://github.com/scorzy/idleant2/blob/master/src/app/app.component.ts): `src/app/app.component.ts`
- [Game Routes](https://github.com/scorzy/idleant2/blob/master/src/app/app.routes.ts): `src/app/app.routes.ts`
- [Unit Screens](https://github.com/scorzy/idleant2/tree/master/src/app/unit-tabs): `src/app/unit-tabs`
- [Home Screen](https://github.com/scorzy/idleant2/tree/master/src/app/home): `src/app/home`
- [Research Screen](https://github.com/scorzy/idleant2/blob/master/src/app/research/research.component.ts): `src/app/research/research.component.ts`
- [Laboratory](https://github.com/scorzy/idleant2/tree/master/src/app/laboratory): `src/app/laboratory`
- [World Travel](https://github.com/scorzy/idleant2/tree/master/src/app/world): `src/app/world`
- [Save Options](https://github.com/scorzy/idleant2/tree/master/src/app/options-nav/save): `src/app/options-nav/save`

### Game Economy

- [Game State](https://github.com/scorzy/idleant2/blob/master/src/app/model/game.ts): `src/app/model/game.ts`
- [Bug Units](https://github.com/scorzy/idleant2/tree/master/src/app/model/units): `src/app/model/units`
- [Materials](https://github.com/scorzy/idleant2/blob/master/src/app/model/units/materials.ts): `src/app/model/units/materials.ts`

### Progression Systems

- [Research](https://github.com/scorzy/idleant2/blob/master/src/app/model/research.ts): `src/app/model/research.ts`
- [Auto-buy](https://github.com/scorzy/idleant2/blob/master/src/app/model/autoBuy/auto-buy-manager.ts): `src/app/model/autoBuy/auto-buy-manager.ts`
- [World State](https://github.com/scorzy/idleant2/blob/master/src/app/model/world.ts): `src/app/model/world.ts`
- [Prestige](https://github.com/scorzy/idleant2/tree/master/src/app/model/prestige): `src/app/model/prestige`
- [Masteries](https://github.com/scorzy/idleant2/tree/master/src/app/model/masteries): `src/app/model/masteries`

### Run Management

- [Game Service](https://github.com/scorzy/idleant2/blob/master/src/app/main.service.ts): `src/app/main.service.ts`
- [Player Options](https://github.com/scorzy/idleant2/blob/master/src/app/options.service.ts): `src/app/options.service.ts`

### Other components

- **Player**
- **Browser Storage**
- **PlayFab Cloud**

## Connections

- Player → Application Shell: plays
- Application Shell → Game Service: starts loop
- Application Shell → Game Routes: hosts screens
- Game Routes → Unit Screens: routes to
- Game Routes → Home Screen: routes to
- Game Routes → Research Screen: routes to
- Game Routes → Laboratory: routes to
- Game Routes → World Travel: routes to
- Game Routes → Save Options: routes to
- Unit Screens → Game Service: reads game
- Research Screen → Game Service: reads game
- Game Service → Game State: updates
- Game Service → Browser Storage: loads and saves
- Game Service → Player Options: uses settings
- Game State → Bug Units: assembles
- Game State → Materials: tracks resources
- Game State → Research: manages
- Research → Auto-buy: refreshes list
- Laboratory → Game Service: reads game
- World Travel → Game Service: reads game
- Game State → World State: tracks current
- Game State → Prestige: manages
- Game State → Masteries: manages
- Save Options → Game Service: saves or loads
- Game Service → PlayFab Cloud: cloud save
