First, the game server features
1. Definition:
A game server is a long-running program, and it also served on a number from time to time, the network request does not point.
2. Focus:
stability
performance
Such procedures If you need more collaboration to improve the carrying capacity, it is also concerned about the ease of deployment and expansion. At the same time, also we need to consider how to achieve a certain level of disaster recovery requirements.
As the collaborative work of multi-process, it also brings the complexity of the development, which is the issue of concern.
3. Special needs:
For storage of player data and game data
Player data synchronization and data broadcasting
The part of the game logic on the server computing, do verification, to prevent the plug.
4, restraint:
Functional constraints:
To achieve the basic functions of the game
Completion of the special needs
Non-functional constraints:
User experience, usability assurance software
Use of computer memory and the CPU, as far as possible to be able to meet the load demand and response delay, it may be cached in various ways to strike a balance on the CPU and memory space
Card, network bandwidth directly limit the processing power of the server
Second, the game server architecture elements
Game server architecture, in three parts how to use the CPU, memory, network card design:
1, memory architecture:
The main memory server uses to decide how to maximize the use of server-side memory to increase the carrying capacity, reducing service delays.
2, logical architecture:
How to use the design process, thread, coroutine these programs for CPU scheduling, selection synchronous, asynchronous, etc. different programming models, to improve stability and carrying capacity of the server.
3, the communication mode:
The manner in which the decision to use communications.
Third, the difference between long and weak links to the game server networking game
Long link, the player is stateful, server and client can always interact with data transmission.
Weak networking in general every time need to re-create a connection.
Faster than weak networked gaming frequency and speed of the long link messaging.
Fourth, the online game server changes:
1, the first generation server architecture diagram:
2, the second-generation server architecture diagram (partition server):
3, third-generation server architecture (world service):
A type:
Are two types:
Three types:
4, server room (the game lobby)
Fifth, the type of server functions
1, the scene server:
它负责完成主要的游戏逻辑,这些逻辑包括:角色在游戏场景中的进入与退出、角色的行走与跑动、角色战斗(包括打怪)、任务的认领等。
场景服务器设计的好坏是整个游戏世界服务器性能差异的主要体现,它的设计难度不仅仅在于通信模型方面,更主要的是整个服务器的体系架构和同步机制的设计。
2、非场景服务器:
它主要负责完成与游戏场景不相关的游戏逻辑,这些逻辑不依靠游戏的地图系统也能正常进行,比如公会聊天或世界聊天,之所以把它从场景服务器中独立出来,是为了节省场景服务器的CPU和带宽资源,让场景服务器能够尽可能快地处理那些对游戏流畅性影响较大的游戏逻辑。
3、网关服务器:
在类型一种的架构中,玩家在多个地图跳转或者场景切换的时候采用跳转的模式,以此进行跳转不同的服务器。
还有一种方式是把这些服务器的节点都通过网关服务器管理,玩家和网关服务器交互,每个场景或者服务器切换的时候,也有网关服务器统一来交换数据,如此玩家操作会比较流畅。
原文链接: