Architecture Design of game servers (for a little reference, the actual value does not seem to be ......)

Source: Internet
Author: User

The Design of game servers is quite challenging. The development of game servers has also changed from the previous single-server structure to multi-server architecture, and even the bigworld engine distributed solution has emerged, I recently learned that the unreal server solution Atlas is also a cluster-based approach.

Server Load balancer is a very complicated issue. We will not talk about the design of bigworld and Atlas servers for the moment. We will divide server structures based on functions and scenarios.

First, let's talk about the concept. Server division is based on the following principles:
1: separates many functions that occupy system resources (CPU, memory, Io, etc.) in the game, and independently becomes a server.
2: different games in the same server architecture should reuse some servers (process-level multiplexing) as much as possible)
3: multi-threaded concurrent programming to adapt to multi-core processors.
4: it is better to copy more data between servers and maintain a clear data flow.
5: The process is mainly divided by scenario. If you need to divide the process by function, you must keep the entire logic simple enough to meet the above 1, 2 points.

Server structure diagram:

Brief description of each server:

Gateway: The application gateway is mainly used to maintain the connection with the client. The server requires two types of I/O and uses a high-concurrency connection and Low-throughput network model for the client, such as iocp, use high-throughput connections to the server, such as blocking or asynchronous Io.

Gateways are mainly used for the following purposes:
1: shared network I/O resources
2: CPU-intensive operations such as encryption, decryption, compression, and decompression of network message packets are also shared.
3: the client and internal server groups are isolated. for the client, it only needs to know the gateway information (IP and port ).
4: because the client has always been connected to the gateway, switching the scene server and other operations is transparent to the client.
5: Maintain the player logon status

World Server is a control center that distributes various computing resources to various servers.
It has the following responsibilities:
1: manage and maintain multiple scene servers
2: manage and maintain Multiple Functional servers, mainly synchronizing data to functional servers
3: complex forwarding of data between other servers and gateways
4: implement other functions that need to be used in different scenarios, such as teaming, chatting, and gangs.

Phys server is mainly used for player movement and collision detection.
All players' mobile operations are checked on the server, so the server itself has all MAP terrain and other related information. The specific check process is as follows: first, worldserver receives a mobile message. After worldserver receives the mobile information, it sends a request to phys server to check the mobile information. After the Phys server checks the mobile information, it returns the result to the world server, then the world server is passed to the corresponding scene server.

Scene server scenario servers are divided by scenario. Each server is responsible for the scenarios that can be configured. Ideally, it can be dynamically adjusted.

Itemmgr server item management server, responsible for the production process of all items. Store an item drop database on this server and load it To the memory during server initialization. Any server that needs to generate items can directly communicate with the server.

Aiserver is another functional Server responsible for managing the AI of all NPCs. The AI server usually has two inputs: one is the player-related operation information sent by the scene server, and the other is the timer driver. In this design, for other servers, aiserver is a client with many NPCs. Aiserver needs to synchronize all AI-related data, including many player data. Thanks to the timer driving feature of aiserver, you can use the TBB library to maximize the performance of multiple cores.

 

========================================================== ========================================

 

Well written ..
However, there are several points worth discussing:
1. The separation of the Phys server will make the logic much more complicated. For example, the skill visibility judgment will be asynchronous.
2. The itemmgr server is unnecessary. You can use a dedicated DB server to handle the DB load.
3. aiserver is generally the biggest load on the server's CPU. The idea of separation is good. That's what we do. good results. however, full timer response is also the bottleneck of efficiency and response speed. some adopt event response, which will make the game perform a lot better.

Finally, in addition to the underlying communication layer, the logic layer should use as many threads as possible.
Reasonable and distributed multi-process design can solve the problem.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.