CN113440863A - Method and device for processing multiplayer online game, electronic equipment and storage medium - Google Patents

Method and device for processing multiplayer online game, electronic equipment and storage medium Download PDF

Info

Publication number
CN113440863A
CN113440863A CN202110815307.7A CN202110815307A CN113440863A CN 113440863 A CN113440863 A CN 113440863A CN 202110815307 A CN202110815307 A CN 202110815307A CN 113440863 A CN113440863 A CN 113440863A
Authority
CN
China
Prior art keywords
game
node
network
leader node
leader
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110815307.7A
Other languages
Chinese (zh)
Inventor
徐帅
胡志鹏
程龙
刘勇成
袁思思
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110815307.7A priority Critical patent/CN113440863A/en
Publication of CN113440863A publication Critical patent/CN113440863A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/80Special adaptations for executing a specific game genre or game mode
    • A63F13/847Cooperative playing, e.g. requiring coordinated actions from several players to achieve a common goal
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/30Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/40Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterised by details of platform network
    • A63F2300/401Secure communication, e.g. using encryption or authentication
    • AHUMAN NECESSITIES
    • A63SPORTS; GAMES; AMUSEMENTS
    • A63FCARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
    • A63F2300/00Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game
    • A63F2300/50Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers
    • A63F2300/53Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers details of basic data processing
    • A63F2300/532Features of games using an electronically generated display having two or more dimensions, e.g. on a television screen, showing representations related to the game characterized by details of game servers details of basic data processing using secure communication, e.g. by encryption, authentication

Abstract

The application provides a processing method and a device of a multiplayer online game, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring a communication address of a designated terminal, and establishing communication connection with the designated terminal according to the communication address of the designated terminal; if the designated terminal belongs to the game node of the constructed game network, acquiring a leader node address of the game network through the game node; wherein, a plurality of game terminals participating in the same game exchange communicate with each other to form a game network; one of the game terminals is marked as a leader node of the game network; establishing communication connection with a leader node in the game network according to the address of the leader node; and according to the game data sent to the game network by the leader node, synchronizing the game state with a plurality of game terminals in the game network. The scheme reduces the cost of purchasing a special server, and can resist single-point failure because a professional server is not needed.

Description

Method and device for processing multiplayer online game, electronic equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method and an apparatus for processing a multiplayer online game, an electronic device, and a computer-readable storage medium.
Background
The MMO (massively multiplayer online game) has a large market share, and common MMO games include Western Olympic game Qian Youhun (beautiful girl soul)' inverse water cold (order of days). The game player is connected to the network through the nodes (computer/mobile phone/tablet/watch/other equipment) so as to participate in the same MMO game, and each node can be on-line and off-line at any time and any place.
As shown in FIG. 1, the current mainstream practice of MMO game is to drive a star structure with thousands or tens of thousands of game nodes by one or a group of servers. All nodes acquire the information of other nodes through the special server of the game provider. The state is synchronized by a dedicated server.
Due to the need to purchase a dedicated server, networking costs are high; and the network structure is single, and when a certain server is down, the whole network can be stopped.
Disclosure of Invention
The embodiment of the application provides a processing method of a multiplayer online game, which is used for solving the problems of whole network service halt and weak fault resistance caused by the fault of a central server.
The embodiment of the application provides a processing method of a multiplayer online game, which comprises the following steps:
acquiring a communication address of a designated terminal, and establishing communication connection with the designated terminal according to the communication address of the designated terminal;
if the designated terminal belongs to a game node of a constructed game network, acquiring a leader node address of the game network through the game node; wherein a plurality of game terminals participating in the same game are communicated with each other to form the game network; one of the game terminals is marked as a leader node of the game network;
establishing communication connection with a leader node in the game network according to the leader node address;
and according to the game data sent to the game network by the leader node, synchronizing the game state with a plurality of game terminals in the game network.
In an embodiment, the method further comprises:
if the appointed terminal does not belong to the game nodes of the constructed game network, the appointed terminal is marked as a leader node and forms the game network together with the appointed terminal;
and according to the game data sent by the leader node, synchronizing the game state with the leader node.
In an embodiment, the acquiring, by the game node, a leader node address of the game network includes:
and determining the address of the leader node according to the node list provided by the game node.
In one embodiment, after establishing a communication connection with a leader node in the gaming network according to the leader node address, the method further comprises:
and establishing communication connection with a plurality of game terminals in the game network according to the node list provided by the leader node.
In an embodiment, after the synchronization of the game state with the plurality of game terminals in the game network according to the game data sent by the leader node to the game network, the method further includes:
receiving heartbeat signals sent by the leader node at fixed time;
if the heartbeat signal is not received within a preset time period, initiating a new leader node election process;
and according to the elected new leader node, synchronizing the game state in the game network.
In one embodiment, the synchronizing of the game state at the game network according to the elected new leader node comprises:
if the terminal is elected as the new leader node, calculating game data of the game and synchronizing the game data to the game network.
In an embodiment, if the self terminal is elected as the new leader node, the method further includes:
and generating a new node list, and synchronizing the new node list to the game network.
In an embodiment, if the self terminal is elected as the new leader node, the method further includes:
and sending heartbeat signals to the game terminals in the game network at fixed time.
In one embodiment, the synchronizing of the game state at the game network according to the elected new leader node comprises:
and if the terminal of the self terminal is not elected as the new leader node, receiving game data sent by the new leader node, and synchronizing the game state with a plurality of game terminals in the game network.
In an embodiment, if the self terminal is not elected as the new leader node, the method further includes:
and receiving a new node list sent by the new leader node and a heartbeat signal sent at fixed time.
In one embodiment, the gaming network is a first gaming network, there being a second gaming network separate from the first gaming network; after the game state is synchronized with a plurality of game terminals in the game network according to the game data sent to the game network by the leader node, the method further comprises:
and selecting one leader node from the leader node of the first game network and the leader node of the second game network as a common node.
Combining the first game network and the second game network to form a new game network; and the shared node is used as a leader node of the new game network, and data synchronization is carried out in the new game network.
In an embodiment, said selecting a leader node from the leader node of the first game network and the leader node of the second game network as a common node comprises:
if a connection request of a designated node in the second game network is received, establishing communication connection with the designated node in the second game network;
informing the designated node of the leader node identification of the first game network, and receiving the leader node identification of the second game network provided by the designated node;
and electing the common node according to the leader node identifier of the first game network and the leader node identifier of the second game network.
In one embodiment, said merging said first gaming network and second gaming network to form a new gaming network comprises:
establishing communication connection with all nodes in the global node list according to the global node list provided by the common node; wherein all nodes in the global node list are connected to form the new game network.
An embodiment of the present application further provides a processing apparatus for a multiplayer online game, the apparatus including:
the system comprises a connection address acquisition module, a communication connection module and a communication connection module, wherein the connection address acquisition module is used for acquiring a communication address of a designated terminal and establishing communication connection with the designated terminal according to the communication address of the designated terminal;
the leader node determining module is used for acquiring a leader node address of the game network through the game node if the designated terminal belongs to the game node of the constructed game network; wherein a plurality of game terminals participating in the same game are communicated with each other to form the game network; one of the game terminals is marked as a leader node of the game network;
the connection establishing module is used for establishing communication connection with the leader node in the game network according to the leader node address;
and the game state synchronization module is used for synchronizing the game states with a plurality of game terminals in the game network according to the game data sent to the game network by the leader node.
An embodiment of the present application further provides an electronic device, where the electronic device includes:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform any one of the above-described methods of processing a multiplayer online game.
An embodiment of the present application further provides a computer-readable storage medium, where the storage medium stores a computer program, and the computer program can be executed by a processor to perform any one of the above methods for processing a multiplayer online game.
According to the technical scheme provided by the embodiment of the application, the intelligent terminal can establish communication connection with the leader node through the communication address of any game terminal in the game network, the game terminal participating in the game is used as the leader node to replace a special server, and the game data is sent, so that the synchronization of the game states of the plurality of game terminals in the game network is realized, the expense for purchasing the special server of a game provider, the electric charge, the network charge and the maintenance cost are reduced, and the single-point fault can be resisted without a professional server.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required to be used in the embodiments of the present application will be briefly described below.
FIG. 1 is a diagram illustrating an architecture of a multiplayer online game in the background art;
FIG. 2 is a schematic diagram of an application scenario of a processing method of a multiplayer online game according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application;
FIG. 4 is a flowchart illustrating a method for processing a multiplayer online game according to an embodiment of the present disclosure;
FIG. 5 is a flowchart illustrating a processing method of a multiplayer online game according to an embodiment of the present application based on the embodiment of FIG. 4;
FIG. 6 is a schematic diagram of node relationships for constructing a game network according to an embodiment of the present disclosure;
FIG. 7 is a flow chart illustrating a method for processing a multiplayer online game according to another embodiment of the present application based on the embodiment of FIG. 4;
FIG. 8 is a schematic diagram of the relationship between two game nets provided by the embodiment of the present application;
FIG. 9 is a flowchart showing details of step S710 in the corresponding embodiment of FIG. 7;
FIG. 10 is a schematic diagram of two gaming networks incorporating the presence of two leader nodes;
FIG. 11 is a schematic diagram of two gaming networks merging to elect a leader node;
fig. 12 is a block diagram of a processing device of a multiplayer online game according to an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be described below with reference to the drawings in the embodiments of the present application.
Like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only for distinguishing the description, and are not to be construed as indicating or implying relative importance.
Fig. 2 is a schematic application scenario diagram of a processing method of a multiplayer online game according to an embodiment of the present application. As shown in fig. 2, the application scenario includes a plurality of game terminals 110, wherein the plurality of game terminals 110 may communicate with each other (indicated by solid line connections) to form a game network and participate in the same game. One of the game terminals 110 serves as a leader node of the game network.
When there is a smart terminal 120 that needs to join the game network to participate in the same game play, the smart terminal 120 may perform the method provided by the embodiment of the present application, join the game network (indicated by the dashed connection), and participate in the same game play with the game terminal 110 in the game network. In one embodiment, if there is no established game network, the intelligent terminal 120 can also be used as a leader node to communicate with other game terminals 110 to form a game network. The game terminal 110 and the smart terminal 120 may be electronic devices such as a smart phone, a tablet computer, a desktop computer, a notebook computer, and a vehicle-mounted terminal.
Fig. 3 is a schematic structural diagram of an electronic device provided in an embodiment of the present application. The electronic device may be used as the intelligent terminal 120, and the electronic device 200 may be used to execute the processing method of the multiplayer online game provided in the embodiment of the present application. As shown in fig. 3, the electronic apparatus 200 includes: one or more processors 202, and one or more memories 204 storing processor-executable instructions. Wherein the processor 202 is configured to execute the processing method of the multiplayer online game provided by the following embodiments of the present application.
The processor 202 may be a device containing a Central Processing Unit (CPU), a Graphics Processing Unit (GPU) or other form of processing unit having data processing and/or instruction execution capabilities, may process data for other components in the electronic device 200, and may control other components in the electronic device 200 to perform desired functions.
The memory 204 may include one or more computer program products that may include various forms of computer-readable storage media, such as volatile memory and/or non-volatile memory. The volatile memory may include, for example, Random Access Memory (RAM), cache memory (cache), and/or the like. The non-volatile memory may include, for example, Read Only Memory (ROM), hard disk, flash memory, etc. On which one or more computer program instructions may be stored that may be executed by processor 202 to implement the processing method of the multiplayer online game described below. Various applications and various data, such as various data used and/or generated by the applications, may also be stored in the computer-readable storage medium.
In one embodiment, the electronic device 200 shown in FIG. 3 may also include an input device 206, an output device 208, and a data acquisition device 210, which may be interconnected via a bus system 212 and/or other form of connection mechanism (not shown). It should be noted that the components and configuration of the electronic device 200 shown in FIG. 3 are exemplary only, and not limiting, and the electronic device 200 may have other components and configurations as desired.
The input device 206 may be a device used by a user to input instructions and may include one or more of a keyboard, a mouse, a microphone, a touch screen, and the like. The output device 208 may output various information (e.g., images or sounds) to the outside (e.g., a user), and may include one or more of a display, a speaker, and the like. The data acquisition device 210 may acquire an image of a subject and store the acquired image in the memory 204 for use by other components. Illustratively, the data acquisition device 210 may be a camera.
In an embodiment, the devices in the example electronic device 100 for implementing the processing method of the multiplayer online game according to the embodiment of the present application may be integrally disposed or may be disposed in a decentralized manner, such as integrally disposing the processor 202, the memory 204, the input device 206 and the output device 208, and disposing the data acquisition device 210 separately.
In an embodiment, the example electronic device 200 for implementing the processing method of the multiplayer online game according to the embodiment of the present application may be implemented as a smart device such as a smart phone, a tablet computer, a desktop computer, a notebook computer, and a vehicle-mounted terminal.
Fig. 4 is a flowchart illustrating a processing method of a multiplayer online game according to an embodiment of the present disclosure. As shown in fig. 4, the method may be performed by a smart terminal, and the method includes the following steps S410 to S440.
Step S410: and acquiring a communication address of a designated terminal, and establishing communication connection with the designated terminal according to the communication address of the designated terminal.
The designated terminal may be a game terminal in a constructed game network or may be a single game terminal. It should be noted that, a game terminal in a game network may also be referred to as a game node, where one game node is responsible for data calculation and data synchronization of the entire game network and may be referred to as a leader node.
The intelligent terminal starts the multi-player online game application and directly enters an offline map mode. The player 1 may input the IP address of the player 2 (i.e., the designated terminal) in the game online interface of the intelligent terminal, so that the intelligent terminal acquires the communication address of the designated terminal and can establish communication connection with the designated terminal.
In another embodiment, the manner for the intelligent terminal to obtain the communication address of the designated terminal may be: the player 2 presents the game two-dimensional code to the player 1, the player 1 scans the game two-dimensional code presented by the player 2, and the game two-dimensional code may include the IP address of the player 2, so that the intelligent terminal corresponding to the player 1 obtains the communication address of the player 2 and connects to the designated terminal corresponding to the player 2.
In other embodiments, the terminal corresponding to player 2 may view the "local IP address" in the game setting interface, and notify player 1 to fill in, so that the intelligent terminal corresponding to player 1 obtains the communication address of the specified terminal, and establishes a communication connection with the specified terminal.
In other embodiments, both player 1 and player 2 may register their accounts with a third-party website, which maintains their respective IP, and a connection button may be clicked on the third-party website to display the two-dimensional code or IP of the other player, so that the smart terminal can establish a connection with the specified terminal through the communication address of the specified terminal provided by the third-party website.
Step S420: if the designated terminal belongs to a game node of a constructed game network, acquiring a leader node address of the game network through the game node; wherein a plurality of game terminals participating in the same game are communicated with each other to form the game network; one of the game terminals is marked as a leader node of the game network.
It should be noted that each game node in the game network stores a "node list," where the node list includes node information of each game node in the game network, and the node information may include a node name, a communication address, and an identifier of whether the node is a leader node. The leader node in the game network may be elected based on the Raft algorithm. For differentiation, a game node other than the leader node (leader) may be referred to as a follower node (follower).
Under normal conditions, only one leader node exists, and the other nodes are all following nodes. The leader node is responsible for all external requests, and if not, the request is directed to the leader node. Typically, the leader node sends a message, i.e., a "heartbeat" (heartbeat), at a fixed time, so that the follower node knows that the leader node of the game network is still operating. Each following node is designed with a timeout mechanism (timeout), and when a heartbeat is not received for a certain time (usually 150ms or 300ms), the game network enters an election state, i.e., a new leader node is elected again.
When the appointed terminal belongs to a game node of a game network, the appointed terminal sends a node list of the game network to the intelligent terminal, and the intelligent terminal can know which game node belongs to the leader node according to the node list to obtain the address of the leader node.
Step S430: and establishing communication connection with the leader node in the game network according to the leader node address.
In an embodiment, according to the address of the leader node, if the communication address of the designated terminal is exactly consistent with the address of the leader node, that is, the designated terminal is exactly the leader node, then a communication connection with the designated terminal is established. And if the designated terminal is not the leader node, the intelligent terminal needs to establish communication connection with the leader node according to the address of the leader node.
Then, the leader node may provide a node list to the intelligent terminal, and the intelligent terminal establishes communication connection with all game terminals in the game network according to the node list provided by the leader node, so that the intelligent terminal joins the game network and becomes one of the game nodes. It should be noted that the node list is a data structure, such as an array/a list/a rect. The node list on the leader node is always up-to-date, describes the latest 'game net' overall picture, and the following node can synchronize the node list to the local in time.
Step S440: and according to the game data sent to the game network by the leader node, synchronizing the game state with a plurality of game terminals in the game network.
It should be noted that the leader node is responsible for the calculation of game data, the synchronization of game states in the game network, the timed heartbeat transmission, the maintenance of the node list, and the like. The game data includes the position, speed, orientation, whether a collision has occurred between the two characters, who wins the game result, and the like of the character at each time.
The leader node may transmit the game data to each game node within the game network, so that each game node may receive the same game data, and achieve synchronization of the game states of the game terminals within the game network. The game state refers to the position, speed, orientation, whether two characters collide, and who wins the game result at each time point of the game data presentation.
According to the technical scheme provided by the embodiment of the application, the intelligent terminal can establish communication connection with the leader node through the communication address of any game terminal in the game network, the game terminals participating in the game are used as the leader node to send game data, and the synchronization of the game states of the plurality of game terminals in the game network is realized, so that the expense for purchasing a special server, the electric charge, the network charge and the maintenance cost of a game provider are reduced, and single-point faults can be resisted without a professional server.
In an embodiment, after step S440, as shown in fig. 5, the method provided in the embodiment of the present application further includes: step S510-step S530.
Step S510: and receiving the heartbeat signal sent by the leader node at fixed time.
For example, the leader node may send a heartbeat signal to all the following nodes in the game network every 100 milliseconds to notify the following nodes that the leader node still normally operates, and the following nodes may return a response message after receiving the heartbeat signal, thereby notifying the leader node that the own node normally operates. And after the intelligent terminal joins the game network, the intelligent terminal can also receive the heartbeat signal sent by the leader node and return a response message.
Step S520: and if the heartbeat signal is not received within the preset time period, initiating a new leader node election process.
Since the leader node will send the heartbeat signal regularly, if the intelligent terminal does not receive the heartbeat signal after timeout (for example, 5 seconds), the intelligent terminal indicates that the leader node is inactivated (for example, the network is disconnected, the intelligent terminal is powered off or the game process/port is closed). So that the intelligent terminal can initiate a new leader node election process.
The process of initiating the election of the new leader node may be that the intelligent terminal sends a voting request to other nodes according to the node list (i.e., requests other nodes to cast one vote of itself), and certainly, the intelligent terminal may cast one vote of itself at the same time. And other nodes respond after receiving the voting request of the intelligent terminal, and the intelligent terminal is approved to be a new leader node. It should be noted that the request-waiting voting response has a validity period, such as 500 ms, during which any node can request other nodes to vote.
If a certain game node receives N/2+1 votes within an effective voting period (wherein N is the length of the node list, namely the number of nodes in the game network, and the inactivated nodes need to be eliminated), the game node considers that the game node itself is already a leader node, other nodes can be notified that the game node itself is a new leader node, and the voting process is also finished. The heartbeat is started to be sent to other nodes regularly. If a certain game node receives the notice of the new leader node, the voting process is ended, the game node is considered to be a following node, and the game node starts to receive the heartbeat signal of the new leader node.
If the 'voting validity period' is exceeded (such as 500 milliseconds), a new round of voting is continuously initiated again, and other nodes are allowed to conceive that the node is the leader node. Until it is selected as a new leader or other node is received as a new leader. And finally, selecting a new leader node and a new follower node.
Step S530: and according to the elected new leader node, synchronizing the game state in the game network.
The new leader node may be the above-mentioned intelligent terminal that has just joined the game network, or may be an existing live game terminal in the game network.
In one embodiment, if the self terminal (i.e., the intelligent terminal) is elected as the new leader node, the intelligent terminal calculates game data of the game play and synchronizes the game data to the game network.
It should be noted that, synchronizing to the game network means sending the game data to all the surviving game terminals in the game network, so that the game data of all the game terminals in the game network are kept consistent, and the synchronization of the game state is realized.
In an embodiment, since the smart terminal is elected as the new leader node, the smart terminal may further generate a new node list, synchronize the new node list to the game network, i.e., transmit the new node list to the surviving game terminals in the game network. If a new node is added or quitted, the intelligent terminal can update the node list and synchronize the updated node list to the game network.
In an embodiment, since the intelligent terminal is elected as a new leader node, the intelligent terminal may periodically send a heartbeat signal to the game terminals in the game network, so as to notify each game terminal that the terminal is working normally, and based on whether a response message is returned, which nodes are deactivated may be determined.
In contrast, in an embodiment, if the own terminal (i.e., the smart terminal) is not elected as the new leader node, the smart terminal may further receive game data sent by the new leader node, and perform synchronization of the game state with the plurality of game terminals living in the game network. The intelligent terminal can also receive a new node list sent by the new leader node and a heartbeat signal sent at regular time.
In one embodiment, if the designated terminal does not belong to the game node of the constructed game network in step S420. Namely, the designated terminal is also an isolated game terminal, the designated terminal and the intelligent terminal can together construct a new game network. The intelligent terminal can mark the designated terminal as a leader node and form a game network together with the designated terminal; and according to the game data transmitted by the leader node (namely the designated terminal), synchronizing the game state with the leader node (namely the designated terminal). And the designated terminal is used as a leader node and can also be used for calculating game data, sending heartbeat signals, maintaining a node list and the like.
For example, two players start a game on their respective devices (cell phone/computer/tablet, etc.) and directly enter the offline map mode to become a node. As shown in fig. 6-1, a certain player 1 fills in the IP address of a player 2 (designated terminal) in the game online interface of the intelligent terminal, so that the intelligent terminal (hereinafter, referred to as node 1) is connected to the designated terminal (hereinafter, referred to as node 2). As shown in fig. 6-2, node 1 is labeled as follow and node 2 is labeled as Leader after the connection. At the moment, the two nodes can be normally online for playing, and a game network is formed. And performing complex calculation and synchronization state through a Leader node. The Leader node sends heartbeat signals at regular time, and the Follower node replies to each heartbeat signal.
As shown in fig. 6-3, if another node is not connected in the game, for example, the fowler node does not receive the heartbeat signal sent by the Leader node periodically (for example, every 100 milliseconds) for a long time (for example, 5 seconds), or the Leader node does not receive a reply of the heartbeat signal for a long time, then node 1 and node 2 switch to the offline map mode respectively.
As shown in fig. 6-4, if node 3 is added (a new node, which is not in any game network), it is assumed that node 3 is connected to a Follower node, and the location of the Leader is known through the Follower node. As shown in fig. 6-5, assuming node 3 is connected to a Leader node, the location of the Leader is directly known.
As shown in fig. 6-6, the newly added node 3 knows all the node information in the game network through all the node lists provided by the Leader node, and performs connection. Finally 3 nodes are connected to each other. Complex computations/state synchronization may continue through the Leader node. After the connection is completed, the new node 3 tells the Leader node that the connection is completed, one node list of the Leader node is added, and then the node list is synchronized to all nodes in the game network.
As shown in fig. 6-7, if one of the Follower nodes (e.g., node 1) is deactivated or disconnected from the network, the Follower node alone enters the offline mode, and the other nodes can still play normally, for example, node 3 can still receive the heartbeat of the Leader node at regular time. The Leader node finds one less node, removes node 1 from the node list, and synchronizes the latest node list to node 3. The Leader continues to send heartbeat signals to all Follower nodes at regular time.
As shown in fig. 6-8, the Leader node is deactivated, the heartbeat of the Leader node is not received by the Follower node for a long time, and the Follower node initiates a Raft election process (possibly initiated by node 1, possibly initiated by node 3, and possibly initiated simultaneously). Because the nodes 1 and 3 are still connected, and know the original node list to each other, the new Leader is finally selected. As shown in fig. 6-9, a node (e.g., node 3) is selected as the new Leader node, and the new game network has 2 nodes, node 1 and node 3. And performing complex calculation, state synchronization, heartbeat signal sending, node list maintenance and the like through the node 3.
As shown in fig. 6-10 and 6-11, the process of joining the 4 th node is the same as that of joining the 3 rd node, and more nodes are the same. The implication of joining a new node is that a new player joins the game or that a new player switches from an offline map to an online map. The process of reducing nodes is the same as the process of deactivating (or not connecting) a node. The implication of reducing nodes is that a player drops off for a long time or that the player switches from an online map to an offline map.
The above are descriptions of a multiplayer online game method for a game network. The following describes how a plurality of online games of two game networks are merged into one game network, i.e. the process of merging users participating in two game plays into the same game play.
Assuming that the game network joined by the intelligent terminal is a first game network, a second game network independent from the first game network exists. After the above step S440, as shown in fig. 7, the smart terminal may further perform the following steps S710 to S720.
Step S710: and selecting one leader node from the leader node of the first game network and the leader node of the second game network as a common node.
As shown in fig. 8, if all nodes of the first game network are not connected to all nodes of the second game network, the first game network and the second game network are considered to be independent from each other.
Assuming that the leader node of the first game network is node 2 and the leader node of the second game network is node 22, the intelligent terminal can select one node from the node 2 and the node 22 as the leader node. All nodes in the first gaming network and the second gaming network may vote for node 2 and node 22. Assuming that the number of votes of the node 2 is preferably half the number within the voting period, the node 2 may be determined as a common node. Conversely, if the number of votes for node 22 during the voting validity period is preferably more than half, node 22 may be determined to be a common node. The shared node is a common leader node selected by all nodes in the first game network and the second game network.
In an embodiment, as shown in fig. 9, the step S710 specifically includes steps S711 to S713.
Step S711: and if a connection request of a designated node in the second game network is received, establishing communication connection with the designated node in the second game network.
The intelligent terminal is positioned in the first game network, and the intelligent terminal can establish communication connection with the specified node on the assumption that the intelligent terminal receives the connection request of the specified node in the second game network. As shown in fig. 10, assuming that a player (node 21) finds that his friend is playing the game, the node 21 may input the IP address of his friend (node 3) through the online interface to connect, and the node 3 may be regarded as an intelligent terminal, and when a connection request of a specific node (node 21) is received, a communication connection with the node 21 is established. There is a conflict at this time because there are two Leader nodes (node 2 and node 22) if the entire game network connects all the nodes.
Step S712: and informing the designated node of the leader node identification of the first game network, and receiving the leader node identification of the second game network provided by the designated node.
As shown in fig. 10, the smart terminal (node 3) may notify the designated node (node 21) that the leader node id of the first game network is node 2, and the node 21 may also notify the node 3 that the leader node id of the second game network is node 22, so that the smart terminal (node 3) may also receive that the leader node id of the second game network provided by the designated node is node 22.
Step S713: and electing the common node according to the leader node identifier of the first game network and the leader node identifier of the second game network.
Node 2 and node 22 may initiate a Raft election process. From the intelligent terminal side, the intelligent terminal may receive the voting requests sent by the node 22 and the node 2, and respond to one of the voting requests (e.g., the voting request of the node 2), so that the intelligent terminal selects the node 2 as a common node.
Node 2 and node 22 initiate the Raft election process as follows: node 2 and node 22 may initiate a voting request to all nodes of the first gaming network and all nodes of the second gaming network (requesting other nodes to cast a 1-vote for themselves, and simultaneously cast a 1-vote for themselves), and the other nodes may respond to the voting request, i.e., recognize it as a common node. If node 2 or node 22 receives N/2+1 votes (N is the total number of all nodes of the first and second gaming networks), i.e., more than half of the votes, within a valid voting period (e.g., 500 milliseconds), then all nodes are considered to be elected as common nodes and are notified of the end of the vote.
Step S720: combining the first game network and the second game network to form a new game network; and the shared node is used as a leader node of the new game network, and data synchronization is carried out in the new game network.
It should be noted that, before the election has no result, the node 2 is still responsible for the Leader function of the first game network, and the node 22 is still responsible for the Leader function of the second game network. Once the new result is obtained, a new game network with all nodes interconnected is formed. The new gaming network has a unique Leader node.
For an intelligent terminal, communication connection with all nodes in a global node list can be established according to the global node list provided by a common node; wherein all nodes in the global node list are connected to form the new game network.
The global node list includes information of all nodes in the first game network and the second game network. The shared node is used as a leader node of the first game network and the second game network and has a latest node list of the whole network. The intelligent terminal can establish connection with all nodes of the first game network and the second game network according to the global node list issued by the common node. As shown in fig. 11, all nodes of the first game network and all nodes of the second game network establish a full connection relationship to form a new game network. Assuming that the elected common node is node 2, the node 2 is responsible for the calculation of game data, state synchronization, heartbeat transmission and maintenance work of a node list of the new game network.
It should be noted that the merging of a plurality of game networks and the merging of two game networks are similar. It may be merged one by one, such as with game net a merged with game net B into game net AB, then merged with game net C into game net ABC, and then merged with game net D into game net ABCD. Or, the game networks can be respectively combined, for example, the game network A and the game network B are combined into the game network AB, the game network C and the game network D are combined into the game network CD, then the game network AB and the game network CD are combined into the game network ABCD, and the leader node selected finally undertakes the work of the existing special server.
A plurality of game nodes are connected with each other through the Internet in an MMO scene, one game node is selected through a Raft algorithm to serve as a Leader node at the initial time, and complex calculation and state synchronization such as the position/speed/direction of a role at each moment are completed through the Leader node, so that a game network is formed. And each following node detects whether the Leader node is alive or not through a timing heartbeat mechanism, and if the Leader node is not alive through overtime detection, a new election is initiated to select a new Leader node. When a new node a which does not belong to any game network joins the game network, a certain node b in the network can be connected, the node b knows the Leader node, and the node a synchronizes the information of other nodes of the game network after connecting the Leader node. And if the nodes in one game network X are communicated with the nodes in the other game network Y, the election is initiated again to form a larger game network.
Therefore, according to the technical scheme provided by the embodiment of the application, the multiplayer online game can be realized without purchasing a special server, the calculation cost and the network cost are borne by the game nodes, and the cost of the game server is 0; the game nodes can be added/withdrawn at any time, and the network has elasticity and can expand and contract the capacity at any time; two or more gaming networks may be merged; and when the Leader node fails, a new Leader can be elected quickly, and the game network has robustness and has no single point failure.
The following is an embodiment of an apparatus of the present application, which can be used to execute an embodiment of a processing method of the multiplayer online game of the present application. For details not disclosed in the embodiments of the device of the present application, please refer to the embodiments of the processing method of the multiplayer online game of the present application.
Fig. 12 is a block diagram of a processing device of a multiplayer online game according to an embodiment of the present application. As shown in fig. 12, the apparatus includes: a connection address acquisition module 1210, a leader node determination module 1220, a connection establishment module 1230, and a game state synchronization module 1240.
A connection address acquisition module 1210, configured to acquire a communication address of a designated terminal, and establish a communication connection with the designated terminal according to the communication address of the designated terminal;
a leader node determining module 1220, configured to, if the designated terminal belongs to a game node of a constructed game network, obtain a leader node address of the game network through the game node; wherein a plurality of game terminals participating in the same game are communicated with each other to form the game network; one of the game terminals is marked as a leader node of the game network;
a connection establishing module 1230, configured to establish a communication connection with a leader node in the game network according to the leader node address;
and the game state synchronization module 1240 is configured to synchronize the game state with the plurality of game terminals in the game network according to the game data sent by the leader node to the game network.
The implementation process of the functions and actions of each module in the device is specifically described in the implementation process of the corresponding step in the processing method of the multiplayer online game, and is not described herein again.
In the embodiments provided in the present application, the disclosed apparatus and method can be implemented in other ways. The apparatus embodiments described above are merely illustrative, and for example, the flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of apparatus, methods and computer program products according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). In some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
In addition, functional modules in the embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application or portions thereof that substantially contribute to the prior art may be embodied in the form of a software product stored in a storage medium and including instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

Claims (16)

1. A method of processing a multiplayer online game, the method comprising:
acquiring a communication address of a designated terminal, and establishing communication connection with the designated terminal according to the communication address of the designated terminal;
if the designated terminal belongs to a game node of a constructed game network, acquiring a leader node address of the game network through the game node; wherein a plurality of game terminals participating in the same game are communicated with each other to form the game network; one of the game terminals is marked as a leader node of the game network;
establishing communication connection with a leader node in the game network according to the leader node address;
and according to the game data sent to the game network by the leader node, synchronizing the game state with a plurality of game terminals in the game network.
2. The method of claim 1, further comprising:
if the appointed terminal does not belong to the game nodes of the constructed game network, the appointed terminal is marked as a leader node and forms the game network together with the appointed terminal;
and according to the game data sent by the leader node, synchronizing the game state with the leader node.
3. The method of claim 1, wherein the obtaining, by the gaming node, a leader node address of the gaming network comprises:
and determining the address of the leader node according to the node list provided by the game node.
4. The method of claim 1, wherein after establishing a communication connection with a leader node in the gaming network based on the leader node address, the method further comprises:
and establishing communication connection with a plurality of game terminals in the game network according to the node list provided by the leader node.
5. The method of claim 1, wherein after the synchronization of the game state with the plurality of game terminals in the gaming network according to the game data transmitted by the leader node to the gaming network, the method further comprises:
receiving heartbeat signals sent by the leader node at fixed time;
if the heartbeat signal is not received within a preset time period, initiating a new leader node election process;
and according to the elected new leader node, synchronizing the game state in the game network.
6. The method of claim 5, wherein the synchronizing of the game state at the gaming network according to the elected new leader node comprises:
if the terminal is elected as the new leader node, calculating game data of the game and synchronizing the game data to the game network.
7. The method of claim 6, wherein if the self terminal is elected as the new leader node, the method further comprises:
and generating a new node list, and synchronizing the new node list to the game network.
8. The method of claim 6, wherein if the self terminal is elected as the new leader node, the method further comprises:
and sending heartbeat signals to the game terminals in the game network at fixed time.
9. The method of claim 5, wherein the synchronizing of the game state at the gaming network according to the elected new leader node comprises:
and if the terminal of the self terminal is not elected as the new leader node, receiving game data sent by the new leader node, and synchronizing the game state with a plurality of game terminals in the game network.
10. The method of claim 9, wherein if the self terminal is not elected as the new leader node, the method further comprises:
and receiving a new node list sent by the new leader node and a heartbeat signal sent at fixed time.
11. The method of claim 1, wherein the gaming network is a first gaming network, and wherein there is a second gaming network separate from the first gaming network; after the game state is synchronized with a plurality of game terminals in the game network according to the game data sent to the game network by the leader node, the method further comprises:
selecting a leader node from the leader node of the first game network and the leader node of the second game network as a common node;
combining the first game network and the second game network to form a new game network; and the shared node is used as a leader node of the new game network, and data synchronization is carried out in the new game network.
12. The method of claim 11, wherein the electing a leader node from the leader node of the first gaming network and the leader node of the second gaming network as a common node comprises:
if a connection request of a designated node in the second game network is received, establishing communication connection with the designated node in the second game network;
informing the designated node of the leader node identification of the first game network, and receiving the leader node identification of the second game network provided by the designated node;
and electing the common node according to the leader node identifier of the first game network and the leader node identifier of the second game network.
13. The method of claim 11, wherein said merging the first gaming network and the second gaming network into a new gaming network comprises:
establishing communication connection with all nodes in the global node list according to the global node list provided by the common node; wherein all nodes in the global node list are connected to form the new game network.
14. A processing apparatus for a multiplayer online game, the apparatus comprising:
the system comprises a connection address acquisition module, a communication connection module and a communication connection module, wherein the connection address acquisition module is used for acquiring a communication address of a designated terminal and establishing communication connection with the designated terminal according to the communication address of the designated terminal;
the leader node determining module is used for acquiring a leader node address of the game network through the game node if the designated terminal belongs to the game node of the constructed game network; wherein a plurality of game terminals participating in the same game are communicated with each other to form the game network; one of the game terminals is marked as a leader node of the game network;
the connection establishing module is used for establishing communication connection with the leader node in the game network according to the leader node address;
and the game state synchronization module is used for synchronizing the game states with a plurality of game terminals in the game network according to the game data sent to the game network by the leader node.
15. An electronic device, characterized in that the electronic device comprises:
a processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to perform the processing method of the multiplayer online game of any one of claims 1-13.
16. A computer-readable storage medium, characterized in that the storage medium stores a computer program executable by a processor to perform the method of processing a multiplayer online game according to any one of claims 1 to 13.
CN202110815307.7A 2021-07-19 2021-07-19 Method and device for processing multiplayer online game, electronic equipment and storage medium Pending CN113440863A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110815307.7A CN113440863A (en) 2021-07-19 2021-07-19 Method and device for processing multiplayer online game, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110815307.7A CN113440863A (en) 2021-07-19 2021-07-19 Method and device for processing multiplayer online game, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN113440863A true CN113440863A (en) 2021-09-28

Family

ID=77816728

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110815307.7A Pending CN113440863A (en) 2021-07-19 2021-07-19 Method and device for processing multiplayer online game, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN113440863A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500612A (en) * 2022-04-06 2022-05-13 深圳航天信息有限公司 Method and device for local networking of Internet of things, electronic equipment and storage medium
CN116744272A (en) * 2023-08-07 2023-09-12 北京自在游网络科技有限公司 Bluetooth-based hand-tour data transmission system

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040152517A1 (en) * 2000-02-14 2004-08-05 Yon Hardisty Internet based multiplayer game system
CN101427255A (en) * 2004-03-16 2009-05-06 爱克斯法尔公司 System and method for facilitating multiplayer online gaming
US20100056275A1 (en) * 2008-09-04 2010-03-04 United States Of America As Represented By The Secretary Of The Army Massively Multiplayer Online Game Technologies
CN102968549A (en) * 2012-10-17 2013-03-13 北京大学 Multi-user on-line interaction method and system based on intelligent mobile terminal equipment
CN104508714A (en) * 2012-05-23 2015-04-08 金.Com有限公司 Systems and methods for interactive gameplay
CN105233496A (en) * 2012-04-12 2016-01-13 舒佩塞尔公司 System, method and graphical user interface for controlling a game
CN107634955A (en) * 2017-09-25 2018-01-26 重庆工程职业技术学院 A kind of palm war game control system and control method
CN112090086A (en) * 2020-08-21 2020-12-18 苏州思酷数字科技有限公司 Data interconnection game system based on wireless sharing and working method thereof

Patent Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20040152517A1 (en) * 2000-02-14 2004-08-05 Yon Hardisty Internet based multiplayer game system
CN101427255A (en) * 2004-03-16 2009-05-06 爱克斯法尔公司 System and method for facilitating multiplayer online gaming
US20100056275A1 (en) * 2008-09-04 2010-03-04 United States Of America As Represented By The Secretary Of The Army Massively Multiplayer Online Game Technologies
CN105233496A (en) * 2012-04-12 2016-01-13 舒佩塞尔公司 System, method and graphical user interface for controlling a game
CN104508714A (en) * 2012-05-23 2015-04-08 金.Com有限公司 Systems and methods for interactive gameplay
CN102968549A (en) * 2012-10-17 2013-03-13 北京大学 Multi-user on-line interaction method and system based on intelligent mobile terminal equipment
CN107634955A (en) * 2017-09-25 2018-01-26 重庆工程职业技术学院 A kind of palm war game control system and control method
CN112090086A (en) * 2020-08-21 2020-12-18 苏州思酷数字科技有限公司 Data interconnection game system based on wireless sharing and working method thereof

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114500612A (en) * 2022-04-06 2022-05-13 深圳航天信息有限公司 Method and device for local networking of Internet of things, electronic equipment and storage medium
CN114500612B (en) * 2022-04-06 2022-07-05 深圳航天信息有限公司 Method and device for local networking of Internet of things, electronic equipment and storage medium
CN116744272A (en) * 2023-08-07 2023-09-12 北京自在游网络科技有限公司 Bluetooth-based hand-tour data transmission system

Similar Documents

Publication Publication Date Title
CN111405304B (en) Anchor interaction method and device, computer equipment and storage medium
CN113440863A (en) Method and device for processing multiplayer online game, electronic equipment and storage medium
CN103477627A (en) Collaborative image control
US20230071173A1 (en) Method for interacting in live streaming and electronic device
CN110149525A (en) A kind of live broadcasting method, device, equipment and storage medium
CN109173270B (en) Game service system and implementation method
CN110120931A (en) A kind of information interacting method, device and storage medium
JP6974458B2 (en) Game server and method for generating context-aware game information
CN111625353B (en) Virtual resource distribution processing method, device, server and storage medium
CN111818349A (en) Page display method and device, electronic equipment and storage medium
CN113996053A (en) Information synchronization method, device, computer equipment, storage medium and program product
CN104917631A (en) Prediction initiation, participation and information processing methods, device and system
CN114070733A (en) Consensus method, device and system based on block chain network
CN112003943A (en) Voice data synchronization method and device
CN112887299B (en) Online interaction method and device, electronic equipment and storage medium
CN113824983A (en) Data matching method, device, equipment and computer readable storage medium
CN110354496B (en) Electronic athletic event processing method and device, storage medium and electronic equipment
CN109714328B (en) Capacity adjustment method and device for game cluster
WO2023151338A1 (en) Game picture display method, storage medium, and electronic device
CN113413586B (en) Virtual object transmission method, device, equipment and storage medium
CN109847340A (en) A kind of information processing method, device, equipment and medium
KR101106873B1 (en) Peer to peer communication method between online game clients
CN111416849B (en) Disconnection reconnection method, device and system and computer equipment
CN110928674B (en) Method for realizing block chain consensus mechanism
KR20180102399A (en) Server, device and method of management for providing of in virtual reality game

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination