How ko4life-net/ko works
Project Type and Purpose
• This is a full‐stack MMORPG codebase (Knight Online) with four solution views: Game Client, Game Servers, Tools, and an “All” meta‐solution.
• The repository includes:
• A native C++/MFC game client (src/game) that links against the engine (src/engine) and common utilities (src/common).
• A suite of dedicated server processes (src/server/*. For example, LoginServer, AIServer, Ebenezer (game logic), ItemManager, Aujard (DB agent)).
• Dozens of Windows desktop tools (src/tool/… MFC editors, viewers, converters) for asset creation and debugging.
• Submodules for database schemas (ko-db), client assets (ko-assets), and utility SDKs (ko-vendor).
• CI/CD workflows for build, lint, test, and release on GitHub Actions.
File‐Structure Patterns and Architectural Layers
• Top‐Level Solutions (src/*.sln) group modules by domain: Game.sln (client+engine), Server.sln (all servers), Tool.sln (all editors), All.sln (everything).
• Shared libraries:
• src/common: parsing (INI), compression, encryption.
• src/engine/N3Base: 3D engine primitives, resource loaders, UI, audio, scene graph.
• Server subdirs each implement one service:
• LoginServer – authentication and version negotiation.
• Aujard – DB agent pooling connections to SQL Server.
• Ebenezer & AIServer – in‐memory game world logic and AI.
• ItemManager – specialized microservice for item data.
• Tools: each under src/tool; all MFC-based desktop apps reading/writing local files or connecting to servers.
• Infrastructure/config files: config.cmd for submodule init, format.ps1 for lint, GitHub workflows for CI/CD.
a. Frontend (Game Client)
• KnightOnLine.exe – MFC application
• Uses engine & common libraries
• Connects over TCP/UDP to LoginServer and then to game servers
b. Backend Services (Game Servers)
• LoginServer – TCP listener, negotiates credentials
• Aujard – DBagent service, talks to SQL Server
• Ebenezer/AIServer – game logic, zone management, NPC/AI threads
• ItemManager – item data CRUD
• SharedMem modules – shared memory segments for cross‐process data
c. Database Layer
• Microsoft SQL Server Express/Developer
• Tables managed by submodule ko-db
• Servers use ODBC/DBAgent to read/write player, item, zone, NPC tables
d. Tools & External Assets
• MFC editors (map editor, FX editor, texture viewer, etc.)
• Submodule ko-assets: models, textures, audio files
e. CI/CD & Build
• GitHub Actions: build-all, lint, test, deploy
• config.cmd fetches submodules; Visual Studio 2022 solutions compile all modules
• Client → LoginServer (authenticate, receive session token)
• Client → Ebenezer / AIServer cluster (game state, movement, combat packets)
• Servers ↔ SQL Server (persistent storage)
• Servers ↔ SharedMem (fast cross‐process reads)
• Tools ↔ Local File System / Asset Repositories (no live server comms, except optional preview sockets)
• CI/CD → GitHub → Build Runners → Binaries → (optional) Deployment scripts
Architectural Patterns & Principles
• N‐Tier Client‐Server: clear separation between client UI/engine, server logic, and database.
• Micro‐service style: each server process handles one domain (auth, game logic, AI, items).
• Shared native C++ libraries (engine/common) to avoid code duplication.
• MFC‐based desktop tools acting as “rich clients” for offline asset creation.
• Git submodules & config scripts to manage dependencies in a monorepo style.