# z3xox/tenkaichi3decomp architecture

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

- Interactive diagram: https://gitdiagram.com/z3xox/tenkaichi3decomp
- Repository: https://github.com/z3xox/tenkaichi3decomp

## Overview

Tenkaichi3Decomp is a native PC port of Dragon Ball Z: Budokai Tenkaichi 3, not an emulator. The player-facing flow runs from game startup through menus and setup of a match into the battle, with saving and audiovisual output alongside it. The port supplies platform services and a renderer beneath the game code; optional online play adds matchmaking and direct peer traffic, with a relay when needed. The graph combines the README’s documented capabilities with the sampled startup, menu, battle, and rendering code; several subsystems are represented at directory level because their implementations were not sampled.

Main entry points: [`src/menu`](https://github.com/z3xox/tenkaichi3decomp/tree/main/src/menu) (Menus), [`src/battle`](https://github.com/z3xox/tenkaichi3decomp/tree/main/src/battle) (Battle simulation), [`src/main.c`](https://github.com/z3xox/tenkaichi3decomp/blob/main/src/main.c) (Game startup), [`port/src/gs/gs_input.c`](https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/gs_input.c) (Input)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game runtime"]
  node_startup["Game startup<br/>[main.c]"]
  node_menus["Menus"]
  node_battle["Battle simulation"]
  node_save[("Save system<br/>[save.c]")]
end

subgraph group_platform["PC platform"]
  node_renderer["Renderer<br/>[gs_draw.c]"]
  node_graphics["GPU backends"]
  node_input["Input<br/>[gs_input.c]"]
  node_audio["Audio<br/>[snd_adx.c]"]
  node_platform_services["Platform services"]
  node_settings["Settings window<br/>[ui.cpp]"]
end

subgraph group_online["Online play"]
  node_netplay["Netplay<br/>[net.c]"]
  node_matchmaking["Matchmaking<br/>[worker.js]"]
  node_relay["TURN relay"]
end

subgraph group_install["Disc setup"]
  node_setup["Setup application<br/>[setup.cpp]"]
  node_installer["Installation<br/>[install.py]"]
end

node_player(("Player"))
node_disc[("Game disc image")]

node_player -->|"starts game"| node_startup
node_startup -->|"loads overlay"| node_menus
node_menus -->|"starts fight"| node_battle
node_menus -.->|"saves progress"| node_save
node_player -->|"provides controls"| node_input
node_input -.->|"controls menus"| node_menus
node_input -.->|"provides controls"| node_battle
node_battle -.->|"sends graphics"| node_renderer
node_renderer -->|"replays draws"| node_graphics
node_battle -.->|"uses sound"| node_audio
node_startup -->|"initializes services"| node_platform_services
node_player -->|"opens settings"| node_settings
node_player -->|"chooses disc"| node_setup
node_setup -->|"runs installer"| node_installer
node_installer -->|"reads data"| node_disc
node_player -->|"joins match"| node_netplay
node_netplay -->|"exchanges room data"| node_matchmaking
node_netplay -.->|"relays packets"| node_relay

click node_startup "https://github.com/z3xox/tenkaichi3decomp/blob/main/src/main.c"
click node_menus "https://github.com/z3xox/tenkaichi3decomp/tree/main/src/menu"
click node_battle "https://github.com/z3xox/tenkaichi3decomp/tree/main/src/battle"
click node_save "https://github.com/z3xox/tenkaichi3decomp/blob/main/src/sys/save.c"
click node_renderer "https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/gs_draw.c"
click node_graphics "https://github.com/z3xox/tenkaichi3decomp/tree/main/port/src/gs"
click node_input "https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/gs_input.c"
click node_audio "https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/snd_adx.c"
click node_platform_services "https://github.com/z3xox/tenkaichi3decomp/tree/main/port/src"
click node_settings "https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/ui.cpp"
click node_netplay "https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/net.c"
click node_matchmaking "https://github.com/z3xox/tenkaichi3decomp/blob/main/port/matchmaking/worker.js"
click node_setup "https://github.com/z3xox/tenkaichi3decomp/blob/main/port/setup/setup.cpp"
click node_installer "https://github.com/z3xox/tenkaichi3decomp/blob/main/install.py"

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_startup,node_menus,node_battle,node_save toneBlue
class node_renderer,node_graphics,node_input,node_audio,node_platform_services,node_settings,node_disc toneAmber
class node_netplay,node_matchmaking,node_relay toneMint
class node_setup,node_installer toneRose
class node_player toneIndigo
```

## Components

### Game runtime

- [Game startup](https://github.com/z3xox/tenkaichi3decomp/blob/main/src/main.c): `src/main.c`
- [Menus](https://github.com/z3xox/tenkaichi3decomp/tree/main/src/menu): `src/menu`
- [Battle simulation](https://github.com/z3xox/tenkaichi3decomp/tree/main/src/battle): `src/battle`
- [Save system](https://github.com/z3xox/tenkaichi3decomp/blob/main/src/sys/save.c): `src/sys/save.c`

### PC platform

- [Renderer](https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/gs_draw.c): `port/src/gs/gs_draw.c`
- [GPU backends](https://github.com/z3xox/tenkaichi3decomp/tree/main/port/src/gs): `port/src/gs`
- [Input](https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/gs_input.c): `port/src/gs/gs_input.c`
- [Audio](https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/snd_adx.c): `port/src/gs/snd_adx.c`
- [Platform services](https://github.com/z3xox/tenkaichi3decomp/tree/main/port/src): `port/src`
- [Settings window](https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/ui.cpp): `port/src/gs/ui.cpp`

### Online play

- [Netplay](https://github.com/z3xox/tenkaichi3decomp/blob/main/port/src/gs/net.c): `port/src/gs/net.c`
- [Matchmaking](https://github.com/z3xox/tenkaichi3decomp/blob/main/port/matchmaking/worker.js): `port/matchmaking/worker.js`
- **TURN relay**

### Disc setup

- [Setup application](https://github.com/z3xox/tenkaichi3decomp/blob/main/port/setup/setup.cpp): `port/setup/setup.cpp`
- [Installation](https://github.com/z3xox/tenkaichi3decomp/blob/main/install.py): `install.py`

### Other components

- **Player**
- **Game disc image**

## Connections

- Player → Game startup: starts game
- Game startup → Menus: loads overlay (evidence: `src/main.c`)
- Menus → Battle simulation: starts fight
- Menus → Save system: saves progress
- Player → Input: provides controls
- Input → Menus: controls menus
- Input → Battle simulation: provides controls
- Battle simulation → Renderer: sends graphics
- Renderer → GPU backends: replays draws (evidence: `port/src/gs/gs_draw.c`)
- Battle simulation → Audio: uses sound
- Game startup → Platform services: initializes services (evidence: `src/main.c`)
- Player → Settings window: opens settings
- Player → Setup application: chooses disc
- Setup application → Installation: runs installer (evidence: `port/setup/setup.cpp`)
- Installation → Game disc image: reads data
- Player → Netplay: joins match
- Netplay → Matchmaking: exchanges room data
- Netplay → TURN relay: relays packets
