How suprcode/crystal works
Project Type and Purpose
• It consists of:
• A Windows client (WinForms + custom rendering via SlimDX)
• A game server (core logic, world simulation, network interfaces)
• Administrative tools (AutoPatcherAdmin, Server.MirForms, LibraryEditor, LibraryViewer)
• A patcher website (static assets + Web.config / HTTP service)
• A shared library for packets, data models, and utilities
File‐Structure Analysis
• “Client” holds the game client code (UI under Forms, rendering under MirGraphics, input, network under MirNetwork, game objects under MirObjects, sounds under MirSounds, utilities, settings).
• “Server” contains:
• Server.Library – common game-server libraries
• Server.MirForms – WinForms admin console for database/tuning/config
• Server – core server engine (MirEnvir, MirDatabase, MirNetwork, MirObjects, Helpers, Utils)
• “Shared” houses protocol definitions (ClientPackets, ServerPackets), data models, enums, extension methods – referenced by both client & server.
• “AutoPatcherAdmin” is a WinForms tool to generate/apply patches.
• “PatcherWebSite” serves static + JS/CSS assets; likely hosts patch manifest & files via HTTP.
• “LibraryEditor” / “LibraryViewer” are separate tools for inspecting graphic asset libraries.
Key Architectural Patterns
• Layered architecture: UI → Application Services → Domain (game logic) → Data (DB)
• Client-server separation via TCP (MirConnection for game traffic; MirStatusConnection).
• Shared contract layer (Shared project) enforces protocol compatibility.
• Admin and patcher tools reuse Shared and Server.Library where applicable.
• Web patcher uses HTTP service for delivering updates.
Main Components
a. Client Application
– UI Layer (WinForms Forms & custom MirControls)
– Rendering Layer (MirGraphics + SlimDX)
– Sound Layer (MirSounds)
– Network Layer (MirNetwork)
– Game Objects Layer (MirObjects & MirScenes)
b. Server Application
– Network Interfaces (MirConnection, MirStatusConnection)
– Core Simulation (MirEnvir, Timers, Robot)
– Domain Objects (MirObjects)
– Persistence Layer (MirDatabase via ORM/ADO.NET to SQL DB)
– Admin UI (Server.MirForms for config & tuning)
c. Shared Library
– Protocol Contracts (ClientPackets, ServerPackets)
– Data Models & Enums
– Utility Functions (FileIO, Crypto, IniReader)
d. Patching Infrastructure
– AutoPatcherAdmin Tool (desktop app to build patch manifests)
– Patcher Website (HTTP Server exposing manifests & files)
e. External Dependencies
– SQL Server / MySQL (game data storage)
– SlimDX (graphics)
– log4net (logging)
Relationships & Data Flows
• Client ↔ Server: bi‐directional TCP over “MirConnection” for gameplay; “MirStatusConnection” for login/realm status.
• Server ↔ Database: CRUD via MirDatabase classes.
• Admin UI (Server.MirForms) ↔ Server.Library / Database: direct in‐process calls or DB access.
• AutoPatcherAdmin → generates patch manifest → deploy to PatcherWebSite HTTP endpoints → Client fetches updates.
• LibraryEditor/Viewer: offline tools reading asset files.
Architectural Patterns & Principles
• Separation of concerns: each layer/project has clear responsibility.
• Reuse of “Shared” contracts to avoid packet mismatches.
• Event‐driven simulation on server (Timer, DelayedAction, AI robots).
• Custom UI controls to encapsulate Mir-specific behavior.
• Modular project structure for extensibility (e.g., custom monsters, scenes).