CN113440863B - Processing method and device for multiplayer online game, electronic equipment and storage medium - Google Patents

Processing method and device for multiplayer online game, electronic equipment and storage medium Download PDF

Info

Publication number
CN113440863B
CN113440863B CN202110815307.7A CN202110815307A CN113440863B CN 113440863 B CN113440863 B CN 113440863B CN 202110815307 A CN202110815307 A CN 202110815307A CN 113440863 B CN113440863 B CN 113440863B
Authority
CN
China
Prior art keywords
game
node
network
leader
leader node
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.)
Active
Application number
CN202110815307.7A
Other languages
Chinese (zh)
Other versions
CN113440863A (en
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/CN113440863B/en
Publication of CN113440863A publication Critical patent/CN113440863A/en
Application granted granted Critical
Publication of CN113440863B publication Critical patent/CN113440863B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Computer And Data Communications (AREA)

Abstract

The application provides a processing method and device of a multiplayer online game, electronic equipment and storage media, 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 office 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 leader node address; and according to the game data sent to the game network by the leader node, synchronizing the game states with a plurality of game terminals in the game network. The proposal reduces the cost of purchasing special servers and can resist single point of failure because no professional server is needed.

Description

Processing method and device for 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 apparatus for processing a multiplayer online game, an electronic device, and a computer readable storage medium.
Background
MMO (MASSIVELY MULTIPLAYER ONLINE GAME, large-scale multiplayer online game) has a large market share, and common MMO games include Dahua Xiyou ghost, duanshui Han, tianorai. The game player is connected to the network through the nodes (computer/mobile phone/tablet/watch/other devices), so as to participate in the same MMO game, and each node can be connected to the Internet and disconnected from the Internet at any time and any place.
As shown in fig. 1, the current mainstream practice of the MMO game is a star structure in which one or a group of servers drive thousands or tens of thousands of game nodes. All nodes acquire information of other nodes through a special server of the game provider. The states are synchronized by a dedicated server.
Because of the need of purchasing a special server, the networking cost is higher; 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 outage 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 appointed terminal belongs to a 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 office communicate with each other to form the game network; one game terminal is marked as a leading 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 states 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 node of the constructed game network, marking the appointed terminal as a leading node, and forming 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 obtaining, by the game node, the address of the leader node of the game network includes:
and determining the address of the leading node according to the node list provided by the game node.
In an embodiment, after the communication connection with the leader node in the game network is established according to the leader node address, the method further includes:
And establishing communication connection with a plurality of game terminals in the game network according to the node list provided by the leading node.
In one embodiment, after the game state synchronization is performed with the 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 includes:
receiving heartbeat signals sent by the leader node at fixed time;
if the heartbeat signal is not received in the preset time period, a new leader node election process is initiated;
and according to the selected new leader node, synchronizing the game states in the game network.
In one embodiment, the step of synchronizing the game states in the game network according to the selected new leader node includes:
if the terminal is elected as the new leader node, calculating the game data of the game bureau, and synchronizing the game data to the game network.
In an embodiment, if the own terminal is elected as the new leader node, the method further includes:
Generating a new node list, and synchronizing the new node list to the game network.
In an embodiment, if the own 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 regular time.
In one embodiment, the step of synchronizing the game states in the game network according to the selected new leader node includes:
And if the self terminal is not elected as the new leader node, receiving game data sent by the new leader node, and synchronizing the game states with a plurality of game terminals in the game network.
In an embodiment, if the own terminal is not elected as the new leader node, the method further includes:
and receiving a new node list sent by the new leading node and a heartbeat signal sent at fixed time.
In an embodiment, the game network is a first game network, and a second game network independent from the first game network exists; after synchronizing the game states with the 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 nodes of the first game network and the leader nodes 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 common node is used as a leading node of the new game network, and performs data synchronization in the new game network.
In an embodiment, the selecting a leader node from the leader nodes of the first game network and the leader nodes of the second game network as a common node includes:
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;
notifying 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 identification of the first game network and the leader node identification of the second game network.
In an embodiment, said merging said first game network and said second game network to form a new game network comprises:
establishing communication connection with all nodes in a global node list according to the global node list provided by the common node; all nodes in the global node list are connected with each other to form the new game network.
The embodiment of the application also provides a processing device for the multiplayer online game, which comprises:
The connection address acquisition module is used for acquiring the communication address of the appointed terminal and establishing communication connection with the appointed terminal according to the communication address of the appointed 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 office communicate with each other to form the game network; one game terminal is marked as a leading node of the game network;
The connection establishment 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.
The embodiment of the application also provides electronic equipment, which comprises:
A processor;
a memory for storing processor-executable instructions;
wherein the processor is configured to execute any one of the above-described processing methods of the multiplayer online game.
The embodiment of the application also provides a computer readable storage medium, wherein the storage medium stores a computer program, and the computer program can be used for executing the processing method of any multi-player online game by a processor.
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 to send game data, so that the synchronization of the game states of a plurality of game terminals in the game network is realized, and the cost of purchasing the special server, the electricity fee, the network fee and the maintenance cost of a game provider are reduced.
Drawings
In order to more clearly illustrate the technical solution of the embodiments of the present application, the drawings that are required to be used in the embodiments of the present application will be briefly described below.
FIG. 1 is a schematic diagram of a multi-player online game architecture in the background;
FIG. 2 is a schematic diagram of an application scenario of a method for processing a multiplayer online game according to an embodiment of the present application;
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application;
FIG. 4 is a schematic flow chart of a method for processing a multiplayer online game according to an embodiment of the present application;
FIG. 5 is a schematic flow chart of a processing method of a multiplayer online game according to an embodiment of the present application based on the corresponding 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 application;
FIG. 7 is a flowchart of a method for processing a multiplayer online game according to another embodiment of the present application based on the corresponding embodiment of FIG. 4;
FIG. 8 is a schematic diagram of a relationship between two game networks provided by an embodiment of the present application;
FIG. 9 is a detailed flowchart of step S710 in the corresponding embodiment of FIG. 7;
FIG. 10 is a schematic diagram of two gaming networks merging to have 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 for 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 accompanying drawings in the embodiments of the present application.
Like reference numerals and letters denote like items in the following figures, and thus once an item is defined in one figure, no further definition or explanation thereof is necessary in the following figures. Meanwhile, in the description of the present application, the terms "first", "second", and the like are used only to distinguish the description, and are not to be construed as indicating or implying relative importance.
Fig. 2 is an application scenario schematic 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 (represented by solid line connections) to form a game network to participate in the same game play. One of the gaming terminals 110 acts as a leader node of the gaming network.
When there is an intelligent terminal 120 that needs to join the game network to participate in the same game play, the intelligent terminal 120 may execute the method provided by the embodiment of the present application, and join the game network (represented by the dashed connection) to participate in the same game play as the game terminal 110 in the game network. In one embodiment, if there is no constructed game network, the intelligent terminal 120 may also serve as a leader node to communicate with other game terminals 110 to form a game network. The game terminal 110 and the intelligent terminal 120 may be electronic devices such as smart phones, tablet computers, desktop computers, notebook computers, vehicle terminals, and the like.
Fig. 3 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device may be used as the above-mentioned intelligent terminal 120, and the electronic device 200 may be used to execute the processing method of the multiplayer online game provided by the embodiment of the application. As shown in fig. 3, the electronic device 200 includes: one or more processors 202, 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 comprising a Central Processing Unit (CPU), an image processing unit (GPU) or other form of processing unit having data processing and/or instruction execution capabilities, may process data from other components in the electronic device 200, and may also 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) and/or cache memory (cache), and the like. The non-volatile memory may include, for example, read Only Memory (ROM), hard disk, flash memory, and the like. One or more computer program instructions may be stored on the computer readable storage medium that may be executed by the processor 202 to implement the method of processing a 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 further include an input device 206, an output device 208, and a data acquisition device 210, which are interconnected by a bus system 212 and/or other form of connection mechanism (not shown). It should be noted that the components and structures of the electronic device 200 shown in fig. 3 are exemplary only and not limiting, as the electronic device 200 may have other components and structures 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, mouse, microphone, 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 images of the subject and store the acquired images in the memory 204 for use by other components. The data acquisition device 210 may be a camera, for example.
In an embodiment, the devices in the exemplary electronic device 100 for implementing the processing method of the multiplayer online game according to the embodiment of the application may be integrated or may be distributed, such as integrating the processor 202, the memory 204, the input device 206 and the output device 208, and separately setting the data acquisition device 210.
In an embodiment, the example electronic device 200 for implementing the processing method of the multiplayer online game according to the embodiment of the application may be implemented as a smart device such as a smart phone, a tablet computer, a desktop computer, a notebook computer, a vehicle-mounted terminal, and the like.
Fig. 4 is a flow chart of a processing method of a multiplayer online game according to an embodiment of the present application. 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 the appointed terminal, and establishing communication connection with the appointed terminal according to the communication address of the appointed terminal.
The designated terminal may be a game terminal in the established game network or may be a single game terminal. It should be noted that, the game terminals in the game network may also be referred to as game nodes, 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. Player 1 may input the IP address of player 2 (i.e., the designated terminal) at the game online interface of the smart terminal, so that the smart terminal obtains the communication address of the designated terminal, and may establish a communication connection with the designated terminal.
In another embodiment, the manner in which the intelligent terminal obtains the communication address of the specified terminal may be: player 2 shows player 1 a game two-dimensional code, player 1 scans the game two-dimensional code shown by player 2, and the game two-dimensional code can contain the IP address of player 2, so that the intelligent terminal corresponding to player 1 obtains the communication address of player 2 and is connected with the designated terminal corresponding to player 2.
In other embodiments, the terminal corresponding to the player 2 may view the "local IP address" on the game setting interface, and notify the player 1 to fill in, so that the intelligent terminal corresponding to the player 1 obtains the communication address of the specified terminal, and establishes communication connection with the specified terminal.
In other embodiments, each of the player 1 and the player 2 may register an account number on a third-party website, the third-party website maintains the IP of each player, and the third-party website may display the two-dimensional code or the IP of the other player by clicking a connection button, so that the intelligent terminal may 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 appointed terminal belongs to a 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 office communicate 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, where 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 Raft algorithm. To distinguish, a game node other than a leader node (leader) may be referred to as a follower node (follower).
Normally there is only one leader node, the others are follower nodes. While the leader node will be responsible for all external requests, if not the leader node receives the request, the request will be directed to the leader node. Typically, the leader node will send a message, i.e., a "heartbeat," over a fixed time period, to let the follower node know that the leader node of the gaming network is still functioning. Each following node is designed with a timeout mechanism (timeout), and when no heartbeat (typically 150ms or 300 ms) is received for a certain period of time, the game network enters an election state, i.e. reelects a new leader node.
When the designated terminal belongs to a game node of a game network, the designated terminal sends a node list of the game network to the intelligent terminal, and the intelligent terminal can know which game node belongs to a leader node according to the node list to obtain a leader node address.
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 leader node address, if the communication address of the specified terminal just coincides with the leader node address, that is, the specified terminal just is the leader node, then the communication connection with the specified terminal is established. If the appointed 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.
And the leader node can provide a node list for 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/list/a direct. The node list on the leader node is always up to date, describing the latest "game net" overview, and the follower node can synchronize this 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 states with a plurality of game terminals in the game network.
The leader node is responsible for calculating game data, synchronizing game states in the game network, sending heartbeats at fixed time, maintaining a node list and the like. The game data includes the position, speed, orientation, whether two characters collide, who wins the game result, etc. of the character at each moment.
The leader node may transmit game data to each game node in the game network, so that each game node may receive the same game data, and synchronization of game states of game terminals in the game network is achieved. The game state refers to a state in which a character is located at a position, a speed, an orientation, whether or not collision occurs between two characters, who wins a game result, and the like at each time point presented by the game data.
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, game data are sent, and the synchronization of the game states of a plurality of game terminals in the game network is realized, so that the cost of purchasing a special server of a game provider, the electricity charge, the network charge and the maintenance cost are reduced, and the special server is not needed, so that single-point faults can be resisted.
In an embodiment, after the 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 heartbeat signals 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, which plays a role in notifying the following nodes that the leader node still works normally, and the following nodes may return a response message after receiving the heartbeat signal, thereby notifying the leader node that the node works normally. 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 in the preset time period, initiating a new leader node election process.
Since the leader node will send a heartbeat signal at a fixed time, if the intelligent terminal does not receive the heartbeat signal over time (e.g., 5 seconds), it indicates that the leader node is deactivated (e.g., disconnected from the network, shut down, or the game process/port is shut down). So that the intelligent terminal can initiate a new leader election process.
The process of initiating the new leader node election 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 a vote), and of course, the intelligent terminal may also cast a vote at the same time. After receiving the voting request of the intelligent terminal, the other nodes respond to acknowledge that the intelligent terminal is a new leading node. It should be noted that this request wait voting response has a validity period, for example, 500 ms, during which any node may request other nodes to vote on it.
If a certain game node receives N/2+1 votes within a valid voting period (where N is the length of the node list, i.e. the number of nodes in the game network, and deactivated nodes need to be excluded), the game node considers itself to be the leader node, and can inform other nodes that the game node is a new leader node, and the voting process is also finished. A heartbeat is started to be sent to other nodes periodically. If a game node receives the notification of the new leader node, the voting process is ended, the game node considers that the game node is a following node, and the heartbeat signal of the new leader node is received.
If this "voting validity period" is exceeded (e.g., 500 milliseconds), then a new round of voting continues to be reinitiated, letting the other nodes acknowledge themselves as the leader node. Until either the node itself is selected as the new leader node or other nodes are received as new leader nodes. Eventually a new leader node and follower node will be selected.
Step S530: and according to the selected new leader node, synchronizing the game states in the game network.
The new leader node may be the above-mentioned intelligent terminal which has just joined the game network, or may be a surviving game terminal which has already existed in the game network.
In one embodiment, if the own terminal (i.e., the smart terminal) is elected as the new leader node, the smart terminal calculates game data of the game office and synchronizes the game data to the game network.
It should be explained that synchronizing to the game network means transmitting game data to all 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 synchronization of game states is achieved.
In an embodiment, since the intelligent terminal is elected as a new leader node, the intelligent terminal may also generate a new node list, synchronize the new node list to the gaming network, i.e., send the new node list to surviving gaming terminals within the gaming network. If a new node is added or exited, 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 selected as a new leader node, the intelligent terminal can send heartbeat signals to the game terminals in the game network at regular time, so as to inform each game terminal that the terminal itself works normally, and determine which nodes are deactivated based on whether a response message is returned.
In contrast, in an embodiment, if the own terminal (i.e., the intelligent terminal) is not selected as the new leader node, the intelligent terminal may also receive the game data sent by the new leader node, and perform synchronization of the game states with the plurality of game terminals surviving in the game network. The intelligent terminal can also receive a new node list sent by the new leading node and heartbeat signals sent at fixed time.
In one embodiment, if the designated terminal in step S420 does not belong to the game node of the constructed game network. I.e. the designated terminal is also an isolated gaming terminal, the designated terminal together with the intelligent terminal may build a new gaming network. The intelligent terminal can mark a designated terminal as a leader node and form a game network together with the designated terminal; and according to the game data sent by the leader node (namely the designated terminal), synchronizing the game state with the leader node (namely the designated terminal). The designated terminal is used as a leading node and can also be responsible for the work of calculating game data, sending heartbeat signals, maintaining a node list and the like.
For example, both players start the game on their respective devices (cell phone/computer/tablet, etc.), enter the offline map mode directly, and become nodes. As shown in fig. 6-1, a 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 Follower (following node) after connection, and node 2 is labeled Leader (Leader node, shown gray). At this time, the two nodes can play normally on-line, and a game network is formed. And carrying out complex calculation and synchronization states through the 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 Follower node fails to receive the heartbeat signal sent by the Leader node at the timing (for example, every 100 ms) for a long time (for example, 5 seconds), or the Leader node fails to receive the reply of the heartbeat signal for a long time, the node 1 and the node 2 switch to the offline map mode respectively.
If node 3 is added (a new node is not on any game network at this time), it is assumed that node 3 is connected to Follower nodes, and the location of the Leader is known by Follower, as shown in fig. 6-4. As shown in fig. 6-5, assuming that node 3 is connected to the Leader node, the location of the Leader is known directly.
As shown in fig. 6-6, the newly added node 3 knows all node information in the game network and connects through the list of all nodes provided by the Leader node. Eventually all 3 nodes are interconnected. Complex computation/state synchronization may continue through the Leader node. After the complete connection, the new node 3 tells the Leader that the node is connected, the node list of the Leader is added by one, and then the node list is synchronized to all nodes in the game network.
6-7, If one of the Follower nodes (e.g., node 1) is deactivated or disconnected, follower node alone enters offline mode, the other nodes can still play normally, e.g., node 3 can still receive the heartbeat of the Leader node at a fixed 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 intervals.
As shown in fig. 6-8, the Leader node is deactivated, the Follower node fails to receive the heartbeat of the Leader node for a long time, and the Follower node initiates Raft the election process (which may be initiated by node 1, may be initiated by node 3, and may be initiated simultaneously). Because node 1, node 3 are still connected and are aware of each other's original list of nodes, the new Leader is eventually selected. As shown in fig. 6-9, a node (e.g., node 3) is selected as the new Leader node, at which point the new game network has 2 nodes, node 1, node 3. Complex computation, state synchronization, sending heartbeat signals, node list maintenance, etc. are done by the node 3.
As shown in fig. 6-10 and fig. 6-11, the process of joining the 4 th node is the same as joining the 3 rd node, and the same is true for more nodes. The meaning of joining a new node is that there is a new player joining the game or that there is a new player switching from an offline map to an online map. The process of reducing nodes is the same as the deactivation (or communication) of a certain node. The meaning of reducing nodes is that a player drops a line for a long time or that the player switches from an online map to an offline map.
The foregoing is a description of a multiplayer online gaming method for a gaming network. The following describes how a plurality of online games of two game networks are combined into one game network, i.e., a process in which users participating in two game plays are combined into the same game play.
Assuming that the game network added by the intelligent terminal is a first game network, a second game network independent of the first game network exists. After the above step S440, as shown in fig. 7, the intelligent terminal may further perform the following steps S710 to S720.
Step S710: and selecting one leader node from the leader nodes of the first game network and the leader nodes of the second game network as a common node.
As shown in fig. 8, if there is no node connection between all nodes of the first game network and 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 may elect one node from among node 2 and node 22 as the leader node. All nodes in the first and second gaming networks may vote on node 2 and node 22. Assuming that the number of votes for node 2 is over half the voting period of validity, node 2 may be determined to be a common node. Conversely, if the number of votes from node 22 within the voting period of validity is over half, then node 22 may be determined to be a common node. The common node refers to a common leader node selected by all nodes in the first game network and the second game network.
In one embodiment, as shown in fig. 9, the step S710 specifically includes steps S711 to S713.
Step S711: and if a connection request of the 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 in the first game network, and the intelligent terminal can establish communication connection with the designated node on the assumption that the intelligent terminal receives the connection request of the designated 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, node 21 may connect by entering the IP address of his friend (node 3) through an online interface, at which point node 3 may be considered an intelligent terminal, receiving a connection request from a designated node (node 21), establishing a communication connection with node 21. This time there is a conflict because there are two Leader nodes (node 2 and node 22) if the entire gaming network is connected to all nodes.
Step S712: and notifying 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 intelligent terminal (node 3) may notify the designated node (node 21) that the leader node identifier of the first game network is node 2, and the node 21 may further notify the node 3 that the leader node identifier of the second game network is node 22, so that the intelligent terminal (node 3) may further receive that the leader node identifier 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 identification of the first game network and the leader node identification of the second game network.
Node 2 and node 22 may initiate Raft an election process. From the side of the intelligent terminal, the intelligent terminal can receive the voting requests sent by the node 22 and the node 2, and answer one of the voting requests (for example, the voting request of the node 2), so that the intelligent terminal selects the node 2 as a shared node.
Node 2 and node 22 initiate Raft an election process as follows: nodes 2 and 22 may initiate voting requests to all nodes of the first gaming network and all nodes of the second gaming network (requesting other nodes to vote themselves for 1 and1 at the same time), and other nodes may respond to the voting requests, i.e., approve that they be common nodes. If node 2 or node 22 receives N/2+1 votes (N being the total number of all nodes of the first and second gaming networks), i.e., more than half of the total number of nodes, once the votes received within a valid voting period (e.g., 500 milliseconds), then the votes are considered to be common nodes and all nodes 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 common node is used as a leading node of the new game network, and performs data synchronization in the new game network.
It should be noted that, before there is no result in the election, 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 available, a new game network is constructed in which all nodes are interconnected. The new game network has a unique Leader node.
For the intelligent terminal, communication connection with all nodes in a global node list can be established according to the global node list provided by the shared node; all nodes in the global node list are connected with each other to form the new game network.
The global node list includes information for all nodes in the first gaming network and the second gaming 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 constitute a new game network. Assuming that the elected common node is node 2, the node 2 is responsible for the calculation of game data of the new game network, state synchronization, heartbeat transmission and maintenance work of a node list.
It should be noted that the combination of a plurality of game networks and the combination of two game networks are similar. It is possible to merge one by one, for example, game net a with game net B into game net AB, then with game net C into game net ABC, then with game net D into game net ABCD. Or the game network A and the game network B can be combined into a game network AB, the game network C and the game network D can be combined into a game network CD, then the game network AB and the game network CD can be combined into a game network ABCD, and the leader node of the final election bears the work of the existing proprietary server.
In the MMO scene, a plurality of game nodes are connected with each other through the Internet, a game node is selected to serve as a Leader node through Raft algorithm in the initial stage, and complex calculation and state synchronization, such as the position/speed/orientation of a character at each moment, are completed through the Leader node, so that a game network is formed. Each following node detects whether the Leader node survives or not through a timing heartbeat mechanism, if the survival of the Leader node is not detected in a time-out mode, a new election is initiated, and a new Leader node is selected. When a new node a which does not belong to any game network joins the game network, a node b which is already in the network can be connected, the Leader node is known through the node b, and the node a is connected with the Leader node to synchronize information of other nodes of the game network. If the node in one game network X is communicated with the node of another game network Y, the election is reinitiated to form a larger game network.
Therefore, the technical scheme provided by the embodiment of the application can realize the multi-player online game without purchasing a special server, the relying calculation cost and the network cost are borne by the game node, and the cost of the game server is 0; the game node can be added/withdrawn at any time, the network has elasticity, and the capacity is expanded and contracted at any time; two or more gaming networks may be consolidated; the Leader node is faulty, so that a new Leader can be rapidly selected, the game network has robustness, and no single point fault exists.
The following is an embodiment of the apparatus of the present application, which may be used to execute the processing method embodiment of the multiplayer online game of the present application. For details not disclosed in the embodiment of the apparatus of the present application, please refer to an embodiment of a processing method of the multiplayer online game of the present application.
Fig. 12 is a block diagram of a processing device for a multiplayer online game according to an embodiment of the 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 specified terminal, and establish a communication connection with the specified terminal according to the communication address of the specified terminal;
A leader node determining module 1220, configured to obtain, if the specified terminal belongs to a game node of the constructed game network, a leader node address of the game network through the game node; wherein a plurality of game terminals participating in the same game office communicate with each other to form the game network; one game terminal is marked as a leading node of the game network;
a connection establishment module 1230, configured to establish a communication connection with a leader node in the game network according to the leader node address;
And a game state synchronization module 1240, configured to synchronize a game state 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 implementation process of the functions and roles of each module in the device is specifically shown in the implementation process of corresponding steps in the processing method of the multiplayer online game, and is not repeated here.
In the several embodiments provided in the present application, the disclosed apparatus and method may be implemented in other manners. The apparatus embodiments described above are merely illustrative, for example, of the flowcharts and block diagrams in the figures that 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 a single part, or each module may exist alone, or two or more modules may be integrated to form a single part.
The functions, if implemented in the form of software functional modules and sold or used as a stand-alone product, may be stored on a computer readable storage medium. Based on this understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art or in a part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing a computer device (which may be a personal computer, a server, a network device, etc.) to perform all or part of the steps of the method of the embodiments of the present application. And the aforementioned storage medium includes: a usb disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or 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 appointed terminal belongs to a 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 office communicate with each other to form the game network; one game terminal is marked as a leading node of the game network; the leader node is responsible for data calculation and data synchronization 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 states with a plurality of game terminals in the game network.
2. The method according to claim 1, wherein the method further comprises:
If the appointed terminal does not belong to the game node of the constructed game network, marking the appointed terminal as a leading node, and forming 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, the leader node address of the gaming network comprises:
Determining a leader node address according to a node list provided by the game node; the node list comprises node information of each game node in the game network; the node information includes at least one of a node name, a communication address, and a leader node identification.
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 leading node.
5. The method of claim 1, wherein after synchronizing the game status with the plurality of game terminals in the game network according to the game data transmitted to the game network by the leader node, the method further comprises:
receiving heartbeat signals sent by the leader node at fixed time;
if the heartbeat signal is not received in the preset time period, a new leader node election process is initiated;
and according to the selected new leader node, synchronizing the game states in the game network.
6. The method of claim 5, wherein the synchronizing of game states at the game network based on the elected new leader node comprises:
if the terminal is elected as the new leader node, calculating the game data of the game bureau, and synchronizing the game data to the game network.
7. The method of claim 6, wherein if the own terminal is elected as the new leader node, the method further comprises:
Generating a new node list, and synchronizing the new node list to the game network.
8. The method of claim 6, wherein if the own 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 regular time.
9. The method of claim 5, wherein the synchronizing of game states at the game network based on the elected new leader node comprises:
And if the self terminal is not elected as the new leader node, receiving game data sent by the new leader node, and synchronizing the game states with a plurality of game terminals in the game network.
10. The method of claim 9, wherein if the own terminal is not elected as the new leader node, the method further comprises:
and receiving a new node list sent by the new leading 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 independent of the first gaming network; after synchronizing the game states with the 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 nodes of the first game network and the leader nodes 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 common node is used as a leading node of the new game network, and performs data synchronization in the new game network.
12. The method of claim 11, wherein the electing one leader node from among the leader nodes of the first gaming network and the leader nodes 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;
notifying 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 identification of the first game network and the leader node identification of the second game network.
13. The method of claim 11, wherein the merging the first game net and the second game net to form a new game net comprises:
establishing communication connection with all nodes in a global node list according to the global node list provided by the common node; all nodes in the global node list are connected with each other to form the new game network.
14. A processing device for a multiplayer online game, the device comprising:
The connection address acquisition module is used for acquiring the communication address of the appointed terminal and establishing communication connection with the appointed terminal according to the communication address of the appointed 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 office communicate with each other to form the game network; one game terminal is marked as a leading node of the game network; the leader node is responsible for data calculation and data synchronization of the game network;
The connection establishment 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, the electronic device comprising:
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 of claims 1-13.
16. A computer readable storage medium, wherein the storage medium stores a computer program executable by a processor to perform the method of processing a multiplayer online game as recited in any one of claims 1-13.
CN202110815307.7A 2021-07-19 2021-07-19 Processing method and device for multiplayer online game, electronic equipment and storage medium Active CN113440863B (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN113440863A CN113440863A (en) 2021-09-28
CN113440863B true CN113440863B (en) 2024-05-10

Family

ID=77816728

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN113440863B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101427255A (en) * 2004-03-16 2009-05-06 爱克斯法尔公司 System and method for facilitating multiplayer online gaming
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

Family Cites Families (2)

* 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
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

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101427255A (en) * 2004-03-16 2009-05-06 爱克斯法尔公司 System and method for facilitating multiplayer online gaming
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

Also Published As

Publication number Publication date
CN113440863A (en) 2021-09-28

Similar Documents

Publication Publication Date Title
CN111405304B (en) Anchor interaction method and device, computer equipment and storage medium
CN113440863B (en) Processing method and device for multiplayer online game, electronic equipment and storage medium
US9282232B2 (en) Collaborative image control
JP5005210B2 (en) Network game system, network game program, and network construction method
CN100481973C (en) Method and device for determining and notifying users having matching preference profiles for accessing a multiple access online application
US20210049695A1 (en) Blockchain-based financial trading executing method and apparatus, and electronic device
CN109173270B (en) Game service system and implementation method
CN112328421B (en) System fault processing method and device, computer equipment and storage medium
JP6974458B2 (en) Game server and method for generating context-aware game information
CN105024919A (en) User group building method and device
JP5866077B2 (en) Information management method and device
CN114070733A (en) Consensus method, device and system based on block chain network
CN112003943A (en) Voice data synchronization method and device
CN110354496B (en) Electronic athletic event processing method and device, storage medium and electronic equipment
JP4889081B2 (en) GAME DEVICE, PROGRAM, AND INFORMATION STORAGE MEDIUM
CN109847340A (en) A kind of information processing method, device, equipment and medium
CN111416849B (en) Disconnection reconnection method, device and system and computer equipment
CN112988882B (en) System, method and device for preparing data from different places and computing equipment
CN113413586A (en) Virtual object transmission method, device, equipment and storage medium
CN110928674B (en) Method for realizing block chain consensus mechanism
CN103618700A (en) Method for determining leader server in server system and server system
CN114432693A (en) Data synchronization method, device and medium
CN113708960B (en) Deployment method, device and equipment of Zookeeper cluster
Marreiros A framework for turn-based local multiplayer games
CN116764189B (en) Virtual space distribution method, device, medium, equipment and product

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
GR01 Patent grant
GR01 Patent grant