Structure - Mini-IT/SnipeWiki GitHub Wiki

Server Structure

Server structure

Internally, the server consists of two separate parts: the cache server, and one or more slave servers. This separation is done through the use of the following five classes: Server, ServerGame, MetaServer, CacheServer and UniServer.

The Server class is the basic slave server execution thread. The majority of code that handles game logic will be executed in slave server modules running in this thread. Each slave server has a separate open connection to the cache server.

The ServerGame class extends Server class and adds users, calendar events, items, quests, and other core high-level functionality. It is called the game server. Only one type of slave servers is allowed to extend the game server class and logging the client into it is considered as logging into the game. Other slave servers for different game services have a separate login that should be based on whether the client is currently logged in on one of the game servers.

The MetaServer class is a logic grouping of multiple slave servers of the same type. Each metaserver will have multiple independent execution threads for game logic, independent data block caches, etc. The slave server rarely needs to know that there is an underlying instance of metaserver but access is available.

The CacheServer class is the cache server. It provides access to core and project-specific cache server modules. It can have some data cached in its memory that all slave servers need access to, like the online users to game server map or item shop contents. Each of the slave servers opens a connection and logs into the cache server before starting to accept client connections. Each of these connections is handled in a separate cache server thread. The editor can connect to the cache server acting as a temporary slave server and make requests to get or change some data. All database connections are done in the cache server subclasses.

The UniServer class groups all slave servers and cache server into a single application, simplifying the communication and increasing its speed. None of the higher-level classes know whether they are running as separate applications or a single one.

⚠️ **GitHub.com Fallback** ⚠️