Resource object processing method, device, electronic device and storage medium
By dividing the game scene into grid and gameplay areas, dynamically loading and activating the resource object collection, the server performance pressure problem caused by the expansion and expansion of resource objects in the game scene is solved, and more efficient resource management and computing resource savings are achieved.
Patent Information
- Application Number
- CN202111193108.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-13
- Publication Date
- 2025-08-12
- Estimated Expiration
- 2041-10-13
AI Technical Summary
The expansion and expansion of resource objects in game scenarios lead to excessive pressure on server performance, and the existing management methods cannot effectively reduce server computing and memory consumption.
Divide the game scene into multiple grids, and divide it into multiple gameplay areas based on the grid. Determine the target grid and gameplay areas according to the location of the virtual character, load and activate the target resource object collection, and reduce the server's memory and computing resource consumption.
By dynamically loading and activating resource objects, the performance pressure of the server is reduced, the consumption of memory and computing resources is reduced, and the load capacity of the game is improved.
Smart Images

Figure CN113908531B_ABST
Abstract
Description
Technical Field
[0001] Embodiments of the present invention relate to the field of data processing technology, and in particular to a method for processing a resource object, a device for processing a resource object, an electronic device, and a computer-readable storage medium. Background Art
[0002] With the continuous development of Internet technology, terminal devices such as smart phones, personal computers, and tablets have been widely used, and online games have gradually entered people's lives, making games one of people's increasingly important entertainment activities.
[0003] In many game scenes, resource objects are set up, such as props, vegetation, gameplay and other resource objects. As the resource objects in the game continue to expand, these resource objects provide players with more gaming experience, but the server needs to load and manage more and more resource objects.
[0004] When the game is running, the client usually uses AOI (Area Of Interest (area of interest) push method is used to load resource objects around the player's virtual character according to the server's push. In other words, the client can only load some resource objects in the game scene, but in order to be able to push the resource objects around the player's virtual character in a timely manner, the server needs to load all resource objects, which brings relatively large performance pressure to the server. Summary of the Invention
[0005] The embodiments of the present invention provide a method, device, electronic device and computer-readable storage medium for processing resource objects to solve the problem of excessive performance pressure on a server.
[0006] An embodiment of the present invention discloses a method for processing a resource object, wherein the resource object is a game entity that needs to consume computing resources. The method includes:
[0007] Obtaining a role position of a virtual character in a game scene; the game scene is divided into a plurality of grids, each grid having a corresponding resource object, and the grids are divided into a plurality of play areas based on the grids, and the resource objects in the play areas are organized into a resource object set;
[0008] determining a target grid from the grids according to the position of the character;
[0009] Determine the gameplay area where the target grid is located as the target gameplay area;
[0010] Determine the resource object set of the target gameplay area as the target resource object set;
[0011] The target resource object set is loaded, and the resource object corresponding to the target grid in the target resource object set is activated.
[0012] Optionally, the game entity includes at least one of a virtual item and a non-player character.
[0013] Optionally, determining a target grid from the grids according to the position of the character includes:
[0014] Taking the grid where the character is located as the current grid;
[0015] The current grid and the grids adjacent to the current grid are determined as target grids.
[0016] Optionally, the grid has a corresponding grid index, and the character position is the grid index of the game character in the game scene;
[0017] The step of taking the grid where the character is located as the current grid includes:
[0018] The mesh that matches the mesh index of the character's position is determined as the current mesh.
[0019] Optionally, activating the resource object corresponding to the target grid in the target resource object set includes:
[0020] An activation notification is sent to the resource object corresponding to the target grid; the resource object is used to be activated according to the activation notification to run according to the custom logic.
[0021] Optionally, after activating the resource object corresponding to the target grid in the target resource object set, the method further includes:
[0022] Obtaining the position of the virtual character after it moves in the game scene;
[0023] determining a moving grid from the grid according to the position of the character after the movement;
[0024] When the index difference between the grid index of the target grid and the grid index of the mobile grid exceeds a preset threshold, a deactivation notification is sent to the resource object corresponding to the target grid; the resource object is used to deactivate according to the deactivation notification to stop running according to the custom logic.
[0025] Optionally, the resource object includes a specific resource object that operates according to specific logic, and the specific resource object is configured to continue operating according to the specific logic after receiving the deactivation notification.
[0026] Optionally, the playing areas overlap or do not overlap in the game scene.
[0027] Optionally, the resource objects of the game scene are distributed in a single process.
[0028] An embodiment of the present invention further discloses a device for processing resource objects, wherein the resource objects are game entities that need to consume computing resources. The device includes:
[0029] A character position acquisition module is used to obtain the character position of the virtual character in the game scene; the game scene is divided into a plurality of grids, each grid having a corresponding resource object, and is further divided into a plurality of play areas based on the grids, and the resource objects in the play areas are organized into resource object sets;
[0030] a target grid determination module, configured to determine a target grid from the grids according to the position of the character;
[0031] A target game area determination module, configured to determine the game area where the target grid is located as the target game area;
[0032] a target resource object set determination module, configured to determine the resource object set of the target gameplay area as the target resource object set;
[0033] The resource object activation module is used to load the target resource object set and activate the resource object corresponding to the target grid in the target resource object set.
[0034] Optionally, the target grid determination module is configured to take the grid where the character is located as the current grid; and determine the current grid and the grids adjacent to the current grid as target grids.
[0035] Optionally, the grid has a corresponding grid index, and the character position is the grid index of the game character in the game scene; the target grid determination module is used to determine the grid that matches the grid index of the character position as the current grid.
[0036] Optionally, the resource object activation module is configured to send an activation notification to the resource object corresponding to the target grid; the resource object is configured to be activated according to the activation notification to run according to custom logic.
[0037] Optionally, the device also includes: a deactivation module, used to obtain the character position of the virtual character after moving in the game scene; determine the moving grid from the grid based on the character position after the movement; when the index difference between the grid index of the target grid and the grid index of the moving grid exceeds a preset threshold, send a deactivation notification to the resource object corresponding to the target grid; the resource object is used to deactivate according to the deactivation notification to stop running according to the custom logic.
[0038] Optionally, the resource object includes a specific resource object that operates according to specific logic, and the specific resource object is configured to continue operating according to the specific logic after receiving the deactivation notification.
[0039] An embodiment of the present invention further discloses an electronic device, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory communicate with each other via the communication bus;
[0040] The memory is used to store computer programs;
[0041] The processor is configured to implement the method described in the embodiment of the present invention when executing the program stored in the memory.
[0042] The embodiments of the present invention further disclose one or more computer-readable storage media having instructions stored thereon. When executed by one or more processors, the processors are enabled to perform the method according to the embodiments of the present invention.
[0043] The embodiments of the present invention include the following advantages:
[0044] In an embodiment of the present invention, the game scene is divided into multiple grids, each grid having a corresponding resource object. The game scene is divided into multiple play areas based on the grids, and the resource objects in the play areas are organized into a resource object set. When obtaining the role position of the virtual character in the game scene, the target grid is determined according to the role position, and then the play area where the target grid is located is determined as the target play area. The target resource object set corresponding to the target play area is loaded, and the resource object corresponding to the target grid in the target resource object set is activated. In an embodiment of the present invention, the resource object is a game entity that requires consumption of computing resources. The resource object set is loaded and the resource object is activated according to the role position of the virtual character operated by the player in the game scene. Therefore, there is no need to load the resource objects in the entire game scene, which reduces the consumption of the server's memory resources. There is no need to activate the resource objects in the entire game scene, which reduces the consumption of the server's computing resources and reduces the performance pressure of the server. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the following is a brief introduction to the drawings required for use in the specific implementation methods or the description of the prior art. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without any creative work.
[0046] Figure 1 This is a flowchart of a method for processing a resource object provided in an embodiment of the present invention;
[0047] Figure 2 is a schematic diagram of a play area in a game scene provided in an embodiment of the present invention;
[0048] Figure 3 is a schematic diagram of a grid state provided in an embodiment of the present invention;
[0049] Figure 4 This is a flow chart of resource object loading management provided in an embodiment of the present invention;
[0050] Figure 5 This is a schematic diagram of an application environment for processing resource objects provided in an embodiment of the present invention;
[0051] Figure 6 is a structural block diagram of a resource object processing device provided in an embodiment of the present invention;
[0052] Figure 7 is a block diagram of an electronic device provided in an embodiment of the present invention;
[0053] Figure 8 is a schematic diagram of a computer-readable storage medium provided in an embodiment of the present invention. DETAILED DESCRIPTION
[0054] In order to make the above-mentioned objects, features and advantages of the present invention more obvious and easy to understand, the present invention is further described in detail below with reference to the accompanying drawings and specific embodiments.
[0055] In a specific implementation, the server can manage resource objects in the game scene through a single-process method or a multi-process method. Single-process method: mainly for simple game scenes, that is, game scenes with a small number of players or resource objects, the resource objects in the game scene are distributed to a single process, so that the resource objects in the entire game scene are loaded through a single process, which facilitates the overall management of the game scene. Multi-process method: mainly for complex game scenes, that is, game scenes with a large number of players or resource objects, the resource objects in the game scene are distributed to multiple processes, so that the resource objects in the game scene are loaded separately through multiple processes, thereby reducing the performance pressure of the server.
[0056] However, the above methods of managing game resource objects all have some problems, specifically:
[0057] Single-process method: When the resource objects in the game scene expand, loading the resource objects through a single process will be slow, which will greatly consume the player's patience.
[0058] Multi-process method: Resource objects are loaded through multiple processes, so the loading speed will be faster. However, the multi-process method is very complicated to implement. Since the game logic of the same game scene is implemented through multiple processes, in order to ensure the normal game logic in the game scene, the data between different processes needs to be synchronized, which requires additional consideration during development.
[0059] The above two methods do not reduce the performance pressure on the server of the entire game, resulting in the number of game scenes that the server of the entire game can support being affected by the complexity of the game scenes.
[0060] In response to the above problems, an embodiment of the present invention proposes a resource object processing method for resource objects in game scenes, especially resource objects in high-complexity game scenes, which supports dynamic loading and activation of resource objects in game scenes and reduces the performance pressure of the server.
[0061] Reference Figure 1 , which shows a flowchart of a method for processing a resource object provided in an embodiment of the present invention, which may specifically include the following steps:
[0062] Step 101: Obtain the position of the virtual character in the game scene; the game scene is divided into multiple grids, each grid has a corresponding resource object, and is divided into multiple play areas based on the grids, and the resource objects in the play areas are organized into a resource object set.
[0063] Among them, the resource object may include a game entity that needs to consume computing resources, and the game entity includes at least one of virtual items (props, treasure chests, medicines, etc.) and non-player characters (NPCs). Specifically, when the resource object is in an activated state, it can run according to custom logic, so it needs to consume certain computing resources of the server. For example, assuming that the resource object is an AI (Artificial Intelligence) NPC, the AINPC will attack the virtual character operated by the player that approaches according to the custom logic. For example, the AI NPC is the BOSS (guardian monster) in the game. If the virtual character operated by the player approaches the BOSS, then the BOSS will release game skills such as freezing and fire on the virtual character.
[0064] In an embodiment of the present invention, the game scene is divided into scene spaces based on a grid, and resource objects, which may be one or more, may be set on the grid, so that the resource objects in the game scene are managed through the grid. Optionally, resource objects may not be set in the grid.
[0065] In addition, in the embodiment of the present invention, the game scene is divided into multiple play areas (levels). Specifically, refer to Figure 2 In a game scene, multiple gameplay areas can be set up, and the gameplay areas can overlap or not overlap. Each gameplay area contains multiple grids. The resource objects in each gameplay area in the game scene can be organized into resource object collections through the UE4 editing tool, so that the game resource objects can be loaded according to the gameplay area during the game running. For example, assuming that the game scene is divided into three gameplay areas: level 1, level 2, and level 3, the resource object collection of level 1 can include resource object 1, resource object 2, and resource object 3, the resource object collection of level 2 can include resource object 2, and the resource object collection of level 3 can include resource object 4, resource object 5, and resource object 3.
[0066] Step 102: Determine a target grid from the grids according to the character position.
[0067] The target grid refers to the grid whose corresponding resource object needs to be loaded during the game.
[0068] Specifically, the grid in the embodiment of the present invention has two states: active state (Active) and inactive state (Deactived). The grid in the active state is the target grid, and the server will load and activate the resource object corresponding to the grid. For the grid in the inactive state, the server can load but not activate the resource object corresponding to the grid, or neither load nor activate the resource object corresponding to the grid.
[0069] In an embodiment of the present invention, the current grid can be determined based on the position of the player's virtual character, that is, the grid adjacent to the position of the player's virtual character in the game scene is used as the target grid. For example, the eight grids surrounding the grid where the character is located can be used as the target grid.
[0070] Step 103: Determine the play area where the target grid is located as the target play area.
[0071] Step 104: Determine the resource object set of the target gameplay area as the target resource object set.
[0072] In an embodiment of the present invention, there can be one or more target grids. Since gameplay areas can overlap, a target grid can also be in multiple gameplay areas simultaneously. Therefore, one or more gameplay areas can be determined as target gameplay areas based on the target grid, and the resource object set of the target gameplay area can be used as the target resource object set. For example, assuming there are three gameplay areas in a game scene: level 1, level 2, and level 3, when the target grid belongs to grids of both level 1 and level 3, level 1 and level 3 can be determined as target gameplay areas, and the resource object sets corresponding to level 1 and level 3, respectively, can be used as the target resource object sets.
[0073] Step 105: Load the target resource object set, and activate the resource object corresponding to the target grid in the target resource object set.
[0074] Specifically, the resource object includes the game entity that needs to consume computing resources. Therefore, after loading the resource object, if the resource object for the game entity is not activated, the resource object will not run according to the custom logic, and the server's computing resources will not be consumed at this time. On the contrary, if the resource object for the game entity is activated, the resource object will run according to the custom logic, and the server's computing resources will begin to be consumed at this time.
[0075] In an embodiment of the present invention, after determining the target play area based on the virtual character's position, only the target resource object set corresponding to the target play area needs to be loaded, without having to load the resource object set for the entire game scene, thus reducing server memory resource consumption. Furthermore, the target resource object set corresponding to the target play area includes resource objects corresponding to the target grid. In an embodiment of the present invention, only the resource objects corresponding to the target grid in the target resource object set need to be activated, which can reduce unnecessary computing resource consumption and reduce server performance pressure.
[0076] In the above-mentioned resource object processing method, the game scene is divided into multiple grids, each grid has a corresponding resource object, and the game scene is divided into multiple play areas based on the grids, and the resource objects in the play areas are organized into a resource object set. When obtaining the role position of the virtual character in the game scene, the target grid is determined according to the role position, and then the play area where the target grid is located is determined as the target play area, the target resource object set corresponding to the target play area is loaded, and the resource object corresponding to the target grid in the target resource object set is activated. In an embodiment of the present invention, the resource object is a game entity that needs to consume computing resources. The resource object set is loaded and the resource object is activated according to the role position of the virtual character operated by the player in the game scene, so that there is no need to load the resource objects in the entire game scene, which reduces the consumption of the server's memory resources, and there is no need to activate the resource objects in the entire game scene, which reduces the consumption of the server's computing resources and reduces the performance pressure of the server.
[0077] Based on the above embodiment, a modified embodiment of the above embodiment is proposed. It should be noted that, in order to simplify the description, only the differences from the above embodiment are described in the modified embodiment.
[0078] In an exemplary embodiment, the step 102 of determining a target grid from the grids according to the character position may include the following steps:
[0079] Taking the grid where the character is located as the current grid;
[0080] The current grid and the grids adjacent to the current grid are determined as target grids.
[0081] In an embodiment of the present invention, the position of the virtual character has a corresponding grid in the game scene, and this grid is the target grid. Optionally, this grid can be used as the current grid, and other grids adjacent to the current grid can be used as target grids, so as to activate the resource object corresponding to the target grid based on the position of the virtual character. Figure 3The game scene (space) is divided into multiple grids, and the avatar is a virtual character. The grid where each player's virtual character is located is checked, and then the grid where the virtual character is located and the eight grids around it are activated at the same time, that is, a total of nine grids are activated as target grids. The above grid activation scheme is also called the nine-square grid activation scheme.
[0082] As an optional example, embodiments of the present invention can be applied to highly complex game scenarios in the form of dungeons, where the number of players is relatively small and players can team up. In this case, the target grid will be determined based on the current grid where the avatars operated by players on the same game team are located. For example, if the avatars operated by players on the same game team are avatar1, avatar2, and avatar3, then the grid containing avatar1, avatar2, and avatar3, as well as the eight surrounding grids, will be activated.
[0083] In the above exemplary embodiment, the grid where the character position of the virtual character operated by the player is located and the grids adjacent to the grid are determined as target grids, and the resource objects corresponding to the target grids are loaded and activated. While frequently avoiding full loading and activation of all resource objects in the game scene, it also avoids repeated loading and activation of game resources, which in turn causes additional performance overhead.
[0084] In an exemplary embodiment, the grid has a corresponding grid index, and the character position is the grid index of the game character in the game scene; and taking the grid where the character position is located as the current grid may include the following steps:
[0085] The mesh that matches the mesh index of the character's position is determined as the current mesh.
[0086] Each grid may have a corresponding grid index, which may be a number or a name, such as 001, 002, grid 1, grid 2, G1, G2, etc. A grid may be uniquely located through the grid index.
[0087] In an embodiment of the present invention, after the game scene is divided into grids, the character's position can be determined by the grid index. Therefore, after the character's position is determined, the grid that matches the grid index of the character's position can be determined as the current grid. For example, if the game scene has grids 001, 002, 003, 004, etc., and the grid index of the character's position is 003, the grid with the same grid index of 003 in the game scene can be determined as the current grid.
[0088] In the above embodiment, the current grid that matches the virtual character operated by the player in the game scene can be quickly determined based on the grid index, and then the target grid and target gameplay area can be quickly determined based on the current grid to load the corresponding resource object set, thereby improving the efficiency of loading resource objects. For players, the time waiting for loading resource objects is reduced, and the player's gaming experience is improved.
[0089] In an exemplary embodiment, the step 105 of activating the resource object corresponding to the target grid in the target resource object set may include the following steps:
[0090] An activation notification is sent to the resource object corresponding to the target grid; the resource object is used to be activated according to the activation notification to run according to the custom logic.
[0091] In an embodiment of the present invention, after determining the target grid based on the position of the player's virtual character and loading the target resource object set corresponding to the target gameplay area corresponding to the target grid, an activation notification can be sent to the resource object of the target grid, so that the resource object is activated based on the activation notification. After activation, the resource object can run according to the corresponding custom logic. It can be understood that the resource objects in the target grid in the gameplay area run according to the custom logic, such as controlling the resource objects in the target grid to run according to the custom logic based on the movement of the player's virtual character in the game scene. There is no need to manage the resource objects, which can avoid the high performance consumption caused by some physical triggers (resource objects).
[0092] In the above embodiment, only the resource objects of the target grid that receives the activation notification are activated, and the resource objects of other grids are not activated even if they are loaded, thereby reducing the consumption of computing resources of the server and alleviating the performance pressure of the server.
[0093] In an exemplary embodiment, after activating the resource object corresponding to the target grid in the target resource object set in step 105, the method may further include the following steps:
[0094] Obtaining the position of the virtual character after it moves in the game scene;
[0095] determining a moving grid from the grid according to the position of the character after the movement;
[0096] When the index difference between the grid index of the target grid and the grid index of the mobile grid exceeds a preset threshold, a deactivation notification is sent to the resource object corresponding to the target grid; the resource object is used to deactivate according to the deactivation notification to stop running according to the custom logic.
[0097] In an embodiment of the present invention, the target grid is determined based on the position of the player's virtual character. Usually, the virtual character will move continuously in the game scene, and accordingly, the target grid will also change continuously. In order to avoid the additional performance overhead caused by frequent changes of the target grid (i.e., frequent changes of the activation state of the grid), a deactivation notification will be sent to the target grid only when the index difference between the grid index of the target grid and the grid index of the moving grid exceeds a preset threshold, for example, more than 2 grids. The resource object corresponding to the target grid will be deactivated based on the deactivation notification and stop running according to the custom logic, without consuming the computing resources of the server.
[0098] It should be noted that when the resource object of the grid is deactivated, the resource objects that have been loaded in the corresponding gameplay area will not be unloaded. This is because the grid state may change at any time after the client interacts with the server, requiring an additional set of serialization management logic for resource objects in the game scene. Moreover, the act of unloading resource objects may affect some gameplay. For example, different gameplays have different requirements for loading resource objects, which brings additional management complexity to the management of resource objects.
[0099] In the above exemplary embodiment, when the virtual character moves in the game scene, the grid is moved based on the character position after the virtual character moves. When the index difference between the grid index of the target grid and the grid index of the moving grid exceeds a preset threshold, the resource object corresponding to the target grid is deactivated based on the received deactivation notification to stop running according to the custom logic. While avoiding continued consumption of the server's computing resources, it also avoids the additional performance resource system overhead caused by repeated activation of resource objects.
[0100] In an exemplary embodiment, the resource object includes a specific resource object that operates according to specific logic, and the specific resource object is configured to continue operating according to the specific logic after receiving the deactivation notification.
[0101] In this embodiment of the present invention, for a gameplay area that has already loaded and activated resource objects, if the player's avatar moves away from the gameplay area, the corresponding grid will be deactivated. Because the gameplay area is no longer visible on the client, the resource objects within the grid will receive a deactivation notification. Upon receiving the deactivation notification, the resource objects can cease operating according to custom logic. For example, AIBOSS can stop checking logic and even stop behavior trees. Dynamically loaded physics components can also be dynamically deleted and re-added when the grid is reactivated.
[0102] As an optional example, resource objects include specific resource objects that continue to operate according to specific logic after activation. These specific resource objects can ignore deactivation notifications. For example, if an AI boss, after activation, needs to continuously pursue the player's avatar until the player's avatar successfully kills the AI boss, these specific resource objects can ignore deactivation notifications.
[0103] In the above optional embodiment, the optimized processing logic when the grid is deactivated, specifically, when a deactivation notification is received, there is no need to unload the resource objects of the entire gameplay area, and when the resource object is a specific resource object, the received deactivation notification is ignored and the game continues to run according to the specific logic, which adds a certain degree of fun to the game.
[0104] In the embodiment of the present invention, the main processing modules involved are game area division, resource object division, resource object dynamic loading, and resource object management. Specifically:
[0105] 1) Gameplay Area Division: Based on the gameplay requirements of the game, the game scene is divided into multiple two-dimensional geographical areas as gameplay areas, where the gameplay areas may or may not overlap.
[0106] 2) Resource Object Division: Divide resource objects based on the Level (play area) of the UE4 editing tool. You can directly edit resource objects in the game scene in the UE4 editing tool and divide resource objects into various play areas based on the geographical area of the game scene, thereby obtaining a collection of resource objects for each play area in the game scene.
[0107] 3) Dynamic loading of resource objects: Based on the division of resource objects, the geographic information (grid index) of each gameplay area is obtained. Based on the grid management of the game scene, the gameplay area corresponding to each grid can be determined. When the virtual character operated by the player approaches the grid, the resource object collection of the gameplay area corresponding to the grid is loaded.
[0108] 4) Resource Object Management: The entire game scene is divided into grids. Each grid manages its resource objects and records overlapping gameplay areas. When the player's avatar approaches a grid, the resource object collection for the corresponding gameplay area is loaded and activated. When the player's avatar moves away from the grid, the resource objects corresponding to the grid are deactivated.
[0109] In order to enable those skilled in the art to better understand the embodiments of the present invention, a specific example is used below for illustration. Figure 4 , is a flow chart of resource object loading management of the present invention, wherein the grid activation scheme is a nine-square grid activation scheme, specifically including the following steps:
[0110] Step 401: Resource object pre-processing, division and export. Figure 2 As shown, after the gameplay areas are divided based on the geographical areas in the game scene, the resource objects in the game scene are organized into resource object sets corresponding to each gameplay area through the UE4 editing tool.
[0111] Step 402: Divide the game scene based on the grid. Figure 4 As shown, the game scene is divided into multiple grids. If a gameplay area does not have a resource object, then no corresponding resource object needs to be created for the grid in that gameplay area. For game scenes with concentrated resource objects, such as one or two gameplay areas within the game scene, loading resource object collections by gameplay area can reduce the performance overhead associated with loading resource objects.
[0112] Step 403: Update the grid state based on the player's position. By activating the grids near the player's virtual character based on the nine-square grid scheme, this embodiment of the present invention can be applied to exploration dungeons with relatively few players. Therefore, each check of the grid where the player's virtual character is located consumes relatively little computing resources. Specifically, in games, players typically work in teams, and the grids corresponding to the virtual characters of different players overlap significantly. This further reduces computing resource consumption associated with grid state updates.
[0113] Step 404: Activate the grid area. For example, after determining the grid according to the position of the virtual character operated by the player, nine grids are determined when a nine-square grid activation scheme is used, and the grids are activated.
[0114] Step 405: Load the grid-related Level. When a grid is activated, the resource object set for the gameplay area corresponding to the grid is loaded. The resource object set is pre-loaded when the player is a certain distance away from the gameplay area to avoid sudden loading of resource objects within the player's field of view.
[0115] Step 406: Notify resource objects in the grid to activate. Grid state changes include grid activation and deactivation. The grid will notify the corresponding resource objects. After receiving the activation notification, the resource objects can run according to the custom logic.
[0116] Step 407: When the grid is activated, the position of the play area is checked again based on the position of the player's virtual character to determine the target network activation resource object, avoiding excessive performance consumption caused by activating an overly large resource object. At the same time, it also avoids performing position checks on each play area in the game scene. Only limited checks are required, reducing the consumption of unnecessary computing resources.
[0117] Step 408: Deactivate the grid. For an activated grid, the grid will be deactivated only when the player moves away from the grid by more than a preset threshold (e.g., 2 grids) to avoid frequent changes in grid status and the resulting extra performance overhead.
[0118] Step 409: Deactivate the grid notification. When a grid is deactivated, the resource object collection already loaded in the gameplay area is not unloaded. This is because the grid state may change when the player interacts with the server, requiring additional resource object serialization management logic. Unloading may also bring additional management complexity.
[0119] Step 410: The resource object is processed according to the custom logic based on the deactivation notification. For a gameplay area with a set of loaded resource objects, when the virtual character operated by the player moves away from the gameplay area, the area will disappear from the player's field of view, and the resource objects in the grid will receive the deactivation notification. The resource objects can process the deactivation notification according to the custom logic. Specifically, if the resource object is a non-specific resource object, it will stop running according to the custom logic when the deactivation is received. If the resource object is a specific resource object, it will continue to run according to the custom logic when the deactivation is received, thereby reducing CPU and memory pressure while avoiding the cancellation of all resource objects in the gameplay area.
[0120] In the above example, the solution of dynamically loading resource objects based on the position of the virtual character operated by the player can avoid loading all the resource objects of the game scene in the server, reducing the loading time of the resource objects, thereby reducing the player's waiting time and avoiding the loss of players due to long waiting; reducing the loading and activation of irrelevant resource objects, reducing the memory pressure of the server, and the CPU pressure caused by instantaneous loading of resource object sets in multiple gameplay areas; grid-based resource object management, when the virtual character operated by the player is away from the grid, cancels the activation state of the resource object corresponding to the grid, stops the inspection logic of the resource objects in the grid and the dynamically added physical components, etc., further reducing CPU and memory pressure; provides gameplay areas with custom logic, which can replace resource objects with high performance consumption and reduce the amount of calculation in the game.
[0121] In summary, the embodiments of the present invention achieve the purpose of increasing the server load of the game by reducing the performance pressure of the server as much as possible, thereby supporting a larger number of players to enter the game.
[0122] For example, the resource object processing method provided by the embodiment of the present invention can be applied to Figure 5In the application environment shown, client 501 interacts with server 502 via a network. Client 501 can be, but is not limited to, various smartphones, laptops, personal computers, tablet computers, and wearable devices, and server 502 can be implemented as an independent server or a server cluster consisting of multiple servers.
[0123] The server 502 stores a resource object set corresponding to each gameplay area in the game scene, and the resource objects in the resource object set are mapped to the corresponding grids of the game scene. It should be noted that the resource objects include game entities that require computing resources. The client 501 has a game application installed. When the client 501 runs the game application, a graphical user interface can be rendered on the display. For complex and large game scenes, the graphical user interface displays a partial game scene, such as the five grids in the game scene. The player can control the game character to move in the game scene, and then request the corresponding resource object from the server 502 based on the grid where the game character is located. The server 502 can then determine the corresponding gameplay area based on the grid, and then load the resource object set corresponding to the gameplay area to the client 501. The resource objects in the loaded resource object set can only activate a portion of the resource objects that consume computing resources based on the grid where the game character is controlled by the player, thereby avoiding activating all resource objects and causing excessive performance pressure on the server 502. In addition, in an embodiment of the present invention, the client 501 and the server 502 are positioned based on a grid, and the grid has a corresponding grid index. Therefore, the server 502 can quickly locate the corresponding gameplay area based on the grid index, and then quickly load the resource object set corresponding to the gameplay area, thereby improving the loading efficiency of the resource objects.
[0124] In an embodiment of the present invention, resource objects include specific resource objects that run according to specific logic. After the specific resource objects are loaded and activated on the client 501, they can run on the client 501 according to the specific logic. During this period, there is no need to interact with the server 502 and no need to consume the computing resources of the server 502. Even if a deactivation notification is received, the client 501 can continue to keep the specific resource object activated until certain conditions are met (for example, the AI BOSS is killed), and then notify the server 502 to perform corresponding processing.
[0125] It can be seen that the embodiment of the present invention can avoid loading a full amount of resource objects by loading resource objects based on the gameplay area, and can avoid activating a large number of resource objects and increasing the performance pressure of the server based on the grid. It can quickly locate in the game scene based on the grid, and can avoid the problem of excessive performance pressure on a certain processing end by processing resource objects respectively by the client and the server. It can be seen that the application of the embodiment of the present invention is conducive to the processing processes such as loading and activating resource objects.
[0126] It should be noted that for the sake of simplicity, the method embodiments are described as a series of actions. However, those skilled in the art should be aware that the embodiments of the present invention are not limited by the order of the actions described, because according to the embodiments of the present invention, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in this specification are all preferred embodiments, and the actions involved are not necessarily required by the embodiments of the present invention.
[0127] Reference Figure 6 , shows a structural block diagram of a processing device for a resource object provided in an embodiment of the present invention. The resource object is a game entity that needs to consume computing resources, and specifically may include the following modules:
[0128] The character position acquisition module 601 is used to obtain the character position of the virtual character in the game scene; the game scene is divided into a plurality of grids, each grid having a corresponding resource object, and the grids are divided into a plurality of play areas based on the grids, and the resource objects in the play areas are organized into resource object sets;
[0129] A target grid determination module 602 is configured to determine a target grid from the grids according to the character position;
[0130] A target playing area determining module 603 is configured to determine the playing area where the target grid is located as the target playing area;
[0131] A target resource object set determination module 604 is configured to determine the resource object set of the target gameplay area as the target resource object set;
[0132] The resource object activation module 605 is configured to load the target resource object set and activate the resource object corresponding to the target grid in the target resource object set.
[0133] In an exemplary embodiment, the game entity includes at least one of a virtual item and a non-player character.
[0134] In an exemplary embodiment, the target grid determination module 602 is configured to take the grid where the character is located as the current grid; and determine the current grid and the grids adjacent to the current grid as target grids.
[0135] In an exemplary embodiment, the grid has a corresponding grid index, and the character position is the grid index of the game character in the game scene; the target grid determination module 602 is used to determine the grid that matches the grid index of the character position as the current grid.
[0136] In an exemplary embodiment, the resource object activation module 605 is configured to send an activation notification to the resource object corresponding to the target grid; the resource object is configured to be activated according to the activation notification to run according to a custom logic.
[0137] In an exemplary embodiment, the device further includes: a deactivation module, configured to obtain the character position of the virtual character after the character moves in the game scene; determine a moving grid from the grid based on the character position after the move; when the index difference between the grid index of the target grid and the grid index of the moving grid exceeds a preset threshold, send a deactivation notification to the resource object corresponding to the target grid; the resource object is configured to be deactivated according to the deactivation notification to stop running according to the custom logic.
[0138] In an exemplary embodiment, the resource object includes a specific resource object that operates according to specific logic, and the specific resource object is configured to continue operating according to the specific logic after receiving the deactivation notification.
[0139] In an exemplary embodiment, the play areas overlap or do not overlap in the game scene.
[0140] In an exemplary embodiment, resource objects of the game scene are distributed in a single process.
[0141] In summary, in an embodiment of the present invention, the game scene is divided into multiple grids, each grid has a corresponding resource object, and the game scene is divided into multiple gameplay areas based on the grids, and the resource objects in the gameplay areas are organized into a resource object set. When obtaining the role position of the virtual character in the game scene, the target grid is determined according to the role position, and then the gameplay area where the target grid is located is determined as the target gameplay area, the target resource object set corresponding to the target gameplay area is loaded, and the resource object corresponding to the target grid in the target resource object set is activated. In an embodiment of the present invention, a resource object is a game entity that requires consumption of computing resources. The resource object set is loaded and the resource object is activated according to the role position of the virtual character operated by the player in the game scene, so that there is no need to load the resource objects in the entire game scene, thereby reducing the consumption of the server's memory resources and the need to activate the resource objects in the entire game scene, thereby reducing the consumption of the server's computing resources and reducing the performance pressure on the server.
[0142] As for the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple, and the relevant parts can be referred to the partial description of the method embodiment.
[0143] In addition, an embodiment of the present invention further provides an electronic device, such as Figure 7 As shown, it includes a processor 701, a communication interface 702, a memory 703 and a communication bus 704, wherein the processor 701, the communication interface 702, and the memory 703 communicate with each other through the communication bus 704.
[0144] Memory 703, for storing computer programs;
[0145] The processor 701 is configured to implement the resource object processing method described in the above embodiment when executing the program stored in the memory 703 .
[0146] The communication bus mentioned in the terminal can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus. This communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is used in the figure, but this does not mean that there is only one bus or only one type of bus.
[0147] The communication interface is used for communication between the above terminal and other devices.
[0148] The memory may include random access memory (RAM) or non-volatile memory, such as at least one disk storage. Alternatively, the memory may be at least one storage device located away from the processor.
[0149] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, and discrete hardware components.
[0150] like Figure 8 As shown, in another embodiment provided by the present invention, a computer-readable storage medium 801 is further provided, in which instructions are stored. When the computer-readable storage medium is run on a computer, the computer executes the resource object processing method described in the above embodiment.
[0151] In another embodiment of the present invention, a computer program product including instructions is provided. When the computer program product is run on a computer, the computer executes the resource object processing method described in the above embodiment.
[0152] In the above embodiments, all or part of the embodiments can be implemented by software, hardware, firmware, or any combination thereof. When implemented using software, all or part of the embodiments can be implemented in the form of a computer program product. The computer program product includes one or more computer instructions. When the computer program instructions are loaded and executed on a computer, all or part of the processes or functions described in the embodiments of the present invention are generated. The computer can be a general-purpose computer, a special-purpose computer, a computer network, or other programmable device. The computer instructions can be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium. For example, the computer instructions can be transmitted from one website, computer, server, or data center to another website, computer, server, or data center via a wired (e.g., coaxial cable, optical fiber, digital subscriber line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.) method. The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device such as a server or data center that includes one or more available media. The available medium can be a magnetic medium (e.g., a floppy disk, a hard disk, a tape), an optical medium (e.g., a DVD), or a semiconductor medium (e.g., a solid-state drive (SSD)).
[0153] It should be noted that, in this document, relational terms such as first and second, etc., are used only to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply the existence of any such actual relationship or order between these entities or operations. Moreover, the terms "comprises," "comprising," or any other variants thereof are intended to cover non-exclusive inclusion, so that a process, method, article, or device comprising a series of elements includes not only those elements, but also other elements not explicitly listed, or elements inherent to such process, method, article, or device. In the absence of further limitations, an element defined by the phrase "comprising a ..." does not exclude the presence of other identical elements in the process, method, article, or device comprising the element.
[0154] Each embodiment in this specification is described in a related manner. Similar parts between the various embodiments can be referred to in conjunction with each other. Each embodiment focuses on the differences between the other embodiments. In particular, the system embodiment is generally similar to the method embodiment, so the description is relatively simple. For related parts, refer to the description of the method embodiment.
[0155] The above description is only a preferred embodiment of the present invention and is not intended to limit the scope of protection of the present invention. Any modifications, equivalent replacements, improvements, etc. made within the spirit and principles of the present invention are included in the scope of protection of the present invention.
Claims
1. A method for processing a resource object, characterized in that: The resource object is a game entity that needs to consume computing resources, and the method includes: Obtaining a position of a virtual character in a game scene; the game scene is divided into a plurality of grids, each grid having a corresponding resource object, and the grids are further divided into a plurality of play areas, wherein the resource objects in the play areas are organized into a resource object set; the grids have an active state and an inactive state; the server loads but does not activate the resource objects corresponding to the inactive grids, or the server neither loads nor activates the resource objects corresponding to the inactive grids; Determining a target grid from the grids according to the position of the character, the target grid being the grid in the activated state; Determine the gameplay area where the target grid is located as the target gameplay area; Determine the resource object set of the target gameplay area as the target resource object set; Loading the target resource object set and sending an activation notification to the resource object corresponding to the target grid; the resource object is used to be activated according to the activation notification to run according to the custom logic; Obtaining the position of the virtual character after it moves in the game scene; determining a moving grid from the grid according to the position of the character after the movement; When the index difference between the grid index of the target grid and the grid index of the mobile grid exceeds a preset threshold, a deactivation notification is sent to the resource object corresponding to the target grid; the resource object is used to deactivate according to the deactivation notification to stop running according to the custom logic.
2. The method according to claim 1, characterized in that The game entity includes at least one of a virtual item and a non-player character.
3. The method according to claim 1, characterized in that Determining a target grid from the grids according to the position of the character includes: Taking the grid where the character is located as the current grid; The current grid and the grids adjacent to the current grid are determined as target grids.
4. The method according to claim 3, characterized in that The grid has a corresponding grid index, and the character position is the grid index of the game character in the game scene; The step of taking the grid where the character is located as the current grid includes: The mesh that matches the mesh index of the character's position is determined as the current mesh.
5. The method according to claim 1, wherein The play areas overlap or do not overlap in the game scene.
6. The method according to claim 1, characterized in that The resource objects of the game scene are distributed in a single process.
7. A resource object processing device, characterized in that: The resource object is a game entity that needs to consume computing resources, and the device includes: A character position acquisition module is configured to acquire the position of a virtual character in a game scene; the game scene is divided into a plurality of grids, each of which has a corresponding resource object, and is further divided into a plurality of play areas based on the grids, wherein the resource objects in the play areas are organized into a resource object set; the grids have an active state and an inactive state; the server loads but does not activate the resource objects corresponding to the inactive grids, or the server neither loads nor activates the resource objects corresponding to the inactive grids; a target grid determining module, configured to determine a target grid from the grids according to the position of the character, wherein the target grid is the grid in the activated state; A target game area determination module, configured to determine the game area where the target grid is located as the target game area; a target resource object set determination module, configured to determine the resource object set of the target gameplay area as the target resource object set; A resource object activation module, configured to load the target resource object set and send an activation notification to the resource object corresponding to the target grid; the resource object is configured to be activated according to the activation notification to run according to the custom logic; A deactivation module is used to obtain the character position of the virtual character after moving in the game scene; determine the moving grid from the grid according to the character position after moving; when the index difference between the grid index of the target grid and the grid index of the moving grid exceeds a preset threshold, send a deactivation notification to the resource object corresponding to the target grid; the resource object is used to deactivate according to the deactivation notification to stop running according to the custom logic.
8. An electronic device, characterized in that: comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; The memory is used to store computer programs; The processor is configured to implement the method according to any one of claims 1 to 6 when executing a program stored in the memory.
9. A computer-readable storage medium having instructions stored thereon, which, when executed by one or more processors, cause the processors to perform the method according to any one of claims 1 to 6.
Citation Information
Patent Citations
Method and device to generate virtual resources in 3D game scene
CN108211354A
Method and Apparatus for Generating Virtual Resources in Three-dimensional Game Scene
US20200316465A1