CN116115993A - Game data synchronization method, device, equipment and storage medium - Google Patents

Game data synchronization method, device, equipment and storage medium Download PDF

Info

Publication number
CN116115993A
CN116115993A CN202310109367.6A CN202310109367A CN116115993A CN 116115993 A CN116115993 A CN 116115993A CN 202310109367 A CN202310109367 A CN 202310109367A CN 116115993 A CN116115993 A CN 116115993A
Authority
CN
China
Prior art keywords
game
target
grid
role
data
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
CN202310109367.6A
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 CN202310109367.6A priority Critical patent/CN116115993A/en
Publication of CN116115993A publication Critical patent/CN116115993A/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/30Interconnection arrangements between game servers and game devices; Interconnection arrangements between game devices; Interconnection arrangements between game servers
    • A63F13/35Details of 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
    • A63F13/00Video games, i.e. games using an electronically generated display having two or more dimensions
    • A63F13/50Controlling the output signals based on the game progress
    • A63F13/52Controlling the output signals based on the game progress involving aspects of the displayed game scene
    • 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/55Details of game data or player data management

Landscapes

  • Engineering & Computer Science (AREA)
  • Multimedia (AREA)
  • Two-Way Televisions, Distribution Of Moving Picture Or The Like (AREA)

Abstract

The invention provides a game data synchronization method, a device, equipment and a storage medium, wherein the method constructs a game role distribution grid diagram through a game scene, the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene; acquiring the position of a target game role, and determining a target grid from a game role distribution grid graph based on the position, wherein the target grid is the grid of the game data to be synchronized; judging whether the game data to be synchronized in the target grid is larger than a preset value or not; if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy. When the game data to be synchronized is larger than a preset value, the protocol quantity is reduced by adjusting the synchronization of the data of each game role through an added data synchronization strategy, so that the performance consumption of a client terminal when processing the protocol quantity is reduced, the smoothness of the client terminal when running a game is improved, and the game experience of a user is improved.

Description

Game data synchronization method, device, equipment and storage medium
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for synchronizing game data.
Background
With the development of the game industry, the user has a higher and higher experience requirement on games, such as smoothness, especially when a player fights in a game scene, the real-time performance of position synchronization is very high, and the server side usually synchronizes position information for more than 20 times in 1 second, namely, in 1 second, in order to synchronize position information of one game unit, sends more than 20 protocols to the client side, and in combat, the protocols such as skills are usually accompanied, so that the consumption of the protocol amount on the game performance of the client side is relatively high.
In order to reduce the performance consumption, the data amount of each transmission is mainly controlled by nine Gong Gefa and a cross linked list method in the prior art. While for nine Gong Gefa, other unit information in 9 lattices around the lattice where the player is located is synchronized based on the position of the current player, the method can reduce the performance consumption of the terminal, but improves the consumption of the CPU; for the cross linked list method, all other player data within the player's visual range is transmitted, and if multiple ranges are to be determined, 2 nodes need to be added to each range. When a player wants to determine the player distribution in a plurality of radius ranges, the method adds a plurality of nodes to the linked list and increases the calculation amount when updating the linked list. Thus, the above two methods do not solve the problem that the game player increases the amount of protocol and occupies the terminal performance.
Disclosure of Invention
The invention mainly aims to solve the problem that the performance consumption of a client is increased due to the increase of the protocol quantity caused by the increase of game players in the existing game data synchronization scheme.
The first aspect of the present invention provides a game data synchronization method, the binding method comprising:
constructing a game role distribution grid diagram based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene;
acquiring the position of a target game role, and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized;
judging whether the game data to be synchronized in the target grid is larger than a preset value or not;
if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy.
A second aspect of the present invention provides a game data synchronizing device comprising:
the dividing module is used for constructing a game role distribution grid diagram based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene;
The determining module is used for acquiring the position of the target game role and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized;
the judging module is used for judging whether the game data to be synchronized in the target grid is larger than a preset value or not;
and the synchronization module is used for synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy when judging that the game data to be synchronized is larger than a preset value.
A third aspect of the present invention provides a game data synchronizing device comprising: a memory and at least one processor, the memory having instructions stored therein, the memory and the at least one processor being interconnected by a line; the at least one processor invokes the instructions in the memory to cause the game data synchronization device to perform the steps of the game data synchronization method described above.
A fourth aspect of the present invention provides a computer readable storage medium having instructions stored therein which, when run on a computer, cause the computer to perform the steps of the game data synchronization method described above.
The game data synchronization method, the game data synchronization device, the game data synchronization equipment and the storage medium construct a game role distribution grid diagram based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene; acquiring the position of a target game role, and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized; judging whether the game data to be synchronized in the target grid is larger than a preset value or not; if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy. When the game data to be synchronized is larger than a preset value, the protocol quantity is reduced by adjusting the synchronization of the data of each game role through an added data synchronization strategy, so that the performance consumption of a client terminal when processing the protocol quantity is reduced, the smoothness of the client terminal when running a game is improved, and the game experience of a user is improved.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and claims hereof as well as the appended drawings.
In order to make the above objects, features and advantages of the present invention more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
FIG. 1 is a diagram illustrating a first embodiment of a game data synchronization method according to an embodiment of the present invention;
FIG. 2 is a diagram illustrating a second embodiment of a game data synchronization method according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a game character distribution grid according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of an embodiment of a game data synchronization device according to the present invention;
FIG. 5 is a schematic diagram of another embodiment of a game data synchronization device according to the present invention;
fig. 6 is a schematic diagram of an embodiment of a game data synchronization apparatus according to an embodiment of the present invention.
Detailed Description
The embodiment of the invention provides a game data synchronization method, a device, equipment and a storage medium, wherein a mechanism for reducing protocol synchronization quantity along with distance is added on the basis of a Sudoku AOI (Area of Interest), namely a certain region of Interest in a game world scene, so that the protocol quantity which is increased in a same ratio and is brought when the number of game characters is increased sharply can be reduced, and the performance consumption of a processing protocol of a client is reduced.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims and in the above drawings, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed or inherent to such process, method, article, or apparatus.
For ease of understanding, a specific flow of an embodiment of the present invention is described below with reference to fig. 1, where a first embodiment of a game data synchronization method according to an embodiment of the present invention includes:
101. constructing a game role distribution grid diagram based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene;
It can be understood that this embodiment is mainly applied to a server or a terminal device, where the terminal device refers to a PC, a mobile phone, an IPAD, and other devices in which a game program is installed, and a user performs an operation on the game program of the terminal device, and a specific user performs a control operation on virtual characters in a game interface of the game program, so as to implement real-time dynamic of each virtual character in the game interface on the terminal device or real-time game data when fighting, and then the terminal device needs to receive the real-time game data of the game program from the server to implement rendering and displaying a corresponding animation picture, and the terminal device and the server perform timing interaction data through a protocol, so that in order to avoid synchronization of some unnecessary game data, a nine-grid method is adopted to select game data synchronization.
In this embodiment, the game scene is divided into a plurality of grids, and each grid is numbered; counting game roles in each grid, and determining the position corresponding relation between each game role and the number; and constructing a game role distribution grid diagram based on the position corresponding relation. Wherein the game scene may be understood as a complete version of the world map of the game. The game scene is divided into a plurality of grids, and the size of each grid is uniform, so that a game role distribution grid diagram is formed.
In practical application, the game role distribution grid graph may also include specific distribution information of the game roles, that is, after the grids are divided, the game roles in the game map are identified, the identifications and positions of the game roles are extracted, and then specific distribution positions and grids of the players are generated by combining the divided grids, so as to generate the game role distribution grid graph, as shown in fig. 3.
102. Acquiring the position of a target game role, and determining a target grid from a game role distribution grid graph based on the position, wherein the target grid is the grid of the game data to be synchronized;
in this embodiment, the target game role refers to a virtual role of a user in a game, and the location of the target game role is specifically determined by determining the location of the target game role in a game map, and of course, the location may be directly represented by a grid, where the specific target game role is located.
In practical application, the terminal device identifies the target game character from the game characters in the currently displayed game interface based on the name, model and other related information of the target game character, collects the environmental information or the marker information around the target game character, calculates the actual position of the target game character through the coordinate system of the game map combined by the environmental information or the marker information, and then selects the target grid from the game character distribution grid graph based on the actual position, namely, selects the grid of the game data to be synchronized.
In this embodiment, after determining the grid where the target game character is located, determining the number of the grid, determining to select the target grid based on the number of the grid, specifically, selecting the grid adjacent to the number from the game character distribution grid graph as the target grid according to the grid adjacent principle based on the number of the grid where the target game character is located, where the optional target grid includes at least one, and in this application, preferably 9, to form a nine-grid shape surrounding the target game character.
Further, the target grid may be determined by the skill attack scope of the target game character.
103. Judging whether the game data to be synchronized in the target grid is larger than a preset value or not;
in this step, the game data to be synchronized specifically refers to operation data and status data of the game character changed in the game interface, for example, data generated after skill release, position change data after movement of the game character, and the like.
In practical applications, for judging whether the number of game characters changed in the target grid is greater than a preset value, the number of game characters to be synchronized may be detected to determine the amount of game data to be synchronized, so as to determine whether adjustment of the synchronization process is required. If not, synchronizing according to a default data synchronization scheme.
104. If yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy.
In this embodiment, the data synchronization policy is specifically the synchronization frequency of the data frame, and since the data synchronization is controlled by the protocol, the data synchronization policy herein is actually the synchronization frequency of the protocol.
In practical application, after judging that the priority is greater than the preset value, the method further comprises the steps of dividing the priorities of all game roles in the target grid, adjusting the synchronous frequency of the protocol of the game role corresponding to each priority based on the data synchronous strategy, and specifically setting the corresponding synchronous frequency, so that game data generated by all the game roles are synchronized based on the set synchronous frequency.
In summary, a game role distribution grid diagram is constructed based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene; acquiring the position of a target game role, and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized; judging whether the game data to be synchronized in the target grid is larger than a preset value or not; if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy. By the method, not only is the block transmission of game data realized, but also the control of a protocol of transmission data is realized, and the problem that in the existing game data synchronization scheme, the performance consumption of a client is increased due to the increase of the protocol quantity caused by the increase of game players is solved.
Referring to fig. 2 and 3, for a second embodiment of the game data synchronization method provided by the present invention, the method is a game data synchronization method provided on the basis of nine-grid synchronization data, specifically, the method is illustrated by taking a virtual character of a game in a combat scene as an example, and the method specifically includes the following steps:
201. dividing a game scene into a plurality of grids, and numbering each grid;
202. counting game roles in each grid, and determining the position corresponding relation between each game role and the number;
203. constructing a game role distribution grid diagram based on the position corresponding relation;
in this embodiment, when the target game character or other game characters around the target game character are in a combat state, the surrounding game characters or the target characters are affected by the release of skills, for example, displacement, state change, etc., in order to batch manage the game characters of a plurality of players, the management method of the nine-grid adopted here divides the game scene into a plurality of grids according to coordinates, that is, divides the game map into a plurality of grids, as shown in fig. 3, and divides the game scene into n x n grids, for example, n=6 in the figure. The grids can be adjusted to be different in length and width according to the viewing angle of the player, wherein the length and width are L, and each grid is numbered, for example, the index value of the grid of the 3 rd row and the 4 th column is 16, and the formula is as follows:
Index number N index Row number (Nrow-1) number of lattices per row n2+column number Ncol;
the black grid is the grid where the current target game character (player A) is located, 9 grids of diagonal grids and black grids are nine grids AOI of the target game character of the player, and state changes of other game character attributes (namely, attributes: game units of the player in the game, such as an NPC) occur in the 9 grids, for example, information of entering, moving, leaving and the like can be synchronized to a client of the player A. Each grid maintains a list of all game character entries that enter the grid, which is updated as entries move or change state.
204. Acquiring the position of a target game role, and determining a target grid from a game role distribution grid graph based on the position;
specifically, a first grid where a target game role is located is determined by acquiring the position of the target game role and based on the position; identifying whether a game character of each grid located within a field of view of the target game character changes based on the first grid; if the game character changes, determining the grid with the changed game character as a target grid.
In practical applications, the target grid is the nine-square grid in fig. 3, and the size of the nine-square grid is usually slightly larger than the actual field of view of the player, and when the information of the nine-square grid changes, especially in combat, the information of the nine-square grid needs to be synchronized to the client of the player a, so that the information of the nine-square grid is continuously monitored, and after the information changes reach a preset limit, the synchronization frequency is adjusted according to the number of players.
205. Judging whether the game data to be synchronized in the target grid is larger than a preset value or not;
in this step, the preset value may be the size of the data packet, in this embodiment, taking a numerical value as an example, that is, a numerical limit of a game character is set, for example, the maximum data processing amount is determined on the premise that the current terminal device runs smoothly according to the performance value of the current terminal device, and when the data processing amount is synchronous, the data is constructed according to the range of the nine boxes to perform synchronization, but the game character in the range of the nine boxes changes along with the progress of the game or the fight information describing the game character changes, that is, the game data needs to be synchronized.
In this regard, by monitoring the number of game characters in the target grid in real time; judging whether the number is larger than a preset number. The preset number may be calculated based on a frequency of a default synchronization protocol and a maximum performance consumption value during a single synchronization.
That is, the nine-grid needs to consider the factors of occupied memory size, CPU consumption, scene size and the like, and the grid size division must be limited to a uniform size. The above mechanism can only synchronize the entity information of 9 grids near player a to player a's client, and there is no way to make better subdivisions.
In this regard, to further ensure that there are too many data or protocol frames synchronized to player a, the present application adds some new entity subdivision scheme, i.e., when it is determined that the data is greater than the preset value, step 206 is performed.
206. Acquiring game roles in a target grid, and constructing a player list;
in this step, a player list is constructed based on the game characters for subsequent synchronous control of game data generated by each game character.
In combat, a game client may accept at most N1 entries within the Sudoku AOI to synchronize their status at a default frequency (e.g., 30 position synchronization protocols per second) while remaining smooth.
Setting N1 as the upper limit of the entity number of the default mechanism of the regular nine-square lattice, and maintaining the entity list of each lattice in the regular nine-square lattice when the entity number Ne < =n1 in the nine-square lattice. When the number of entries Ne > N1 in the nine boxes, a new mechanism is started, and a list B of all the entries in the nine boxes are arranged from small to large from the current player A is added. This list B is maintained again when Ne < = N1, and updated when Ne > N1 and the intra-nine-grid entity status changes.
207. Calculating the corresponding relation between each game role and the target game role in the player list;
In this embodiment, the correspondence may be understood as a distance, that is, a distance between each game character in the player list and the target game character is calculated, specifically:
acquiring position coordinates of each game role in the player list;
based on the position coordinates, a Euclidean distance between the corresponding game character and the target game character is calculated.
In practical applications, euclidean distance is typically used to calculate the distance of player a from other game character assets, i.e., the distance between two-dimensional coordinate points. And then ordering all the entries in the nine grids according to the distance, thereby obtaining a list B.
The performance consumption of the server is greater due to the greater number of entities and the higher frequency of state updates. The list B calculation is optimized here. The Euclidean distance between the player A and other items is not required to be directly obtained, and the distance relation between the player A and other items is only required to be obtained. In order to reduce the amount of calculation, the following method can be used:
the coordinates of player A are (x 1, y 1), the other entity coordinates are (x 2, y 2),
the absolute value of the difference in coordinates on the abscissa is x3=abs (x 1-x 2), y3=abs (y 1-y 2)
When x3> y3, the distance estimate is d1=x3-y3+y3×1.4=x3+0.4×y3
When x3< = y3, the distance estimate is d1=y3-x3+x3×1.4=y3+0.4×3
Where 1.4 is the square of 2, an approximation of 1.414.
And according to the distance estimated value D1 of each entity and the player A, the distance sorting of other entities in the 9 palace can be judged to obtain a list B.
Since the entity is not usually fast, the update interval of the list B can be set according to the requirement, for example, the list B is updated every 0.1s, and by increasing the update interval, the performance consumption caused by calculating the list B of the server can be reduced.
208. Based on the corresponding relation and a preset data synchronization strategy, adjusting the synchronization frequency of game data corresponding to each game role in the target grid, and synchronizing the corresponding game data to the client where the target game role is located based on the synchronization frequency.
In this embodiment, the game characters in the player list are ordered according to the calculated distances, and the synchronization is selected or the frequency of the synchronization is set according to the ordering.
Specifically, based on the euclidean distance, ordering each game role in the player list, and classifying each ordered game role according to a preset distance level to obtain a plurality of game role groups;
Determining the synchronization frequency of a synchronization protocol of each game role group according to the sequence of the distance level based on a preset data synchronization strategy, wherein the larger the Euclidean distance between the game role and the target game role is, the smaller the synchronization frequency of the synchronization protocol is;
and synchronizing game data of the game characters in each game character group to the client where the target game character is located based on the synchronization frequency.
In practical application, when the number of the items in the nine-grid is too large, if the status of the items is synchronized according to the default frequency, the number of protocols needed to be synchronized is greatly increased, while in practical game combat, the highest requirement is usually that the real-time nature of the items closest to the player is synchronized, and if the items are far from the player, the skill of the player or attack of the player cannot reach the items, and the meaning of the status synchronization frequency is not great. Therefore, the principle of adjusting the frequency of the synchronization protocol (namely, the data synchronization strategy) is that the farther the entity is from the player, the lower the synchronization frequency is in the nine-grid, so that the protocol synchronization quantity can be reduced when the entity quantity is increased, and the running smoothness of the client is ensured.
In the above step, the limit of the enable list B is set such that the entity number Ne exceeds N1.
The frequency of the synchronization protocol can be freely set according to several parameters:
(1) Distance estimation hierarchy
The squared distance estimation can be divided into four levels 0< first distance D2< second distance D3< third distance D4, the frequencies from high to low are the first frequency F1> the second frequency F2> the third frequency F3> the fourth frequency F4.
When the distance estimation D1< D2 between the entity and the player is met, the game data corresponding to the entity sends a synchronous protocol according to the frequency F1.
When the distance estimation D2< D1< D3 of the entity and the player, the game number corresponding to the entity sends a synchronous protocol according to the frequency F2.
When the distance estimation D2< D1< D4 of the entity and the player, the game number corresponding to the entity sends a synchronous protocol according to the frequency F3.
When the distance estimation D1> D4 between the entity and the player, the game number corresponding to the entity sends a synchronization protocol according to the frequency F4.
(2) Distance estimation ranking of entries in list B
In the nine-grid, the distance estimation ranking of the entity in the list B can be divided into four grades 0< first ranking r2=5 < second ranking r3=10 < third ranking r4=15, and the frequencies are from high to low, namely, the first frequency F1> the second frequency F2> the third frequency F3> the fourth frequency F4.
When the distance estimation ranking R1< R2 of the entity and the player, the game number corresponding to the entity sends a synchronous protocol according to the F1 frequency.
And when the distance estimation ranking R2< R1< R3 of the entity and the player is carried out, the game number corresponding to the entity sends a synchronous protocol according to the F2 frequency.
And when the distance estimation ranking R2< R1< R4 of the entity and the player is carried out, the game number corresponding to the entity sends a synchronous protocol according to the F3 frequency.
When the distance estimation ranking R1> R4 of the entity and the player, the game number corresponding to the entity sends a synchronous protocol according to the F4 frequency.
(3) Both parameters can be used as conditions at the same time.
For example: and when D1< D2 or the distance estimation ranking order is smaller than 5, transmitting the synchronous protocol according to the F1 frequency. The remainder at F2 frequency.
Note that: the frequency F is the number of sending synchronization protocols per second, for example, default 20 pieces of position synchronization protocols per second with a certain entity in the nine-grid are sent to the current player a.
In conclusion, the method increases a protocol quantity optimization mechanism when the number of contents in the nine grids is too large on the basis of the nine grids AOI. The basic implementation architecture of the Sudoku AOI algorithm is reserved, a list ordered according to the distance between the player and the entity is added, and the effect that the synchronous protocol quantity gradually decreases along with the increase of the distance between the entity and the current player is realized by taking the hierarchy of the distance estimation or the entity distance ranking order as a judging condition. And further, the performance consumption of the client caused by high protocol quantity due to multiple units can be reduced.
The method for synchronizing game data in the embodiment of the present invention is described above, and the following describes a device for synchronizing game data in the embodiment of the present invention, referring to fig. 4, an embodiment of the device for synchronizing game data in the embodiment of the present invention includes:
a partitioning module 410, configured to construct a game role distribution grid graph based on a game scene, where the game role distribution grid graph includes at least nine grids, and at least one game role is distributed in the game scene;
a determining module 420, configured to obtain a position of a target game role, and determine a target grid from the game role distribution grid graph based on the position, where the target grid is a grid of game data to be synchronized;
a judging module 430, configured to judge whether game data to be synchronized in the target grid is greater than a preset value;
and the synchronization module 440 is configured to synchronize the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization policy when the game data to be synchronized is determined to be greater than a preset value.
In summary, a game role distribution grid diagram is constructed based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene; acquiring the position of a target game role, and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized; judging whether the game data to be synchronized in the target grid is larger than a preset value or not; if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy. When the game data to be synchronized is larger than a preset value, the protocol quantity is reduced by adjusting the synchronization of the data of each game role through an added data synchronization strategy, so that the performance consumption of a client terminal when processing the protocol quantity is reduced, the smoothness of the client terminal when running a game is improved, and the game experience of a user is improved.
Referring to fig. 5, in a second embodiment of the game data synchronization device provided in the embodiment of the present application, the method specifically includes:
a partitioning module 410, configured to construct a game role distribution grid graph based on a game scene, where the game role distribution grid graph includes at least nine grids, and at least one game role is distributed in the game scene;
a determining module 420, configured to obtain a position of a target game role, and determine a target grid from the game role distribution grid graph based on the position, where the target grid is a grid of game data to be synchronized;
a judging module 430, configured to judge whether game data to be synchronized in the target grid is greater than a preset value;
and the synchronization module 440 is configured to synchronize the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization policy when the game data to be synchronized is determined to be greater than a preset value.
In this embodiment, the dividing module 410 includes:
a dividing unit 411, configured to divide the game scene into a plurality of grids, and number each grid;
a statistics unit 412, configured to count game characters in each grid, and determine a positional correspondence between each game character and the number;
A construction unit 413 for constructing a game character distribution grid graph based on the position correspondence relationship.
In this embodiment, the determining module 420 includes:
a position obtaining unit 421, configured to obtain a position of a target game character, and determine a first grid where the target game character is located based on the position;
an identification unit 422 for identifying whether or not a game character of each grid located within a visual field of the target game character is changed based on the first grid;
and a determining unit 423 for determining that the grid with the changed game character is the target grid if the change is recognized.
In this embodiment, the determining module 430 is specifically configured to:
monitoring the number of game characters in the target grid;
judging whether the number is larger than a preset number. The preset number may be calculated based on a frequency of a default synchronization protocol and a maximum performance consumption value during a single synchronization.
In this embodiment, the synchronization module 440 includes:
a list construction unit 441 configured to acquire a game character in the target grid, and construct a player list;
a calculating unit 442, configured to calculate a correspondence between each game character in the player list and the target game character;
The synchronization unit 443 is configured to adjust a synchronization frequency of game data corresponding to each game character in the target grid based on the corresponding relationship and a preset data synchronization policy, and synchronize the corresponding game data to a client where the target game character is located based on the synchronization frequency.
In this embodiment, the computing unit 442 is specifically configured to:
and calculating the distance between each game role in the player list and the target game role.
In this embodiment, the computing unit 442 is specifically configured to:
acquiring position coordinates of each game role in the player list;
based on the position coordinates, a Euclidean distance between the corresponding game character and the target game character is calculated.
In the present embodiment, the synchronization unit 443 is specifically configured to:
based on the Euclidean distance, ordering each game role in the player list, and classifying each ordered game role according to a preset distance level to obtain a plurality of game role groups;
determining the synchronization frequency of a synchronization protocol of each game role group according to the sequence of the distance level based on a preset data synchronization strategy, wherein the larger the Euclidean distance between the game role and the target game role is, the smaller the synchronization frequency of the synchronization protocol is;
And synchronizing game data of the game characters in each game character group to the client where the target game character is located based on the synchronization frequency.
In the embodiment of the invention, a game role distribution grid diagram is constructed based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene; acquiring the position of a target game role, and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized; judging whether the game data to be synchronized in the target grid is larger than a preset value or not; if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy. By the method, not only is the block transmission of game data realized, but also the control of a protocol of transmission data is realized, and the problem that in the existing game data synchronization scheme, the performance consumption of a client is increased due to the increase of the protocol quantity caused by the increase of game players is solved.
The present embodiment also provides a game data synchronization device including a processor and a memory storing machine-executable instructions executable by the processor, the processor executing the machine-executable instructions to implement the above-described method of game skill control. The game data synchronizing device may be a server or a terminal device.
Referring to fig. 6, the game data synchronization device includes a processor 600 and a memory 6101, the memory 601 storing machine executable instructions that can be executed by the processor 600, the processor 600 executing the machine executable instructions to implement the above-described game data synchronization method.
Further, the game data synchronization device shown in fig. 6 further includes a bus 602 and a communication interface 603, and the processor 600, the communication interface 603, and the memory 601 are connected through the bus 602.
The memory 601 may include a high-speed random access memory (RAM, random Access Memory), and may further include a non-volatile memory (non-volatile memory), such as at least one magnetic disk memory. The communication connection between the system network element and at least one other network element is implemented via at least one communication interface 603 (which may be wired or wireless), which may use the internet, a wide area network, a local network, a metropolitan area network, etc. Bus 602 may be an ISA bus, a PCI bus, an EISA bus, or the like. The buses may be classified as address buses, data buses, control buses, etc. For ease of illustration, only one bi-directional arrow is shown in FIG. 6, but not only one bus or type of bus.
The processor 600 may be an integrated circuit chip with signal processing capabilities. In implementation, the steps of the methods described above may be performed by integrated logic circuitry in hardware or instructions in software in processor 600. The processor 600 may be a general-purpose processor, including a central processing unit (Central Processing Unit, CPU for short), a network processor (Network Processor, NP for short), etc.; but also digital signal processors (Digital Signal Processor, DSP for short), application specific integrated circuits (Application Specific Integrated Circuit, ASIC for short), field-programmable gate arrays (Field-Programmable Gate Array, FPGA for short) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The disclosed methods, steps, and logic blocks in the embodiments of the present invention may be implemented or performed. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like. The steps of the method disclosed in connection with the embodiments of the present invention may be embodied directly in the execution of a hardware decoding processor, or in the execution of a combination of hardware and software modules in a decoding processor. The software modules may be located in a random access memory, flash memory, read only memory, programmable read only memory, or electrically erasable programmable memory, registers, etc. as well known in the art. The storage medium is located in the memory 601, and the processor 600 reads the information in the memory 601, and in combination with its hardware, performs the following steps:
Constructing a game role distribution grid diagram based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene;
acquiring the position of a target game role, and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized;
judging whether the game data to be synchronized in the target grid is larger than a preset value or not;
if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy.
The above-mentioned constructing a game character distribution grid based on a game scene includes:
dividing the game scene into a plurality of grids, and numbering each grid;
counting game roles in each grid, and determining the position corresponding relation between each game role and the number;
and constructing a game role distribution grid diagram based on the position corresponding relation.
The obtaining the position of the target game character and determining the target grid from the game character distribution grid graph based on the position comprises the following steps:
Acquiring the position of a target game role, and determining a first grid where the target game role is located based on the position;
and determining each grid within the visual field range of the target game role as a target grid based on the first grid.
The determining whether the game data to be synchronized in the target grid is greater than a preset value includes:
monitoring the number of game characters in the target grid;
judging whether the number is larger than a preset number. The preset number may be calculated based on a frequency of a default synchronization protocol and a maximum performance consumption value during a single synchronization.
The step of synchronizing the game data corresponding to each game role to the client where the target game role is located based on the preset data synchronization policy includes:
acquiring game roles in the target grid, and constructing a player list;
calculating the corresponding relation between each game role in the player list and the target game role;
and adjusting the synchronous frequency of game data corresponding to each game role in the target grid based on the corresponding relation and a preset data synchronous strategy, and synchronizing the corresponding game data to a client where the target game role is located based on the synchronous frequency.
The calculating the correspondence between each game role in the player list and the target game role includes:
and calculating the distance between each game role in the player list and the target game role.
The calculating the distance between each game character in the player list and the target game character comprises the following steps:
acquiring position coordinates of each game role in the player list;
based on the position coordinates, a Euclidean distance between the corresponding game character and the target game character is calculated.
The adjusting the synchronization frequency of the game data corresponding to each game role in the target grid based on the corresponding relation and the preset data synchronization policy, and synchronizing the corresponding game data to the client where the target game role is located based on the synchronization frequency includes:
based on the Euclidean distance, ordering each game role in the player list, and classifying each ordered game role according to a preset distance level to obtain a plurality of game role groups;
determining the synchronous frequency of a synchronous protocol of each game role group according to the sequence of the distance level based on a preset data synchronous strategy;
And synchronizing game data of the game characters in each game character group to the client where the target game character is located based on the synchronization frequency.
The preset data synchronization policy is that the larger the Euclidean distance between the game role and the target game role is, the smaller the synchronization frequency of the synchronization protocol is.
In summary, a game role distribution grid diagram is constructed based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene; acquiring the position of a target game role, and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized; judging whether the game data to be synchronized in the target grid is larger than a preset value or not; if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy. When the game data to be synchronized is larger than a preset value, the protocol quantity is reduced by adjusting the synchronization of the data of each game role through an added data synchronization strategy, so that the performance consumption of a client terminal when processing the protocol quantity is reduced, the smoothness of the client terminal when running a game is improved, and the game experience of a user is improved.
The present embodiment also provides a machine-readable storage medium storing machine-executable instructions that, when invoked and executed by a processor, cause the processor to perform the steps of:
constructing a game role distribution grid diagram based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene;
acquiring the position of a target game role, and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized;
judging whether the game data to be synchronized in the target grid is larger than a preset value or not;
if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy.
The above-mentioned constructing a game character distribution grid based on a game scene includes:
dividing the game scene into a plurality of grids, and numbering each grid;
counting game roles in each grid, and determining the position corresponding relation between each game role and the number;
And constructing a game role distribution grid diagram based on the position corresponding relation.
The obtaining the position of the target game character and determining the target grid from the game character distribution grid graph based on the position comprises the following steps:
acquiring the position of a target game role, and determining a first grid where the target game role is located based on the position;
and determining each grid within the visual field range of the target game role as a target grid based on the first grid.
The determining whether the game data to be synchronized in the target grid is greater than a preset value includes:
monitoring the number of game characters in the target grid;
judging whether the number is larger than a preset number. The preset number may be calculated based on a frequency of a default synchronization protocol and a maximum performance consumption value during a single synchronization.
The step of synchronizing the game data corresponding to each game role to the client where the target game role is located based on the preset data synchronization policy includes:
acquiring game roles in the target grid, and constructing a player list;
calculating the corresponding relation between each game role in the player list and the target game role;
And adjusting the synchronous frequency of game data corresponding to each game role in the target grid based on the corresponding relation and a preset data synchronous strategy, and synchronizing the corresponding game data to a client where the target game role is located based on the synchronous frequency.
The calculating the correspondence between each game role in the player list and the target game role includes:
and calculating the distance between each game role in the player list and the target game role.
The calculating the distance between each game character in the player list and the target game character comprises the following steps:
acquiring position coordinates of each game role in the player list;
based on the position coordinates, a Euclidean distance between the corresponding game character and the target game character is calculated.
The adjusting the synchronization frequency of the game data corresponding to each game role in the target grid based on the corresponding relation and the preset data synchronization policy, and synchronizing the corresponding game data to the client where the target game role is located based on the synchronization frequency includes:
based on the Euclidean distance, ordering each game role in the player list, and classifying each ordered game role according to a preset distance level to obtain a plurality of game role groups;
Determining the synchronous frequency of a synchronous protocol of each game role group according to the sequence of the distance level based on a preset data synchronous strategy;
and synchronizing game data of the game characters in each game character group to the client where the target game character is located based on the synchronization frequency.
The preset data synchronization policy is that the larger the Euclidean distance between the game role and the target game role is, the smaller the synchronization frequency of the synchronization protocol is.
In conclusion, the method increases a protocol quantity optimization mechanism when the number of contents in the nine grids is too large on the basis of the nine grids AOI. The basic implementation architecture of the Sudoku AOI algorithm is reserved, a list ordered according to the distance between the player and the entity is added, and the effect that the synchronous protocol quantity gradually decreases along with the increase of the distance between the entity and the current player is realized by taking the hierarchy of the distance estimation or the entity distance ranking order as a judging condition. And further, the performance consumption of the client caused by high protocol quantity due to multiple units can be reduced.
The computer program product of the game data synchronization method and the related device provided in the embodiments of the present invention includes a computer readable storage medium storing program codes, where the instructions included in the program codes may be used to execute the method described in the foregoing method embodiment, and specific implementation may refer to the method embodiment and will not be described herein.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described system and apparatus may refer to corresponding procedures in the foregoing method embodiments, which are not described herein again.
In addition, in the description of embodiments of the present invention, unless explicitly stated and limited otherwise, the terms "mounted," "connected," and "connected" are to be construed broadly, and may be, for example, fixedly connected, detachably connected, or integrally connected; can be mechanically or electrically connected; can be directly connected or indirectly connected through an intermediate medium, and can be communication between two elements. The specific meaning of the above terms in the present invention will be understood by those skilled in the art in specific cases.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention 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 according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-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.
In the description of the present invention, it should be noted that the directions or positional relationships indicated by the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc. are based on the directions or positional relationships shown in the drawings, are merely for convenience of describing the present invention and simplifying the description, and do not indicate or imply that the devices or elements referred to must have a specific orientation, be configured and operated in a specific orientation, and thus should not be construed as limiting the present invention. Furthermore, the terms "first," "second," and "third" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance.
Finally, it should be noted that: the above examples are only specific embodiments of the present invention for illustrating the technical solution of the present invention, but not for limiting the scope of the present invention, and although the present invention has been described in detail with reference to the foregoing examples, it will be understood by those skilled in the art that the present invention is not limited thereto: any person skilled in the art may modify or easily conceive of the technical solution described in the foregoing embodiments, or perform equivalent substitution of some of the technical features, while remaining within the technical scope of the present disclosure; such modifications, changes or substitutions do not depart from the spirit and scope of the technical solutions of the embodiments of the present invention, and are intended to be included in the scope of the present invention. Therefore, the protection scope of the invention is subject to the protection scope of the claims.

Claims (12)

1. A game data synchronization method, characterized in that the game data synchronization method comprises:
constructing a game role distribution grid diagram based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene;
acquiring the position of a target game role, and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized;
judging whether the game data to be synchronized in the target grid is larger than a preset value or not;
if yes, synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy.
2. The game data synchronization method according to claim 1, wherein the constructing a game character distribution grid based on a game scene comprises:
dividing the game scene into a plurality of grids, and numbering each grid;
counting game roles in each grid, and determining the position corresponding relation between each game role and the number;
and constructing a game role distribution grid diagram based on the position corresponding relation.
3. The game data synchronization method according to claim 1, wherein the acquiring the position of the target game character and determining the target grid from the game character distribution grid graph based on the position comprises:
acquiring the position of a target game role, and determining a first grid where the target game role is located based on the position;
and determining each grid within the visual field range of the target game role as a target grid based on the first grid.
4. The game data synchronization method according to claim 1, wherein the determining whether the game data to be synchronized in the target grid is greater than a preset value comprises:
monitoring the number of game characters in the target grid;
judging whether the number is larger than a preset number.
5. The game data synchronization method according to any one of claims 1 to 4, wherein the synchronizing the game data corresponding to each of the game characters to the client where the target game character is located based on a preset data synchronization policy includes:
acquiring game roles in the target grid, and constructing a player list;
calculating the corresponding relation between each game role in the player list and the target game role;
And adjusting the synchronous frequency of game data corresponding to each game role in the target grid based on the corresponding relation and a preset data synchronous strategy, and synchronizing the corresponding game data to a client where the target game role is located based on the synchronous frequency.
6. The game data synchronization method according to claim 5, wherein the calculating of the correspondence between each game character in the player list and the target game character includes:
and calculating the distance between each game role in the player list and the target game role.
7. The method of claim 6, wherein calculating the distance between each game character in the player list and the target game character comprises:
acquiring position coordinates of each game role in the player list;
based on the position coordinates, a Euclidean distance between the corresponding game character and the target game character is calculated.
8. The method for synchronizing game data according to claim 7, wherein the adjusting the synchronization frequency of the game data corresponding to each game character in the target grid based on the correspondence and a preset data synchronization policy, and synchronizing the corresponding game data to the client where the target game character is located based on the synchronization frequency, includes:
Based on the Euclidean distance, ordering each game role in the player list, and classifying each ordered game role according to a preset distance level to obtain a plurality of game role groups;
determining the synchronous frequency of a synchronous protocol of each game role group according to the sequence of the distance level based on a preset data synchronous strategy;
and synchronizing game data of the game characters in each game character group to the client where the target game character is located based on the synchronization frequency.
9. The game data synchronization method according to claim 8, wherein the predetermined data synchronization policy is that the larger the euclidean distance between the game character and the target game character is, the smaller the synchronization frequency of the synchronization protocol is.
10. A game data synchronizing apparatus, characterized by comprising:
the dividing module is used for constructing a game role distribution grid diagram based on a game scene, wherein the game role distribution grid diagram comprises at least nine grids, and at least one game role is distributed in the game scene;
the determining module is used for acquiring the position of the target game role and determining a target grid from the game role distribution grid graph based on the position, wherein the target grid is a grid of game data to be synchronized;
The judging module is used for judging whether the game data to be synchronized in the target grid is larger than a preset value or not;
and the synchronization module is used for synchronizing the game data corresponding to each game role to the client where the target game role is located based on a preset data synchronization strategy when judging that the game data to be synchronized is larger than a preset value.
11. A game data synchronization device, characterized in that the game data synchronization device comprises: a memory and at least one processor, the memory having instructions stored therein;
the at least one processor invokes the instructions in the memory to cause the game data synchronization device to perform the steps of the game data synchronization method of any one of claims 1-9.
12. A computer readable storage medium having instructions stored thereon, which when executed by a processor, perform the steps of the game data synchronization method according to any of claims 1-9.
CN202310109367.6A 2023-02-03 2023-02-03 Game data synchronization method, device, equipment and storage medium Pending CN116115993A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310109367.6A CN116115993A (en) 2023-02-03 2023-02-03 Game data synchronization method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310109367.6A CN116115993A (en) 2023-02-03 2023-02-03 Game data synchronization method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116115993A true CN116115993A (en) 2023-05-16

Family

ID=86309863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310109367.6A Pending CN116115993A (en) 2023-02-03 2023-02-03 Game data synchronization method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116115993A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117560385A (en) * 2024-01-09 2024-02-13 北京万物镜像数据服务有限公司 Synchronous information processing method, device and equipment for virtual object

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117560385A (en) * 2024-01-09 2024-02-13 北京万物镜像数据服务有限公司 Synchronous information processing method, device and equipment for virtual object
CN117560385B (en) * 2024-01-09 2024-03-22 北京万物镜像数据服务有限公司 Synchronous information processing method, device and equipment for virtual object

Similar Documents

Publication Publication Date Title
JP7350263B2 (en) Method for displaying position indication information, electronic device, storage medium, and computer program
US20190091569A1 (en) Method for movement synchronization of virtual object, client, server, and storage medium
KR101517927B1 (en) network game system without dynamic obstructions and processing method thereof
US8512140B1 (en) Gaming system for updating a presentation of a virtual game environment
CN108389245A (en) Rendering intent, device, electronic equipment and the readable storage medium storing program for executing of cartoon scene
CN116115993A (en) Game data synchronization method, device, equipment and storage medium
CN109925720A (en) Information processing method and device
CN106600665A (en) Camera animation path generating method and device
CA2768900A1 (en) Rendering control apparatus, control method thereof, recording medium, rendering server, and rendering system
JP2022515798A (en) Lighting rendering methods, equipment, electronic equipment and computer programs
US10653961B2 (en) Systems and methods of controlling game character attributes
US10350499B2 (en) Display control apparatus, display control system, display control method and storage medium
US11847714B2 (en) Information processing device, information processing method, and information processing program
CN110665223B (en) Game resource caching method, decision network training method and device
CN109364480A (en) A kind of information synchronization method and device
CN110248381A (en) Location data processing method, device, computer equipment and storage medium
JP6360028B2 (en) Program, communication system, server control method, and server
CN111359204A (en) Rendering method and device of mobile phone game scene and mobile terminal
CN107920132B (en) Information-pushing method, information displaying method and device
JP2020014715A (en) Video game processing program and video game processing system
CN113797546B (en) Resource processing method, device, computing equipment and computer readable storage medium
US9959021B2 (en) Method, system and computer storage medium of controlling visual field based on distances between users and a current user
CN116521789A (en) Data synchronization method, device, electronic equipment and storage medium
CN116212376A (en) Game information display control method and device and electronic equipment
CN116980458A (en) Data packet broadcasting method, device, equipment, medium 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