Data update method and device
By dividing the virtual map into multiple map areas and maintaining the role attribute data table of each area, the CPU cache miss problem in online games is solved, and efficient data updates and calculations are achieved.
Patent Information
- Application Number
- CN202111481945.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-06
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2041-12-06
AI Technical Summary
In online games, CPU cache miss problems caused by virtual character operation events lead to inefficient data reading and computing, and the inability to respond to operation events in time.
Divide the virtual map into multiple map areas, each area maintains a role attribute data table, and selects the associated area according to the operation event, and updates the role attribute data table for the target area and the associated area.
Improves computing efficiency, reduces CPU cache miss problem, reduces resource consumption, and improves resource utilization.
Smart Images

Figure CN114130032B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to a data update method. This application also relates to a data update device, a computing device, and a computer-readable storage medium. Background Art
[0002] With the development of Internet technology, the population of game players has become larger and larger. Providing better game services to this population has become an issue that major game manufacturers need to face. In online games, there are usually many game objects, such as characters, NPCs, etc. In order to implement the functions of these objects and store data, more data will be recorded on the objects to support the application of the game scenario. However, this leads to an excessive amount of data involved in a single object. Especially when triggering an operation that needs to enumerate other surrounding objects, there will be a very large CPU cache miss problem, so that the CPU cannot quickly complete data reading and calculation, and cannot respond in a timely manner to the triggered operation event. Therefore, an effective solution is urgently needed to solve the above problems. Summary of the Invention
[0003] In view of this, embodiments of this application provide a data update method to solve the technical defects existing in the prior art. Embodiments of this application also provide a data update device, a computing device, and a computer-readable storage medium.
[0004] According to the first aspect of the embodiments of this application, a data update method is provided, including:
[0005] Obtain an operation event triggered by a target virtual character in a target area of a virtual map;
[0006] Select an associated area associated with the target area in the virtual map according to the operation event;
[0007] Respectively determine role attribute data tables corresponding to the target area and the associated area in memory;
[0008] Update the role attribute data table based on the operation event.
[0009] Optionally, the step of selecting an associated area associated with the target area in the virtual map according to the operation event includes:
[0010] Determine the event type corresponding to the operation event;
[0011] Determine range information corresponding to the operation event according to the event type;
[0012] Select the associated area associated with the target area in the virtual map according to the range information.
[0013] Optionally, determining the role attribute data tables corresponding to the target area and the associated area in memory respectively includes:
[0014] Determine the attribute change information corresponding to the operation event according to the event type;
[0015] Determine the attribute data table identifier corresponding to the attribute change information in the identification information corresponding to the target virtual role; wherein, the identification information records the identifier corresponding to the role attribute data table stored in memory corresponding to the target area;
[0016] Read the first role attribute data table corresponding to the attribute data table identifier in the memory corresponding to the target area;
[0017] Read the second role attribute data table associated with the first role attribute data table in the memory corresponding to the associated area.
[0018] Optionally, updating the role attribute data table based on the operation event includes:
[0019] Analyze the attribute change information corresponding to the operation event to obtain parameter change information;
[0020] Update the first role attribute data table and the second role attribute data table according to the parameter change information.
[0021] Optionally, before the step of obtaining the operation event triggered by the target virtual role in the target area of the virtual map, it further includes:
[0022] Divide the virtual map according to a preset division rule to obtain multiple map areas;
[0023] Correspondingly, the target area is determined by the following method:
[0024] Determine the position information of the target virtual role in the virtual map;
[0025] Based on the position information, determine the target area in the multiple map areas.
[0026] Optionally, allocate memory for each of the multiple map areas, and record in the allocated memory the role attribute data tables corresponding to multiple role attribute types of the virtual roles included in each map area;
[0027] Correspondingly, the virtual character configuration records the area identifier corresponding to the map area where the current moment is located, as well as the identifier information of multiple character attribute data tables corresponding to the map area.
[0028] Optionally, it further includes:
[0029] When the target virtual character leaves the target area, determine the global character attribute data table corresponding to the target area;
[0030] Detect whether the attribute data corresponding to the target virtual character is recorded at the end of the global character attribute data table corresponding to the target area;
[0031] If so, delete the attribute data corresponding to the target virtual character in the global character attribute data table corresponding to the target area.
[0032] Optionally, if the result of the step of detecting whether the attribute data corresponding to the target virtual character is recorded at the end of the global character attribute data table corresponding to the target area is negative, then perform the following steps:
[0033] Determine the recording position of the attribute data corresponding to the target virtual character in the global character attribute data table corresponding to the target area, and the attribute data corresponding to the changed virtual character recorded at the end of the global character attribute data table corresponding to the target area;
[0034] Delete the attribute data corresponding to the target virtual character in the global character attribute data table corresponding to the target area, and move the attribute data corresponding to the changed virtual character to the recording position;
[0035] Update the identification information configured for the changed virtual character according to the movement result of the attribute data corresponding to the changed virtual character.
[0036] Optionally, it further includes:
[0037] When the target virtual character moves to the movement area in the virtual map, update the identification information configured for the target virtual character according to the area identifier corresponding to the movement area;
[0038] Record the attribute data corresponding to the target virtual character into the global character attribute data table corresponding to the movement area.
[0039] Optionally, after the step of updating the character attribute data table based on the operation event, it further includes:
[0040] Receive the read request submitted by the processing unit;
[0041] Send the updated role attribute data in the memory to the processing unit in response to the read request.
[0042] According to a second aspect of the embodiments of the present application, a data update device is provided, including:
[0043] An acquisition module, configured to acquire an operation event triggered by a target virtual role in a target area of a virtual map;
[0044] A selection module, configured to select an associated area associated with the target area in the virtual map according to the operation event;
[0045] A determination module, configured to respectively determine role attribute data tables corresponding to the target area and the associated area in the memory;
[0046] An update module, configured to update the role attribute data table based on the operation event.
[0047] According to a third aspect of the embodiments of the present application, a computing device is provided, including:
[0048] A memory and a processor;
[0049] The memory is used to store computer-executable instructions, and when the processor executes the computer-executable instructions, the steps of the data update method are implemented.
[0050] According to a fourth aspect of the embodiments of the present application, a computer-readable storage medium is provided, which stores computer-executable instructions, and when the instructions are executed by a processor, the steps of the data update method are implemented.
[0051] According to a fifth aspect of the embodiments of the present application, a chip is provided, which stores a computer program, and when the computer program is executed by the chip, the steps of the data update method are implemented.
[0052] For the data update method provided by the present application, after acquiring the operation event triggered by the target virtual role in the target area of the virtual map, the associated area associated with the target area can be selected in the virtual map according to the operation event; then, the role attribute data tables corresponding to the target area and the associated area are respectively determined in the memory; finally, the role attribute data table is updated based on the operation event. By maintaining the corresponding role attribute data table in the memory corresponding to each area, the problem that the data that the CPU needs to read is not in the cache can be avoided, so that the data involved in the operation event can be calculated in time, and at the same time, the number of data copies can be reduced, effectively improving the resource utilization rate and reducing excessive consumption of resources. BRIEF DESCRIPTION OF THE DRAWINGS
[0053] Figure 1It is a flowchart of a data update method provided by an embodiment of the present application;
[0054] Figure 2 It is a schematic diagram of a game screen in a data update method provided by an embodiment of the present application;
[0055] Figure 3 It is a schematic diagram of a game screen in another data update method provided by an embodiment of the present application;
[0056] Figure 4 It is a processing flowchart of a data update method applied to a game scenario provided by an embodiment of the present application;
[0057] Figure 5 It is a schematic structural diagram of a data update device provided by an embodiment of the present application;
[0058] Figure 6 It is a structural block diagram of a computing device provided by an embodiment of the present application. Detailed implementation manners
[0059] Many specific details are set forth in the following description in order to provide a thorough understanding of the present application. However, the present application can be implemented in many other ways different from those described herein, and those skilled in the art can make similar extensions without departing from the connotation of the present application. Therefore, the present application is not limited by the specific implementations disclosed below.
[0060] The terms used in one or more embodiments of the present application are for the purpose of describing specific embodiments only and are not intended to limit one or more embodiments of the present application. The singular forms "a", "the", and "said" used in one or more embodiments of the present application and the appended claims are also intended to include the plural forms unless the context clearly indicates otherwise. It should also be understood that the term "and / or" used in one or more embodiments of the present application refers to and includes any or all possible combinations of one or more of the associated listed items.
[0061] It should be understood that although the terms first, second, etc. may be used in one or more embodiments of the present application to describe various information, such information should not be limited to these terms. These terms are only used to distinguish the same type of information from each other. For example, without departing from the scope of one or more embodiments of the present application, the first may also be referred to as the second, and similarly, the second may also be referred to as the first.
[0062] First, the noun terms related to one or more embodiments of the present invention are explained.
[0063] NPC: (non-player character) is a type of character in a game, meaning a non-player character, referring to a game character that is not controlled by a real player in the game.
[0064] CPU: (central processing unit) As the operation and control core of a computer system, it is the final execution unit for information processing and program running.
[0065] MMO: (Massive (Massively) Multiplayer Online Game) refers to any online game where a large number of players (about 1000) can be online simultaneously on the server of the game, and such a game can be called a massive multiplayer online game.
[0066] In this application, a data update method is provided. This application is also related to a data update device, a computing device, and a computer-readable storage medium, which will be described in detail one by one in the following embodiments.
[0067] In practical applications, cache miss means that when the CPU wants to access memory data, it will also put a segment of data near the data to be accessed in the memory into the CPU's level 1, level 2, and level 3 caches (cache). If the next data to be accessed is exactly in the cache, this part of the data can be accessed within a few CPU cycles. If this part of the data is not in the cache, data needs to be obtained by accessing the memory, which will result in hundreds of CPU cycles to complete, greatly affecting the data reading efficiency.
[0068] In the prior art, the ECS architecture is usually adopted to solve the above problems. This solution means that multiple Components (data blocks) are maintained on one entity, and then each Component can be managed by multiple Systems. For example, in a game scene, a player entity has coordinate xyz data blocks and movement state data blocks on its body, and there is a movement state calculation system. In each game frame, based on the coordinate data blocks and movement state data blocks of the previous frame, the current coordinate data can be calculated and filled into the corresponding data blocks. The advantage is that in each frame, the server updates each data block of the player through each system. Since the data volume of each disassembled data block itself is very small, such as the coordinates are only three values of x, y, and z, the same type of data blocks can be placed in the same memory area; during the operation, since these data blocks are in the same memory area, when calculating all players and NPCs, the data required for each operation is continuous in the memory, which will greatly reduce the operation of fetching data from the memory and reduce the idle waiting process of the CPU for data. In this way, the execution efficiency of the CPU is high and the program speed is fast.
[0069] However, in MMO online games, if the operations with high frequencies are to send broadcast messages to the players within the AOI (Area Of Interest) of a player to notify something, or to release some range-type skills, both of these operations require searching for appropriate targets within a certain area range near a specific player for the entire game world's large map, and then performing corresponding operations. ECS splits the data in the entire game world dimension. In application scenarios with fine granularity, such as when calculating a character in a 3*3 grid within a 128*128 checkerboard grid, a large amount of redundant data will be filtered; at the same time, for the original C++ objects, a large C++ object needs to be obtained by each CPU instruction, resulting in a CPU cache miss problem every time an object is obtained. Therefore, an effective solution is urgently needed to solve the above problems.
[0070] In view of this, the data update method provided in this application can select an associated area associated with the target area in the virtual map according to the operation event after obtaining the operation event triggered by the target virtual character in the target area of the virtual map; then determine the character attribute data tables corresponding to the target area and the associated area in the memory respectively; finally, update the character attribute data tables based on the operation event. By maintaining the corresponding character attribute data tables in the memory corresponding to each area, the problem that the data that the CPU needs to read is not in the cache is avoided, so that the data involved in the operation event can be calculated in time, and at the same time, the number of data copies can be reduced, effectively improving the resource utilization rate and reducing excessive resource consumption.
[0071] Figure 1 The figure shows a flowchart of a data update method provided according to an embodiment of the present application, which specifically includes the following steps:
[0072] Step S102, obtain an operation event triggered by a target virtual character in a target area of a virtual map.
[0073] Specifically, the target virtual character specifically refers to a player character or NPC that releases skills or broadcasts information to other virtual characters in a game scene or virtual reality scene; correspondingly, the virtual map specifically refers to the game map where the target virtual character is located or the map in the virtual reality scene; correspondingly, the target area specifically refers to the area where the target virtual character is currently located after dividing the virtual map into multiple map areas; correspondingly, the operation event specifically refers to an event triggered by the target virtual character releasing a skill or broadcasting information; it should be noted that the operation event that needs to be triggered needs to radiate to the events of other virtual characters within a set range.
[0074] Based on this, in order to be able to smoothly read data from the cache when the CPU performs calculations after the target virtual character triggers an operation event, avoid the problem of CPU cache miss, and at the same time increase the consumption of computing resources, the virtual map can be divided into a set number of map areas. After that, each map area will maintain a character attribute data table of the virtual characters currently on that area, and by updating the table according to the change time of the virtual characters, ensure that the CPU can smoothly read the data that needs to be used at any time, so as to meet the subsequent calculation and processing requirements.
[0075] Furthermore, to support the subsequent smooth determination of the character attribute data table in the target area and its associated associated area and update it in combination with the triggered event, before this, it is necessary to divide the virtual map according to preset requirements to ensure the completion of the update operation of the character attribute data table starting from each area. In this embodiment, the specific implementation method is as follows:
[0076] Divide the virtual map according to a preset division rule to obtain multiple map areas;
[0077] Determine the position information of the target virtual character in the virtual map;
[0078] Based on the position information, determine the target area in the multiple map areas.
[0079] Specifically, the division rule specifically refers to the rule for dividing the virtual map according to a set size. This division rule can be set according to the size of the virtual map, and this embodiment does not make any limitation here. Correspondingly, the map area specifically refers to the smallest unit map area obtained after dividing the virtual map. Correspondingly, the position information specifically refers to the position coordinates of the target virtual character in the virtual map in the current frame. Preferably, each map area can be of the same size.
[0080] Based on this, before the game runs, the virtual map can be divided according to the preset division rule to obtain multiple map areas. After that, when the target virtual character triggers an operation event, the position information of the target virtual character in the virtual map can be determined first, and the map area to which this position information belongs can be located, and this area can be used as the target area for subsequent update of the character attribute data table.
[0081] In summary, by dividing the virtual map into multiple map areas, it is convenient to manage each area separately, and it supports allocating a continuous memory for each area subsequently, so as to support the data to be read and calculated by the CPU smoothly, effectively improving the calculation efficiency.
[0082] Furthermore, in order to ensure that the character attribute data table can be maintained in units of map areas subsequently and support the CPU to directly read the required data for calculation, memory can be allocated for each of the multiple map areas, and the character attribute data table corresponding to multiple character attribute types of the virtual characters included in each map area can be recorded in the allocated memory. Correspondingly, the virtual character configuration records the area identifier corresponding to the map area where it is located at the current moment, and the identifier information of the multiple character attribute data tables corresponding to the map area.
[0083] Specifically, the character attribute data table specifically refers to a list recording multiple virtual character attribute data of the same type, such as the virtual character xyz coordinate data table, which is used to support each map area to record the coordinate information of the virtual characters in this area in the current frame; or the virtual character HP data table, which is used to support each map area to record the HP information of the virtual characters in this area in the current frame; or the virtual character MP data table, which is used to support each map area to record the MP information of the virtual characters in this area in the current frame. It should be noted that in practical applications, there are multiple types of character attribute data tables based on the game mechanism, and different types are used to record different information to facilitate subsequent support for the CPU to use. This embodiment does not make any limitation here.
[0084] Based on this, in order to reduce the consumption of computing resources and ensure that the CPU can smoothly read the data to be calculated, after dividing the virtual map into multiple map regions, a continuous memory can be allocated to each map region, and in the allocated memory, a role attribute data table corresponding to multiple role attribute types of the virtual characters included in the current map region is maintained; at the same time, in order to support the timely update of the role attribute data table maintained for each map region after the virtual character moves, a region identifier of the current map region where the virtual character is located and identifier information corresponding to the multiple role attribute data tables maintained in this map region can also be configured for each virtual character.
[0085] Among them, the region identifier specifically refers to the unique identifier corresponding to each map region; correspondingly, the identifier information specifically refers to the information corresponding to the data table identifiers respectively corresponding to the multiple role attribute data tables maintained in the map region where the virtual character is currently located. When the virtual character moves from one region to another, the identifier information will also be updated. Correspondingly, the role attribute data tables of the two map regions before and after the movement will also change. The role attribute data corresponding to the virtual character needs to be deleted in the map region before the movement, and the role attribute data of the virtual character needs to be added to each role attribute data table in the map region after the movement.
[0086] For example, in game J, through the block (region) division technology, the game map of game J with a size of 8000*8000 can be divided according to coordinates into 64*64 map regions. At the same time, a continuous memory is mounted on each map region, and through this memory, the role attribute data of the game characters and NPCs included in the current frame of a map region is maintained and recorded in different types of role attribute data tables for convenient subsequent use; at the same time, each game character and NPC will also be configured with the region identifier of the map region where they are located and the identifier information corresponding to each role attribute data table maintained in this region.
[0087] Furthermore, when the player controls game character A to release a skill that can cause damage to other game characters, at this time, the position information (x, y, z) of game character A in the game map will be determined first, and then it is determined that the map region where this position information is located is S. That is to say, game character A releases the skill in map region S. At this time, map region S is used as the target region, and it is determined that the operation event triggered by game character A is a range skill, so as to be used for subsequent damage calculation of other game characters affected by the skill by the CPU.
[0088] Step S104, select an associated region associated with the target region in the virtual map according to the operation event.
[0089] Specifically, after obtaining the operation event triggered by the target virtual character in the target area, further, since the virtual map is divided into multiple map areas, and the operation event may affect players in other map areas due to game mechanism settings. In order to execute the operation event in accordance with the game mechanism, the associated area associated with the target area can be selected in the virtual map according to the operation event, which is convenient for subsequent updating of the character attribute data tables maintained for both the target area and the associated area based on the operation event. This can not only save the consumption of computing resources but also quickly complete data reading and calculation.
[0090] Among them, the associated area specifically refers to other map areas in the virtual map that have a connection relationship with the target area. It should be noted that the ranges affected by different operation events may be different, and at this time, the associated areas that can be selected in the virtual map are also different. For example, for skill A released by a game character, its corresponding range is 300 yards, and for skill B released, its corresponding range is 800 yards. Then, when selecting the associated area, the associated area corresponding to skill A of the operation event is smaller than the associated area corresponding to skill B of the operation event, so as to avoid excessive selection of the associated area and affect the calculation efficiency.
[0091] Further, when selecting the associated area, considering that different operation events may correspond to different associated areas, it is necessary to complete the selection in combination with the event type. In this embodiment, the specific implementation method is as follows:
[0092] Determine the event type corresponding to the operation event; determine the range information corresponding to the operation event according to the event type; select the associated area associated with the target area in the virtual map according to the range information.
[0093] Specifically, the event type includes but is not limited to skill release events, broadcast events, etc.; correspondingly, the range information specifically refers to the information corresponding to the maximum range that the operation event can affect other areas. Based on this, after obtaining the operation event triggered by the target virtual character in the target area, the event type corresponding to the operation event can be determined first, and the range information corresponding to the operation event can be located based on the event type. Finally, the associated area associated with the target area can be selected in the virtual map according to the range information.
[0094] It should be noted that when selecting the associated area, the target area should be used as the center point for selecting the associated area. When the range information is a fan-shaped range, the associated area is selected according to the orientation of the target virtual character. When the range information is a circular range or a polygon range, the map areas around the target virtual character are selected as the associated area; in practical applications, the selection of the associated area can be set according to actual needs, and this embodiment does not make any limitations here.
[0095] Continuing with the previous example, based on the skills released by game character A, it is determined that it is necessary to enumerate the 3*3 map area around as the associated area. At this time, the 3*3 map area associated with the target area S is selected as the associated area. Refer to Figure 2 the schematic diagram shown to facilitate the subsequent calculation of skill damage by combining the role attribute data tables maintained for the target area and the associated area.
[0096] In summary, by selecting the associated area according to the event type, it is possible to ensure the maximum utilization of computing resources, avoid wasting computing resources, and further improve the computing efficiency.
[0097] Step S106, respectively determine the role attribute data tables corresponding to the target area and the associated area in the memory.
[0098] Specifically, after determining the associated area above, further, since corresponding role attribute data tables are maintained in the memory corresponding to each area, to improve the computing efficiency and avoid the problem of CPU cache miss, at this time, the role attribute data tables can be respectively determined in the memory corresponding to each area for subsequent updating of the role attribute data tables in the memory corresponding to each area in combination with the operation event.
[0099] Further, in the process of determining the role attribute data tables corresponding to the target area and the associated area respectively, considering that different operation events affect different role attribute data, therefore, when determining the role attribute data table, it is necessary to determine in combination with the event type of the operation event. In this embodiment, the specific implementation method is as follows:
[0100] Determine the attribute change information corresponding to the operation event according to the event type; determine the attribute data table identifier corresponding to the attribute change information in the identification information of the target virtual character; wherein, the identification information records the identifier corresponding to the role attribute data table stored in the memory corresponding to the target area; read the first role attribute data table corresponding to the attribute data table identifier in the memory corresponding to the target area; read the second role attribute data table associated with the first role attribute data table in the memory corresponding to the associated area.
[0101] Specifically, the attribute change information specifically refers to the information that can cause changes to the character attribute data of other virtual characters after an operation event is triggered, including but not limited to character position change information, character HP change information, character MP change information, etc.; correspondingly, the attribute data table identifier specifically refers to the identifier corresponding to the character attribute data table that can be affected by the attribute change information in the identifier information configured by the target virtual character; correspondingly, the first character attribute data table specifically refers to the character attribute data table associated with the attribute change information maintained in the memory corresponding to the target area; the second character attribute data table specifically refers to the character attribute data table associated with the attribute change information maintained in the memory corresponding to the associated area.
[0102] Based on this, in order to improve the calculation efficiency and avoid wasting too much computing resources, when determining the character attribute data table, the attribute change information corresponding to the operation event can be determined according to the event type, and based on this, the affected attribute data table identifier can be determined in the identifier information corresponding to the target virtual character. Then, the first character attribute data table corresponding to the attribute data table identifier can be read in the memory corresponding to the target area. Since the character attribute data affected in the associated area is the same as that in the target area, the second character attribute data table associated with the first character attribute data table can be read in the memory corresponding to the associated area for subsequent calculation processing operations.
[0103] Continuing with the above example, based on the skills released by game character A, it is determined that it will affect the HP and position of other players. In the memory corresponding to each map area, there are maintained the character HP data table, character MP data table, character coordinate data table, etc. of all game characters and NPCs in this area. At this time, the identifier ID_HP1 corresponding to the character HP data table and the identifier ID_CD1 corresponding to the character coordinate data table can be determined in the identifier information configured by game character A according to the attribute change information. Then, the character HP data table and character coordinate data table corresponding to the identifiers ID_HP1 and ID_CD1 are read in the memory of the target area. At the same time, the character HP data table and character coordinate data table maintained in the memory of each associated area are also read to facilitate subsequent character attribute data update and facilitate the CPU to smoothly read the data required for calculation for use.
[0104] In addition, it should be noted that since the character attribute data table will be affected by the operation event, and the character attribute data table records the attribute data of different virtual characters, when performing data calculation, there is no need to distinguish the order, and only the character attribute data involved in the sequential enumeration operation needs to be calculated, so as to avoid the problem of CPU cache miss.
[0105] In summary, by combining the attribute change information to update the character attribute data table, not only can redundant data reading be avoided, but it can also ensure that the read data tables are all the data tables that need to be updated subsequently, and it can ensure that the update is accurately completed in response to the operation event.
[0106] Step S108: Update the character attribute data table based on the operation event.
[0107] Specifically, after respectively determining the character attribute data tables corresponding to the target area and the associated area above, further, since the character attribute data affected by the operation event is all recorded in the character attribute data table, therefore, it is only necessary to update the character attribute data table in combination with the operation event, so that the updated character attribute data table records the character attribute data of the virtual character after being affected by the operation event, thus meeting the execution mechanism of the operation event.
[0108] It should be noted that since different character attribute data tables record character attribute data of different character attribute types, therefore, when updating, the character attribute data table also needs to be updated according to the influence on different character attribute types.
[0109] Further, when updating the character attribute data table, considering that the character attribute data will change differently due to different parameters in different scenarios, it is necessary to complete the update of the character attribute data table in combination with the parameter change information. In this embodiment, the specific implementation method is as follows:
[0110] Analyze the attribute change information corresponding to the operation event to obtain parameter change information; update the first character attribute data table and the second character attribute data table according to the parameter change information.
[0111] Specifically, the parameter change information specifically refers to the numerical change impact on the character attribute parameters of any virtual character after the operation event is triggered. Based on this, the parameter change information is obtained by analyzing the attribute change information corresponding to the operation event, and the first character attribute data table and the second character attribute data table are updated according to the parameter change information.
[0112] In addition, after completing the update of the character attribute data table, at this time, the CPU can directly read the updated data to complete the calculation, so as to render a picture that conforms to the game mechanism through the GPU. In this embodiment, the specific implementation method is as follows:
[0113] Receive the read request submitted by the processing unit; send the updated character attribute data in the memory to the processing unit in response to the read request. Here, the processing unit specifically refers to the CPU with computing power.
[0114] Continuing with the above example, if it is determined that the skill released by game character A will repel other game characters by a distance of L and cause damage of M, then at this time, the character coordinate data table maintained for the target area and the associated area can be updated according to the repulsion distance L, so that the game characters in the target area and the associated area can be updated from their original positions to the positions after being repelled by a distance of L, and the coordinate information after the repulsion is recorded in the updated character coordinate data table; correspondingly, the character HP data table in the target area and the associated area can be updated according to the damage M, so that the game characters in the target area and the associated area can be updated from their original HP to the HP after receiving damage M, and the HP information after causing damage is recorded in the updated character HP data table.
[0115] Further, after the data table is updated, the CPU can directly read the updated character HP data table and character coordinate data table from the memories corresponding to the target area and the associated area respectively, so as to complete the calculation by combining the character attribute data of each game character recorded in the table, and render a schematic diagram as shown by the GPU Figure 3 to realize the display of the result in response to the skill released by game character A.
[0116] In summary, by updating the character attribute data table in units of areas, not only can the calculation efficiency be improved, but the problem of CPU cache miss can also be avoided, thus effectively reducing the number of data copies and the consumption of computing resources.
[0117] In addition, since the character attribute data corresponding to all virtual characters included in each map area is maintained in the memory corresponding to that area, and different character attribute data is recorded in different character attribute data tables, when the target virtual character leaves or moves to other areas, if the character attribute data table in the original area is not updated, it will cause data chaos problems, which does not conform to the setting of the game mechanism. Therefore, the character attribute data table of each map area needs to be updated in the moving state. In this embodiment, the specific implementation method is as follows:
[0118] In the case where the target virtual character leaves the target area, determine the global character attribute data table corresponding to the target area; detect whether the attribute data corresponding to the target virtual character is recorded at the end of the global character attribute data table corresponding to the target area;
[0119] If so, delete the attribute data corresponding to the target virtual character from the global character attribute data table corresponding to the target area;
[0120] Otherwise, determine the record position of the attribute data corresponding to the target virtual character in the global character attribute data table corresponding to the target area, and the attribute data corresponding to the changed virtual character at the end record in the global character attribute data table corresponding to the target area; delete the attribute data corresponding to the target virtual character in the global character attribute data table corresponding to the target area, and move the attribute data corresponding to the changed virtual character to the record position; update the identification information configured for the changed virtual character according to the movement result of the attribute data corresponding to the changed virtual character.
[0121] Among them, the global character attribute data table specifically refers to the set of all types of character attribute data tables; correspondingly, the changed virtual character specifically refers to the virtual character whose corresponding character attribute data is to be moved.
[0122] In practical applications, considering that the character attribute data table records character attribute information in an increasing manner, when a virtual character leaves the corresponding map area, the character attribute information corresponding to the virtual character needs to be deleted in the corresponding character attribute data table. In order to fill the record position after deletion, it is necessary to move the other character attribute data in the character attribute data table as a whole, which causes excessive consumption of computing power. Therefore, in order to avoid the computing power consumption caused by the above problems, the filling can be completed by reducing the movement of character attribute data.
[0123] Based on this, when the target virtual character leaves the target area, it means that the character attribute data corresponding to the target virtual character needs to be deleted in each character attribute data table maintained in the target area memory. At this time, the global character attribute data table corresponding to the target area can be determined, and then it is detected whether the attribute data corresponding to the target virtual character is recorded at the end of the global character attribute data table.
[0124] If so, it means that when the target virtual character enters the target area, no other virtual characters enter the area again, and the character attribute data of other virtual characters is not recorded in the corresponding global character attribute data table. At this time, the character attribute data at the end of the global character attribute data table can be directly deleted without other operations.
[0125] Otherwise, it indicates that the virtual characters in the target area change frequently. To reduce the consumption of computing resources, the record position of the attribute data corresponding to the target virtual character in the global character attribute data table can be determined at this time, and the attribute data corresponding to the changed virtual character at the end record in the global character attribute data table can be determined. Then, directly delete the attribute data corresponding to the target virtual character in the global character attribute data table corresponding to the target area, and then move the attribute data corresponding to the changed virtual character to the record position to complete the update of the global character attribute data table corresponding to the target area according to the movement result. At the same time, the identification information corresponding to the changed virtual character also needs to be updated to indicate that the changed virtual character moves from the end of the table to other positions.
[0126] For example, when game character B leaves map area N1 of the game map, the entire character attribute data table recorded in the memory corresponding to map area N1 can be determined at this time. If the character attribute data corresponding to game character B is recorded at the end of each character attribute data table, then the character attribute data corresponding to game character B can be directly deleted from each character attribute data table.
[0127] If the character attribute data corresponding to game character B is recorded at a non-end position in each character attribute data table, then the record position of the character attribute data corresponding to game character B in each character attribute data table and the attribute data of the end record in each character attribute data table can be determined. It is determined that the character attribute data of the end record in each character attribute data table belongs to game character C. At this time, the character attribute data corresponding to game character B can be directly deleted from each character attribute data table, and at the same time, the character attribute data corresponding to game character C is moved to the record position to complete the update of each character attribute data table, and the identification information configured for game character C is updated.
[0128] In summary, by dynamically updating the global character attribute data table, not only can the consumption of computing resources be saved, but data chaos can also be avoided, so as to quickly complete the maintenance of the character attribute data in each area.
[0129] In addition, when the target virtual character moves to another map area, directly add the character attribute data corresponding to the target virtual character to the global character attribute data table maintained in the memory of the map area after the movement. In this embodiment, the specific implementation method is as follows:
[0130] When the target virtual character moves to the movement area in the virtual map, update the identification information configured for the target virtual character according to the area identifier corresponding to the movement area; record the attribute data corresponding to the target virtual character in the global character attribute data table corresponding to the movement area.
[0131] Continuing with the above example, when game character B moves from map area N1 to map area N2, at this time, the character attribute data corresponding to game character B can be recorded into each character attribute data table maintained in the memory corresponding to map area N2, and at the same time, the identification information configured for game character B is updated to indicate that game character B is located in map area N2.
[0132] In addition, any movement method of the virtual character in the virtual map can change and update the character attribute data according to the above solution, so as to support accurate character attribute data to be maintained in each map area.
[0133] The data update method provided in this application can select an associated area associated with the target area in the virtual map according to the operation event after obtaining the operation event triggered by the target virtual character in the target area of the virtual map; then determine the character attribute data tables corresponding to the target area and the associated area in the memory respectively; finally, update the character attribute data table based on the operation event. By maintaining the corresponding character attribute data table in the memory corresponding to each area, it is possible to avoid the problem that the data that the CPU needs to read is not in the cache, so that the data involved in the operation event can be calculated in a timely manner, and at the same time, the number of data copies can be reduced, effectively improving the resource utilization rate and reducing excessive resource consumption.
[0134] The following combines the attached Figure 4 , taking the application of the data update method provided in this application in the game scenario as an example, to further illustrate the data update method. Among them, Figure 4 FIG. shows a processing flow chart of a data update method applied to a game scenario provided by an embodiment of this application, which specifically includes the following steps:
[0135] Step S402, obtain the operation event triggered by the target virtual character in the target area of the virtual map.
[0136] Step S404, determine the event type corresponding to the operation event.
[0137] Step S406, determine the range information corresponding to the operation event according to the event type.
[0138] Step S408, select an associated area associated with the target area in the virtual map according to the range information.
[0139] Step S410, determine the attribute change information corresponding to the operation event according to the event type.
[0140] Step S412, determine the attribute data table identifier corresponding to the attribute change information in the identification information corresponding to the target virtual character.
[0141] Step S414: Read the first role attribute data table corresponding to the attribute data table identifier in the memory corresponding to the target area.
[0142] Step S416: Read the second role attribute data table associated with the first role attribute data table in the memory corresponding to the associated area.
[0143] Step S418: Analyze the attribute change information corresponding to the operation event to obtain parameter change information.
[0144] Step S420: Update the first role attribute data table and the second role attribute data table according to the parameter change information.
[0145] In summary, after obtaining the operation event triggered by the target virtual character in the target area of the virtual map, the associated area associated with the target area can be selected in the virtual map according to the operation event; then, the role attribute data tables corresponding to the target area and the associated area are respectively determined in the memory; finally, the role attribute data tables are updated based on the operation event. By maintaining the corresponding role attribute data tables in the memory corresponding to each area, the problem that the data that the CPU needs to read is not in the cache can be avoided, so that the data involved in the operation event can be calculated in time, and at the same time, the number of data copies can be reduced, effectively improving the resource utilization rate and reducing excessive consumption of resources.
[0146] Corresponding to the above method embodiment, the present application also provides an embodiment of a data update device. Figure 5 The structure diagram of a data update device provided by an embodiment of the present application is shown. As Figure 5 shown, the device includes:
[0147] An acquisition module 502, configured to acquire an operation event triggered by a target virtual character in a target area of a virtual map;
[0148] A selection module 504, configured to select an associated area associated with the target area in the virtual map according to the operation event;
[0149] A determination module 506, configured to respectively determine role attribute data tables corresponding to the target area and the associated area in the memory;
[0150] An update module 508, configured to update the role attribute data tables based on the operation event.
[0151] In an optional embodiment, the selection module 504 is further configured to:
[0152] Determine the event type corresponding to the operation event; determine the range information corresponding to the operation event according to the event type; select the associated area associated with the target area in the virtual map according to the range information.
[0153] In an optional embodiment, the determining module 506 is further configured to:
[0154] Determine the attribute change information corresponding to the operation event according to the event type; determine the attribute data table identifier corresponding to the attribute change information in the identification information of the target virtual character; wherein, the identification information records the identifier of the character attribute data table stored in the memory corresponding to the target area; read the first character attribute data table corresponding to the attribute data table identifier in the memory corresponding to the target area; read the second character attribute data table associated with the first character attribute data table in the memory corresponding to the associated area.
[0155] In an optional embodiment, the updating module 508 is further configured to:
[0156] Analyze the attribute change information corresponding to the operation event to obtain parameter change information; update the first character attribute data table and the second character attribute data table according to the parameter change information.
[0157] In an optional embodiment, the data updating device further includes:
[0158] A dividing module, configured to divide the virtual map according to a preset dividing rule to obtain multiple map areas; correspondingly, the target area is determined by the following method: determine the position information of the target virtual character in the virtual map; determine the target area in the multiple map areas based on the position information.
[0159] In an optional embodiment, allocate memory for each of the multiple map areas, and record in the allocated memory the character attribute data tables corresponding to multiple character attribute types of the virtual characters included in each map area; correspondingly, the virtual character configuration records the area identifier corresponding to the map area where it is located at the current moment, and the identification information of the multiple character attribute data tables corresponding to the map area.
[0160] In an optional embodiment, the data updating device further includes:
[0161] The first moving module is configured to determine the global role attribute data table corresponding to the target area when the target virtual role leaves the target area; detect whether the attribute data corresponding to the target virtual role is recorded at the end of the global role attribute data table corresponding to the target area; if so, delete the attribute data corresponding to the target virtual role in the global role attribute data table corresponding to the target area.
[0162] In an optional embodiment, the first moving module is further configured to:
[0163] Determine the recording position of the attribute data corresponding to the target virtual role in the global role attribute data table corresponding to the target area, and the attribute data corresponding to the changed virtual role recorded at the end of the global role attribute data table corresponding to the target area; delete the attribute data corresponding to the target virtual role in the global role attribute data table corresponding to the target area, and move the attribute data corresponding to the changed virtual role to the recording position; update the identification information configured for the changed virtual role according to the moving result of the attribute data corresponding to the changed virtual role.
[0164] In an optional embodiment, the data update device further includes:
[0165] The second moving module is configured to update the identification information configured for the target virtual role according to the area identifier corresponding to the moving area when the target virtual role moves to the moving area in the virtual map; record the attribute data corresponding to the target virtual role in the global role attribute data table corresponding to the moving area.
[0166] In an optional embodiment, the data update device further includes:
[0167] The processing module is configured to receive a read request submitted by the processing unit; and send the updated role attribute data in the memory to the processing unit in response to the read request.
[0168] After obtaining the operation event triggered by the target virtual role in the target area of the virtual map, the data update device provided in this application can select the associated area associated with the target area in the virtual map; then determine the role attribute data tables corresponding to the target area and the associated area in the memory respectively; and finally update the role attribute data tables based on the operation event. By maintaining the corresponding role attribute data tables in the memory corresponding to each area, the problem that the data that the CPU needs to read is not in the cache can be avoided, so that the data involved in the operation event can be calculated in time, and at the same time, the number of data copies can be reduced, effectively improving the resource utilization rate and reducing excessive consumption of resources.
[0169] The above is a schematic solution of a data update device according to this embodiment. It should be noted that the technical solution of this data update device and the technical solution of the above data update method belong to the same concept. For the details not described in the technical solution of the data update device, reference can be made to the description of the technical solution of the above data update method. In addition, each component in the device embodiment should be understood as a functional module that must be established to implement each step of the program flow or each step of the method. Each functional module is not an actual functional division or separation limitation. The device claims defined by such a set of functional modules should be understood as mainly implementing the functional module architecture of the solution through the computer program recorded in the specification, rather than understanding as an entity device mainly implementing the solution through hardware means.
[0170] Figure 6 FIG. shows a block diagram of a computing device 600 according to an embodiment of the present application. The components of the computing device 600 include but are not limited to a memory 610 and a processor 620. The processor 620 is connected to the memory 610 through a bus 630, and a database 650 is used to store data.
[0171] The computing device 600 further includes an access device 640, which enables the computing device 600 to communicate via one or more networks 660. Examples of these networks include the Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or a combination of communication networks such as the Internet. The access device 640 may include one or more of any type of wired or wireless network interface (e.g., Network Interface Card (NIC)), such as an IEEE802.11 Wireless Local Area Network (WLAN) wireless interface, a Worldwide Interoperability for Microwave Access (Wi-MAX) interface, an Ethernet interface, a Universal Serial Bus (USB) interface, a cellular network interface, a Bluetooth interface, a Near Field Communication (NFC) interface, and so on.
[0172] In an embodiment of the present application, the above components of the computing device 600 and Figure 6 other components not shown in the figure may also be connected to each other, for example, through a bus. It should be understood that Figure 6 the block diagram of the computing device shown is only for illustrative purposes and is not a limitation on the scope of the present application. Those skilled in the art can add or replace other components as needed.
[0173] The computing device 600 can be any type of stationary or mobile computing device, including mobile computers or mobile computing devices (e.g., tablet computers, personal digital assistants, laptop computers, notebook computers, netbooks, etc.), mobile phones (e.g., smartphones), wearable computing devices (e.g., smartwatches, smart glasses, etc.) or other types of mobile devices, or stationary computing devices such as desktop computers or PCs. The computing device 600 can also be a mobile or stationary server.
[0174] Wherein, the processor 620 is used to execute the following computer-executable instructions:
[0175] Obtain the operation event triggered by the target virtual character in the target area of the virtual map;
[0176] Select the associated area associated with the target area in the virtual map according to the operation event;
[0177] Respectively determine the role attribute data tables corresponding to the target area and the associated area in the memory;
[0178] Update the role attribute data table based on the operation event.
[0179] The above is a schematic solution of a computing device in this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the above data update method belong to the same concept. For the details not described in the technical solution of the computing device, reference can be made to the description of the technical solution of the above data update method.
[0180] An embodiment of the present application further provides a computer-readable storage medium, which stores computer instructions that are executed by a processor for:
[0181] Obtain the operation event triggered by the target virtual character in the target area of the virtual map;
[0182] Select the associated area associated with the target area in the virtual map according to the operation event;
[0183] Respectively determine the role attribute data tables corresponding to the target area and the associated area in the memory;
[0184] Update the role attribute data table based on the operation event.
[0185] The above is a schematic solution of a computer-readable storage medium in this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the above data update method belong to the same concept. For the details not described in the technical solution of the storage medium, reference can be made to the description of the technical solution of the above data update method.
[0186] An embodiment of the present application further provides a chip that stores a computer program, and when the computer program is executed by the chip, the steps of the data update method are implemented.
[0187] The above describes specific embodiments of the present application. Other embodiments are within the scope of the appended claims. In some cases, the actions or steps recited in the claims may be performed in a different order than in the embodiments and still achieve the desired result. Additionally, the processes depicted in the drawings do not necessarily require the particular order or sequential order shown to achieve the desired result. In certain embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0188] The computer instructions include computer program code, and the computer program code may be in the form of source code, object code, executable files, or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, USB flash drive, removable hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electrical carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer-readable medium may be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, the computer-readable medium does not include electrical carrier signals and telecommunication signals.
[0189] It should be noted that for the foregoing method embodiments, for the sake of simplicity of description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the present application is not limited by the described action sequence, because according to the present application, certain steps may be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily essential to the present application.
[0190] In the above embodiments, the descriptions of each embodiment have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the relevant descriptions of other embodiments.
[0191] The preferred embodiments of the present application disclosed above are only used to help illustrate the present application. The optional embodiments do not describe all the details in detail, nor do they limit the invention to the specific embodiments described. Obviously, many modifications and changes can be made according to the content of the present application. The present application selects and specifically describes these embodiments in order to better explain the principle and practical application of the present application, so that those skilled in the art can well understand and utilize the present application. The present application is only limited by the claims and their full scope and equivalents.
Claims
1. A data updating method, characterized in that: include: Obtaining an operation event triggered by a target virtual character in a target area of a virtual map; selecting, in the virtual map, an associated area associated with the target area according to the operation event; Determining, in a memory, role attribute data tables corresponding to the target area and the associated area, respectively, wherein the role attribute data tables corresponding to the target area and the associated area are determined based on attribute change information corresponding to the operation event, and the attribute change information corresponding to the operation event is determined based on an event type of the operation event; The role attribute data table is updated based on the operation event.
2. The data updating method according to claim 1, wherein: The selecting, in the virtual map, an associated area associated with the target area according to the operation event includes: Determining an event type corresponding to the operation event; Determining scope information corresponding to the operation event according to the event type; The associated area associated with the target area is selected in the virtual map according to the range information.
3. The data updating method according to claim 2, wherein: The determining in the memory respectively the role attribute data tables corresponding to the target area and the associated area includes: Determining attribute change information corresponding to the operation event according to the event type; Determining the attribute data table identifier corresponding to the attribute change information in the identification information corresponding to the target virtual character; wherein the identification information records the identifier corresponding to the character attribute data table stored in the memory corresponding to the target area; Reading a first character attribute data table corresponding to the attribute data table identifier in a memory corresponding to the target area; The second role attribute data table associated with the first role attribute data table is read in the memory corresponding to the associated area.
4. The data updating method according to claim 3, wherein: The updating of the role attribute data table based on the operation event includes: Parsing the attribute change information corresponding to the operation event to obtain parameter change information; The first role attribute data table and the second role attribute data table are updated according to the parameter change information.
5. The data updating method according to claim 1, wherein: Before the step of obtaining an operation event triggered by the target virtual character in the target area of the virtual map is executed, the method further includes: Dividing the virtual map according to a preset division rule to obtain a plurality of map areas; Accordingly, the target area is determined as follows: Determining the location information of the target virtual character in the virtual map; The target area is determined among the plurality of map areas based on the position information.
6. The data updating method according to claim 5, characterized in that: Allocating memory for each of the plurality of map areas, and recording in the allocated memory a character attribute data table corresponding to a plurality of character attribute types of the virtual characters included in each map area; Correspondingly, the virtual character configuration records the area identifier corresponding to the map area at the current moment, and the identification information of multiple character attribute data tables corresponding to the map area.
7. The data updating method according to any one of claims 1 to 6, characterized in that: Also includes: When the target virtual character leaves the target area, determining a global character attribute data table corresponding to the target area; Detecting whether the attribute data corresponding to the target virtual character is recorded at the end of the global character attribute data table corresponding to the target area; If so, the attribute data corresponding to the target virtual character is deleted from the global character attribute data table corresponding to the target area.
8. The data updating method according to claim 7, characterized in that: If the result of the step of detecting whether the attribute data corresponding to the target virtual character is recorded at the end of the global character attribute data table corresponding to the target area is no, then the following steps are executed: Determining a record position of the attribute data corresponding to the target virtual character in the global character attribute data table corresponding to the target area, and the attribute data corresponding to the changed virtual character in the last record in the global character attribute data table corresponding to the target area; Deleting the attribute data corresponding to the target virtual character in the global character attribute data table corresponding to the target area, and moving the attribute data corresponding to the changed virtual character to the recording location; The identification information of the changed virtual character configuration is updated according to the movement result of the attribute data corresponding to the changed virtual character.
9. The data updating method according to any one of claims 1 to 6, characterized in that: Also includes: When the target virtual character moves to a moving area in the virtual map, updating identification information configured for the target virtual character according to an area identification corresponding to the moving area; The attribute data corresponding to the target virtual character is recorded in the global character attribute data table corresponding to the moving area.
10. The data updating method according to any one of claims 1 to 6, characterized in that: After the step of updating the role attribute data table based on the operation event is executed, the method further includes: receiving a read request submitted by a processing unit; The updated character attribute data in the memory is sent to the processing unit in response to the read request.
11. A data updating device, characterized in that: include: An acquisition module is configured to acquire an operation event triggered by a target virtual character in a target area of the virtual map; A selection module is configured to select an associated area associated with the target area in the virtual map according to the operation event; a determination module configured to determine, in a memory, role attribute data tables corresponding to the target area and the associated area, respectively, wherein the role attribute data tables corresponding to the target area and the associated area are determined based on attribute change information corresponding to the operation event, and the attribute change information corresponding to the operation event is determined based on an event type of the operation event; An updating module is configured to update the role attribute data table based on the operation event.
12. A computing device, characterized in that include: memory and processor; The memory is used to store computer-executable instructions, and the processor is used to execute the computer-executable instructions to implement the steps of the method according to any one of claims 1 to 10.
13. A computer-readable storage medium storing computer instructions, characterized in that: When the instruction is executed by a processor, the steps of the method according to any one of claims 1 to 10 are implemented.
14. A computer program product, characterized in that The method comprises computer instructions, which, when executed by a processor, implement the steps of the method according to any one of claims 1 to 10.
Citation Information
Patent Citations
Non-player game role control method and device, equipment and storage medium
CN113440839A