# faonpingoin634/pokemon_game architecture

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

- Interactive diagram: https://gitdiagram.com/faonpingoin634/pokemon_game
- Repository: https://github.com/faonpingoin634/pokemon_game

## Overview

This is a playable Pokémon-inspired 2D RPG demo. The user workflow runs from the menu into tile-map exploration, where movement, collision and tall-grass encounters can start turn-based battles; combat returns to exploration when finished. The graph also preserves the documented camera, battle UI/AI, creature roster, and special tile event. Relationships are limited to calls and behaviors shown in excerpts or stated in the README; some initialization and rendering details are unsampled.

Main entry points: [`src/Game.cpp`](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Game.cpp) (Game State Orchestrator), [`src/BattleSystem.cpp`](https://github.com/faonpingoin634/pokemon_game/blob/main/src/BattleSystem.cpp) (Battle Logic and UI), [`src/Map.cpp`](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Map.cpp) (Tile Map), [`src/Player.cpp`](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Player.cpp) (Player)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_gameplay["Game Flow"]
  node_game["Game State Orchestrator<br/>[Game.cpp]"]
  node_entry["Application Entry<br/>[main.cpp]"]
end

subgraph group_world["World Exploration"]
  node_map["Tile Map<br/>[Map.cpp]"]
  node_exploration["Movement and Encounters<br/>[Game.cpp]"]
  node_camera["Camera Tracking<br/>[Game.cpp]"]
end

subgraph group_battle["Turn-Based Battle"]
  node_battle["Battle Logic and UI<br/>[BattleSystem.cpp]"]
end

subgraph group_actors["Game Entities"]
  node_player["Player<br/>[Player.cpp]"]
  node_creature["Creatures and Moves<br/>[Creature.cpp]"]
end

subgraph group_ambience["Audio and Events"]
  node_music["Music and Special Event<br/>[Game.cpp]"]
end

node_user(("Player"))
node_sfml["SFML"]

node_user -->|"starts game"| node_entry
node_entry -->|"runs"| node_game
node_game -->|"updates"| node_exploration
node_game -->|"dispatches input"| node_battle
node_game -->|"updates battle"| node_battle
node_game -.->|"draws battle"| node_battle
node_exploration -->|"checks terrain"| node_map
node_exploration -.->|"moves and updates"| node_player
node_game -.->|"draws map"| node_map
node_game -.->|"draws player"| node_player
node_exploration -->|"starts encounter"| node_battle
node_exploration -.->|"chooses opponent"| node_creature
node_battle -->|"applies moves"| node_creature
node_game -.->|"tracks player"| node_camera
node_game -->|"switches audio"| node_music
node_map -->|"renders tiles"| node_sfml
node_player -->|"renders sprite"| node_sfml
node_battle -->|"renders battle UI"| node_sfml
node_music -.->|"plays audio"| node_sfml

click node_player "https://github.com/faonpingoin634/pokemon_game/blob/main/src/Player.cpp"
click node_creature "https://github.com/faonpingoin634/pokemon_game/blob/main/src/Creature.cpp"
click node_map "https://github.com/faonpingoin634/pokemon_game/blob/main/src/Map.cpp"
click node_exploration "https://github.com/faonpingoin634/pokemon_game/blob/main/src/Game.cpp"
click node_camera "https://github.com/faonpingoin634/pokemon_game/blob/main/src/Game.cpp"
click node_battle "https://github.com/faonpingoin634/pokemon_game/blob/main/src/BattleSystem.cpp"
click node_game "https://github.com/faonpingoin634/pokemon_game/blob/main/src/Game.cpp"
click node_entry "https://github.com/faonpingoin634/pokemon_game/blob/main/src/main.cpp"
click node_music "https://github.com/faonpingoin634/pokemon_game/blob/main/src/Game.cpp"

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_game,node_entry toneBlue
class node_map,node_exploration,node_camera toneAmber
class node_battle toneMint
class node_player,node_creature toneRose
class node_music,node_user,node_sfml toneIndigo
```

## Components

### Game Flow

- [Game State Orchestrator](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Game.cpp): `src/Game.cpp`
- [Application Entry](https://github.com/faonpingoin634/pokemon_game/blob/main/src/main.cpp): `src/main.cpp`

### World Exploration

- [Tile Map](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Map.cpp): `src/Map.cpp`
- [Movement and Encounters](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Game.cpp): `src/Game.cpp`
- [Camera Tracking](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Game.cpp): `src/Game.cpp`

### Turn-Based Battle

- [Battle Logic and UI](https://github.com/faonpingoin634/pokemon_game/blob/main/src/BattleSystem.cpp): `src/BattleSystem.cpp`

### Game Entities

- [Player](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Player.cpp): `src/Player.cpp`
- [Creatures and Moves](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Creature.cpp): `src/Creature.cpp`

### Audio and Events

- [Music and Special Event](https://github.com/faonpingoin634/pokemon_game/blob/main/src/Game.cpp): `src/Game.cpp`

### Other components

- **Player**
- **SFML**

## Connections

- Player → Application Entry: starts game (evidence: `src/main.cpp`)
- Application Entry → Game State Orchestrator: runs (evidence: `src/main.cpp`)
- Game State Orchestrator → Movement and Encounters: updates (evidence: `src/Game.cpp`)
- Game State Orchestrator → Battle Logic and UI: dispatches input (evidence: `src/Game.cpp`)
- Game State Orchestrator → Battle Logic and UI: updates battle (evidence: `src/Game.cpp`)
- Game State Orchestrator → Battle Logic and UI: draws battle
- Movement and Encounters → Tile Map: checks terrain (evidence: `src/Game.cpp`)
- Movement and Encounters → Player: moves and updates
- Game State Orchestrator → Tile Map: draws map
- Game State Orchestrator → Player: draws player
- Movement and Encounters → Battle Logic and UI: starts encounter (evidence: `src/Game.cpp`)
- Movement and Encounters → Creatures and Moves: chooses opponent
- Battle Logic and UI → Creatures and Moves: applies moves (evidence: `src/BattleSystem.cpp`)
- Game State Orchestrator → Camera Tracking: tracks player (evidence: `src/Game.cpp`)
- Game State Orchestrator → Music and Special Event: switches audio (evidence: `src/Game.cpp`)
- Tile Map → SFML: renders tiles (evidence: `src/Map.cpp`)
- Player → SFML: renders sprite (evidence: `src/Player.cpp`)
- Battle Logic and UI → SFML: renders battle UI (evidence: `src/BattleSystem.cpp`)
- Music and Special Event → SFML: plays audio
