# younessfrommood/pokemon-mood architecture

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

- Interactive diagram: https://gitdiagram.com/younessfrommood/pokemon-mood
- Repository: https://github.com/younessfrommood/pokemon-mood

## Overview

pokeemerald-expansion is a Game Boy Advance ROM-hack base, not a standalone playable game. Developers adapt its engine and feature set; in play, player actions are handled by the runtime and appear as overworld or battle outcomes. The tree and README support major gameplay subsystems, but sampled source is too limited to establish most runtime call paths, so those connections are shown as unverified dashed edges. The README also highlights debugging and quality-of-life features; debug support is represented without assuming a specific wiring path.

Main entry points: [`src/main.c`](https://github.com/younessfrommood/pokemon-mood/blob/master/src/main.c) (Game Loop), [`src/overworld.c`](https://github.com/younessfrommood/pokemon-mood/blob/master/src/overworld.c) (Overworld), [`include/battle.h`](https://github.com/younessfrommood/pokemon-mood/blob/master/include/battle.h) (Battle Engine), [`src/battle_controllers.c`](https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_controllers.c) (Battle Controllers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_runtime["Runtime Core"]
  node_main["Game Loop<br/>[main.c]"]
  node_global["Shared State<br/>[global.h]"]
end

subgraph group_world["World Gameplay"]
  node_overworld["Overworld<br/>[overworld.c]"]
  node_fieldmap["Field Maps<br/>[fieldmap.c]"]
  node_events["Scripted Events<br/>[script.c]"]
  node_followers["Followers<br/>[follower_npc.c]"]
end

subgraph group_battle["Battle System"]
  node_battle["Battle Engine<br/>[battle.h]"]
  node_controllers["Battle Controllers"]
  node_player_controller["Player Battle Input"]
  node_opponent_controller["Opponent Controller"]
  node_battle_ai["Battle AI<br/>[battle_ai_main.c]"]
  node_battle_messages["Battle Messages<br/>[battle_message.c]"]
end

subgraph group_systems["Player Systems"]
  node_pokemon["Pokémon Data<br/>[pokemon.c]"]
  node_items["Items<br/>[item.c]"]
  node_storage["Pokémon Storage"]
  node_pokedex["Pokédex<br/>[pokedex.c]"]
  node_contest["Contests<br/>[contest.c]"]
  node_save[("Save Data<br/>[save.c]")]
end

subgraph group_platform["Platform Services"]
  node_link["Link Multiplayer<br/>[link.c]"]
  node_graphics["Graphics<br/>[graphics.c]"]
  node_sound["Sound<br/>[sound.c]"]
  node_debug["Debug Features<br/>[debug.c]"]
end

node_player(("Player"))

node_player -.->|"provides input"| node_main
node_main -.->|"runs gameplay"| node_overworld
node_overworld -.->|"uses maps"| node_fieldmap
node_overworld -.->|"dispatches events"| node_events
node_overworld -.->|"updates followers"| node_followers
node_main -.->|"enters battles"| node_battle
node_battle -.->|"dispatches commands"| node_controllers
node_controllers -.->|"selects player"| node_player_controller
node_controllers -.->|"selects opponent"| node_opponent_controller
node_battle -.->|"queries decisions"| node_battle_ai
node_battle -.->|"displays messages"| node_battle_messages
node_battle -.->|"uses combatants"| node_pokemon
node_battle -.->|"uses battle items"| node_items
node_overworld -.->|"uses party"| node_pokemon
node_overworld -.->|"uses items"| node_items
node_main -.->|"opens storage"| node_storage
node_main -.->|"opens Pokédex"| node_pokedex
node_main -.->|"runs contests"| node_contest
node_main -.->|"persists progress"| node_save
node_main -.->|"supports multiplayer"| node_link
node_main -.->|"renders scenes"| node_graphics
node_main -.->|"plays audio"| node_sound
node_main -.->|"uses shared state"| node_global
node_player -.->|"invokes debug tools"| node_debug

click node_main "https://github.com/younessfrommood/pokemon-mood/blob/master/src/main.c"
click node_global "https://github.com/younessfrommood/pokemon-mood/blob/master/include/global.h"
click node_overworld "https://github.com/younessfrommood/pokemon-mood/blob/master/src/overworld.c"
click node_fieldmap "https://github.com/younessfrommood/pokemon-mood/blob/master/src/fieldmap.c"
click node_events "https://github.com/younessfrommood/pokemon-mood/blob/master/src/script.c"
click node_followers "https://github.com/younessfrommood/pokemon-mood/blob/master/src/follower_npc.c"
click node_battle "https://github.com/younessfrommood/pokemon-mood/blob/master/include/battle.h"
click node_controllers "https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_controllers.c"
click node_player_controller "https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_controller_player.c"
click node_opponent_controller "https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_controller_opponent.c"
click node_battle_ai "https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_ai_main.c"
click node_battle_messages "https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_message.c"
click node_pokemon "https://github.com/younessfrommood/pokemon-mood/blob/master/src/pokemon.c"
click node_items "https://github.com/younessfrommood/pokemon-mood/blob/master/src/item.c"
click node_storage "https://github.com/younessfrommood/pokemon-mood/blob/master/src/pokemon_storage_system.c"
click node_pokedex "https://github.com/younessfrommood/pokemon-mood/blob/master/src/pokedex.c"
click node_contest "https://github.com/younessfrommood/pokemon-mood/blob/master/src/contest.c"
click node_save "https://github.com/younessfrommood/pokemon-mood/blob/master/src/save.c"
click node_link "https://github.com/younessfrommood/pokemon-mood/blob/master/src/link.c"
click node_graphics "https://github.com/younessfrommood/pokemon-mood/blob/master/src/graphics.c"
click node_sound "https://github.com/younessfrommood/pokemon-mood/blob/master/src/sound.c"
click node_debug "https://github.com/younessfrommood/pokemon-mood/blob/master/src/debug.c"

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_main,node_global toneBlue
class node_overworld,node_fieldmap,node_events,node_followers toneAmber
class node_battle,node_controllers,node_player_controller,node_opponent_controller,node_battle_ai,node_battle_messages toneMint
class node_pokemon,node_items,node_storage,node_pokedex,node_contest,node_save toneRose
class node_link,node_graphics,node_sound,node_debug,node_player toneIndigo
```

## Components

### Runtime Core

- [Game Loop](https://github.com/younessfrommood/pokemon-mood/blob/master/src/main.c): `src/main.c`
- [Shared State](https://github.com/younessfrommood/pokemon-mood/blob/master/include/global.h): `include/global.h`

### World Gameplay

- [Overworld](https://github.com/younessfrommood/pokemon-mood/blob/master/src/overworld.c): `src/overworld.c`
- [Field Maps](https://github.com/younessfrommood/pokemon-mood/blob/master/src/fieldmap.c): `src/fieldmap.c`
- [Scripted Events](https://github.com/younessfrommood/pokemon-mood/blob/master/src/script.c): `src/script.c`
- [Followers](https://github.com/younessfrommood/pokemon-mood/blob/master/src/follower_npc.c): `src/follower_npc.c`

### Battle System

- [Battle Engine](https://github.com/younessfrommood/pokemon-mood/blob/master/include/battle.h): `include/battle.h`
- [Battle Controllers](https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_controllers.c): `src/battle_controllers.c`
- [Player Battle Input](https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_controller_player.c): `src/battle_controller_player.c`
- [Opponent Controller](https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_controller_opponent.c): `src/battle_controller_opponent.c`
- [Battle AI](https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_ai_main.c): `src/battle_ai_main.c`
- [Battle Messages](https://github.com/younessfrommood/pokemon-mood/blob/master/src/battle_message.c): `src/battle_message.c`

### Player Systems

- [Pokémon Data](https://github.com/younessfrommood/pokemon-mood/blob/master/src/pokemon.c): `src/pokemon.c`
- [Items](https://github.com/younessfrommood/pokemon-mood/blob/master/src/item.c): `src/item.c`
- [Pokémon Storage](https://github.com/younessfrommood/pokemon-mood/blob/master/src/pokemon_storage_system.c): `src/pokemon_storage_system.c`
- [Pokédex](https://github.com/younessfrommood/pokemon-mood/blob/master/src/pokedex.c): `src/pokedex.c`
- [Contests](https://github.com/younessfrommood/pokemon-mood/blob/master/src/contest.c): `src/contest.c`
- [Save Data](https://github.com/younessfrommood/pokemon-mood/blob/master/src/save.c): `src/save.c`

### Platform Services

- [Link Multiplayer](https://github.com/younessfrommood/pokemon-mood/blob/master/src/link.c): `src/link.c`
- [Graphics](https://github.com/younessfrommood/pokemon-mood/blob/master/src/graphics.c): `src/graphics.c`
- [Sound](https://github.com/younessfrommood/pokemon-mood/blob/master/src/sound.c): `src/sound.c`
- [Debug Features](https://github.com/younessfrommood/pokemon-mood/blob/master/src/debug.c): `src/debug.c`

### Other components

- **Player**

## Connections

- Player → Game Loop: provides input
- Game Loop → Overworld: runs gameplay
- Overworld → Field Maps: uses maps
- Overworld → Scripted Events: dispatches events
- Overworld → Followers: updates followers
- Game Loop → Battle Engine: enters battles
- Battle Engine → Battle Controllers: dispatches commands (evidence: `src/battle_controllers.c`)
- Battle Controllers → Player Battle Input: selects player
- Battle Controllers → Opponent Controller: selects opponent
- Battle Engine → Battle AI: queries decisions
- Battle Engine → Battle Messages: displays messages
- Battle Engine → Pokémon Data: uses combatants
- Battle Engine → Items: uses battle items
- Overworld → Pokémon Data: uses party
- Overworld → Items: uses items
- Game Loop → Pokémon Storage: opens storage
- Game Loop → Pokédex: opens Pokédex
- Game Loop → Contests: runs contests
- Game Loop → Save Data: persists progress
- Game Loop → Link Multiplayer: supports multiplayer
- Game Loop → Graphics: renders scenes
- Game Loop → Sound: plays audio
- Game Loop → Shared State: uses shared state
- Player → Debug Features: invokes debug tools
