How 80o/plusemu works
Project type and purpose
• This is a server-side emulator for the Habbo Hotel game (“PlusEMU++”), written in C#/.NET. It implements the network protocols, encryption, packet handling, game logic (“HabboHotel” domain), persistence (MySQL/SQL), plus an RCON command interface and plugin extension system.
High-level layering and main components
A. Clients (FlashClient, NitroClient)
– Represent actual game clients (Flash or Nitro) connecting over TCP or WebSocket.
B. Communication Layer
– TcpGameServer / WebsocketGameServer (IGameServer implementations)
– Handshake / encryption modules (DiffieHellman, ARC4, RSA)
– PacketFactory → PacketManager → IPacketEvent handlers (Incoming) / IServerPacket composers (Outgoing)
C. Core & Configuration
– Core services: IStartable, IServerStatusUpdater, SettingsManager, LanguageManager, Logging (NLog)
– Configuration (config.json, nlog.config, figuredata.xml)
D. Domain Logic (“HabboHotel” namespace)
– Subsystems: Users (Authentication, Inventory, Effects, Messenger, Navigator, Permissions)
– Rooms (RoomManager, RoomItemHandling, PathFinding, AI bots)
– Catalog, Marketplace, Friends, Groups, Achievements, Quests, Moderation, Games, Rewards, Subscriptions
– Each manager implements an interface (e.g., IItemDataManager, IUserDataFactory).
E. Database Layer
– DatabaseConnection / QueryAdapter → NormalQueryReactor
– IDatabaseClient, IRegularQueryAdapter abstractions
F. Plugin & RCON System
– IPluginDefinition / IPlugin / PluginsCache → dynamic assembly loading
– RCON socket → IRconSocket → CommandManager → IRCONCommand implementations
G. Utilities
– DependencyInjection attributes, text handling, randomizer, encoding, converters
Data flow & component interactions
• Client initiates connection → Communication Layer handles handshake/encryption → Once session established, TcpSessionProxy or WsSessionProxy abstracts the stream.
• Incoming bytes go to PacketFactory → PacketManager routes to specific IPacketEvent handler under “Communication/Packets/Incoming”.
• Each handler invokes Domain Logic (HabboHotel.* Managers, e.g., RoomManager, CatalogManager). Domain logic may:
– Query or update persistent state via Database Layer
– Update cache (HabboHotel/Cache)
– Trigger outgoing responses (via IServerPacket composers under Communication/Packets/Outgoing)
• Configuration Managers (SettingsManager, LanguageManager) provide runtime parameters to encryption, game logic, and plugin loader.
• Plugin system hooks into packet events or domain events to allow extension.
• RCON commands connect over a separate TCP port (RCONSocket) to trigger administrative actions (reload bans, kick users).
Architectural patterns & principles
• Layered architecture: clear separation of network / core / domain / persistence.
• Dependency inversion: interfaces for every manager and adapter, DI attributes (Scoped/Singleton).
• Event-driven packet dispatch: decouple network I/O from business logic.
• Plugin architecture: dynamic assembly load context, cache, and hook points.
• Single Responsibility: each folder / class group handles one concern (e.g., “Rooms/PathFinding” vs “Rooms/AI”).