# The Realm Online: Engine & Protocol Documentation ## 1. Game Engine: Sierra Creative Interpreter (SCI) 2.1 The Realm Online was developed using a heavily modified version of the **SCI 2.1** engine. ### Key Modifications: - **Networking Stack**: Unlike standard single-player SCI games (e.g., King's Quest), Realm includes a proprietary networking layer for real-time multiplayer interactions. - **Resource Management**: Uses `.res` and `.pqc` (Packaged Quest Content) files for storing tiles, sprites, and sounds. - **Client Logic**: Much of the client logic is written in SCI script (a Smalltalk-like language), but the core engine handles the rendering and networking primitives. ### Tools for Asset Extraction: - **SCI Companion**: A modern tool for editing and viewing SCI resources. - **QuickBMS**: Can be used with custom scripts to extract files from `.pqc` archives. - **SCI Resource Viewer**: Useful for browsing sprites and tiles. ## 2. Network Protocol The game uses a client-server architecture with multiple dedicated TCP ports for different services. ### Port Mapping: - **6002 (Realm Server)**: Main game world communication. - **6003 (Auth Server)**: Login and authentication. - **6005 (Patch Server)**: Version checking and file updates. - **7002 (Route Server)**: Redirects clients to specific game instances/realms. - **8001 (Game Server)**: Individual game instance handling. ### Handshake & Packet Structure: Based on community reverse-engineering (e.g., the `server_poc.py` script): - **Framework**: Many modern emulators use the **Twisted** framework (Python) to handle the asynchronous networking required. - **Packet Headers**: Packets typically have a size header followed by the payload. - **Authentication**: Involves a multi-step handshake where the client identifies itself, sends credentials, and receives a session token or redirection to a game server. ## 3. Database Schema The community-maintained database (TRO-DB) provides schemas for the following: - **Mobs/NPCs**: Statistics, drops, and spawn logic. - **Items**: Equipment stats, consumable effects, and shop prices. - **Spells**: Damage formulas, mana costs, and requirements. - **Maps**: Area definitions, warp points, and shop inventory mappings.