# 350312/rpg-game architecture

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

- Interactive diagram: https://gitdiagram.com/350312/rpg-game
- Repository: https://github.com/350312/rpg-game

## Overview

Monpura Tales is a 2D action RPG, documented as a Java game and also represented by a web client. The player starts or loads a game, explores maps, fights monsters and the boss, collects keys and loot, improves gear through inventory and merchant interactions, and can save progress. The Java runtime centers on GamePanel; the web runtime centers on App and the game engine. The graph includes both implementations and the documented combat, exploration, and progression branches. Edges are limited to shown calls, source-index references, or README statements; unsampled connections are omitted.

Main entry points: [`web/game/engine.ts`](https://github.com/350312/rpg-game/blob/main/web/game/engine.ts) (Game Engine), [`src/main/GamePanel.java`](https://github.com/350312/rpg-game/blob/main/src/main/GamePanel.java) (Game Loop and Runtime), [`web/App.tsx`](https://github.com/350312/rpg-game/blob/main/web/App.tsx) (Web App), [`src/monster/MON_SkeletonLord.java`](https://github.com/350312/rpg-game/blob/main/src/monster/MON_SkeletonLord.java) (Monsters and Boss)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_java_runtime["Java Game Runtime"]
  node_pathfinding["Pathfinding<br/>[PathFinder.java]"]
  node_world_events["Events and Cutscenes<br/>[EventHandler.java]"]
  node_lighting["Lighting and Cycle"]
  node_save_load["Save and Load<br/>[SaveLoad.java]"]
  node_game_panel["Game Loop and Runtime<br/>[GamePanel.java]"]
  node_keyboard["Keyboard Input<br/>[KeyHandler.java]"]
  node_java_entry["Java Launcher<br/>[Main.java]"]
end

subgraph group_java_world["Java World and Progression"]
  node_player["Player and Combat<br/>[Player.java]"]
  node_entities["Entities and Projectiles<br/>[Entity.java]"]
  node_monsters["Monsters and Boss"]
  node_world_maps["Maps and Tiles<br/>[TileManager.java]"]
  node_world_objects["Items and Interactives<br/>[OBJ_Key.java]"]
end

subgraph group_web_runtime["Web Game Runtime"]
  node_web_engine["Game Engine<br/>[engine.ts]"]
  node_web_maps["Map Data<br/>[maps.ts]"]
  node_web_items["Item System<br/>[items.ts]"]
  node_web_assets["Asset Loading<br/>[assets.ts]"]
  node_web_sound["Audio<br/>[sound.ts]"]
  node_web_renderer["Canvas Renderer<br/>[renderer.ts]"]
end

subgraph group_web_ui["Web Interface"]
  node_web_app["Web App<br/>[App.tsx]"]
  node_web_hud["HUD and Map<br/>[HUD.tsx]"]
  node_web_character["Inventory Screen<br/>[CharacterModal.tsx]"]
  node_web_shop["Merchant Shop<br/>[MerchantShop.tsx]"]
  node_web_controls["Virtual Controls"]
end

node_web_user(("Player"))

node_java_entry -->|"creates"| node_game_panel
node_game_panel -->|"registers input"| node_keyboard
node_keyboard -->|"changes game state"| node_game_panel
node_game_panel -->|"updates and draws"| node_world_maps
node_game_panel -->|"updates and draws"| node_entities
node_game_panel -->|"draws lighting"| node_lighting
node_game_panel -->|"owns events"| node_world_events
node_game_panel -->|"uses pathfinder"| node_pathfinding
node_player -->|"extends"| node_entities
node_player -.->|"attacks"| node_monsters
node_player -->|"uses items"| node_world_objects
node_monsters -->|"extends"| node_entities
node_monsters -->|"drops loot"| node_world_objects
node_world_events -->|"starts boss scene"| node_monsters
node_game_panel -->|"delegates saves"| node_save_load
node_save_load -->|"serializes state"| node_entities
node_web_user -.->|"starts game"| node_web_app
node_web_app -->|"initializes and controls"| node_web_engine
node_web_app -->|"preloads assets"| node_web_assets
node_web_app -->|"renders HUD"| node_web_hud
node_web_app -->|"renders inventory"| node_web_character
node_web_app -->|"renders shop"| node_web_shop
node_web_app -->|"renders controls"| node_web_controls
node_web_engine -->|"loads map grids"| node_web_maps
node_web_engine -->|"creates items"| node_web_items
node_web_engine -->|"uses assets"| node_web_assets
node_web_engine -.->|"plays effects"| node_web_sound
node_web_renderer -->|"reads game state"| node_web_engine
node_web_hud -->|"reads game state"| node_web_engine
node_web_character -->|"updates inventory"| node_web_engine
node_web_shop -->|"updates purchases"| node_web_engine
node_web_controls -->|"dispatches controls"| node_web_engine
node_web_engine -.->|"renders frame"| node_web_renderer

click node_player "https://github.com/350312/rpg-game/blob/main/src/entity/Player.java"
click node_entities "https://github.com/350312/rpg-game/blob/main/src/entity/Entity.java"
click node_monsters "https://github.com/350312/rpg-game/blob/main/src/monster/MON_SkeletonLord.java"
click node_world_maps "https://github.com/350312/rpg-game/blob/main/src/tile/TileManager.java"
click node_world_objects "https://github.com/350312/rpg-game/blob/main/src/object/OBJ_Key.java"
click node_pathfinding "https://github.com/350312/rpg-game/blob/main/src/ai/PathFinder.java"
click node_world_events "https://github.com/350312/rpg-game/blob/main/src/main/EventHandler.java"
click node_lighting "https://github.com/350312/rpg-game/blob/main/src/environment/EnvironmentManager.java"
click node_save_load "https://github.com/350312/rpg-game/blob/main/src/data/SaveLoad.java"
click node_game_panel "https://github.com/350312/rpg-game/blob/main/src/main/GamePanel.java"
click node_keyboard "https://github.com/350312/rpg-game/blob/main/src/main/KeyHandler.java"
click node_java_entry "https://github.com/350312/rpg-game/blob/main/src/main/Main.java"
click node_web_app "https://github.com/350312/rpg-game/blob/main/web/App.tsx"
click node_web_engine "https://github.com/350312/rpg-game/blob/main/web/game/engine.ts"
click node_web_maps "https://github.com/350312/rpg-game/blob/main/web/game/maps.ts"
click node_web_items "https://github.com/350312/rpg-game/blob/main/web/game/items.ts"
click node_web_assets "https://github.com/350312/rpg-game/blob/main/web/game/assets.ts"
click node_web_sound "https://github.com/350312/rpg-game/blob/main/web/game/sound.ts"
click node_web_renderer "https://github.com/350312/rpg-game/blob/main/web/game/renderer.ts"
click node_web_hud "https://github.com/350312/rpg-game/blob/main/web/components/HUD.tsx"
click node_web_character "https://github.com/350312/rpg-game/blob/main/web/components/CharacterModal.tsx"
click node_web_shop "https://github.com/350312/rpg-game/blob/main/web/components/MerchantShop.tsx"
click node_web_controls "https://github.com/350312/rpg-game/blob/main/web/components/VirtualControls.tsx"

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_pathfinding,node_world_events,node_lighting,node_save_load,node_game_panel,node_keyboard,node_java_entry toneBlue
class node_player,node_entities,node_monsters,node_world_maps,node_world_objects toneAmber
class node_web_engine,node_web_maps,node_web_items,node_web_assets,node_web_sound,node_web_renderer toneMint
class node_web_app,node_web_hud,node_web_character,node_web_shop,node_web_controls toneRose
class node_web_user toneIndigo
```

## Components

### Java Game Runtime

- [Pathfinding](https://github.com/350312/rpg-game/blob/main/src/ai/PathFinder.java): `src/ai/PathFinder.java`
- [Events and Cutscenes](https://github.com/350312/rpg-game/blob/main/src/main/EventHandler.java): `src/main/EventHandler.java`
- [Lighting and Cycle](https://github.com/350312/rpg-game/blob/main/src/environment/EnvironmentManager.java): `src/environment/EnvironmentManager.java`
- [Save and Load](https://github.com/350312/rpg-game/blob/main/src/data/SaveLoad.java): `src/data/SaveLoad.java`
- [Game Loop and Runtime](https://github.com/350312/rpg-game/blob/main/src/main/GamePanel.java): `src/main/GamePanel.java`
- [Keyboard Input](https://github.com/350312/rpg-game/blob/main/src/main/KeyHandler.java): `src/main/KeyHandler.java`
- [Java Launcher](https://github.com/350312/rpg-game/blob/main/src/main/Main.java): `src/main/Main.java`

### Java World and Progression

- [Player and Combat](https://github.com/350312/rpg-game/blob/main/src/entity/Player.java): `src/entity/Player.java`
- [Entities and Projectiles](https://github.com/350312/rpg-game/blob/main/src/entity/Entity.java): `src/entity/Entity.java`
- [Monsters and Boss](https://github.com/350312/rpg-game/blob/main/src/monster/MON_SkeletonLord.java): `src/monster/MON_SkeletonLord.java`
- [Maps and Tiles](https://github.com/350312/rpg-game/blob/main/src/tile/TileManager.java): `src/tile/TileManager.java`
- [Items and Interactives](https://github.com/350312/rpg-game/blob/main/src/object/OBJ_Key.java): `src/object/OBJ_Key.java`

### Web Game Runtime

- [Game Engine](https://github.com/350312/rpg-game/blob/main/web/game/engine.ts): `web/game/engine.ts`
- [Map Data](https://github.com/350312/rpg-game/blob/main/web/game/maps.ts): `web/game/maps.ts`
- [Item System](https://github.com/350312/rpg-game/blob/main/web/game/items.ts): `web/game/items.ts`
- [Asset Loading](https://github.com/350312/rpg-game/blob/main/web/game/assets.ts): `web/game/assets.ts`
- [Audio](https://github.com/350312/rpg-game/blob/main/web/game/sound.ts): `web/game/sound.ts`
- [Canvas Renderer](https://github.com/350312/rpg-game/blob/main/web/game/renderer.ts): `web/game/renderer.ts`

### Web Interface

- [Web App](https://github.com/350312/rpg-game/blob/main/web/App.tsx): `web/App.tsx`
- [HUD and Map](https://github.com/350312/rpg-game/blob/main/web/components/HUD.tsx): `web/components/HUD.tsx`
- [Inventory Screen](https://github.com/350312/rpg-game/blob/main/web/components/CharacterModal.tsx): `web/components/CharacterModal.tsx`
- [Merchant Shop](https://github.com/350312/rpg-game/blob/main/web/components/MerchantShop.tsx): `web/components/MerchantShop.tsx`
- [Virtual Controls](https://github.com/350312/rpg-game/blob/main/web/components/VirtualControls.tsx): `web/components/VirtualControls.tsx`

### Other components

- **Player**

## Connections

- Java Launcher → Game Loop and Runtime: creates (evidence: `src/main/Main.java`)
- Game Loop and Runtime → Keyboard Input: registers input (evidence: `src/main/GamePanel.java`)
- Keyboard Input → Game Loop and Runtime: changes game state (evidence: `src/main/KeyHandler.java`)
- Game Loop and Runtime → Maps and Tiles: updates and draws (evidence: `src/main/GamePanel.java`)
- Game Loop and Runtime → Entities and Projectiles: updates and draws (evidence: `src/main/GamePanel.java`)
- Game Loop and Runtime → Lighting and Cycle: draws lighting (evidence: `src/main/GamePanel.java`)
- Game Loop and Runtime → Events and Cutscenes: owns events (evidence: `src/main/GamePanel.java`)
- Game Loop and Runtime → Pathfinding: uses pathfinder (evidence: `src/main/GamePanel.java`)
- Player and Combat → Entities and Projectiles: extends (evidence: `src/entity/Player.java`)
- Player and Combat → Monsters and Boss: attacks
- Player and Combat → Items and Interactives: uses items (evidence: `src/entity/Player.java`)
- Monsters and Boss → Entities and Projectiles: extends (evidence: `src/monster/MON_SkeletonLord.java`)
- Monsters and Boss → Items and Interactives: drops loot (evidence: `src/monster/MON_SkeletonLord.java`)
- Events and Cutscenes → Monsters and Boss: starts boss scene
- Game Loop and Runtime → Save and Load: delegates saves (evidence: `src/main/GamePanel.java`)
- Save and Load → Entities and Projectiles: serializes state (evidence: `src/data/SaveLoad.java`)
- Player → Web App: starts game
- Web App → Game Engine: initializes and controls (evidence: `web/App.tsx`)
- Web App → Asset Loading: preloads assets (evidence: `web/App.tsx`)
- Web App → HUD and Map: renders HUD (evidence: `web/App.tsx`)
- Web App → Inventory Screen: renders inventory (evidence: `web/App.tsx`)
- Web App → Merchant Shop: renders shop (evidence: `web/App.tsx`)
- Web App → Virtual Controls: renders controls (evidence: `web/App.tsx`)
- Game Engine → Map Data: loads map grids (evidence: `web/game/engine.ts`)
- Game Engine → Item System: creates items (evidence: `web/game/engine.ts`)
- Game Engine → Asset Loading: uses assets (evidence: `web/game/engine.ts`)
- Game Engine → Audio: plays effects (evidence: `web/game/engine.ts`)
- Canvas Renderer → Game Engine: reads game state (evidence: `web/game/renderer.ts`)
- HUD and Map → Game Engine: reads game state (evidence: `web/components/HUD.tsx`)
- Inventory Screen → Game Engine: updates inventory (evidence: `web/components/CharacterModal.tsx`)
- Merchant Shop → Game Engine: updates purchases (evidence: `web/components/MerchantShop.tsx`)
- Virtual Controls → Game Engine: dispatches controls (evidence: `web/components/VirtualControls.tsx`)
- Game Engine → Canvas Renderer: renders frame (evidence: `web/game/renderer.ts`)
