# krunkit/krunknative-odin architecture

> Architecture diagram of the GitHub repository krunkit/krunknative-odin, 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/krunkit/krunknative-odin
- Repository: https://github.com/krunkit/krunknative-odin

## Overview

KrunkNative is a native Odin rewrite of a Krunker-style multiplayer game. The main workflow is player input into the client, followed by local authoritative simulation for offline play or TCP communication with the dedicated server for multiplayer; the client presents the resulting game state. The README documents maps, data-driven gameplay configuration, classes, weapons, match rules, UI, audio, and rendering. Source excerpts were not provided for runtime modules, so the graph uses documented capabilities and avoids asserting internal call sequences beyond that documentation.

Main entry points: [`src/client/main.odin`](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/main.odin) (Client runtime), [`src/shared/game.odin`](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/game.odin) (Game simulation), [`src/client/net_client.odin`](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/net_client.odin) (Client networking), [`src/server/net_server.odin`](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/server/net_server.odin) (TCP networking)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Game client"]
  node_client_app["Client runtime<br/>[main.odin]"]
  node_client_ui["UI and input<br/>[ui.odin]"]
  node_menu["Menus"]
  node_renderer["Renderer<br/>[renderer.odin]"]
  node_audio["Audio<br/>[audio.odin]"]
  node_client_net["Client networking<br/>[net_client.odin]"]
end

subgraph group_simulation["Shared gameplay"]
  node_simulation_core["Game simulation<br/>[game.odin]"]
  node_movement["Movement and combat<br/>[player.odin]"]
  node_map_rules["Maps and modes<br/>[map.odin]"]
  node_protocol["Native protocol<br/>[net.odin]"]
  node_game_config["Gameplay configuration<br/>[config.odin]"]
end

subgraph group_server["Dedicated server"]
  node_server_app["Server runtime<br/>[main.odin]"]
  node_server_net["TCP networking<br/>[net_server.odin]"]
end

subgraph group_content["Game content"]
  node_maps["Bundled maps"]
  node_config_file["Game settings<br/>[game.toml]"]
  node_assets["Runtime assets"]
end

node_player(("Player"))

node_player -->|"plays through"| node_client_app
node_client_app -->|"accepts input"| node_client_ui
node_client_ui -->|"offers menus"| node_menu
node_client_app -->|"presents game"| node_renderer
node_client_app -->|"provides audio"| node_audio
node_client_app -->|"connects for multiplayer"| node_client_net
node_client_app -->|"runs offline simulation"| node_simulation_core
node_client_net -->|"exchanges TCP data"| node_server_net
node_server_net -->|"serves clients"| node_server_app
node_server_app -->|"runs authoritative simulation"| node_simulation_core
node_simulation_core -->|"simulates gameplay"| node_movement
node_simulation_core -->|"applies match rules"| node_map_rules
node_client_net -->|"uses native protocol"| node_protocol
node_server_net -->|"uses native protocol"| node_protocol
node_game_config -->|"loads settings"| node_config_file
node_map_rules -->|"provides map choices"| node_maps
node_renderer -->|"uses runtime assets"| node_assets

click node_client_app "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/main.odin"
click node_client_ui "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/ui.odin"
click node_menu "https://github.com/krunkit/krunknative-odin/tree/game-state%2Bserver/src/menu"
click node_renderer "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/renderer.odin"
click node_audio "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/audio.odin"
click node_client_net "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/net_client.odin"
click node_simulation_core "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/game.odin"
click node_movement "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/player.odin"
click node_map_rules "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/map.odin"
click node_protocol "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/net.odin"
click node_game_config "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/config.odin"
click node_server_app "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/server/main.odin"
click node_server_net "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/server/net_server.odin"
click node_maps "https://github.com/krunkit/krunknative-odin/tree/game-state%2Bserver/assets/maps"
click node_config_file "https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/assets/config/game.toml"
click node_assets "https://github.com/krunkit/krunknative-odin/tree/game-state%2Bserver/assets"

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_client_app,node_client_ui,node_menu,node_renderer,node_audio,node_client_net toneBlue
class node_simulation_core,node_movement,node_map_rules,node_protocol,node_game_config toneAmber
class node_server_app,node_server_net toneMint
class node_maps,node_config_file,node_assets toneRose
class node_player toneIndigo
```

## Components

### Game client

- [Client runtime](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/main.odin): `src/client/main.odin`
- [UI and input](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/ui.odin): `src/client/ui.odin`
- [Menus](https://github.com/krunkit/krunknative-odin/tree/game-state%2Bserver/src/menu): `src/menu`
- [Renderer](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/renderer.odin): `src/client/renderer.odin`
- [Audio](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/audio.odin): `src/client/audio.odin`
- [Client networking](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/client/net_client.odin): `src/client/net_client.odin`

### Shared gameplay

- [Game simulation](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/game.odin): `src/shared/game.odin`
- [Movement and combat](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/player.odin): `src/shared/player.odin`
- [Maps and modes](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/map.odin): `src/shared/map.odin`
- [Native protocol](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/net.odin): `src/shared/net.odin`
- [Gameplay configuration](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/shared/config.odin): `src/shared/config.odin`

### Dedicated server

- [Server runtime](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/server/main.odin): `src/server/main.odin`
- [TCP networking](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/src/server/net_server.odin): `src/server/net_server.odin`

### Game content

- [Bundled maps](https://github.com/krunkit/krunknative-odin/tree/game-state%2Bserver/assets/maps): `assets/maps`
- [Game settings](https://github.com/krunkit/krunknative-odin/blob/game-state%2Bserver/assets/config/game.toml): `assets/config/game.toml`
- [Runtime assets](https://github.com/krunkit/krunknative-odin/tree/game-state%2Bserver/assets): `assets`

### Other components

- **Player**

## Connections

- Player → Client runtime: plays through (evidence: `README.md`)
- Client runtime → UI and input: accepts input (evidence: `README.md`)
- UI and input → Menus: offers menus (evidence: `README.md`)
- Client runtime → Renderer: presents game (evidence: `README.md`)
- Client runtime → Audio: provides audio (evidence: `README.md`)
- Client runtime → Client networking: connects for multiplayer (evidence: `README.md`)
- Client runtime → Game simulation: runs offline simulation (evidence: `README.md`)
- Client networking → TCP networking: exchanges TCP data (evidence: `README.md`)
- TCP networking → Server runtime: serves clients (evidence: `README.md`)
- Server runtime → Game simulation: runs authoritative simulation (evidence: `README.md`)
- Game simulation → Movement and combat: simulates gameplay (evidence: `README.md`)
- Game simulation → Maps and modes: applies match rules (evidence: `README.md`)
- Client networking → Native protocol: uses native protocol (evidence: `README.md`)
- TCP networking → Native protocol: uses native protocol (evidence: `README.md`)
- Gameplay configuration → Game settings: loads settings (evidence: `README.md`)
- Maps and modes → Bundled maps: provides map choices (evidence: `README.md`)
- Renderer → Runtime assets: uses runtime assets (evidence: `README.md`)
