# open-ko/knightonline architecture

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

- Interactive diagram: https://gitdiagram.com/open-ko/knightonline
- Repository: https://github.com/open-ko/knightonline

## Overview

OpenKO is an academic reimplementation of the 1298/9 Knight Online MMORPG, comprising a game client, multiple server processes, shared runtime libraries, and asset-authoring tools. A player-facing flow begins in the client’s login and character-selection procedures, then enters the main game, where world rendering and game UI support play; client traffic targets the game server, while backend services support server operations. README claims establish product scope and compatibility goals; source-index references support only selected internal links, so other likely runtime interactions are marked unverified or omitted.

Main entry points: [`src/Server/Ebenezer/EbenezerApp.h`](https://github.com/open-ko/knightonline/blob/master/src/Server/Ebenezer/EbenezerApp.h) (Game server), [`src/Client/WarFare/GameProcMain.h`](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/GameProcMain.h) (Main gameplay), [`src/Client/WarFare/GameProcedure.h`](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/GameProcedure.h) (Game procedures), [`src/Server/Aujard/DBAgent.cpp`](https://github.com/open-ko/knightonline/blob/master/src/Server/Aujard/DBAgent.cpp) (Database agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Game client"]
  node_clientproc["Game procedures<br/>[GameProcedure.h]"]
  node_login["Login flow<br/>[UILogin_1298.cpp]"]
  node_select["Character selection"]
  node_mainplay["Main gameplay<br/>[GameProcMain.h]"]
  node_gameui["Game UI<br/>[UIManager.cpp]"]
  node_world["World manager<br/>[N3WorldManager.h]"]
  node_terrain["Terrain and objects"]
  node_playeractor["Player model<br/>[PlayerMySelf.h]"]
  node_clientnet["Client socket<br/>[APISocket.cpp]"]
end

subgraph group_server["Server services"]
  node_gameserver["Game server<br/>[EbenezerApp.h]"]
  node_gameusers["Users and game logic<br/>[User.h]"]
  node_guilds["Guild operations<br/>[KnightsManager.cpp]"]
  node_aiserver["AI server<br/>[AIServerApp.h]"]
  node_dbagent["Database agent<br/>[DBAgent.cpp]"]
  node_itemservice["Item manager<br/>[ItemManagerApp.cpp]"]
  node_versionservice["Version service"]
end

subgraph group_runtime["Shared runtime"]
  node_dbpool["DB connections"]
  node_sharednet["TCP sockets<br/>[TcpSocket.h]"]
  node_graphics["3D rendering"]
  node_archive["ZIP archives<br/>[ZipStorage.cpp]"]
end

subgraph group_tools["Content tools"]
  node_mapeditor["Map editor<br/>[WallMgr.cpp]"]
  node_effecteditor["Effect editor"]
  node_charactereditor["Character editor"]
  node_clienttools["Client utilities<br/>[LauncherDlg.cpp]"]
end

node_player(("Player"))
node_database[("Game database")]

node_player -.->|"starts session"| node_login
node_login -.->|"enters procedure"| node_clientproc
node_clientproc -.->|"selects character"| node_select
node_clientproc -.->|"starts gameplay"| node_mainplay
node_mainplay -->|"uses UI"| node_gameui
node_mainplay -.->|"uses world"| node_world
node_world -->|"loads terrain"| node_terrain
node_mainplay -.->|"controls player"| node_playeractor
node_clientproc -.->|"sends packets"| node_clientnet
node_clientnet -.->|"exchanges game traffic"| node_gameserver
node_gameserver -.->|"manages users"| node_gameusers
node_gameserver -.->|"coordinates AI"| node_aiserver
node_gameserver -->|"handles guild requests"| node_guilds
node_guilds -->|"reads user state"| node_gameusers
node_gameserver -.->|"requests persistence"| node_dbagent
node_dbagent -.->|"reads and writes"| node_database
node_versionservice -->|"uses connections"| node_dbpool
node_dbagent -.->|"uses connections"| node_dbpool
node_itemservice -.->|"manages item data"| node_database
node_gameserver -.->|"uses sockets"| node_sharednet
node_aiserver -.->|"uses sockets"| node_sharednet
node_versionservice -->|"accepts clients"| node_sharednet
node_mainplay -.->|"renders scene"| node_graphics
node_clienttools -.->|"checks versions"| node_versionservice

click node_clientproc "https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/GameProcedure.h"
click node_login "https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/UILogin_1298.cpp"
click node_select "https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/GameProcCharacterSelect.cpp"
click node_mainplay "https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/GameProcMain.h"
click node_gameui "https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/UIManager.cpp"
click node_world "https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/N3WorldManager.h"
click node_terrain "https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/N3TerrainManager.cpp"
click node_playeractor "https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/PlayerMySelf.h"
click node_clientnet "https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/APISocket.cpp"
click node_gameserver "https://github.com/open-ko/knightonline/blob/master/src/Server/Ebenezer/EbenezerApp.h"
click node_gameusers "https://github.com/open-ko/knightonline/blob/master/src/Server/Ebenezer/User.h"
click node_guilds "https://github.com/open-ko/knightonline/blob/master/src/Server/Ebenezer/KnightsManager.cpp"
click node_aiserver "https://github.com/open-ko/knightonline/blob/master/src/Server/AIServer/AIServerApp.h"
click node_dbagent "https://github.com/open-ko/knightonline/blob/master/src/Server/Aujard/DBAgent.cpp"
click node_itemservice "https://github.com/open-ko/knightonline/blob/master/src/Server/ItemManager/ItemManagerApp.cpp"
click node_versionservice "https://github.com/open-ko/knightonline/blob/master/src/Server/VersionManager/VersionManagerApp.cpp"
click node_dbpool "https://github.com/open-ko/knightonline/blob/master/src/db-library/ConnectionManager.cpp"
click node_sharednet "https://github.com/open-ko/knightonline/blob/master/src/Server/shared-server/TcpSocket.h"
click node_graphics "https://github.com/open-ko/knightonline/blob/master/src/N3Base/N3AlphaPrimitiveManager.cpp"
click node_archive "https://github.com/open-ko/knightonline/blob/master/src/Client/ZipArchive/ZipStorage.cpp"
click node_mapeditor "https://github.com/open-ko/knightonline/blob/master/src/Tools/N3ME/WallMgr.cpp"
click node_effecteditor "https://github.com/open-ko/knightonline/blob/master/src/Tools/N3FXE/DlgEditPartParticle.cpp"
click node_charactereditor "https://github.com/open-ko/knightonline/blob/master/src/Tools/N3CE/FormViewProperty.cpp"
click node_clienttools "https://github.com/open-ko/knightonline/blob/master/src/Client/Launcher/LauncherDlg.cpp"

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_clientproc,node_login,node_select,node_mainplay,node_gameui,node_world,node_terrain,node_playeractor,node_clientnet toneBlue
class node_gameserver,node_gameusers,node_guilds,node_aiserver,node_dbagent,node_itemservice,node_versionservice,node_database toneAmber
class node_dbpool,node_sharednet,node_graphics,node_archive toneMint
class node_mapeditor,node_effecteditor,node_charactereditor,node_clienttools toneRose
class node_player toneIndigo
```

## Components

### Game client

- [Game procedures](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/GameProcedure.h): `src/Client/WarFare/GameProcedure.h`
- [Login flow](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/UILogin_1298.cpp): `src/Client/WarFare/UILogin_1298.cpp`
- [Character selection](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/GameProcCharacterSelect.cpp): `src/Client/WarFare/GameProcCharacterSelect.cpp`
- [Main gameplay](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/GameProcMain.h): `src/Client/WarFare/GameProcMain.h`
- [Game UI](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/UIManager.cpp): `src/Client/WarFare/UIManager.cpp`
- [World manager](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/N3WorldManager.h): `src/Client/WarFare/N3WorldManager.h`
- [Terrain and objects](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/N3TerrainManager.cpp): `src/Client/WarFare/N3TerrainManager.cpp`
- [Player model](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/PlayerMySelf.h): `src/Client/WarFare/PlayerMySelf.h`
- [Client socket](https://github.com/open-ko/knightonline/blob/master/src/Client/WarFare/APISocket.cpp): `src/Client/WarFare/APISocket.cpp`

### Server services

- [Game server](https://github.com/open-ko/knightonline/blob/master/src/Server/Ebenezer/EbenezerApp.h): `src/Server/Ebenezer/EbenezerApp.h`
- [Users and game logic](https://github.com/open-ko/knightonline/blob/master/src/Server/Ebenezer/User.h): `src/Server/Ebenezer/User.h`
- [Guild operations](https://github.com/open-ko/knightonline/blob/master/src/Server/Ebenezer/KnightsManager.cpp): `src/Server/Ebenezer/KnightsManager.cpp`
- [AI server](https://github.com/open-ko/knightonline/blob/master/src/Server/AIServer/AIServerApp.h): `src/Server/AIServer/AIServerApp.h`
- [Database agent](https://github.com/open-ko/knightonline/blob/master/src/Server/Aujard/DBAgent.cpp): `src/Server/Aujard/DBAgent.cpp`
- [Item manager](https://github.com/open-ko/knightonline/blob/master/src/Server/ItemManager/ItemManagerApp.cpp): `src/Server/ItemManager/ItemManagerApp.cpp`
- [Version service](https://github.com/open-ko/knightonline/blob/master/src/Server/VersionManager/VersionManagerApp.cpp): `src/Server/VersionManager/VersionManagerApp.cpp`

### Shared runtime

- [DB connections](https://github.com/open-ko/knightonline/blob/master/src/db-library/ConnectionManager.cpp): `src/db-library/ConnectionManager.cpp`
- [TCP sockets](https://github.com/open-ko/knightonline/blob/master/src/Server/shared-server/TcpSocket.h): `src/Server/shared-server/TcpSocket.h`
- [3D rendering](https://github.com/open-ko/knightonline/blob/master/src/N3Base/N3AlphaPrimitiveManager.cpp): `src/N3Base/N3AlphaPrimitiveManager.cpp`
- [ZIP archives](https://github.com/open-ko/knightonline/blob/master/src/Client/ZipArchive/ZipStorage.cpp): `src/Client/ZipArchive/ZipStorage.cpp`

### Content tools

- [Map editor](https://github.com/open-ko/knightonline/blob/master/src/Tools/N3ME/WallMgr.cpp): `src/Tools/N3ME/WallMgr.cpp`
- [Effect editor](https://github.com/open-ko/knightonline/blob/master/src/Tools/N3FXE/DlgEditPartParticle.cpp): `src/Tools/N3FXE/DlgEditPartParticle.cpp`
- [Character editor](https://github.com/open-ko/knightonline/blob/master/src/Tools/N3CE/FormViewProperty.cpp): `src/Tools/N3CE/FormViewProperty.cpp`
- [Client utilities](https://github.com/open-ko/knightonline/blob/master/src/Client/Launcher/LauncherDlg.cpp): `src/Client/Launcher/LauncherDlg.cpp`

### Other components

- **Player**
- **Game database**

## Connections

- Player → Login flow: starts session
- Login flow → Game procedures: enters procedure
- Game procedures → Character selection: selects character
- Game procedures → Main gameplay: starts gameplay (evidence: `src/Client/WarFare/GameProcMain.h`)
- Main gameplay → Game UI: uses UI (evidence: `src/Client/WarFare/UIManager.cpp`)
- Main gameplay → World manager: uses world
- World manager → Terrain and objects: loads terrain (evidence: `src/Client/WarFare/N3TerrainManager.cpp`)
- Main gameplay → Player model: controls player
- Game procedures → Client socket: sends packets
- Client socket → Game server: exchanges game traffic
- Game server → Users and game logic: manages users
- Game server → AI server: coordinates AI
- Game server → Guild operations: handles guild requests (evidence: `src/Server/Ebenezer/KnightsManager.cpp`)
- Guild operations → Users and game logic: reads user state (evidence: `src/Server/Ebenezer/KnightsManager.cpp`)
- Game server → Database agent: requests persistence
- Database agent → Game database: reads and writes
- Version service → DB connections: uses connections (evidence: `src/Server/VersionManager/VersionManagerApp.cpp`)
- Database agent → DB connections: uses connections
- Item manager → Game database: manages item data
- Game server → TCP sockets: uses sockets
- AI server → TCP sockets: uses sockets
- Version service → TCP sockets: accepts clients (evidence: `src/Server/VersionManager/VersionManagerApp.cpp`)
- Main gameplay → 3D rendering: renders scene
- Client utilities → Version service: checks versions
