# ccorax2/source_code architecture

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

## Overview

This is a C++ multiplayer MMORPG server, with separate game-server and database-server code plus a shared systems library. The principal workflow is a client packet entering game input/dispatch, changing player or world state, and exchanging persistent data with the DB server. The tree also exposes major gameplay domains such as quests, guilds, items, and auctions. Source excerpts cover only libthecore declarations, so cross-subsystem runtime links are left unverified rather than presented as inspected calls.

Main entry points: [`libthecore/include/main.h`](https://github.com/ccorax2/source_code/blob/master/libthecore/include/main.h) (Core lifecycle), [`game/input.cpp`](https://github.com/ccorax2/source_code/blob/master/game/input.cpp) (Client dispatch), [`DB/Peer.cpp`](https://github.com/ccorax2/source_code/blob/master/DB/Peer.cpp) (DB peer networking), [`DB/ClientManager.cpp`](https://github.com/ccorax2/source_code/blob/master/DB/ClientManager.cpp) (Client data handlers)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_game["Game server"]
  node_player["Player state<br/>[char.cpp]"]
  node_packet["Client dispatch<br/>[input.cpp]"]
  node_connections["Client connections<br/>[desc_manager.cpp]"]
  node_world["World maps"]
  node_quests["Quest runtime<br/>[questmanager.cpp]"]
  node_items["Items and inventory<br/>[item_manager.cpp]"]
  node_guilds["Guild management<br/>[guild_manager.cpp]"]
  node_auctions["Auction system"]
  node_game_db["DB client link<br/>[db.cpp]"]
end

subgraph group_db["Database server"]
  node_db_peer["DB peer networking<br/>[Peer.cpp]"]
  node_db_clients["Client data handlers<br/>[ClientManager.cpp]"]
  node_db_guilds["Guild persistence<br/>[GuildManager.cpp]"]
  node_db_auction["Auction persistence<br/>[AuctionManager.cpp]"]
end

subgraph group_core["Shared systems"]
  node_fdwatch["FD watching<br/>[fdwatch.h]"]
  node_buffers["Network buffers<br/>[buffer.h]"]
  node_sockets["Sockets<br/>[socket.h]"]
  node_crypto["Cryptography<br/>[crypt.h]"]
  node_heart["Main loop timing<br/>[heart.h]"]
  node_core_main["Core lifecycle<br/>[main.h]"]
  node_core_log["Logging<br/>[log.h]"]
  node_core_signal["Signal handling<br/>[signal.h]"]
  node_core_utils["Core utilities<br/>[utils.h]"]
  node_core_types["Core types<br/>[typedef.h]"]
  node_hangul["Hangul support<br/>[hangul.h]"]
  node_kstbl["Key string table<br/>[kstbl.h]"]
  node_memcpy["Memory copy<br/>[memcpy.h]"]
  node_xdirent["Directory compatibility<br/>[xdirent.h]"]
  node_xgetopt["Option parsing<br/>[xgetopt.h]"]
end

node_actor(("Player client"))
node_database[("Database")]

node_actor -.->|"connects to"| node_connections
node_actor -.->|"sends packets"| node_packet
node_packet -.->|"updates state"| node_player
node_game_db -.->|"exchanges data"| node_db_peer
node_db_peer -.->|"dispatches requests"| node_db_clients
node_db_clients -.->|"persists records"| node_database
node_core_main -.->|"uses"| node_fdwatch
node_core_main -.->|"uses"| node_heart
node_fdwatch -.->|"monitors"| node_sockets
node_buffers -.->|"supports encrypted data"| node_crypto

click node_player "https://github.com/ccorax2/source_code/blob/master/game/char.cpp"
click node_packet "https://github.com/ccorax2/source_code/blob/master/game/input.cpp"
click node_connections "https://github.com/ccorax2/source_code/blob/master/game/desc_manager.cpp"
click node_world "https://github.com/ccorax2/source_code/blob/master/game/sectree_manager.cpp"
click node_quests "https://github.com/ccorax2/source_code/blob/master/game/questmanager.cpp"
click node_items "https://github.com/ccorax2/source_code/blob/master/game/item_manager.cpp"
click node_guilds "https://github.com/ccorax2/source_code/blob/master/game/guild_manager.cpp"
click node_auctions "https://github.com/ccorax2/source_code/blob/master/game/auction_manager.cpp"
click node_game_db "https://github.com/ccorax2/source_code/blob/master/game/db.cpp"
click node_db_peer "https://github.com/ccorax2/source_code/blob/master/DB/Peer.cpp"
click node_db_clients "https://github.com/ccorax2/source_code/blob/master/DB/ClientManager.cpp"
click node_db_guilds "https://github.com/ccorax2/source_code/blob/master/DB/GuildManager.cpp"
click node_db_auction "https://github.com/ccorax2/source_code/blob/master/DB/AuctionManager.cpp"
click node_fdwatch "https://github.com/ccorax2/source_code/blob/master/libthecore/include/fdwatch.h"
click node_buffers "https://github.com/ccorax2/source_code/blob/master/libthecore/include/buffer.h"
click node_sockets "https://github.com/ccorax2/source_code/blob/master/libthecore/include/socket.h"
click node_crypto "https://github.com/ccorax2/source_code/blob/master/libthecore/include/crypt.h"
click node_heart "https://github.com/ccorax2/source_code/blob/master/libthecore/include/heart.h"
click node_core_main "https://github.com/ccorax2/source_code/blob/master/libthecore/include/main.h"
click node_core_log "https://github.com/ccorax2/source_code/blob/master/libthecore/include/log.h"
click node_core_signal "https://github.com/ccorax2/source_code/blob/master/libthecore/include/signal.h"
click node_core_utils "https://github.com/ccorax2/source_code/blob/master/libthecore/include/utils.h"
click node_core_types "https://github.com/ccorax2/source_code/blob/master/libthecore/include/typedef.h"
click node_hangul "https://github.com/ccorax2/source_code/blob/master/libthecore/include/hangul.h"
click node_kstbl "https://github.com/ccorax2/source_code/blob/master/libthecore/include/kstbl.h"
click node_memcpy "https://github.com/ccorax2/source_code/blob/master/libthecore/include/memcpy.h"
click node_xdirent "https://github.com/ccorax2/source_code/blob/master/libthecore/include/xdirent.h"
click node_xgetopt "https://github.com/ccorax2/source_code/blob/master/libthecore/include/xgetopt.h"

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_player,node_packet,node_connections,node_world,node_quests,node_items,node_guilds,node_auctions,node_game_db,node_actor toneBlue
class node_db_peer,node_db_clients,node_db_guilds,node_db_auction,node_database toneAmber
class node_fdwatch,node_buffers,node_sockets,node_crypto,node_heart,node_core_main,node_core_log,node_core_signal,node_core_utils,node_core_types,node_hangul,node_kstbl,node_memcpy,node_xdirent,node_xgetopt toneMint
```

## Components

### Game server

- [Player state](https://github.com/ccorax2/source_code/blob/master/game/char.cpp): `game/char.cpp`
- [Client dispatch](https://github.com/ccorax2/source_code/blob/master/game/input.cpp): `game/input.cpp`
- [Client connections](https://github.com/ccorax2/source_code/blob/master/game/desc_manager.cpp): `game/desc_manager.cpp`
- [World maps](https://github.com/ccorax2/source_code/blob/master/game/sectree_manager.cpp): `game/sectree_manager.cpp`
- [Quest runtime](https://github.com/ccorax2/source_code/blob/master/game/questmanager.cpp): `game/questmanager.cpp`
- [Items and inventory](https://github.com/ccorax2/source_code/blob/master/game/item_manager.cpp): `game/item_manager.cpp`
- [Guild management](https://github.com/ccorax2/source_code/blob/master/game/guild_manager.cpp): `game/guild_manager.cpp`
- [Auction system](https://github.com/ccorax2/source_code/blob/master/game/auction_manager.cpp): `game/auction_manager.cpp`
- [DB client link](https://github.com/ccorax2/source_code/blob/master/game/db.cpp): `game/db.cpp`

### Database server

- [DB peer networking](https://github.com/ccorax2/source_code/blob/master/DB/Peer.cpp): `DB/Peer.cpp`
- [Client data handlers](https://github.com/ccorax2/source_code/blob/master/DB/ClientManager.cpp): `DB/ClientManager.cpp`
- [Guild persistence](https://github.com/ccorax2/source_code/blob/master/DB/GuildManager.cpp): `DB/GuildManager.cpp`
- [Auction persistence](https://github.com/ccorax2/source_code/blob/master/DB/AuctionManager.cpp): `DB/AuctionManager.cpp`

### Shared systems

- [FD watching](https://github.com/ccorax2/source_code/blob/master/libthecore/include/fdwatch.h): `libthecore/include/fdwatch.h`
- [Network buffers](https://github.com/ccorax2/source_code/blob/master/libthecore/include/buffer.h): `libthecore/include/buffer.h`
- [Sockets](https://github.com/ccorax2/source_code/blob/master/libthecore/include/socket.h): `libthecore/include/socket.h`
- [Cryptography](https://github.com/ccorax2/source_code/blob/master/libthecore/include/crypt.h): `libthecore/include/crypt.h`
- [Main loop timing](https://github.com/ccorax2/source_code/blob/master/libthecore/include/heart.h): `libthecore/include/heart.h`
- [Core lifecycle](https://github.com/ccorax2/source_code/blob/master/libthecore/include/main.h): `libthecore/include/main.h`
- [Logging](https://github.com/ccorax2/source_code/blob/master/libthecore/include/log.h): `libthecore/include/log.h`
- [Signal handling](https://github.com/ccorax2/source_code/blob/master/libthecore/include/signal.h): `libthecore/include/signal.h`
- [Core utilities](https://github.com/ccorax2/source_code/blob/master/libthecore/include/utils.h): `libthecore/include/utils.h`
- [Core types](https://github.com/ccorax2/source_code/blob/master/libthecore/include/typedef.h): `libthecore/include/typedef.h`
- [Hangul support](https://github.com/ccorax2/source_code/blob/master/libthecore/include/hangul.h): `libthecore/include/hangul.h`
- [Key string table](https://github.com/ccorax2/source_code/blob/master/libthecore/include/kstbl.h): `libthecore/include/kstbl.h`
- [Memory copy](https://github.com/ccorax2/source_code/blob/master/libthecore/include/memcpy.h): `libthecore/include/memcpy.h`
- [Directory compatibility](https://github.com/ccorax2/source_code/blob/master/libthecore/include/xdirent.h): `libthecore/include/xdirent.h`
- [Option parsing](https://github.com/ccorax2/source_code/blob/master/libthecore/include/xgetopt.h): `libthecore/include/xgetopt.h`

### Other components

- **Player client**
- **Database**

## Connections

- Player client → Client connections: connects to
- Player client → Client dispatch: sends packets
- Client dispatch → Player state: updates state
- DB client link → DB peer networking: exchanges data
- DB peer networking → Client data handlers: dispatches requests
- Client data handlers → Database: persists records
- Core lifecycle → FD watching: uses
- Core lifecycle → Main loop timing: uses
- FD watching → Sockets: monitors
- Network buffers → Cryptography: supports encrypted data
