Object attribute value acquisition method and device in program, and computer device

CN113384891BActive Publication Date: 2025-10-10TENCENT TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202010165558.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-03-11
Publication Date
2025-10-10
Estimated Expiration
2040-03-11

AI Technical Summary

Technical Problem

In the prior art, the process of obtaining object attribute values ​​in a program consumes too many server performance resources, resulting in low data processing efficiency.

Method used

By judging the storage value availability status of the target attribute, the storage value availability status is used to judge whether the sub-attribute has changed and whether the coefficient of the attribute value calculation function has been updated. When the state is disabled, the attribute value is calculated in real time, and when the state is enabled, the storage value is directly obtained to reduce repeated calculations.

Benefits of technology

It reduces the consumption of server performance resources and improves data processing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113384891B_ABST
    Figure CN113384891B_ABST
Patent Text Reader

Abstract

The application relates to an object attribute value acquisition method and device in a program, computer equipment and a storage medium. The method comprises the following steps: in response to an attribute value acquisition instruction, determining a target attribute, reading the storage value available state of the target attribute, and when the attribute value of the attribute is updated to an attribute value storage area, the attribute value available state is an enabled state, and when the attribute value of a sub attribute of the attribute changes or the coefficient of an attribute value calculation function is updated, the attribute value available state is a disabled state; when the storage value available state of the target attribute is the enabled state, the storage value corresponding to the target attribute is inquired to obtain the attribute value of the target attribute; and when the storage value available state of the target attribute is the disabled state, the attribute value of the target attribute is calculated by acquiring the attribute value calculation function corresponding to the target attribute and the attribute values of the sub attributes relied on by the target attribute. Through attribute value caching and storage value available state marking, attribute value reading and repeated calculation are not required, the consumption of server performance resources is reduced, and the data processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a method, apparatus, computer device, and storage medium for obtaining object attribute values ​​in a program. Background Art

[0002] Object properties in a program refer to data object parameters in an application or software that use certain data to describe its performance, such as games or data management systems. An object may have multiple properties, and there are dependencies between the multiple properties of an object. Generally speaking, high-level properties depend on the values ​​of low-level properties.

[0003] Take object attributes in games as an example. In the game attribute system, every human or non-human player is a character object. Object attributes in games are player characters or character-related abilities related to game progression. For example, a character's luck attribute is a low-level attribute that affects higher-level attributes such as the chance and rarity of dropping treasures, and may also affect higher-level attributes such as evasion rate and hit rate.

[0004] In traditional technology, the processing and analysis of the attribute values ​​of object attributes in a program is generally implemented through code calculation based on the dependency relationship between attributes. However, with the increasing complexity of applications or software, the dependency between attributes increases. For complex scenarios that require large-scale attribute calculations, more and more server performance resources are consumed, reducing data processing efficiency. Summary of the Invention

[0005] Based on this, it is necessary to provide a method, device, computer equipment and storage medium for obtaining object attribute values ​​in a program that consumes less server performance resources and is efficient, in order to address the technical problems that general attribute value acquisition solutions require consuming too many server performance resources and have low data processing efficiency during the attribute value acquisition process.

[0006] A method for obtaining an object attribute value in a program, the method comprising:

[0007] Responding to an attribute value acquisition instruction, determining a target attribute corresponding to the attribute value acquisition instruction;

[0008] Read the storage value availability status of the target attribute, where the storage value availability status includes an enabled state and a disabled state. The storage value availability status is enabled when the attribute value of the attribute is updated to the attribute value storage area, and is disabled when the attribute value of at least one sub-attribute on which the attribute depends changes or the coefficient of the attribute value calculation function of the attribute is updated;

[0009] When the storage value availability state of the target attribute is enabled, query the storage value of the attribute value storage area corresponding to the target attribute to obtain the attribute value of the target attribute;

[0010] When the storage value availability state of the target attribute is disabled, obtain the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends, and calculate the attribute value of the target attribute based on the attribute value calculation function and the attribute value of the sub-attribute.

[0011] A device for obtaining object attribute values ​​in a program, the device comprising:

[0012] A target attribute determination module is used to respond to an attribute value acquisition instruction and determine a target attribute corresponding to the attribute value acquisition instruction;

[0013] A storage value availability status reading module is used to read the storage value availability status of the target attribute, wherein the storage value availability status includes an enabled state and a disabled state. When the attribute value of the attribute is updated to the attribute value storage area, the storage value availability status is enabled. When the attribute value of at least one sub-attribute on which the attribute depends changes or the coefficient of the attribute value calculation function of the attribute is updated, the storage value availability status is disabled.

[0014] A first attribute value acquisition module is configured to query the storage value of the attribute value storage area corresponding to the target attribute to obtain the attribute value of the target attribute when the storage value availability state of the target attribute is enabled;

[0015] The second attribute value acquisition module is used to obtain the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends when the storage value availability status of the target attribute is disabled, and calculate the attribute value of the target attribute based on the attribute value calculation function and the attribute value of the sub-attribute.

[0016] A computer device includes a memory and a processor, wherein the memory stores a computer program, and when the processor executes the computer program, the following steps are performed:

[0017] Responding to an attribute value acquisition instruction, determining a target attribute corresponding to the attribute value acquisition instruction;

[0018] Read the storage value availability status of the target attribute, where the storage value availability status includes an enabled state and a disabled state. The storage value availability status is enabled when the attribute value of the attribute is updated to the attribute value storage area, and is disabled when the attribute value of at least one sub-attribute on which the attribute depends changes or the coefficient of the attribute value calculation function of the attribute is updated;

[0019] When the storage value availability state of the target attribute is enabled, query the storage value of the attribute value storage area corresponding to the target attribute to obtain the attribute value of the target attribute;

[0020] When the storage value available state of the target attribute is the disabled state, the attribute value calculation function corresponding to the target attribute and the attribute values of the sub-attributes relied on by the target attribute are obtained, and the attribute value of the target attribute is calculated according to the attribute value calculation function and the attribute values of the sub-attributes.

[0021] A computer-readable storage medium having stored thereon a computer program, the computer program being executed by a processor to implement the following steps:

[0022] In response to the attribute value obtaining instruction, a target attribute corresponding to the attribute value obtaining instruction is determined.

[0023] A storage value available state of the target attribute is read, wherein the storage value available state includes an enabled state and a disabled state, the storage value available state is the enabled state when the attribute value of the attribute is updated to the attribute value storage area, and the storage value available state is the disabled state when the attribute value of at least one sub-attribute relied on by the attribute or the coefficient of the attribute value calculation function of the attribute is updated.

[0024] When the storage value available state of the target attribute is the enabled state, the storage value of the attribute value storage area corresponding to the target attribute is queried to obtain the attribute value of the target attribute.

[0025] When the storage value available state of the target attribute is the disabled state, the attribute value calculation function corresponding to the target attribute and the attribute values of the sub-attributes relied on by the target attribute are obtained, and the attribute value of the target attribute is calculated according to the attribute value calculation function and the attribute values of the sub-attributes.

[0026] The object attribute value obtaining method, device, computer equipment and storage medium in the above program, when the attribute value obtaining instruction is obtained, the target attribute to be processed is determined, the storage value available state of the target attribute is read, and whether the attribute value of at least one sub-attribute relied on by the target attribute is changed and whether the coefficient of the attribute value calculation function corresponding to the target attribute is updated is determined by using the storage value available state. For the disabled state, that is, the attribute value of the sub-attribute is changed, the attribute value calculation function corresponding to the target attribute and the attribute values of the sub-attributes relied on by the target attribute are obtained, and the attribute value of the target attribute is calculated in real time. For the enabled state, that is, the attribute value of the sub-attribute is not changed and the coefficient of the attribute value calculation function is not updated, the stored attribute value is directly obtained. The attribute value cache is used to mark the storage value available state by using the attribute value change of the sub-attribute and the coefficient update of the attribute value calculation function, multiple repeated reading of the attribute value and repeated calculation are not required for each storage value obtaining, the consumption of server performance resources is reduced, and the data processing efficiency is improved. BRIEF DESCRIPTION OF DRAWINGS

[0027] Figure 1 An application environment diagram of the object attribute value obtaining method in the program in one embodiment.

[0028] Figure 2 A flowchart of a method for obtaining object attribute values ​​in a program in one embodiment;

[0029] Figure 3 A flowchart of a method for obtaining object attribute values ​​in a program in another embodiment;

[0030] Figure 4 A flowchart of a method for obtaining object attribute values ​​in a program in yet another embodiment;

[0031] Figure 5 Schematic diagram of a flow chart of a method for obtaining object attribute values ​​in a program in yet another embodiment;

[0032] Figure 6 Schematic diagram of a flow chart of a method for obtaining object attribute values ​​in a program in another embodiment;

[0033] Figure 7 A flowchart of a method for obtaining object attribute values ​​in a program in one embodiment;

[0034] Figure 8 A flowchart of a method for obtaining object attribute values ​​in a program in another embodiment;

[0035] Figure 9 A schematic diagram of attribute dependency in a method for obtaining object attribute values ​​in a program in one embodiment;

[0036] Figure 10 A schematic diagram of the hierarchical relationship of attributes in a method for obtaining object attribute values ​​in a program in one embodiment;

[0037] Figure 11 A flowchart of a method for obtaining object attribute values ​​in a program in one embodiment;

[0038] Figure 12 A structural block diagram of a device for obtaining object attribute values ​​in a program in one embodiment;

[0039] Figure 13 FIG. 1 is a diagram showing the internal structure of a computer device in one embodiment. DETAILED DESCRIPTION

[0040] In order to make the purpose, technical solutions and advantages of this application more clear, the following further describes this application in detail with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain this application and are not intended to limit this application.

[0041] The object attribute value acquisition method in the program provided by this application can be applied to Figure 1In the game attribute management system shown in FIG. The game attribute management system includes a terminal 102 and a server 104, and the terminal 102 and the server 104 communicate via a network. The server 104 receives an attribute value acquisition instruction sent by the terminal 102, determines the target attribute corresponding to the attribute value acquisition instruction, and reads the storage value availability status of the target attribute. The storage value availability status is marked as enabled when the attribute value of the corresponding attribute is updated to the attribute value storage area, and is marked as disabled when the attribute value of at least one sub-attribute on which the attribute depends changes or the coefficient of the attribute value calculation function corresponding to the attribute is updated. When the storage value availability status of the target attribute is enabled, the stored value of the attribute value storage area corresponding to the target attribute is queried to obtain the attribute value of the target attribute. When the storage value availability status of the target attribute is disabled, the attribute value calculation function corresponding to the target attribute and the attribute values ​​of the sub-attributes on which the target attribute depends are obtained. The attribute value of the target attribute is calculated based on the attribute value calculation function and the attribute values ​​of the sub-attributes, and finally the attribute value is returned to the terminal 102. The terminal 102 may be, but is not limited to, various personal computers, laptops, smart phones, tablet computers, and portable wearable devices, and the server 104 may be implemented as an independent server or a server cluster consisting of multiple servers.

[0042] In other embodiments, the game attribute management system may also be implemented by a terminal or server including a data processor, which is not limited here.

[0043] In one embodiment, Figure 2 As shown, a method for obtaining the object attribute value in a program is provided, which is applied to Figure 1 The server in is used as an example for description, including steps 210 to 240.

[0044] Step 210: respond to the attribute value acquisition instruction and determine the target attribute corresponding to the attribute value acquisition instruction.

[0045] An object in a program can be a data object in an application or software, and object attributes can specifically be various attributes within the application or various types of software that have dependencies on each other. The application or software can be a game, a data management system, or the like. The following embodiments will be described using game attributes within a game attribute management system as an example. Game attributes refer to player characters or abilities related to the game process. The types of attributes vary between games. Generally, games with combat mechanics will have attributes such as strength and health, while management games will always have a money attribute. The attribute values ​​of game attributes refer to the values ​​of various related abilities. In games, various attributes do not exist independently. As game complexity increases, dependencies between attributes increase, and the dependency relationships become increasingly complex. For two dependent attributes, A and B, if a change in the value of attribute A directly affects the value of attribute B, then attribute A is considered a child attribute of attribute B, and attribute B is considered a parent attribute of attribute A.

[0046] The attribute value acquisition instruction is used to indicate which specific attributes in the game need to obtain corresponding attribute values. The attribute value acquisition instruction carries the attribute identifier of the attribute to be processed, and the target attribute to be processed is determined based on the attribute identifier. In an embodiment, for example, during the game development process, the attribute value acquisition instruction can be generated by the attribute management system by reading a configuration file, and the attribute values ​​of each game character in a set game frame can be obtained.

[0047] Step 220: Read the available status of the stored value of the target attribute.

[0048] Among them, the storage value available state includes an enabled state and a disabled state. When the attribute value of the attribute is updated to the attribute value storage area, the storage value available state is enabled. When the attribute value of at least one sub-attribute on which the attribute depends changes or the coefficient of the attribute value calculation function of the attribute is updated, the storage value available state is disabled. Specifically, the storage value available state is marked as enabled when the attribute value of the corresponding attribute is updated to the attribute value storage area. The disabled state includes a basic value disabled state and a function disabled state. When the attribute value of at least one sub-attribute on which the attribute depends changes, it is marked as the basic value disabled state. When the coefficient of the attribute value calculation function corresponding to the attribute is updated, it is marked as the function disabled state.

[0049] An attribute's stored value is one of its associated elements. The data corresponding to the stored value is the result of the attribute's most recent calculation. For any attribute in the game, when a new value is calculated for that attribute, the new value is updated to the attribute value storage area, and the attribute's stored value availability is marked as enabled. By caching the attribute's stored value, you can directly retrieve the target attribute's value when the stored value is available.

[0050] The associated elements of an attribute also include a base value. The numerical calculation of the base value depends on the sub-attributes of the attribute. When any sub-attribute of the attribute changes, the attribute value of the attribute will also change accordingly. Once the attribute value of the sub-attribute of the attribute changes, the original stored value cached in the storage area will not be used to represent the attribute value at the current moment. Therefore, the storage value availability status of the game attribute needs to be marked as disabled.

[0051] The associated elements of the attribute also include the coefficient value of the attribute value calculation function. The coefficient value can be modified through modification instructions and is independent of the attribute's sub-attributes. When the attribute parameter modification instruction is obtained and the attribute coefficient value is modified, there is no need to calculate the attribute value of the attribute temporarily. Instead, the attribute storage value availability status is marked as disabled. The next time the attribute value of the attribute needs to be obtained, the attribute value of the attribute is calculated using the modified coefficient value.

[0052] In one embodiment, the coefficient values ​​of the attribute value calculation function include additive coefficients, multiplicative coefficients, etc. For example, attribute B = a(attribute 1 + b*attribute 2) + c attribute 3 + d, etc. When any of the multiplication coefficients a, b, c or the additive coefficient d changes, the attribute value calculation function is also updated. At this time, the storage value availability status of the target attribute is disabled, and the attribute value of the target attribute needs to be calculated based on the obtained attribute value calculation function and the attribute values ​​of the sub-attributes on which the target attribute depends.

[0053] In an embodiment, at the same time when the sub-attribute of any attribute value in the game or the coefficient of the attribute value calculation function changes, it is not necessary to immediately calculate the attribute value of the attribute and the attribute value of the parent attribute of the attribute. Instead, the calculation is performed until the next time the attribute or the parent attribute of the attribute is needed. By delaying the calculation, unnecessary data calculation processing is avoided, which greatly improves the performance and development efficiency of the attribute module.

[0054] Step 230: When the storage value availability state of the target attribute is enabled, query the storage value of the attribute value storage area corresponding to the target attribute to obtain the attribute value of the target attribute.

[0055] The available state of the storage value of the target attribute is the enabled state, which indicates that the current storage value can be used to represent the attribute value of the target attribute. According to the attribute identifier of the target attribute, the attribute value storage area corresponding to the target attribute is searched, the storage value of the attribute value storage area is obtained, and the storage value is used as the attribute value of the target attribute.

[0056] Step 240: When the storage value availability state of the target attribute is disabled, obtain the attribute value calculation function corresponding to the target attribute and the attribute values ​​of the sub-attributes on which the target attribute depends, and calculate the attribute value of the target attribute based on the attribute value calculation function and the attribute values ​​of the sub-attributes.

[0057] An attribute value calculation function is a function used to calculate an attribute. Each attribute is assigned a corresponding attribute value calculation function. For example, a high-level attribute is calculated by combining N low-level attributes using a formula. Its attribute value calculation function can be expressed as: high-level attribute A = f(low-level attribute 1, low-level attribute 2, ..., low-level attribute N). Low-level attribute 1, low-level attribute 2, ..., and low-level attribute N are all sub-attributes of high-level attribute A.

[0058] Specifically, the target attribute's storage value availability status is disabled, indicating that the current storage value cannot be used to represent the attribute value of the target attribute, and the attribute value of the target attribute needs to be obtained through real-time analysis and calculation. Specifically, there are two cases in which the target attribute's storage value availability status is disabled. The first is when the attribute value of at least one sub-attribute on which the target attribute depends changes, and the target attribute is marked as a base value disabled state. The second is when the coefficient of the attribute value calculation function corresponding to the target attribute is updated, and the target attribute is marked as a function disabled state.

[0059] For the first case, in one embodiment, Figure 3 As shown, when the storage value availability state of the target attribute is disabled, the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends are obtained, and the attribute value of the target attribute is calculated according to the attribute value calculation function and the attribute value of the sub-attribute, including steps 310 to 340.

[0060] Step 310: When the target attribute's storage value availability state is the base value disabled state, recursively read the storage value availability states of each sub-attribute that the target attribute directly or indirectly depends on, according to the preset attribute dependency relationship, until a target sub-attribute whose storage value availability state is enabled or function disabled is found.

[0061] Step 320: When the storage value availability status of the target sub-attribute is enabled, query to obtain the attribute value of the target sub-attribute; when the storage value availability status of the target sub-attribute is function disabled, obtain the updated attribute value calculation function of the target sub-attribute and calculate to obtain the attribute value of the target sub-attribute.

[0062] Step 330: recursively calculate the attribute value of each sub-attribute to be calculated based on the attribute value of the target sub-attribute.

[0063] The sub-attribute to be calculated refers to the sub-attribute whose reading result is a disabled state of the base value. The order of recursive calculation is the reverse of the recursive order of recursive reading.

[0064] Step 340: Obtain the attribute value calculation function of the target attribute, and calculate the attribute value of the target attribute according to the attribute value calculation function of the target attribute and the attribute values ​​of each sub-attribute of the target attribute.

[0065] The updated attribute value calculation function refers to the attribute value calculation function of the updated coefficient. The updated attribute value calculation function can be obtained by obtaining the updated coefficient and the original attribute value calculation function expression.

[0066] When the storage value available state of the target attribute is the base value disabled state, according to the preset attribute dependency, the sub-attributes that have a direct dependency relationship with the target attribute, the sub-attributes that have a direct dependency relationship with the sub-attribute and an indirect dependency relationship with the target attribute, and the sub-attributes that have an indirect dependency relationship with the sub-attribute are determined to all belong to the sub-attributes of the target attribute, thereby obtaining the sub-attributes that have a direct dependency relationship or an indirect dependency relationship with the target attribute.

[0067] According to the preset attribute dependency relationship, each attribute can form an attribute dependency chain, and read the storage value availability status of each sub-attribute in turn, until the target sub-attribute does not have a corresponding sub-attribute or the storage value availability status of each sub-attribute is enabled. The non-existence of a sub-attribute refers to the characteristic of the lowest-level sub-attribute on the attribute dependency chain. The calculation of the attribute value of the target attribute is a cyclic process. First, it is necessary to determine the sub-attribute in the target attribute that is in a basic value disabled state or a function disabled state due to the storage value availability status. If the sub-attribute is in a function disabled state, the updated attribute value calculation function is obtained to calculate the attribute value; if the sub-attribute is in a basic value disabled state, the storage value availability status of the sub-attribute of the sub-attribute is further read, and the process is cyclical until there is no sub-attribute, and the reading of the storage value availability status is ended.

[0068] The calculation of the attribute value of the target attribute needs to be obtained based on the calculation results of each sub-attribute whose storage value availability status is enabled on the attribute dependency chain. Starting from the low level of the attribute dependency chain, that is, the sub-attribute without sub-attributes or the sub-attribute whose storage value availability status is enabled, according to the sub-attribute whose storage value availability status is disabled and the attribute value calculation function of the target attribute, the attribute value of each sub-attribute whose storage value availability status is disabled is calculated, and then recursively calculated to the higher level of the attribute dependency chain in turn to obtain the attribute value of each sub-attribute and the attribute value of the target attribute.

[0069] In one embodiment, Figure 4As shown, after obtaining the attribute value calculation function of the target attribute and calculating the attribute value of the target attribute according to the attribute value calculation function of the target attribute and the attribute values ​​of each sub-attribute of the target attribute, step 410 is further included.

[0070] Step 410: Update the attribute value of each sub-attribute of the target attribute and the attribute value of the target attribute to the corresponding attribute value storage area, and mark the available status of the stored value of each sub-attribute and the target attribute as enabled.

[0071] After calculating the attribute values ​​of each sub-attribute and the attribute value of the target attribute, the attribute values ​​are cached and stored in the attribute value storage area corresponding to the attribute. The next time the attribute is needed, if the storage value availability status is still enabled, that is, the current attribute value of the target attribute has not changed, the attribute value of the target attribute can be directly obtained through the attribute value storage area corresponding to the target attribute, without the need to recalculate through the attribute value calculation function, etc., which reduces the consumption of server performance resources and improves the performance of the attribute module and the data acquisition efficiency.

[0072] For the second case, in one embodiment, Figure 5 As shown, the storage value available state is marked as the function disabled state when the coefficient of the attribute value calculation function corresponding to the attribute is updated;

[0073] When the storage value availability state of the target attribute is disabled, obtain the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends. According to the attribute value calculation function and the attribute value of the sub-attribute on which the target attribute depends, calculate the attribute value of the target attribute, including steps 510 to 530.

[0074] Step 510: When the storage value availability state of the target attribute is a function disabled state, obtain the target attribute value update calculation function and the target attribute sub-attribute.

[0075] Step 520: query the storage value of the attribute value storage area corresponding to each sub-attribute to obtain the attribute value of each sub-attribute.

[0076] Step 530: Calculate the attribute value of the target attribute according to the updated attribute value calculation function and the attribute values ​​of the sub-attributes on which the target attribute depends.

[0077] For the target attribute whose storage value available state is in the function disabled state, the coefficient representing the corresponding attribute value calculation function is updated. At this time, by obtaining the attribute value calculation function after the coefficient is updated and querying the storage value of the attribute value storage area corresponding to each sub-attribute, the attribute value of each sub-attribute is obtained, and the attribute value of the target attribute can be obtained by calculation.

[0078] In other embodiments, if the storage value available state of the target attribute includes both a function disabled state and a basic value disabled state, the same method as described above is used to obtain the attribute values ​​of each sub-attribute, and then the updated attribute value calculation function is obtained to calculate the attribute value of the target attribute.

[0079] Specifically, the attribute value calculation function corresponding to the attribute includes two parts: the base value and the coefficient value. The calculation of the base value depends on the attribute value of the sub-attribute of the attribute. Take the attribute value (result), the base value (base) multiplication coefficient (multi), and the addition coefficient (add) as an example.

[0080] Assuming that attribute C depends on attributes A and B, the attribute value calculation function of attribute C is split into the following expressions:

[0081] f(C result )=m(C basa )*(1+n*multi)+k*add, (m, n, k are all constants)

[0082] Among them, C basa =a*A resul +b*B result , (a and b are both constants)

[0083] That is, the complete expression of the attribute value calculation function of attribute C is f(C result )=m(a*A resul +b*B result )*(1+n*multi)+k*add.

[0084] In an embodiment, the function disabled state corresponds to the storage value available state corresponding to the case where the multiplication coefficient (multi) or the addition coefficient (add) in the above expression is updated.

[0085] In one embodiment, the basic value obtained from each calculation can also be stored, and the basic value available status flag can be set. In the above embodiment, taking attribute C as the target attribute, first, the available status of the stored value of attribute C is judged. The stored value is the result saved when the attribute value of attribute C was calculated last time. If the available status of the stored value of attribute C is enabled (for example, the available status flag of the stored value is yes), the result saved after the last calculation is directly obtained, and the processing process ends.

[0086] If the storage value available state of attribute C is the disabled state (e.g. the storage value available state identifier is no), the base value available state of attribute C is read (disabled identifier is yes, enabled identifier is no), and if the base value available state of attribute C is identified as yes, it means that the change is in the coefficient of the attribute value calculation function of attribute C, i.e. the corresponding function disabled state. By obtaining the original attribute value calculation function expression, updating the coefficient, and the last stored base value of attribute C, the attribute value of attribute C is calculated.

[0087] If the base value available state of attribute C is identified as no, it means that at least one of the attribute values of attributes A and B has changed, at this time, the attribute values of attributes A and B need to be reacquired, and then the base value of attribute C can be calculated according to the attribute values of attributes A and B, and then the attribute value of attribute C is further calculated (corresponding to the split expression of the attribute value calculation function described above). Through the split expression and the storage of the base value, the data processing amount can be further reduced, and the server performance resource consumption can be reduced. In other embodiments, the attribute value of attribute C can also be directly calculated according to the attribute values of attributes A and B based on the complete expression of the attribute value calculation function of attribute C.

[0088] It can be understood that if attributes A or B also have corresponding sub-attributes, the attribute value acquisition process of attributes A or B is the same as that of attribute C.

[0089] The object attribute value acquisition method in the above procedure, when the attribute value acquisition instruction is acquired, determines the target attribute to be processed, reads the storage value available state of the target attribute, and uses the storage value available state to determine whether the attribute value of at least one sub-attribute on which the target attribute depends has changed and whether the coefficient of the attribute value calculation function corresponding to the target attribute has been updated. For the disabled state, i.e. the attribute value of the sub-attribute has changed, the attribute value of the target attribute is calculated in real time by acquiring the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends. For the enabled state, i.e. the attribute value of the sub-attribute has not changed and the coefficient of the attribute value calculation function has not been updated, the stored attribute value is directly acquired. By using the attribute value cache, the attribute value change of the sub-attribute, and the coefficient update of the attribute value calculation function to mark the storage value available state, multiple repeated attribute value reading and repeated calculation are not required for each storage value acquisition, the consumption of server performance resources is reduced, and the data processing efficiency is improved.

[0090] In one embodiment, as shown in FIG. 1, the system includes a server 100 and a plurality of clients 200. The server 100 is connected to the clients 200 through a network 300. The server 100 includes a data storage unit 110 and a data processing unit 120. The data storage unit 110 stores a plurality of attributes and their corresponding attribute value calculation functions. The data processing unit 120 is connected to the data storage unit 110 and is configured to acquire the attribute values of the attributes according to the attribute value acquisition instructions from the clients 200. Figure 6As shown, when the storage value availability state of the target attribute is disabled, the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends are obtained, and the attribute value of the target attribute is calculated according to the attribute value calculation function and the attribute value of the sub-attribute, including steps 610 to 630.

[0091] Step 610: When the storage value availability state of the target attribute is disabled, obtain the attribute value calculation function corresponding to the target attribute and the attribute values ​​of the sub-attributes on which the target attribute depends.

[0092] Step 620: Calculate the initial attribute value of the target attribute according to the attribute value calculation function and the attribute values ​​of the sub-attributes on which the target attribute depends.

[0093] Step 630: Obtain the attribute range constraint function of the target attribute, and update the initial attribute value according to the attribute range constraint function to obtain the attribute value of the target attribute.

[0094] The initial attribute value is calculated directly from the attribute value calculation function and the attribute values ​​of each sub-attribute. Because the calculation result involves multiple coefficient values ​​and multiple sub-attributes, the calculated result may exceed the value range of the target attribute. To avoid invalid attribute values, after the initial attribute value is calculated, the attribute range constraint function of the target attribute is used to update the initial attribute value that exceeds the value range of the target attribute. The result is an attribute value that is within the value range, which improves the validity of the data processing results and ensures the smooth and efficient execution of subsequent processing.

[0095] In one embodiment, Figure 7 As shown, obtaining the attribute range constraint function of the target attribute, updating the initial attribute value according to the attribute range constraint function, and obtaining the attribute value of the target attribute includes steps 710 to 720.

[0096] Step 710: Obtain the attribute range constraint function of the target attribute and determine the boundary range formed by the boundary attribute values.

[0097] Step 720: When the initial attribute value exceeds the boundary range, the boundary attribute value closest to the initial attribute value is used as the attribute value of the target attribute.

[0098] The boundary attribute values ​​that constitute the boundary range include a minimum boundary attribute value and a maximum boundary attribute value. Specifically, when the initial attribute value is less than the minimum boundary attribute value, the minimum boundary attribute value is used as the attribute value of the target attribute. When the initial attribute value is greater than the maximum boundary attribute value, the maximum boundary attribute value is used as the attribute value of the target attribute. When the initial attribute value does not exceed the boundary range, the initial attribute value is used as the attribute value of the target attribute. This processing method not only avoids invalid calculated attribute values, but also achieves the rationalization of attribute values.

[0099] In one embodiment, Figure 8 As shown, the object attribute value acquisition method in the program also includes an attribute value modification process.

[0100] Specifically, for any attribute, the following steps 810 to 830 are executed.

[0101] Step 810: In response to the attribute value modification instruction, determine the attribute corresponding to the attribute value modification instruction.

[0102] Step 820, according to the modification coefficient carried by the attribute modification instruction, the coefficient value of the attribute value calculation function of the attribute is modified, and according to the preset attribute dependency relationship, the parent attribute with a direct dependency relationship and the parent attribute with an indirect dependency relationship with the attribute are obtained in sequence.

[0103] Step 830: recursively mark the storage value availability status of the attribute and each parent attribute of the attribute as disabled.

[0104] Attribute value modification instructions can be directed at any attribute in the game, including low-level and high-level attributes. Specifically, for low-level attributes without sub-attributes, the attribute value modification can be a direct modification of the attribute value. For high-level attributes with one or more sub-attributes, the attribute value modification can be a coefficient modification. The attribute value of the attribute is modified according to the modification parameters carried by the attribute modification instruction. After the modification is completed, the attribute value of the attribute will change. Since the parent attribute with which the attribute has a dependency relationship is related to the attribute value of the sub-attribute, the current attribute value of the parent attribute must also be changed accordingly. It can be understood that the parent attribute can be a directly dependent parent attribute or a parent attribute that is indirectly dependent through one or more intermediate attributes. By recursively marking the available state of the stored value of the attribute and its parent attribute as disabled, it can be ensured that the next calculation will not directly obtain the unupdated data value through the attribute value storage area, ensuring data reliability. At the same time, only marking the state and not performing real-time calculation updates can avoid the repeated calculation of useless data and reduce the consumption of server performance resources.

[0105] In a dependency chain consisting of multi-level attribute dependencies, when the attribute value of an attribute changes, the attribute value of its parent attribute also needs to change, and the attribute value of the parent attribute of the parent attribute also needs to change, and so on, until the attribute at the highest level. Recursive marking means that according to the dependency relationship, when a child attribute is marked as disabled, the storage value availability status of its parent attribute is also marked as disabled, and then the parent attribute is used as a child attribute and marked as disabled in turn until the parent attribute no longer exists. In order to reduce the number of calculations and processing times, after the attribute value of an attribute is modified, the attribute value of itself, its parent attribute, that is, the parent attribute on which it directly depends, and the parent attribute of its parent attribute, that is, the parent attribute on which it indirectly depends, will not be calculated temporarily. Instead, the storage value availability status of the parent attribute of the attribute is recursively marked as disabled.

[0106] This application also provides an application scenario, which applies the object attribute value acquisition method in the above program. Specifically, the application of the object attribute value acquisition method in the program in this application scenario is as follows:

[0107] Take, for example, the acquisition of attribute values ​​for the artificial intelligence (AI) of non-human players in games. Due to the large number of non-human players in games, a large number of AI calculations are required in each frame of the game. Consequently, each calculation requires repeated reading of the attribute values ​​of the character attributes, and there are strong dependencies between the attributes. Because it is a complex, massively multiplayer online game involving multiple non-human players, each server needs to simultaneously support tens of thousands of players, and the game logic relies heavily on attribute systems. For example, luck, as a low-level attribute, affects the probability and rarity of treasure drops, and may also affect higher-level attributes such as evasion rate and hit rate. The luck attribute is dependent on multiple other high-level attributes. If traditional processing methods are used, each time the attribute value of a high-level attribute needs to be obtained, a complete recalculation is required based on the attribute dependencies, involving algorithms for each attribute, calculation of sub-attributes, and even calculation of sub-attributes of sub-attributes.

[0108] like Figure 9 As shown, taking attribute F as an example, when calculating attribute F, it is necessary to rely on attributes C, D, and E; when calculating attribute C, it is necessary to rely on attributes A and B. When applying this solution, after calculating the attribute value of attribute F for the first time, the attribute values ​​of attributes F and C are recorded in the cache. When the attribute F value needs to be obtained again, if the attribute values ​​of attributes A to E have not changed between the two calculations, the calculation is skipped directly and the attribute value of the last cache is used. In addition, when any attribute value of attributes A to E changes, the next time the value of attribute F is obtained, the change will be reflected in attribute F by marking the available status of the stored value.

[0109] Specifically, before implementing the solution, you first need to initialize the attribute framework and first divide the hierarchy of all attributes in the game. To prevent circular dependencies, high-level attributes depend on low-level attributes, and attributes at the same level cannot depend on each other. For example, Figure 10 As shown, the third-level attribute G can depend on the second-level attributes D, E, and F and the first-level attribute C. The second-level attribute D can depend on the first-level attributes A and B. Then, configure the attribute value calculation function for each attribute, as well as each attribute's sub-attributes, that is, the other game attributes that the attribute calculation process depends on. At the same time, it is necessary to record all sub-attributes used in the attribute value calculation function as dependencies. Then, configure the value range constraint function for each attribute. If the attribute value exceeds the constraint boundary, set the attribute value to the boundary value closest to the target value. Finally, mark the storage value of all attributes as disabled.

[0110] In other application scenarios, the storage value available flag can be replaced by a dirty flag. The dirty flag is a flag that indicates whether a game attribute needs to be recalculated. If there is a dirty flag, the game attribute needs to be recalculated according to the attribute value calculation function. If the dirty flag is cleared, the last calculated and stored result value can be used.

[0111] When obtaining an attribute value, the attribute's dirty flag is checked. If the dirty flag is not set, the stored attribute value is returned directly. If the dirty flag is set, the attribute's attribute value calculation function is used to calculate the attribute value. If the calculation involves sub-attribute values, the dirty flag of each sub-attribute is checked and the same process is repeated until the attribute value of each sub-attribute is obtained and the calculation result is obtained. The attribute range constraint function is then used to constrain the calculated attribute value. Finally, the constrained attribute value is saved and the attribute's dirty flag is cleared.

[0112] Modifying attribute values ​​involves three main steps: first, modifying the coefficient of the current attribute value; second, setting the dirty flag for the current attribute; and third, recursively setting the dirty flags for all parent attributes of the current attribute. This solution utilizes a delayed calculation attribute framework based on attribute dependencies. By delaying calculation and caching attribute values, it significantly improves the performance and data processing efficiency of the attribute module, making it suitable for game development.

[0113] In one embodiment, a method for obtaining object attribute values ​​in a program is provided, and the method includes steps 1102 to 1134 .

[0114] Step 1102: respond to the attribute value modification instruction and determine the attribute corresponding to the attribute value modification instruction.

[0115] Step 1104, according to the modification coefficient carried by the attribute modification instruction, modifying the coefficient value of the attribute value calculation function of the attribute, and according to the preset attribute dependency relationship, sequentially obtaining the parent attributes having direct dependency relationship and the parent attributes having indirect dependency relationship with the attribute.

[0116] Step 1106, recursively marking the storage value available state of the attribute and each parent attribute of the attribute as the disabled state.

[0117] Step 1108, in response to the attribute value obtaining instruction, determining the target attribute corresponding to the attribute value obtaining instruction.

[0118] Step 1110, reading the storage value available state of the target attribute.

[0119] Step 1112, when the storage value available state of the target attribute is the enabled state, querying the storage value of the attribute value storage area corresponding to the target attribute to obtain the attribute value of the target attribute.

[0120] Step 1114, when the storage value available state of the target attribute is the base value disabled state, according to the preset attribute dependency relationship, recursively reading the storage value available state of each child attribute directly dependent or indirectly dependent on the target attribute until a target child attribute having the storage value available state as the enabled state or the function disabled state is read.

[0121] Step 1116, when the storage value available state of the target child attribute is the enabled state, querying to obtain the attribute value of the target child attribute, and when the storage value available state of the target child attribute is the function disabled state, obtaining the updated attribute value calculation function of the target child attribute to calculate the attribute value of the target child attribute.

[0122] Step 1118, according to the attribute value of the target child attribute, recursively calculating the attribute values of each to-be-calculated child attribute, wherein the to-be-calculated child attribute refers to the child attribute having the read result as the base value disabled state, and the recursive calculation order is inverse to the recursive reading order.

[0123] Step 1120, obtaining the attribute value calculation function of the target attribute, and calculating the initial attribute value of the target attribute according to the attribute value calculation function of the target attribute and the attribute values of each child attribute of the target attribute.

[0124] Step 1122, when the storage value available state of the target attribute is the function disabled state, obtaining the updated attribute value calculation function of the target attribute and the child attributes of the target attribute.

[0125] Step 1124, querying the storage value of the attribute value storage area corresponding to each child attribute to obtain the attribute value of each child attribute.

[0126] Step 1126, according to the update attribute value calculation function and the attribute value of the sub-attribute on which the target attribute depends, the initial attribute value of the target attribute is calculated.

[0127] Step 1128, the attribute range constraint function of the target attribute is obtained, and the boundary range composed of the boundary attribute values is determined.

[0128] Step 1130, when the initial attribute value exceeds the boundary range, the boundary attribute value closest to the initial attribute value is taken as the attribute value of the target attribute.

[0129] Step 1132, when the initial attribute value does not exceed the boundary range, the initial attribute value is taken as the attribute value of the target attribute.

[0130] Step 1134, the attribute value of the target attribute is updated to the attribute value storage area corresponding to the target attribute, and the storage value available state of the target attribute is marked as enabled.

[0131] It should be understood that, although Figures 2-8 , Figure 11 The steps in the flowchart are displayed in sequence according to the arrows, but these steps are not necessarily executed in the order indicated by the arrows. Unless otherwise specified herein, the execution of these steps has no strict order limitation, and these steps can be executed in other orders. Moreover, Figures 2-8 , Figure 11 At least part of the steps in ,

[0132] In one embodiment, as shown in Figure 12 , an object attribute value obtaining device 1200 in a program is provided, which can be a software module or a hardware module, or a combination of the two as part of a computer device, and specifically includes: a target attribute determination module 1210, a storage value available state reading module 1220, a first attribute value obtaining module 1230, and a second attribute value obtaining module 1240. Wherein:

[0133] The target attribute determination module 1210 is configured to determine the target attribute corresponding to the attribute value obtaining instruction in response to the attribute value obtaining instruction.

[0134] The storage value availability status reading module 1220 is configured to read the storage value availability status of the target attribute. The storage value availability status includes an enabled state and a disabled state. The storage value availability status is enabled when the attribute value of the attribute is updated to the attribute value storage area, and is disabled when the attribute value of at least one sub-attribute on which the attribute depends changes or the coefficient of the attribute value calculation function is updated.

[0135] The first attribute value obtaining module 1230 is configured to query the storage value of the attribute value storage area corresponding to the target attribute to obtain the attribute value of the target attribute when the storage value availability status of the target attribute is enabled.

[0136] The second attribute value acquisition module 1240 is used to obtain the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends when the storage value availability status of the target attribute is disabled, and calculate the attribute value of the target attribute based on the attribute value calculation function and the attribute value of the sub-attribute.

[0137] In one embodiment, the second attribute value acquisition module is also used to identify each sub-attribute that has a direct dependency or indirect dependency relationship with the target attribute when the storage value availability status of the target attribute is a basic value disabled state; recursively read the storage value availability status of each sub-attribute until there is no corresponding sub-attribute for the target sub-attribute or the storage value availability status of each sub-attribute is in an enabled state; respectively obtain the attribute value calculation function of each sub-attribute whose storage value availability status is a disabled state and the target attribute; and according to each attribute value calculation function, calculate the attribute value of each sub-attribute and the attribute value of the target attribute in sequence.

[0138] In one embodiment, the second attribute value acquisition module is further used to update the attribute values ​​of each sub-attribute of the target attribute and the attribute value of the target attribute to the corresponding attribute value storage area, and mark the storage value availability status of each sub-attribute and the target attribute as enabled.

[0139] In one embodiment, the second attribute value acquisition module is also used to obtain the updated attribute value calculation function of the target attribute and the sub-attributes of the target attribute when the storage value availability status of the target attribute is a function disabled state; query the storage value of the attribute value storage area corresponding to each sub-attribute to obtain the attribute value of each sub-attribute; calculate the attribute value of the target attribute based on the updated attribute value calculation function and the attribute value of the sub-attribute on which the target attribute depends.

[0140] In one embodiment, the second attribute value acquisition module is also used to calculate the initial attribute value of the target attribute based on the attribute value calculation function and the attribute values ​​of the sub-attributes on which the target attribute depends, obtain the attribute range constraint function of the target attribute, and update the initial attribute value according to the attribute range constraint function to obtain the attribute value of the target attribute.

[0141] In one embodiment, the second attribute value acquisition module is further used to obtain the attribute range constraint function of the target attribute and determine the boundary range formed by the boundary attribute values; when the initial attribute value exceeds the boundary range, the boundary attribute value closest to the initial attribute value is used as the attribute value of the target attribute.

[0142] In one embodiment, the object attribute value acquisition device in the program also includes an attribute value modification module, which is used to obtain an attribute value modification instruction for any attribute and determine the attribute corresponding to the attribute value modification instruction; modify the coefficient value of the attribute value calculation function of the attribute according to the modification coefficient carried by the attribute modification instruction, and obtain the parent attribute that has a direct dependency relationship with the attribute and the parent attribute that has an indirect dependency relationship in turn according to the preset attribute dependency relationship; recursively mark the storage value available status of the attribute and each parent attribute of the attribute as disabled.

[0143] The object attribute value acquisition device in the above program, upon receiving an attribute value acquisition instruction, determines the target attribute to be processed, reads the target attribute's stored value availability status, and uses the stored value availability status to determine whether the attribute value of at least one sub-attribute on which the target attribute depends has changed and whether the coefficient of the attribute value calculation function corresponding to the target attribute has been updated. For a disabled state, i.e., a change in the attribute value of a sub-attribute, the target attribute's attribute value is calculated in real time by acquiring the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends. For an enabled state, i.e., no change in the attribute value of the sub-attribute and no update in the coefficient of the attribute value calculation function, the stored attribute value is directly acquired. By caching the attribute values ​​and marking the stored value availability status based on changes in the attribute values ​​of the sub-attributes and updates to the coefficients of the attribute value calculation function, the stored attribute value need not be repeatedly read and calculated each time a stored value is acquired, thereby reducing the consumption of server performance resources and improving data processing efficiency.

[0144] For the specific definition of the object attribute value acquisition device in the program, please refer to the definition of the object attribute value acquisition method in the program above, which will not be repeated here. The various modules in the object attribute value acquisition device in the above program can be implemented in whole or in part by software, hardware and their combination. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or can be stored in the memory of the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

[0145] In one embodiment, a computer device is provided. The computer device may be a server, and its internal structure diagram may be as follows: Figure 13As shown in the figure. The computer device includes a processor, a memory and a network interface connected through a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The internal memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store attribute value data. The network interface of the computer device is used to communicate with the external terminal through the network connection. The computer program is executed by the processor to implement an object attribute value acquisition method in a program.

[0146] Those skilled in the art can understand that, Figure 13 The structure shown in the figure is only a block diagram of part of the structure related to the scheme of the present application, and does not constitute a limitation on the computer device to which the scheme of the present application is applied. The specific computer device can include more or fewer components than those shown in the figure, or combine certain components, or have a different component arrangement.

[0147] In one embodiment, a computer device is also provided, including a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the steps in the above method embodiments.

[0148] In one embodiment, a computer readable storage medium is provided, storing a computer program, which is executed by a processor to implement the steps in the above method embodiments.

[0149] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer readable storage medium. When the computer program is executed, it can include the processes of the above-mentioned embodiments. Any reference to memory, storage, database or other medium used in the embodiments provided by the present application can include at least one of non-volatile and volatile memory. Non-volatile memory can include read-only memory (ROM), magnetic tape, floppy disk, flash memory or optical memory, etc. Volatile memory can include random access memory (RAM) or external cache memory. As an illustration but not limitation, RAM can be in various forms, such as static random access memory (SRAM) or dynamic random access memory (DRAM), etc.

[0150] The technical features of the above embodiments can be combined arbitrarily. To make the description concise, not all possible combinations of the technical features in the above embodiments are described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.

[0151] The above embodiments merely represent several implementation methods of the present application. While the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of the present invention. It should be noted that a person skilled in the art could make various modifications and improvements without departing from the spirit of the present application, all of which fall within the scope of protection of the present application. Therefore, the scope of protection of the present patent application shall be determined by the appended claims.

Claims

1. A method for obtaining an object attribute value in a program, the method comprising: In response to an attribute value acquisition instruction, determining a target attribute corresponding to the attribute value acquisition instruction; Reading the storage value availability state of the target attribute, wherein the storage value availability state includes an enabled state and a disabled state. The storage value availability state is enabled when the attribute value of the attribute is updated to the attribute value storage area, and is disabled when the attribute value of at least one sub-attribute on which the attribute depends changes or the coefficient of the attribute value calculation function of the attribute is updated. The enabled state is used to indicate that the current storage value of the target attribute is used to represent the attribute value of the target attribute, and the disabled state is used to indicate that the current storage value of the target attribute is not used to represent the attribute value of the target attribute. When the storage value availability state of the target attribute is enabled, querying the storage value of the attribute value storage area corresponding to the target attribute to obtain the attribute value of the target attribute; When the storage value availability state of the target attribute is disabled, obtain the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends, and calculate the attribute value of the target attribute based on the attribute value calculation function and the attribute value of the sub-attribute.

2. The method according to claim 1, characterized in that The disabled state includes a function disabled state, and the function disabled state refers to a disabled state corresponding to when the coefficient of the attribute value calculation function corresponding to the attribute is updated; When the storage value availability state of the target attribute is a disabled state, obtaining an attribute value calculation function corresponding to the target attribute, and calculating the attribute value of the target attribute according to the attribute value calculation function and the attribute values ​​of the sub-attributes on which the target attribute depends includes: When the storage value available state of the target attribute is a function disabled state, obtaining an updated attribute value calculation function of the target attribute and a sub-attribute of the target attribute; Querying the storage value of the attribute value storage area corresponding to each of the sub-attributes to obtain the attribute value of each of the sub-attributes; The attribute value of the target attribute is calculated according to the updated attribute value calculation function and the attribute values ​​of the sub-attributes on which the target attribute depends.

3. The method according to claim 1, characterized in that The disabled state includes a basic value disabled state and a function disabled state. The basic value disabled state refers to a disabled state corresponding to when the attribute value of at least one sub-attribute on which the attribute depends changes; When the storage value availability state of the target attribute is disabled, obtaining an attribute value calculation function corresponding to the target attribute and an attribute value of a sub-attribute on which the target attribute depends, and calculating the attribute value of the target attribute based on the attribute value calculation function and the attribute value of the sub-attribute on which the target attribute depends includes: When the storage value availability state of the target attribute is the base value disabled state, recursively read the storage value availability state of each sub-attribute that the target attribute directly or indirectly depends on according to the preset attribute dependency relationship until a target sub-attribute whose storage value availability state is the enabled state or the function disabled state is read; When the storage value availability state of the target sub-attribute is enabled, query and obtain the attribute value of the target sub-attribute; when the storage value availability state of the target sub-attribute is function disabled, obtain the updated attribute value calculation function of the target sub-attribute, and calculate and obtain the attribute value of the target sub-attribute; Recursively calculating the attribute value of each to-be-calculated sub-attribute based on the attribute value of the target sub-attribute; wherein the to-be-calculated sub-attribute is a sub-attribute whose reading result is a base value disabled state, and the order of the recursive calculation is the reverse of the order of the recursive reading; An attribute value calculation function of the target attribute is obtained, and an attribute value of the target attribute is calculated according to the attribute value calculation function of the target attribute and the attribute values ​​of each sub-attribute of the target attribute.

4. The method according to claim 3, characterized in that After obtaining the attribute value calculation function of the target attribute and calculating the attribute value of the target attribute according to the attribute value calculation function of the target attribute and the attribute values ​​of each sub-attribute of the target attribute, the method further includes: The attribute value of each sub-attribute of the objective function and the attribute value of the target attribute are respectively updated to the corresponding attribute value storage area, and the storage value availability status of each sub-attribute and the target attribute is marked as enabled.

5. The method according to any one of claims 1 to 4, characterized in that Calculating the attribute value of the target attribute according to the attribute value calculation function and the attribute values ​​of the sub-attributes on which the target attribute depends includes: Calculating an initial attribute value of the target attribute according to the attribute value calculation function and the attribute values ​​of the sub-attributes on which the target attribute depends; An attribute range constraint function of the target attribute is obtained, and the initial attribute value is updated according to the attribute range constraint function to obtain the attribute value of the target attribute.

6. The method according to claim 5, characterized in that The acquiring of the attribute range constraint function of the target attribute and updating the initial attribute value according to the attribute range constraint function to obtain the attribute value of the target attribute includes: Obtaining an attribute range constraint function of the target attribute and determining a boundary range formed by boundary attribute values; When the initial attribute value exceeds the boundary range, the boundary attribute value closest to the initial attribute value is used as the attribute value of the target attribute.

7. The method according to claim 1, characterized in that The method further comprises: For any attribute, perform the following steps: In response to an attribute value modification instruction, determining an attribute corresponding to the attribute value modification instruction; Modifying the coefficient value of the attribute value calculation function of the attribute according to the modification coefficient carried by the attribute modification instruction, and sequentially obtaining the parent attribute that has a direct dependency relationship and the parent attribute that has an indirect dependency relationship with the attribute according to the preset attribute dependency relationship; The storage value availability status of the attribute and each parent attribute of the attribute is recursively marked as disabled.

8. A device for obtaining object attribute values ​​in a program, characterized in that: The device comprises: a target attribute determination module, configured to respond to an attribute value acquisition instruction and determine a target attribute corresponding to the attribute value acquisition instruction; a storage value availability status reading module, configured to read the storage value availability status of the target attribute, wherein the storage value availability status includes an enabled state and a disabled state. The storage value availability status is enabled when the attribute value of the attribute is updated to the attribute value storage area, and is disabled when the attribute value of at least one sub-attribute on which the attribute depends changes or the coefficient of the attribute value calculation function of the attribute is updated; the enabled state is used to indicate that the current storage value of the target attribute is used to represent the attribute value of the target attribute, and the disabled state is used to indicate that the current storage value of the target attribute is not used to represent the attribute value of the target attribute; A first attribute value acquisition module is configured to query a storage value in an attribute value storage area corresponding to the target attribute to obtain the attribute value of the target attribute when the storage value availability state of the target attribute is enabled; The second attribute value acquisition module is used to obtain the attribute value calculation function corresponding to the target attribute and the attribute value of the sub-attribute on which the target attribute depends when the storage value availability state of the target attribute is disabled, and calculate the attribute value of the target attribute based on the attribute value calculation function and the attribute value of the sub-attribute.

9. The device according to claim 8, characterized in that The second attribute value acquisition module is also used to obtain the update attribute value calculation function of the target attribute and the sub-attributes of the target attribute when the storage value availability status of the target attribute is the function disabled state; query the storage value of the attribute value storage area corresponding to each sub-attribute to obtain the attribute value of each sub-attribute; calculate the attribute value of the target attribute based on the update attribute value calculation function and the attribute value of the sub-attribute on which the target attribute depends.

10. The device according to claim 8, characterized in that The second attribute value acquisition module is further configured to, when the storage value availability state of the target attribute is the base value disabled state, recursively read the storage value availability states of each sub-attribute on which the target attribute directly or indirectly depends, according to a preset attribute dependency relationship, until a target sub-attribute whose storage value availability state is the enabled state or the function disabled state is read; when the storage value availability state of the target sub-attribute is the enabled state, query and obtain the attribute value of the target sub-attribute; when the storage value availability state of the target sub-attribute is the function disabled state, obtain the updated attribute value calculation function of the target sub-attribute and calculate the attribute value of the target sub-attribute; based on the attribute value of the target sub-attribute, recursively calculate the attribute value of each sub-attribute to be calculated; wherein the sub-attribute to be calculated is the sub-attribute whose reading result is the base value disabled state, and the order of the recursive calculation is the reverse of the recursive order of the recursive reading; obtain the attribute value calculation function of the target attribute, and calculate the attribute value of the target attribute based on the attribute value calculation function of the target attribute and the attribute values ​​of each sub-attribute of the target attribute.

11. The device according to claim 10, characterized in that The second attribute value acquisition module is further used to update the attribute values ​​of each sub-attribute of the objective function and the attribute value of the target attribute to the corresponding attribute value storage area, and mark the storage value availability status of each sub-attribute and the target attribute as enabled.

12. The device according to any one of claims 8 to 11, characterized in that The second attribute value acquisition module is further used to calculate the initial attribute value of the target attribute based on the attribute value calculation function and the attribute values ​​of the sub-attributes on which the target attribute depends; obtain the attribute range constraint function of the target attribute, and update the initial attribute value according to the attribute range constraint function to obtain the attribute value of the target attribute.

13. The device according to claim 12, characterized in that The second attribute value acquisition module is further used to obtain the attribute range constraint function of the target attribute and determine the boundary range composed of boundary attribute values; when the initial attribute value exceeds the boundary range, the boundary attribute value closest to the initial attribute value is used as the attribute value of the target attribute.

14. The device according to claim 8, characterized in that The object attribute value acquisition device in the program further includes an attribute value modification module; The attribute value modification module is used to perform the following steps for any attribute: responding to an attribute value modification instruction, determining the attribute corresponding to the attribute value modification instruction; modifying the coefficient value of the attribute value calculation function of the attribute according to the modification coefficient carried by the attribute modification instruction, and obtaining the parent attribute that has a direct dependency relationship and the parent attribute that has an indirect dependency relationship with the attribute in sequence according to the preset attribute dependency relationship; and recursively marking the storage value availability status of the attribute and each parent attribute of the attribute as disabled.

15. A computer device comprising a memory and a processor, wherein the memory stores a computer program, wherein: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 7 are implemented.

16. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 7 are implemented.

Citation Information

Patent Citations

  • Building a data query visualization

    WO2016163992A1