# vedantgawande/text-based-rpg architecture

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

- Interactive diagram: https://gitdiagram.com/vedantgawande/text-based-rpg
- Repository: https://github.com/vedantgawande/text-based-rpg

## Overview

This Java Swing RPG lets a player explore a branching house, interact with room items, recover health, and fight monsters. The main GUI starts a game using GameVersionFinal, presents room and combat actions, and delegates combat moves to MonsterRoom; the game logic also supports command-based interaction. The graph covers documented navigation, inventory, healing, and combat capabilities. Some setup and GUI behavior is unsampled, so edges are limited to excerpted calls or README statements.

Main entry points: [`Text-Based-RPG/CustomPlayer.java`](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/CustomPlayer.java) (Health-capable player), [`Text-Based-RPG/Room.java`](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Room.java) (Room navigation), [`Text-Based-RPG/GameGUI.java`](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/GameGUI.java) (Game GUI), [`Text-Based-RPG/MonsterRoom.java`](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/MonsterRoom.java) (Monster room)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_interface["Player interface"]
  node_game_gui["Game GUI<br/>[GameGUI.java]"]
  node_game_window["Game window<br/>[GameWindow.java]"]
  node_game_input["Command input<br/>[GameInput.java]"]
end

subgraph group_world["World exploration"]
  node_game_setup["Game setup"]
  node_room["Room navigation<br/>[Room.java]"]
  node_standard_room["Standard room<br/>[StandardRoom.java]"]
  node_sleep_room["Sleep room<br/>[SleepRoom.java]"]
  node_monster_room["Monster room<br/>[MonsterRoom.java]"]
end

subgraph group_player["Player state"]
  node_player_state["Player and inventory<br/>[Player.java]"]
  node_custom_player["Health-capable player<br/>[CustomPlayer.java]"]
  node_health_catalog["Health item catalog"]
  node_health_item["Health item definitions<br/>[HealthItem.java]"]
  node_consumable["Consumable contract<br/>[Consumable.java]"]
  node_utilities["Item utilities<br/>[Utilities.java]"]
end

subgraph group_combat["Combat"]
  node_battle["Battle rules<br/>[MonsterBattle.java]"]
  node_attack_set["Player attacks"]
  node_attack["Attack definition<br/>[Attack.java]"]
  node_attack_effect["Attack effects<br/>[AttackEffect.java]"]
end

node_player_actor(("Player"))

node_player_actor -->|"uses controls"| node_game_gui
node_game_gui -->|"starts game"| node_game_setup
node_game_gui -->|"submits attacks"| node_monster_room
node_player_actor -->|"enters commands"| node_game_window
node_game_setup -->|"creates rooms"| node_room
node_room -->|"updates inventory"| node_player_state
node_room -->|"manages items"| node_utilities
node_custom_player -->|"extends player"| node_player_state
node_custom_player -->|"looks up items"| node_health_catalog
node_health_catalog -->|"registers definitions"| node_health_item
node_health_item -->|"implements contract"| node_consumable
node_monster_room -->|"delegates combat"| node_battle
node_battle -->|"checks inventory"| node_utilities
node_battle -->|"applies damage"| node_custom_player
node_custom_player -->|"owns attacks"| node_attack_set
node_attack_set -->|"provides moves"| node_attack
node_attack -->|"specifies effect"| node_attack_effect
node_sleep_room -->|"heals player"| node_custom_player
node_standard_room -->|"specializes room"| node_room
node_monster_room -->|"specializes room"| node_room

click node_game_gui "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/GameGUI.java"
click node_game_window "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/GameWindow.java"
click node_game_setup "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/GameVersionFinal.java"
click node_room "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Room.java"
click node_standard_room "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/StandardRoom.java"
click node_sleep_room "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/SleepRoom.java"
click node_monster_room "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/MonsterRoom.java"
click node_player_state "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Player.java"
click node_custom_player "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/CustomPlayer.java"
click node_health_catalog "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/HealthItemCatalog.java"
click node_health_item "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/HealthItem.java"
click node_consumable "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Consumable.java"
click node_utilities "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Utilities.java"
click node_game_input "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/GameInput.java"
click node_battle "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/MonsterBattle.java"
click node_attack_set "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/PlayerAttackSet.java"
click node_attack "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Attack.java"
click node_attack_effect "https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/AttackEffect.java"

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_gui,node_game_window,node_game_input toneBlue
class node_game_setup,node_room,node_standard_room,node_sleep_room,node_monster_room toneAmber
class node_player_state,node_custom_player,node_health_catalog,node_health_item,node_consumable,node_utilities toneMint
class node_battle,node_attack_set,node_attack,node_attack_effect toneRose
class node_player_actor toneIndigo
```

## Components

### Player interface

- [Game GUI](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/GameGUI.java): `Text-Based-RPG/GameGUI.java`
- [Game window](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/GameWindow.java): `Text-Based-RPG/GameWindow.java`
- [Command input](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/GameInput.java): `Text-Based-RPG/GameInput.java`

### World exploration

- [Game setup](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/GameVersionFinal.java): `Text-Based-RPG/GameVersionFinal.java`
- [Room navigation](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Room.java): `Text-Based-RPG/Room.java`
- [Standard room](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/StandardRoom.java): `Text-Based-RPG/StandardRoom.java`
- [Sleep room](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/SleepRoom.java): `Text-Based-RPG/SleepRoom.java`
- [Monster room](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/MonsterRoom.java): `Text-Based-RPG/MonsterRoom.java`

### Player state

- [Player and inventory](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Player.java): `Text-Based-RPG/Player.java`
- [Health-capable player](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/CustomPlayer.java): `Text-Based-RPG/CustomPlayer.java`
- [Health item catalog](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/HealthItemCatalog.java): `Text-Based-RPG/HealthItemCatalog.java`
- [Health item definitions](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/HealthItem.java): `Text-Based-RPG/HealthItem.java`
- [Consumable contract](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Consumable.java): `Text-Based-RPG/Consumable.java`
- [Item utilities](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Utilities.java): `Text-Based-RPG/Utilities.java`

### Combat

- [Battle rules](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/MonsterBattle.java): `Text-Based-RPG/MonsterBattle.java`
- [Player attacks](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/PlayerAttackSet.java): `Text-Based-RPG/PlayerAttackSet.java`
- [Attack definition](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/Attack.java): `Text-Based-RPG/Attack.java`
- [Attack effects](https://github.com/vedantgawande/text-based-rpg/blob/main/Text-Based-RPG/AttackEffect.java): `Text-Based-RPG/AttackEffect.java`

### Other components

- **Player**

## Connections

- Player → Game GUI: uses controls (evidence: `README.md`)
- Game GUI → Game setup: starts game (evidence: `Text-Based-RPG/GameGUI.java`)
- Game GUI → Monster room: submits attacks (evidence: `Text-Based-RPG/GameGUI.java`)
- Player → Game window: enters commands (evidence: `README.md`)
- Game setup → Room navigation: creates rooms (evidence: `README.md`)
- Room navigation → Player and inventory: updates inventory (evidence: `Text-Based-RPG/Room.java`)
- Room navigation → Item utilities: manages items (evidence: `Text-Based-RPG/Room.java`)
- Health-capable player → Player and inventory: extends player (evidence: `Text-Based-RPG/CustomPlayer.java`)
- Health-capable player → Health item catalog: looks up items (evidence: `Text-Based-RPG/CustomPlayer.java`)
- Health item catalog → Health item definitions: registers definitions (evidence: `Text-Based-RPG/HealthItemCatalog.java`)
- Health item definitions → Consumable contract: implements contract (evidence: `Text-Based-RPG/HealthItem.java`)
- Monster room → Battle rules: delegates combat (evidence: `Text-Based-RPG/MonsterRoom.java`)
- Battle rules → Item utilities: checks inventory (evidence: `Text-Based-RPG/MonsterBattle.java`)
- Battle rules → Health-capable player: applies damage (evidence: `Text-Based-RPG/MonsterBattle.java`)
- Health-capable player → Player attacks: owns attacks (evidence: `Text-Based-RPG/CustomPlayer.java`)
- Player attacks → Attack definition: provides moves (evidence: `Text-Based-RPG/PlayerAttackSet.java`)
- Attack definition → Attack effects: specifies effect (evidence: `Text-Based-RPG/Attack.java`)
- Sleep room → Health-capable player: heals player (evidence: `README.md`)
- Standard room → Room navigation: specializes room (evidence: `README.md`)
- Monster room → Room navigation: specializes room (evidence: `Text-Based-RPG/MonsterRoom.java`)
