# yuji29/thefourthtenant architecture

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

- Interactive diagram: https://gitdiagram.com/yuji29/thefourthtenant
- Repository: https://github.com/yuji29/thefourthtenant

## Overview

The repository is a Java Swing narrative mystery game. The player starts at the main menu, enters a narrated backstory, then investigates a crime scene by navigating it and collecting clues. Loading, settings, pause controls, subtitles, audio, and visual transitions support that experience. The source index identifies the major screens and their references; because excerpts omit most screen-transition code, several screen-to-screen links are shown as unverified rather than asserted calls.

Main entry points: [`src/theforthtenant/Backstory.java`](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/Backstory.java) (Backstory), [`src/theforthtenant/CrimeScene.java`](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/CrimeScene.java) (Crime scene), [`src/theforthtenant/MainMenu.java`](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/MainMenu.java) (Main menu), [`src/theforthtenant/OptionsMenu.java`](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/OptionsMenu.java) (Options menu)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["Game Entry"]
  node_loading["Loading screen<br/>[LoadingScreen.java]"]
  node_menu["Main menu<br/>[MainMenu.java]"]
end

subgraph group_story["Narrative and Investigation"]
  node_backstory["Backstory<br/>[Backstory.java]"]
  node_crime["Crime scene<br/>[CrimeScene.java]"]
  node_subtitles["Subtitle display<br/>[SubtitleBox.java]"]
  node_pickup["Pickup animation"]
end

subgraph group_ui["Game UI"]
  node_pause["Pause menu<br/>[PauseMenu.java]"]
  node_options["Options menu<br/>[OptionsMenu.java]"]
  node_transition["Transition overlay"]
end

subgraph group_audio["Audio Settings"]
  node_sfx["Sound manager<br/>[SfxManager.java]"]
  node_preferences[("User preferences")]
end

node_player(("Player"))

node_player -->|"starts game"| node_loading
node_loading -.->|"opens menu"| node_menu
node_player -->|"chooses menu"| node_menu
node_menu -.->|"starts story"| node_backstory
node_menu -.->|"opens settings"| node_options
node_backstory -.->|"continues story"| node_crime
node_backstory -->|"displays dialogue"| node_subtitles
node_backstory -.->|"uses pause controls"| node_pause
node_backstory -.->|"uses settings"| node_options
node_backstory -.->|"uses transitions"| node_transition
node_crime -.->|"uses pause controls"| node_pause
node_crime -.->|"uses settings"| node_options
node_crime -.->|"uses transitions"| node_transition
node_crime -.->|"uses animation"| node_pickup
node_player -->|"investigates scene"| node_crime
node_player -->|"pauses game"| node_pause
node_player -->|"changes settings"| node_options
node_menu -.->|"plays sound"| node_sfx
node_options -.->|"sets audio levels"| node_sfx
node_backstory -.->|"plays audio"| node_sfx
node_crime -.->|"plays sound"| node_sfx
node_sfx -->|"reads and writes"| node_preferences

click node_loading "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/LoadingScreen.java"
click node_menu "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/MainMenu.java"
click node_backstory "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/Backstory.java"
click node_crime "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/CrimeScene.java"
click node_subtitles "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/SubtitleBox.java"
click node_pickup "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/PickupAnimation.java"
click node_pause "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/PauseMenu.java"
click node_options "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/OptionsMenu.java"
click node_transition "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/TransitionOverlay.java"
click node_sfx "https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/SfxManager.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_loading,node_menu toneBlue
class node_backstory,node_crime,node_subtitles,node_pickup toneAmber
class node_pause,node_options,node_transition toneMint
class node_sfx,node_preferences toneRose
class node_player toneIndigo
```

## Components

### Game Entry

- [Loading screen](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/LoadingScreen.java): `src/theforthtenant/LoadingScreen.java`
- [Main menu](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/MainMenu.java): `src/theforthtenant/MainMenu.java`

### Narrative and Investigation

- [Backstory](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/Backstory.java): `src/theforthtenant/Backstory.java`
- [Crime scene](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/CrimeScene.java): `src/theforthtenant/CrimeScene.java`
- [Subtitle display](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/SubtitleBox.java): `src/theforthtenant/SubtitleBox.java`
- [Pickup animation](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/PickupAnimation.java): `src/theforthtenant/PickupAnimation.java`

### Game UI

- [Pause menu](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/PauseMenu.java): `src/theforthtenant/PauseMenu.java`
- [Options menu](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/OptionsMenu.java): `src/theforthtenant/OptionsMenu.java`
- [Transition overlay](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/TransitionOverlay.java): `src/theforthtenant/TransitionOverlay.java`

### Audio Settings

- [Sound manager](https://github.com/yuji29/thefourthtenant/blob/master/src/theforthtenant/SfxManager.java): `src/theforthtenant/SfxManager.java`
- **User preferences**

### Other components

- **Player**

## Connections

- Player → Loading screen: starts game (evidence: `src/theforthtenant/LoadingScreen.java`)
- Loading screen → Main menu: opens menu (evidence: `src/theforthtenant/LoadingScreen.java`)
- Player → Main menu: chooses menu (evidence: `src/theforthtenant/MainMenu.java`)
- Main menu → Backstory: starts story (evidence: `src/theforthtenant/MainMenu.java`)
- Main menu → Options menu: opens settings (evidence: `src/theforthtenant/MainMenu.java`)
- Backstory → Crime scene: continues story (evidence: `src/theforthtenant/Backstory.java`)
- Backstory → Subtitle display: displays dialogue (evidence: `src/theforthtenant/Backstory.java`)
- Backstory → Pause menu: uses pause controls (evidence: `src/theforthtenant/Backstory.java`)
- Backstory → Options menu: uses settings (evidence: `src/theforthtenant/Backstory.java`)
- Backstory → Transition overlay: uses transitions (evidence: `src/theforthtenant/Backstory.java`)
- Crime scene → Pause menu: uses pause controls (evidence: `src/theforthtenant/CrimeScene.java`)
- Crime scene → Options menu: uses settings (evidence: `src/theforthtenant/CrimeScene.java`)
- Crime scene → Transition overlay: uses transitions (evidence: `src/theforthtenant/CrimeScene.java`)
- Crime scene → Pickup animation: uses animation (evidence: `src/theforthtenant/CrimeScene.java`)
- Player → Crime scene: investigates scene (evidence: `src/theforthtenant/CrimeScene.java`)
- Player → Pause menu: pauses game (evidence: `src/theforthtenant/PauseMenu.java`)
- Player → Options menu: changes settings (evidence: `src/theforthtenant/OptionsMenu.java`)
- Main menu → Sound manager: plays sound (evidence: `src/theforthtenant/MainMenu.java`)
- Options menu → Sound manager: sets audio levels (evidence: `src/theforthtenant/OptionsMenu.java`)
- Backstory → Sound manager: plays audio (evidence: `src/theforthtenant/Backstory.java`)
- Crime scene → Sound manager: plays sound (evidence: `src/theforthtenant/CrimeScene.java`)
- Sound manager → User preferences: reads and writes (evidence: `src/theforthtenant/SfxManager.java`)
