mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-09-07 07:41:26 +00:00
141 lines
12 KiB
Markdown
141 lines
12 KiB
Markdown
# DarkflameServer Architecture - ASCII Diagram
|
|
|
|
```
|
|
DARKFLAME SERVER ARCHITECTURE
|
|
===============================
|
|
|
|
┌─────────────────────────────────────────────────────────────────────────────────────────┐
|
|
│ CLIENT LAYER │
|
|
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
│ │LEGO Universe│ │LEGO Universe│ │LEGO Universe│ │LEGO Universe│ │
|
|
│ │ Client │ │ Client │ │ Client │ │ Client │ │
|
|
│ │ (Player) │ │ (Player) │ │ (Player) │ │ (Player) │ │
|
|
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
│ │ │ │ │ │
|
|
└─────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┘
|
|
│ │ │ │
|
|
│ │ │ │
|
|
┌─────────┼───────────────────┼───────────────────┼───────────────────┼───────────────────┐
|
|
│ │ SERVER COMMUNICATION LAYER │ │ │
|
|
│ │ │ │ │ │
|
|
│ ▼ ▼ ▼ ▼ │
|
|
│ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐ │
|
|
│ │AUTH SERVER │ │WORLD SERVER │ │WORLD SERVER │ │WORLD SERVER │ │
|
|
│ │ │ │ │ │ │ │ │ │
|
|
│ │Port: 1001 │ │Port: Dynamic│ │Port: Dynamic│ │Port: Dynamic│ │
|
|
│ │ │ │ │ │ │ │ │ │
|
|
│ │• Login │ │• Game Logic │ │• Game Logic │ │• Game Logic │ │
|
|
│ │• Accounts │ │• Entities │ │• Entities │ │• Entities │ │
|
|
│ │• Sessions │ │• Physics │ │• Physics │ │• Physics │ │
|
|
│ │• Keys │ │• Zone Mgmt │ │• Zone Mgmt │ │• Zone Mgmt │ │
|
|
│ └─────────────┘ └─────────────┘ └─────────────┘ └─────────────┘ │
|
|
│ │ │ │ │ │
|
|
│ │ │ │ │ │
|
|
│ │ │ │ │ │
|
|
│ │ ┌─────────────┐ │ │ │ │
|
|
│ │ │CHAT SERVER │←──────┼───────────────────┼───────────────────┘ │
|
|
│ │ │ │ │ │ │
|
|
│ │ │Port: 1501 │ │ │ │
|
|
│ │ │ │ │ │ │
|
|
│ │ │• Chat Msgs │ │ │ │
|
|
│ │ │• Teams │ │ │ │
|
|
│ │ │• Guilds │ │ │ │
|
|
│ │ │• Friends │ │ │ │
|
|
│ │ └─────────────┘ │ │ │
|
|
│ │ │ │ │ │
|
|
│ └─────────────────┼───────────┼───────────────────┼────────────────────────────┤
|
|
│ │ │ │ │
|
|
│ ┌─────────────────┼───────────┼───────────────────┼───────────────────┐ │
|
|
│ │ │ │ │ │ │
|
|
│ ▼ ▼ ▼ ▼ ▼ │
|
|
│ ┌─────────────────────────────────────────────────────────────────────────────┐ │
|
|
│ │ MASTER SERVER (Port: 1500) │ │
|
|
│ │ │ │
|
|
│ │ ┌──────────────────┐ ┌──────────────────┐ ┌──────────────────┐ │ │
|
|
│ │ │ Instance Manager │ │Persistent ID Mgr │ │ Session Manager │ │ │
|
|
│ │ │ │ │ │ │ │ │ │
|
|
│ │ │• Zone Instances │ │• Object ID Gen │ │• Player Sessions │ │ │
|
|
│ │ │• Load Balance │ │• Unique IDs │ │• Server Registry │ │ │
|
|
│ │ │• Player Transfer │ │• Cross-Server │ │• Coordination │ │ │
|
|
│ │ └──────────────────┘ └──────────────────┘ └──────────────────┘ │ │
|
|
│ └─────────────────────────────────────────────────────────────────────────────┘ │
|
|
│ │ │
|
|
└────────────────────────────────────────┼────────────────────────────────────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────────────────────┐
|
|
│ DATABASE LAYER │
|
|
│ │
|
|
│ ┌─────────────────────┐ │
|
|
│ │ MySQL Database │ │
|
|
│ │ │ │
|
|
│ │ • Player Data │ │
|
|
│ │ • Characters │ │
|
|
│ │ • Friends/Mail │ │
|
|
│ │ • Properties │ │
|
|
│ │ • Leaderboards │ │
|
|
│ │ • Configuration │ │
|
|
│ └─────────────────────┘ │
|
|
└─────────────────────────────────────────┘
|
|
|
|
|
|
MESSAGE FLOW OVERVIEW
|
|
====================
|
|
|
|
Auth Messages Chat Messages World Messages
|
|
============= ============= ==============
|
|
|
|
LOGIN_REQUEST GENERAL_CHAT_MESSAGE CHARACTER_LIST_REQUEST
|
|
CREATE_ACCOUNT PRIVATE_CHAT_MESSAGE GAME_MSG (1000+ types)
|
|
SESSION_KEY TEAM_INVITE LEVEL_LOAD_COMPLETE
|
|
AUTH_RESPONSE ADD_FRIEND POSITION_UPDATE
|
|
GUILD_OPERATIONS ZONE_TRANSFER_REQUEST
|
|
|
|
Master Coordination Messages
|
|
============================
|
|
|
|
SERVER_INFO REQUEST_PERSISTENT_ID WORLD_READY
|
|
PLAYER_ADDED/REMOVED REQUEST_ZONE_TRANSFER SHUTDOWN
|
|
SET_SESSION_KEY AFFIRM_TRANSFER NEW_SESSION_ALERT
|
|
|
|
|
|
COMMUNICATION PATTERNS
|
|
======================
|
|
|
|
1. Client Authentication Flow:
|
|
Client → Auth Server → Master Server → World Server → Chat Server
|
|
|
|
2. Zone Transfer Flow:
|
|
World Server → Master Server → Target World Server → Client
|
|
|
|
3. Chat Message Flow:
|
|
Client → World Server → Chat Server → Target World Server(s) → Target Client(s)
|
|
|
|
4. Entity Updates Flow:
|
|
World Server → EntityManager → ReplicaManager → All Clients in Zone
|
|
|
|
5. Master Coordination:
|
|
All Servers ↔ Master Server (Heartbeat, Registration, Coordination)
|
|
|
|
|
|
NETWORK SPECIFICATIONS
|
|
======================
|
|
|
|
Protocol: RakNet (UDP-based)
|
|
Encryption: Enabled for client connections
|
|
Packet Structure: [RakNet Header][Message Type][Service Type][Message Data]
|
|
|
|
Service Type Codes:
|
|
- MASTER (5): Server coordination
|
|
- AUTH (1): Authentication
|
|
- CHAT (2): Social features
|
|
- WORLD (4): Game simulation
|
|
- CLIENT (4): Client-specific
|
|
|
|
Key Features:
|
|
- Distributed architecture for scalability
|
|
- Fault tolerance through master coordination
|
|
- Real-time entity replication
|
|
- Cross-server player transfers
|
|
- Persistent world state
|
|
``` |