Game data processing method, device, equipment and storage medium

文档序号:1896914 发布日期:2021-11-30 浏览:26次 中文

阅读说明:本技术 一种游戏数据处理方法、装置、设备及存储介质 (Game data processing method, device, equipment and storage medium ) 是由 刘慧孟 于 2021-09-01 设计创作,主要内容包括:本申请提供一种游戏数据处理方法、装置、设备及存储介质,涉及计算机技术领域。该方法包括:确定玩家所操控的虚拟角色的当前视野下的目标虚拟场景;根据目标虚拟场景对应的非玩家角色的信息,确定目标虚拟场景下各网格中待加载的目标非玩家角色的数据;根据目标虚拟场景下各网格中待加载的目标非玩家角色的数据对应的数据量,启动运行至少一个目标进程,目标进程用于加载所述目标虚拟场景下各网格中待加载的目标非玩家角色的数据。应用本申请实施例,有限硬件资源(游戏服务器)的前提下,保证玩家有高质量的游戏体验。(The application provides a game data processing method, a game data processing device and a game data processing storage medium, and relates to the technical field of computers. The method comprises the following steps: determining a target virtual scene under the current visual field of the virtual character controlled by the player; determining data of target non-player characters to be loaded in each grid under the target virtual scene according to information of the non-player characters corresponding to the target virtual scene; and starting to run at least one target process according to the data volume corresponding to the data of the target non-player character to be loaded in each grid under the target virtual scene, wherein the target process is used for loading the data of the target non-player character to be loaded in each grid under the target virtual scene. By applying the embodiment of the application, the high-quality game experience of the player is ensured on the premise of limited hardware resources (game server).)

1. A game data processing method, characterized in that the method comprises:

determining a target virtual scene under the current visual field of the virtual character controlled by the player;

determining data of target non-player characters to be loaded in each grid under the target virtual scene according to information of the non-player characters corresponding to the target virtual scene;

and starting to run at least one target process according to the data volume corresponding to the data of the target non-player character to be loaded in each grid under the target virtual scene, wherein the target process is used for loading the data of the target non-player character to be loaded in each grid under the target virtual scene.

2. The method according to claim 1, wherein the starting of the running of the at least one target process according to the data amount corresponding to the data of the target non-player character to be loaded in each grid in the target virtual scene comprises:

determining at least one initial process according to the load information of each process;

and starting to run at least one target process in the at least one initial process according to the data amount corresponding to the data of the target non-player character to be loaded in each grid in the target virtual scene and the residual loading space of the initial process.

3. The method of claim 1, further comprising:

and if the load of a first target process in the target processes is greater than a first preset threshold value, migrating the data of the target non-player character to be loaded in at least one target grid in the data of the target non-player character to be loaded in each grid loaded by the first target process to a migration process for loading.

4. The method according to claim 3, wherein the migrated process is a process in the at least one target process, and wherein the load of the migrated process is less than the first preset threshold.

5. The method of claim 3, wherein the migrating process is a process other than the at least one target process;

migrating the data of the target non-player character to be loaded in at least one target grid in the target non-player characters to be loaded in each network loaded by the first target process to a migration process for loading, wherein the migrating process comprises the following steps:

starting to run the migration process;

and migrating the data of the target non-player character to be loaded in at least one target grid in the target non-player characters to be loaded in each network loaded by the first target process to the migration process for loading.

6. The method of claim 1, further comprising:

if the load of a plurality of second target processes in the target processes is smaller than a second preset threshold value, merging the data of the target non-player characters to be loaded in each grid loaded by the second target processes into one of the plurality of second target processes for loading.

7. The method of claim 1, wherein prior to determining the target virtual scene in the current field of view of the virtual character being manipulated by the player, the method further comprises:

and starting a management process corresponding to the target virtual scene, wherein the management process is used for loading and managing a non-player character, and the management non-player character is used for monitoring whether the virtual character enters the target virtual scene.

8. The method according to claim 7, wherein the determining data of the target non-player character to be loaded in each grid under the target virtual scene according to the information of the non-player character corresponding to the target virtual scene comprises:

determining information of a non-player character corresponding to the target virtual scene according to identification information of the non-player character associated with the management non-player character;

and determining data of the target non-player character to be loaded in each grid under the target virtual scene according to the information of the non-player character corresponding to the target virtual scene.

9. The method of claim 1, further comprising:

and adding data of a plurality of target non-player characters into a target queue, and reading the data of each target non-player character from the target queue in sequence for loading.

10. The method of claim 1, further comprising:

reducing a frame refresh frequency of the target non-player character when the target non-player character exits a field of view of a virtual character manipulated by the player.

11. The method of claim 1, further comprising:

and unloading the data of the target non-player character from the target process when the time length of the target non-player character exiting the visual field of the virtual character controlled by the player reaches the preset time length.

12. A game data processing apparatus, characterized in that the apparatus comprises:

the first determination module is used for determining a target virtual scene under the current visual field of the virtual character controlled by the player;

the second determining module is used for determining data of target non-player characters to be loaded in each grid under the target virtual scene according to the information of the non-player characters corresponding to the target virtual scene;

and the starting and running module is used for starting and running at least one target process according to the data volume corresponding to the data of the target non-player character to be loaded in each grid under the target virtual scene, and the target process is used for loading the data of the target non-player character to be loaded in each grid under the target virtual scene.

13. An electronic device, comprising: a processor, a storage medium and a bus, the storage medium storing machine-readable instructions executable by the processor, the processor and the storage medium communicating via the bus when the electronic device is operating, the processor executing the machine-readable instructions to perform the steps of the game data processing method according to any one of claims 1 to 11.

14. A storage medium, having stored thereon a computer program for performing the steps of the in-game data processing method according to any one of claims 1 to 11 when executed by a processor.

Technical Field

The present application relates to the field of computer technologies, and in particular, to a game data processing method, apparatus, device, and storage medium.

Background

NPC (Non-Player Character) refers to a game Character that is not manipulated by a Player in a game, and may be generally classified into scenario NPC, battle NPC, service NPC, and the like, and sometimes, one NPC may have multiple functions, and the NPC plays an important role in promoting and developing a game scenario as an essential role in a game.

Currently, in a game scene in the world, in order to enable a player to achieve rich game experience, a huge amount of NPCs (Artificial Intelligence) units are often required to be created. When a large number of players join a game through a plurality of logic services, the number of AI units to be loaded in a process running in a game server cluster can reach the hundred million level, and how to ensure that the players have high-quality game experience on the premise of limited hardware resources is a problem to be solved urgently at present.

Disclosure of Invention

An object of the present application is to provide a method, an apparatus, a device and a storage medium for processing game data, which can ensure that a player has a high-quality game experience on the premise of limited hardware resources.

In order to achieve the above purpose, the technical solutions adopted in the embodiments of the present application are as follows:

in a first aspect, an embodiment of the present application provides a game data processing method, where the method includes:

determining a target virtual scene under the current visual field of the virtual character controlled by the player;

determining data of target non-player characters to be loaded in each grid under the target virtual scene according to information of the non-player characters corresponding to the target virtual scene;

and starting to run at least one target process according to the data volume corresponding to the data of the target non-player character to be loaded in each grid under the target virtual scene, wherein the target process is used for loading the data of the target non-player character to be loaded in each grid under the target virtual scene.

Optionally, the starting running of at least one target process according to a data amount corresponding to data of a target non-player character to be loaded in each grid in the target virtual scene includes:

determining at least one initial process according to the load information of each process;

and starting to run at least one target process in the at least one initial process according to the data amount corresponding to the data of the target non-player character to be loaded in each grid in the target virtual scene and the residual loading space of the initial process.

Optionally, the method further comprises:

and if the load of a first target process in the target processes is greater than a first preset threshold value, migrating the data of the target non-player character to be loaded in at least one target grid in the data of the target non-player character to be loaded in each grid loaded by the first target process to a migration process for loading.

Optionally, the migration process is a process in the at least one target process, and a load of the migration process is smaller than the first preset threshold.

Optionally, the migration process is a process other than the at least one target process;

migrating the data of the target non-player character to be loaded in at least one target grid in the target non-player characters to be loaded in each network loaded by the first target process to a migration process for loading, wherein the migrating process comprises the following steps:

starting to run the migration process;

and migrating the data of the target non-player character to be loaded in at least one target grid in the target non-player characters to be loaded in each network loaded by the first target process to the migration process for loading.

Optionally, the method further comprises:

if the load of a plurality of second target processes in the target processes is smaller than a second preset threshold value, merging the data of the target non-player characters to be loaded in each grid loaded by the second target processes into one of the plurality of second target processes for loading.

Optionally, before determining the target virtual scene in the current view of the virtual character manipulated by the player, the method further includes:

and starting a management process corresponding to the target virtual scene, wherein the management process is used for loading and managing a non-player character, and the management non-player character is used for monitoring whether the virtual character enters the target virtual scene.

Optionally, the determining, according to the information of the non-player character corresponding to the target virtual scene, data of the target non-player character to be loaded in each grid in the target virtual scene includes:

determining information of a non-player character corresponding to the target virtual scene according to identification information of the non-player character associated with the management non-player character;

and determining data of the target non-player character to be loaded in each grid under the target virtual scene according to the information of the non-player character corresponding to the target virtual scene.

Optionally, the method further comprises:

and adding data of a plurality of target non-player characters into a target queue, and reading the data of each target non-player character from the target queue in sequence for loading.

Optionally, the method further comprises:

reducing a frame refresh frequency of the target non-player character when the target non-player character exits a field of view of a virtual character manipulated by the player.

Optionally, the method further comprises:

and unloading the data of the target non-player character from the target process when the time length of the target non-player character exiting the visual field of the virtual character controlled by the player reaches the preset time length.

In a second aspect, an embodiment of the present application provides a game data processing apparatus, including:

the first determination module is used for determining a target virtual scene under the current visual field of the virtual character controlled by the player;

the second determining module is used for determining data of target non-player characters to be loaded in each grid under the target virtual scene according to the information of the non-player characters corresponding to the target virtual scene;

and the starting and running module is used for starting and running at least one target process according to the data volume corresponding to the data of the target non-player character to be loaded in each grid under the target virtual scene, and the target process is used for loading the data of the target non-player character to be loaded in each grid under the target virtual scene.

Optionally, the start operation module is specifically configured to determine at least one initial process according to load information of each process; and starting to run at least one target process in the at least one process according to the data amount corresponding to the data of the target non-player character to be loaded in each grid in the target virtual scene and the residual loading space of the initial process.

Optionally, the apparatus further comprises: a migration device; the migration device is configured to migrate, to the migration process and load, data of a target non-player character to be loaded in at least one target grid among data of target non-player characters to be loaded in grids loaded by the first target process, if a load of the first target process in the target processes is greater than a first preset threshold.

Optionally, the migration process is a process in the at least one target process, and a load of the migration process is smaller than the first preset threshold.

Optionally, the migration process is a process other than the at least one target process;

correspondingly, the migration device is further configured to start running the migration process; and migrating the data of the target non-player character to be loaded in at least one target grid in the target non-player characters to be loaded in each network loaded by the first target process to the migration process for loading.

Optionally, the apparatus further comprises: a merging device, configured to merge, if loads of multiple second target processes in the target processes are smaller than a second preset threshold, data of a target non-player character to be loaded in each grid loaded by the second target process into one target process in the multiple second target processes for loading.

Optionally, the start-up module is further configured to start up and run a management process corresponding to the target virtual scene, where the management process is used to load and manage a non-player character, and the management non-player character is used to monitor whether the virtual character enters the target virtual scene.

Optionally, the second determining module is further configured to determine, according to the identification information of the non-player character associated with the management non-player character, information of the non-player character corresponding to the target virtual scene; and determining data of the target non-player character to be loaded in each grid under the target virtual scene according to the information of the non-player character corresponding to the target virtual scene.

Optionally, the apparatus further comprises: adding a device; the adding device is used for adding the data of the target non-player characters into a target queue, and reading the data of each target non-player character from the target queue in sequence for loading.

Optionally, the apparatus further comprises: a processing device; the processing device is used for reducing the frame refreshing frequency of the target non-player character when the target non-player character exits the visual field of the virtual character controlled by the player.

Optionally, the apparatus further comprises: unloading the module; the unloading module is used for unloading the data of the target non-player character from the target process when the time length of the target non-player character exiting the visual field of the virtual character controlled by the player reaches a preset time length.

In a third aspect, an embodiment of the present application provides an electronic device, including: a processor, a storage medium and a bus, wherein the storage medium stores machine-readable instructions executable by the processor, when the electronic device runs, the processor and the storage medium communicate through the bus, and the processor executes the machine-readable instructions to execute the steps of the game data processing method of the first aspect.

In a fourth aspect, the present application provides a storage medium, on which a computer program is stored, the computer program being executed by a processor to perform the steps of the game data processing method according to the first aspect.

The beneficial effect of this application is:

the embodiment of the application provides a game data processing method, a device, equipment and a storage medium, wherein the method comprises the following steps: determining a target virtual scene under the current visual field of the virtual character controlled by the player; determining data of target non-player characters to be loaded in each grid under the target virtual scene according to information of the non-player characters corresponding to the target virtual scene; and starting to run at least one target process according to the data volume corresponding to the data of the target non-player character to be loaded in each grid under the target virtual scene, wherein the target process is used for loading the data of the target non-player character to be loaded in each grid under the target virtual scene. By applying the embodiment of the application, the data amount corresponding to the data of the target player character to be loaded is determined according to the information (such as the number of the non-player characters) of the target virtual scene and the non-player characters of the virtual character controlled by the player under the current visual field, because the visual field range of the virtual character is limited, the number of the non-player characters to be loaded can be reduced according to the data amount, and the virtual character controlled by each player has the aggregation characteristic in the game scene from the dimension of the logic service, the number of the non-player characters to be loaded can be greatly reduced, on the basis, not only can the starting number of the target processes be reduced, but also the phenomenon that the data of the process-loaded target non-player characters are overloaded can be avoided, that is to say, under the premise of limited hardware resources (game servers), the high-quality game experience of the player is guaranteed.

Drawings

In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings needed to be used in the embodiments will be briefly described below, it should be understood that the following drawings only illustrate some embodiments of the present invention and therefore should not be considered as limiting the scope, and for those skilled in the art, other related drawings can be obtained according to the drawings without inventive efforts.

Fig. 1 is a schematic view of a scenario in which a game server performs load balancing control according to an embodiment of the present application;

FIG. 2 is a schematic flow chart illustrating a game data processing method according to an embodiment of the present disclosure;

fig. 3 is a schematic view illustrating a visual field of a virtual character according to an embodiment of the present disclosure;

FIG. 4 is a schematic flow chart illustrating another game data processing method according to an embodiment of the present disclosure;

FIG. 5 is a schematic flow chart illustrating another game data processing method according to an embodiment of the present application;

FIG. 6 is a schematic flow chart illustrating another game data processing method according to an embodiment of the present application;

fig. 7 is a schematic structural diagram of a game data processing device according to an embodiment of the present application;

fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. The components of the embodiments of the present application, generally described and illustrated in the figures herein, can be arranged and designed in a wide variety of different configurations.

Thus, the following detailed description of the embodiments of the present application, presented in the accompanying drawings, is not intended to limit the scope of the claimed application, but is merely representative of selected embodiments of the application. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.

Before explaining the embodiments of the present application, an application scenario of the present application will be described first. The application scenario of the present application may specifically be: a large number of players enter a world game scene through a plurality of logic servers at the same time, and under the condition that a game server cluster needs to load billions of levels of NPCs, a scene of load balancing control is carried out on each game server in the game server cluster, namely the scene of NPC control in a game. Fig. 1 is a schematic view of a scenario in which a game server performs load balancing control according to an embodiment of the present disclosure, as shown in fig. 1, the scenario includes a plurality of players 101, game clients corresponding to the players 101 correspond to the game server 103, and a program for providing local services to the players by the game clients may be pre-installed on terminal devices held by the players 101 and needs to cooperate with the game server 103 to operate, where specific forms of the terminal devices may include a mobile phone, a tablet computer, a desktop computer, and the present disclosure does not limit the terminal devices. The scene also comprises a plurality of logic suits 102, each logic suit 102 can support a plurality of players 101, virtual characters operated by the players 101 on the same logic suit 102 are visible in the game scene of the world, and virtual characters operated by the players on different logic suits 102 are not visible in the game scene of the world.

The scene also includes a game server cluster 100, the game server cluster 100 may include a plurality of game servers 103, and the game servers 103 correspond to the above-mentioned game clients, may be installed in an IDC (Internet Data Center), and provide a software program of Data forwarding and logic processing service for the game clients. Since a Game client installed on a terminal device held by a player is easily cracked and utilized and cheated, most of the logic processing in a network Game such as MMORPG (Massive Multiplayer Online Role-Playing Game) is calculated in a Game server.

Each game server 103 can create a plurality of processes 104 according to actual requirements, each process 104 is in a closed state in an initial state after creation is completed, and when data to be processed sent by a game client needs to be loaded, the corresponding process 104 can be started. The starting management of the process 104 is handled by a load balancing management unit 105 in the scene, and the load balancing management unit 105 is associated with load information of each process 104 in each game server 103, where the load information may include a preset load threshold corresponding to the process 104 and currently occupied load information. Specifically, when receiving NPC to-be-processed data sent by a game client, the load balancing management unit 105 may allocate the NPC to-be-processed data to a target process according to a load condition of each current process in a manner described below in this embodiment of the present application, and then the target process loads NPC data to be loaded in each grid included in a target virtual scene under a current view of a virtual character controlled by the player 101 with a map instance (such as a grid) of a minimum unit in the virtual scene as a dimension, and the load balancing management unit 105 feeds back the NPC data obtained after loading to a corresponding game client, and further controls each NPC in the target virtual scene to perform a corresponding action, such as moving, fighting, and performing various game operations.

It should be noted that, for a player dimension, data of an NPC to be loaded included in a target virtual scene in a current view of a virtual character manipulated by one player 101 may be loaded into processes 104 corresponding to different game servers 103, or may be loaded into a process 104 corresponding to the same game server 103; regarding the dimensions of the logic servers, data of NPCs to be loaded included in a target virtual scene in a current view of each virtual character manipulated by each player 101 supported by one logic server 102 may be loaded into processes 104 corresponding to different game servers 103, or may be loaded into processes 104 corresponding to the same game server 103, which is not limited in the present application.

The method for controlling a non-player character in a game mentioned in the present application can be explained as follows by means of an embodiment of the present application. Fig. 2 is a schematic flow chart of a game data processing method according to an embodiment of the present application. As shown in fig. 2, the method includes:

s201, determining a target virtual scene under the current visual field of the virtual character controlled by the player.

In a game scene (such as MMORPG) of the world, in order to enable players to achieve rich game experience, a large number of NPCs are often required to be created, and particularly when a large number of players join in the game at the same time, a plurality of logic uniforms are often required to be created, the number of the logic uniforms is related to the number of the players who are online at the same time and the number of the players supported by the logic uniforms, virtual characters operated by the players located on the same logic uniform are visible, and virtual characters operated by the players located on different logic uniforms are invisible. A cluster of game servers corresponding to a plurality of logical servers may include a limited number of game servers, such as N game servers, each having a corresponding identifier, which may be represented by symbols, text, or any other combination as will be appreciated by those skilled in the art. Each game server may create a limited number of processes in advance, such as M processes, the processes of the game server may be used to load game data to be processed sent by the game client, each process corresponds to a respective identifier, it should be noted that the number of the processes corresponding to each game server may be the same or different, and the present application does not limit the number of the processes.

Here, the data of the NPCs to be loaded corresponding to the virtual character operated and controlled by each player supported by one of the logic servers (target logic server) is similar to the data of the NPCs to be loaded corresponding to the virtual character operated and controlled by each player supported by the other logic servers. The large world scene can be divided into a plurality of grids according to the distribution density information of the NPC in the large world scene, the sizes of the grids in the large world scene can be different, for example, an area with high NPC distribution density can be divided into a large grid, an area with low NPC distribution density can be divided into a small grid, and the grids in the large world scene can be in a square shape, a rectangular shape and the like. Each grid corresponds to position information and a visual field list in a game scene of the world, wherein the visual field list comprises the number of virtual characters and the number of non-player characters corresponding to the grid, the visual field range of each virtual character controlled by each player can be preset, the visual field range can be specifically an area formed by presetting a plurality of grids around the grid where the virtual character is currently located, and a target virtual scene under the current visual field of the virtual character controlled by each player supported by each target logic service can be determined according to the position information of the area.

Here, a virtual character manipulated by a player is taken as an example for explanation, fig. 3 is a schematic view of a visual field range of a virtual character provided in an embodiment of the present application, as shown in fig. 3, a grid 301 in a shadow state in fig. 3 is a position in a game scene where the virtual character manipulated by the player is currently located, and according to a preset visual field range (for example, 9 grids) corresponding to the virtual character manipulated by the player, a target virtual scene 302 in a current visual field of the virtual character can be determined to be an area formed by the 9 grids. It can be understood that the visual field ranges, i.e., the number of grids, corresponding to different virtual characters may be the same or different, and the present application does not limit the scope.

It should be noted that fig. 3 is only an example, and the size and shape of the mesh are not limited in the present application.

S202, determining data of target non-player characters to be loaded in each grid under the target virtual scene according to information of the non-player characters corresponding to the target virtual scene.

The area corresponding to the target virtual scene comprises a plurality of grids, and each grid is equivalent to a map example. In an implementation embodiment, the process is loaded with the map instance as the minimum unit, that is, the data of the NPC to be loaded in the same grid is loaded in the same process, so the grid is taken as the dimension for explanation here.

Each mesh corresponding to the target virtual scene may correspond to position information and a view list, where the view list includes information of virtual characters corresponding to the mesh and information of non-player characters (NPCs), and in an implementation embodiment, the information of the virtual characters may include the number of virtual characters, and the information of the non-player characters may include the number of non-player characters, where the information of the non-player characters is mainly used as a main description, and data of the target non-player characters in a mesh may be determined according to the number of non-player characters in the mesh.

Optionally, the information of the non-player character may include the number of the non-player characters and the weight of the non-player character, where the weight is used to indicate the degree of the non-player character's requirement for resources, and the larger the weight is, the more resources are required by the non-player character, that is, the process needs to allocate a larger resource space to the non-player character with the larger weight to load the to-be-processed data corresponding to the non-player character.

For example, a grid includes a target non-player character a, a target non-player character B, and a target non-player character C, the number of the target non-player characters a, the number of the target non-player characters B, and the number of the target non-player characters C may be counted, and the total number of the target non-player characters in the grid may be obtained. In an implementation example, the data amount corresponding to the data of the target non-player character to be loaded in the grid can be obtained according to the total number of the target non-player characters in the grid, the proportion of the fighting attributes corresponding to the grid, and the weight corresponding to each fighting attribute. Wherein the combat attribute proportion is the proportion of participating in combat or the proportion of not participating in combat, specifically, the number of target non-player characters participating in combat and the number of target non-player characters not participating in combat are estimated according to the total number of the target non-player characters in the grid and the proportion of participating in combat, and the data amount corresponding to the target non-player characters participating in combat is determined according to the number of the target non-player characters participating in combat and the combat weight, determining the data amount corresponding to the target non-player characters not participating in the battle according to the number of the target non-player characters not participating in the battle and the weight not participating in the battle, the data volume corresponding to the target non-player character participating in the battle is added to the data volume corresponding to the target non-player character not participating in the battle to obtain the data volume corresponding to the data of the target non-player character in the grid.

S203, starting and running at least one target process according to the data volume corresponding to the data of the target non-player character to be loaded in each grid under the target virtual scene, wherein the target process is used for loading the data of the target non-player character to be loaded in each grid under the target virtual scene.

The game server in the game server cluster can be pre-established with a plurality of processes, the initial state of each process can be a closed state, and after receiving a starting instruction, a target process corresponding to the starting instruction can be started.

When an instruction sent by a game client to enter a target virtual scene is received, data of target non-player characters to be loaded in each grid in the target virtual scene can be calculated firstly, if a plurality of target non-player characters exist in a certain grid, total data to be loaded can be obtained according to the data of each target player character, and the data quantity corresponding to the total data is used as the data quantity of the grid.

In an implementation embodiment, firstly, according to the load of each game server and a server load threshold, filtering out game servers exceeding the load threshold, that is, filtering out processes under the game servers, then, according to the load of each process under the game server not exceeding the load threshold and each process load threshold, determining processes not exceeding the process load threshold, taking the processes not exceeding the process load threshold as target processes, and finally, loading the data of each grid into the corresponding target processes according to the process load threshold of the target processes and the resources required for loading the data of each grid, where the resources required for the data of each grid correspond to the data amount corresponding to the data of each grid, and it can be understood that the resources required for the data of the grid are more when the data amount corresponding to the data of the grid is larger. The target process processes the loaded data (i.e., the data of the target non-player character), and then feeds the processed data back to the corresponding game client to control the corresponding target non-player character to perform game operation.

To sum up, the game data processing method provided in the embodiment of the present application determines the data amount corresponding to the data of the target player character to be loaded according to the information (such as the number of non-player characters) of the target virtual scene and the non-player characters of the virtual character operated by the player in the current visual field, and since the visual field range of the virtual character is limited, the number of the non-player characters to be loaded can be fundamentally reduced, and in terms of the dimension of the logical service, the virtual character operated by each player has an aggregation characteristic in the game scene, so that the number of the non-player characters to be loaded can be greatly reduced, on this basis, not only can the number of the target processes be reduced, but also the phenomenon that the data of the process loaded target non-player characters is overloaded can be avoided, that is, in the above manner, on the premise of limited hardware resources (game servers), the player can be guaranteed to have a high-quality game experience.

Fig. 4 is a schematic flow chart of another game data processing method according to an embodiment of the present application. Optionally, as shown in fig. 4, the starting and running at least one target process according to a data amount corresponding to data of a target non-player character to be loaded in each grid in the target virtual scene includes:

s401, determining at least one initial process according to the load information of each process.

S402, starting and running at least one target process in at least one initial process according to the data amount corresponding to the data of the target non-player character to be loaded in each grid under the target virtual scene and the residual loading space of the initial process.

The load information of each process may include current load information of each process and a process load threshold, where the current load information of each process may be understood as a resource occupation condition of a Central Processing Unit (CPU) in a corresponding game server currently occupied by each process, and the process load threshold may be understood as a load threshold preset for each process. In an implementation embodiment, the current load information of each process may be compared with the corresponding process load threshold, and an initial process with the current load information smaller than the corresponding process threshold is determined, where when there are multiple initial processes, each initial process may belong to the same game server or different game servers, and the application does not limit this.

After each initial process is determined, the remaining loading space can be determined according to the current load information of each initial process and the corresponding process load threshold, and then the grid is taken as a dimension, and the corresponding process is matched according to the remaining loading space corresponding to each initial process and the data amount corresponding to the data of the target non-player character to be loaded in each grid under the target scene, namely the required loading space corresponding to the data of the target non-player character, and the matched process can be called as a target process. And associating the matched grid identification with the target process identification, and loading the data of each target non-player character to be loaded in the grid with the association relation into the corresponding identified target process, namely starting to run the target process.

Optionally, the method may further include: and if the load of a first target process in the target processes is greater than a first preset threshold value, migrating the data of the target non-player character to be loaded in at least one target grid in the data of the target non-player character to be loaded in each grid loaded by the first target process to a migration process for loading.

The first preset threshold is associated with the process load threshold mentioned above, and is generally smaller than the process load threshold, and the degree to which the first preset threshold is smaller than the process load threshold may be set according to an actual situation, which is not limited in the present application. The loading space required for the data of the target non-player character to be loaded in each grid varies with the association relationship between the virtual character manipulated by the player in the target virtual scene and each target non-player character. For example, assuming that at a previous time, the virtual character manipulated by the player in the target virtual scene and the target non-player characters in a grid are in a non-combat state, and at a current time, the virtual character manipulated by the player and the target non-player characters in the grid are in a combat state, a loading space required by the first target process to load data of the target non-player character to be loaded in the grid at the current time is larger than a loading space required by the first target process to load data of the target non-player character to be loaded in the grid at the previous time, that is, the first target process loads data of the grid at the current time (data of the target non-player character to be loaded) and occupies more CPU resources.

When the load of the first target process is judged to be greater than a first preset threshold, data of a target non-player character to be loaded in a certain target grid needs to be migrated from the first target process, wherein the target grid can be a grid under a target virtual scene corresponding to a virtual character controlled by the player, can also be a grid under a target virtual scene corresponding to a virtual character controlled by other players belonging to the same logic service, and can also be a grid under a target virtual scene corresponding to a virtual character controlled by other players belonging to different logic services, and the number of the target grids can be one or more.

Optionally, the migration process may be at least one target process, and the migration process is smaller than the first preset threshold mentioned above.

In an implementation embodiment, the target processes may be sorted according to the current load information of each target process except the first target process and a first preset threshold, and the target process with the current load information smaller than the first threshold is determined as the migration process, where it should be noted that the number of the migration processes is not limited in the present application.

It can be seen that, when the current target load at a time is smaller than the first preset threshold, and the game operation between the virtual character and the non-player character in the game scene changes to a target load with a load larger than the first preset threshold, the data of the target non-player character originally belonging to the target load can be dynamically migrated to the migration process, so that the performance of the target process can be ensured, and the phenomenon that the player corresponding to the target process experiences blocking at the game client is avoided.

Fig. 5 is a schematic flow chart of another game data processing method according to an embodiment of the present application. Optionally, as shown in fig. 5, the migrating process is a process other than at least one target process, and migrating data of a target non-player character to be loaded in at least one target grid among target non-player characters to be loaded in networks loaded by a first target process to the migrating process for loading includes:

s501, starting a running migration process;

s502, transferring the data of the target non-player character to be loaded in at least one target grid in the target non-player characters to be loaded in each network loaded by the first target process to the transfer process for loading.

If a process with an initial state of a closed state still exists in the game server cluster, the process with the initial state of the closed state, which can be used as a migration process, can be determined according to CPU resource information pre-allocated to each process with the initial state of the closed state and loading space information required by data of a target non-player character to be loaded in a target grid. The process in which the initial state as the migration process is the closed state may be started and run, and then the data of the target non-player character to be loaded in the target grid may be loaded in the corresponding migration process.

Optionally, the method may further include: and if the load of a plurality of second target processes in the target processes is smaller than a second preset threshold value, merging the data of the target non-player characters to be loaded in each grid loaded by the second target processes into one of the plurality of second target processes for loading.

The second preset threshold is associated with the process load threshold mentioned above, and is generally smaller than the process load threshold, and the degree to which the second preset threshold is smaller than the process load threshold may be set according to an actual situation, which is not limited in the present application. The aforementioned load balancing management unit may detect the load of each target process according to a preset frequency, may use a target process whose load is smaller than a second preset threshold as a second target process, and may use the second target process whose deviation value is the largest as a main second target process according to a deviation between the load of each second target process and the second preset threshold, and if a remaining load space of the main second target process is capable of loading data of target non-player characters to be loaded in each grid loaded by a plurality of other second target processes, and the load of the main second target process is smaller than the first preset threshold, may merge data of target non-player characters to be loaded in each grid loaded on the plurality of other second target processes into the main second target process; if the main second target process cannot record all the data loaded by the other second target processes, the second main second target process may be determined from the other second target processes according to the above-described manner, and it should be noted that the number of the main second target processes is not limited in the present application.

It can be understood that, if the load of the target process is smaller than the second preset threshold, it is proved that the target process has a wasted loading space, when the data loaded on a plurality of second target processes with lower loads are merged onto one main second target process, more idle processes can be vacated, and the idle processes can be assigned to a busier logic uniform, it can be understood that the busier logic uniform means that the number of supported players is increased, or a specific play method is started in a game scene under the logic uniform, so that a large number of players are attracted to join in the game scene, and further, a large amount of data of target non-player characters can be generated. That is, the logic uniform with a larger number of players can occupy more processes, and the logic uniform with a smaller number of players can occupy less processes, thereby achieving the purpose of load balancing.

Optionally, before determining the target virtual scene in the current view of the virtual character manipulated by the player, the method may further include: and starting a management process corresponding to the running target virtual scene, wherein the management process is used for loading and managing the non-player character, and the management non-player character is used for monitoring whether the virtual character enters the target virtual scene or not.

As can be seen from the above description, a game scene is composed of a plurality of grids, and a plurality of adjacent grids may constitute a virtual scene in the game scene. Assuming that the game scene is divided into a plurality of fixed virtual scenes, for each virtual scene, the non-player characters allocated thereon can be divided into two categories, such as a non-player character for monitoring whether the virtual character enters the virtual scene, i.e., a management non-player character, and other non-player characters associated with the management non-player character, for example, one management non-player character may be associated with 10 other non-player characters.

For one of the target virtual scenes, when a distance between a virtual character operated by a player and the target virtual scene meets a first distance condition, a management process corresponding to the target virtual scene can be started to run, the management process can be the above-mentioned target process, the management process can load data for managing non-player characters, the managed non-player character is created in the target virtual scene, whether the distance between the virtual character and the target virtual scene meets a second distance condition is monitored through the managed non-player character, and if the distance meets the second distance condition, the virtual player is proved to enter the target virtual scene. A process is then initiated to load data for other non-player characters associated with the managing non-player character, which may be the managing process mentioned above. Therefore, the number of the non-player characters which need to be loaded simultaneously by the process can be reduced by the distributed data loading mode, and the phenomenon of overload of the process is avoided.

Fig. 6 is a schematic flow chart of another game data processing method according to an embodiment of the present application. Optionally, as shown in fig. 6, the determining, according to the information of the non-player character corresponding to the target virtual scene, data of the target non-player character to be loaded in each grid in the target virtual scene includes:

s601, determining information of the non-player character corresponding to the target virtual scene according to the information of the non-player character related to the management non-player character.

S602, determining data of target non-player characters to be loaded in each grid under the target virtual scene according to information of the non-player characters corresponding to the target virtual scene.

The non-player character as the management non-player character belongs to a static non-player character, that is, the management non-player character does not actively attack the virtual character controlled by the player and does not counterattack the virtual character touched by the player, so that after the management non-player character is created in advance, data for managing the non-player character is not required to be processed subsequently.

The management non-player character may be associated with a plurality of non-player characters, and the number set of the plurality of non-player characters may constitute the number of total non-player characters on the target virtual scene.

The area corresponding to the target virtual scene comprises a plurality of grids, a management non-player character is positioned on one grid, the management non-player character sends a monitoring result of monitoring that the virtual character enters the target virtual scene to the load balancing management unit, the load balancing management unit determines non-player character identification information associated with the management non-player character according to the monitoring result, and the number of the non-player characters is determined according to the non-player character identification information. For the grid as a dimension, data of a target non-player character to be loaded in each grid in a target virtual scene can be determined according to the number of the non-player characters on each grid, and a process for loading data of other non-player characters associated with the management non-player character is started, where the process can be the above-mentioned management process.

Optionally, the method further comprises: and adding data of a plurality of target non-player characters into a target queue, and reading the data of each target non-player character from the target queue in sequence for loading.

For a target process, data of each target non-player character to be loaded in the target process can be put into a global target queue in advance, and data of a preset number of non-player characters loaded in each frame is set until the target process finishes loading the data of each target non-player character to be loaded, so that the phenomenon of picture stuttering on a game interface of a game client can be avoided.

Optionally, the method further comprises: when a target non-player character exits the field of view of a virtual character manipulated by a player, the frame refresh frequency of the target non-player character is reduced.

The virtual character controlled by the player can move in a game scene according to a game task, and in the moving process, the target non-player character in the visual field range of the virtual character can gradually quit the visual field of the virtual character, so that when a certain target non-player character quits the visual field of the virtual character, the frequency of loading the data of the target non-player character by the process can be reduced, namely the refreshing frequency of the target non-player character is reduced, and the CPU resource corresponding to the process can be reserved for the data of the target non-player character loaded in the visual field range of the virtual character.

Optionally, the method further comprises: and unloading the data of the target from the target process when the time length of the target non-player character exiting the visual field of the virtual character controlled by the player reaches the preset time length.

When the time length of the virtual character which is exited by a certain target non-player character reaches the preset time length (such as 5S), the data of the target non-player character loaded in the target process can be directly removed, so that the data volume loaded by the process can be reduced, and the phenomenon of overload of the process is avoided.

Fig. 7 is a schematic structural diagram of a game data processing device according to an embodiment of the present application. As shown in fig. 7, the apparatus includes:

a first determining module 701, configured to determine a target virtual scene in a current view of a virtual character manipulated by a player;

a second determining module 702, configured to determine, according to information of a non-player character corresponding to a target virtual scene, data of a target non-player character to be loaded in each grid in the target virtual scene;

the starting and running module 703 is configured to start and run at least one target process according to a data amount corresponding to data of a target non-player character to be loaded in each grid in the target virtual scene.

Optionally, the starting operation module 703 is specifically configured to determine at least one initial process according to load information of each process; and starting to run at least one target process in at least one initial process according to the data amount corresponding to the data of the target non-player character to be loaded in each grid under the target virtual scene and the residual loading space of the initial process.

Optionally, the apparatus further comprises: a migration device; the migration device is configured to migrate, to the migration process for loading, data of a target non-player character to be loaded in at least one target grid among data of target non-player characters to be loaded in grids loaded by the first target process, if a load of the first target process in the target processes is greater than a first preset threshold.

Optionally, the migration process is a process in the at least one target process, and a load of the migration process is smaller than a first preset threshold.

Optionally, the migration process is a process other than the at least one target process;

correspondingly, the migration device is also used for starting the running of the migration process; and migrating the data of the target non-player character to be loaded in at least one target grid in the target non-player characters to be loaded in each network loaded by the first target process to a migration process for loading.

Optionally, the apparatus further comprises: and the merging device is used for merging the data of the target non-player character to be loaded in each grid loaded by each second target process into one target process of the second target processes for loading if the load of the second target processes in the target processes is smaller than a second preset threshold value.

Optionally, the starting and running module 703 is further configured to start a management process corresponding to the running target virtual scene, where the management process is used to load and manage a non-player character, and the management non-player character is used to monitor whether the virtual character enters the target virtual scene.

Optionally, the second determining module 702 is further configured to determine, according to the identification information of the non-player character associated with the managed non-player character, information of the non-player character corresponding to the target virtual scene; and determining data of the target non-player character to be loaded in each grid under the target virtual scene according to the information of the non-player character corresponding to the target virtual scene.

Optionally, the apparatus further comprises: adding a device; the joining device is used for joining the data of a plurality of target non-player characters into the target queue, and reading the data of each target non-player character from the target queue in sequence for loading.

Optionally, the apparatus further comprises: a processing device; the processing device is used for reducing the frame refreshing frequency of the target non-player character when the target non-player character exits the visual field of the virtual character controlled by the player.

Optionally, the apparatus further comprises: unloading the module; the unloading module is used for unloading the data of the target non-player character from the target process when the time length of the target non-player character exiting the visual field of the virtual character controlled by the player reaches the preset time length.

The above-mentioned apparatus is used for executing the method provided by the foregoing embodiment, and the implementation principle and technical effect are similar, which are not described herein again.

These above modules may be one or more integrated circuits configured to implement the above methods, such as: one or more Application Specific Integrated Circuits (ASICs), or one or more microprocessors, or one or more Field Programmable Gate Arrays (FPGAs), etc. For another example, when one of the above modules is implemented in the form of a Processing element scheduler code, the Processing element may be a general-purpose processor, such as a Central Processing Unit (CPU) or other processor capable of calling program code. For another example, these modules may be integrated together and implemented in the form of a system-on-a-chip (SOC).

Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 8, the electronic device may include: a processor 801, a storage medium 802 and a bus 803, wherein the storage medium 802 stores machine-readable instructions executable by the processor 801, and when the electronic device is operated, the processor 801 communicates with the storage medium 802 via the bus 803, and the processor 801 executes the machine-readable instructions to perform the steps of the above-mentioned method embodiments. The specific implementation and technical effects are similar, and are not described herein again.

Optionally, the present application further provides a storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the computer program performs the steps of the above method embodiments. The specific implementation and technical effects are similar, and are not described herein again.

In the several embodiments provided in the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.

The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.

In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.

The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to perform some steps of the methods according to the embodiments of the present application. And the aforementioned storage medium includes: a U disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.

It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application. It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures. The above description is only a preferred embodiment of the present application and is not intended to limit the present application, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, improvement and the like made within the spirit and principle of the present application shall be included in the protection scope of the present application.

20页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:虚拟场景中障碍物的消除方法、装置、设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类