Architecture
LoginServer and GameServer
Two JVMs, two responsibilities. They speak over a private TCP socket via LoginServerThread, which lives inside the GameServer process.
LOGINSERVER GAMESERVER
─────────── ──────────
(java/.../login*) (java/.../gameserver)
• account auth • the actual world
• server-list view • NPCs, players, AI, skills, items
• session handoff • zones, sieges, olympiad, quests
• bans / flood control
◄───── TCP bridge ─────►
(LoginServerThread)
│ TCP 2106 │ TCP 7777
│ (client login) │ (client play)
│ │
└──────────────────────┬──────────────────────┘
│
▼
CLIENT
HANDOFF FLOW
────────────
client ── login/pw ──► LoginServer
LoginServer ── session key ──► client
client ── session key + "join GS#3" ──► GameServer
GameServer ── verify key ──► LoginServer
LoginServer ── OK / DENY ──► GameServer
(over the LoginServerThread bridge)
Two processes, two crash domains
The two daemons never share a process. The bridge socket is what lets the GameServer report population counts, validate session keys and receive "kick this account" commands from the LoginServer. Run two terminals, two log files, two independent failure modes.
What lives in the LoginServer
- Account authentication. Username and password verification against the
accountstable. - Server list view. The "choose a server" screen the player sees right after logging in.
- Session keys. A short-lived token the player presents to the GameServer to prove they authenticated.
- Bans and flood protection. Rejected accounts and IP-level rate limits.
What lives in the GameServer
- The world simulation. NPCs, players, AI, skills, items, drops, spawns.
- Zones and instanced dungeons. Sieges, Olympiad, raids, party instances.
- Persistent state. Clan reputation, inventories, mail, offline trade, olympiad standings.
- Scripts. All quests, AI overrides and events, compiled at boot.
The LoginServerThread bridge
Inside the GameServer process, a single class - LoginServerThread - opens a persistent TCP socket back to the LoginServer. Over that socket, the GameServer:
- Registers itself with a server ID and capacity.
- Sends periodic player-count updates so the server-list view stays accurate.
- Asks "is this session key valid for this account?" on every
EnterWorld. - Receives kick commands when an account is banned mid-session.
If the bridge socket dies the GameServer keeps running, existing players stay connected, but new logins are refused until it reconnects.