| With the rapid development of Internet technology,online games have become one of the main entertainment methods of people.The traditional network game server architecture adopts the client-server pattern.It means that the client initiates a network request directly to the server and the server responds accordingly.With the continuous increase in the number of game players,a single game server can not deal with this problem,and the architectural pattern,meaning the client and server directly connected,is difficult to support the game server cluster and limit the game’s load ceiling.On the other hand,according to the traditional server architecture pattern,servers are independent of each other without communication.It is difficult to meet business requirements,such as cross-server battlefields and overall-server battlefields.This thesis is based on the background of the growing number of gamers and aim to remove the difficulty of achieving cross-server battlefields.On the basis of the current research status of game server architectures,it addresses their shortcomings and considers the needs of game company server architectures,and proposes a gateway server architecture from the perspective of design and set-up.The main work of this thesis is as follows:(1)In response to the problem of game server load caused by increasing game players,this thesis proposes to introduce a gateway server in the directly connected architecture pattern.The gateway server balances load for game server clusters,allowing them to on-line or off-line game servers dynamically based on actual game load.It supports more players to attend online competition at the same time,without a load ceiling.(2)In response to the demand for cross-server battlefields,this thesis proposes to define communication messages as three types:unicast,multicast and broadcast.Unicast messages are used for client-to-server communication;multicast messages for cross-server battlefield communications;and broadcast messages for full-server battlefield communications.Gateway servers and game servers will respond differently for different types of messages,effectively solve cross-server battlefield issues,and support more complex business requirements.(3)For the problem of message serialization,this thesis proposes a custom binary protocol,which implements the coding and decoding of the message protocol.It improves the transmission efficiency of the message and solves the problems of packetization and sticky packets.The binary protocol supports any language to implement the game client.(4)For the problem of service management,this thesis proposes to introduce a service registration center in the server architecture.The service registration center based on ZooKeeper is able to register,discover and monitor game services.At the same time,the service registration center realizes the management of the service by dividing the nodes to support the game server to go online and offline dynamically.The developer does not need to manually maintain the server configuration table,which simplifies the development process.At present,a game company in Shanghai has organized a team for developing game gateway server architecture.The use of this architecture has completed the partial reconstruction of the game server logic,laying the foundation for the evolution of the game server architecture. |