Object generation method and apparatus
By obtaining and utilizing the initial component properties and unit properties in the component bar to generate virtual objects, the problem of complex and time-consuming object generation in existing technologies is solved, and efficient object generation is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- ZHUHAI KINGSOFT ONLINE GAME TECH CO LTD
- Filing Date
- 2023-05-25
- Publication Date
- 2026-04-24
AI Technical Summary
The process of generating virtual objects in existing technologies is complex and time-consuming, especially when components, hierarchical relationships, or nesting relationships change, requiring reloading and adjustment, resulting in low object generation efficiency.
By obtaining the component list of the target component, recording its initial component attributes and the unit attributes of the unit to be loaded, extracting the target component attributes and generating the target object based on these attributes, the loss of loading information caused by component or unit changes is avoided, and the generation of the target object is determined directly based on the target component attributes.
It greatly reduces the time spent generating target objects, improves the efficiency of object generation, and avoids the loss of loading information due to component or unit changes.
Smart Images

Figure CN116617664B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an object generation method. This application also relates to an object generation apparatus, a computing device, and a computer-readable storage medium. Background Technology
[0002] With the continuous development of virtual technology, more and more fields are applying virtual object generation technology. The needs of different fields for virtual objects are becoming more and more complex and diverse, making the process of virtual object generation increasingly complex. For example, in some scenarios where virtual characters need to be generated, the components loaded on the virtual characters have a hierarchical structure or are nested with each other.
[0003] In related technologies, when generating objects, components need to be loaded onto the target object according to hierarchical or nested relationships. If the components, hierarchical relationships, or nested relationships change, the components need to be reloaded according to the changed information. If the loading result does not meet the requirements, the components need to be adjusted and then reloaded.
[0004] As can be seen, the process of generating objects described above is very complex and time-consuming, resulting in very low efficiency in object generation. Summary of the Invention
[0005] In view of this, embodiments of this application provide an object generation method. This application also relates to an object generation apparatus, a computing device, and a computer-readable storage medium, to address the technical deficiencies existing in the prior art.
[0006] According to a first aspect of the embodiments of this application, an object generation method is provided, including:
[0007] Get the component bar of the target component, where the component bar records the initial component properties of the target component and the unit properties of the unit to be loaded corresponding to each loading position of the target component in the pre-configured way;
[0008] Extract the target component properties from the component list. The target component properties are determined based on the initial component properties and the unit properties.
[0009] Based on the target component's properties, generate a target object that loads the target component.
[0010] According to a second aspect of the embodiments of this application, an object generation apparatus is provided, comprising:
[0011] The acquisition module is configured to acquire the component bar of the target component, wherein the component bar records the initial component properties of the target component and the pre-configured unit properties of the units to be loaded corresponding to each loading position of the target component;
[0012] The extraction module is configured to extract the target component attributes of the target component from the component bar, wherein the target component attributes are determined based on the initial component attributes and the unit attributes;
[0013] The generation module is configured to generate a target object that loads the target component based on the target component's properties.
[0014] According to a third aspect of the embodiments of this application, a computing device is provided, including: a memory and a processor;
[0015] The memory is used to store computer-executable instructions, and the processor is used to implement the object generation method provided in the first aspect of the embodiments of this application when executing the computer-executable instructions.
[0016] According to a fourth aspect of the embodiments of this application, a computer-readable storage medium is provided, storing computer instructions that, when executed by a processor, implement the object generation method provided in the first aspect of the embodiments of this application.
[0017] The object generation method provided in this application obtains the component bar of the target component, extracts the target component attributes from the component bar, and generates a target object for loading the target component based on the target component attributes. By using the component bar to record the initial component attributes of the target component and the pre-configured unit attributes of each loading position of the target component, it avoids the loss of all corresponding loading information due to changes in components or units. Furthermore, the target component attributes are determined based on the initial component attributes and unit attributes; that is, if a unit changes, the component attributes of the target component will change. Ultimately, the target object for loading the target component is generated based on the target component attributes, without needing to load first, adjust units, and then load again. It only needs to determine whether to generate a target object for loading the target component based on the target component attributes, greatly saving the time spent on target object generation and improving the efficiency of object generation. Attached Figure Description
[0018] Figure 1 This is a framework diagram of an object processing system provided in one embodiment of this application;
[0019] Figure 2 This is a flowchart of an object generation method provided in an embodiment of this application;
[0020] Figure 3 This is a flowchart illustrating the processing steps of an object generation method provided in an embodiment of this application;
[0021] Figure 4 This is a schematic diagram of the structure of an object generation device provided in an embodiment of this application;
[0022] Figure 5This is a structural block diagram of a computing device provided in one embodiment of this application. Detailed Implementation
[0023] Many specific details are set forth in the following description to provide a full understanding of this application. However, this 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 spirit of this application; therefore, this application is not limited to the specific embodiments disclosed below.
[0024] The terminology used in one or more embodiments of this application is for the purpose of describing particular embodiments only and is not intended to limit the scope of one or more embodiments of this application. The singular forms “a,” “the,” and “the” used in one or more embodiments of this application and in 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 this application refers to and includes any or all possible combinations of one or more associated listed items.
[0025] It should be understood that although the terms first, second, etc., may be used to describe various information in one or more embodiments of this application, such information should not be limited to these terms. These terms are only used to distinguish information of the same type from one another. For example, first may also be referred to as second without departing from the scope of one or more embodiments of this application, and similarly, second may also be referred to as first. Depending on the context, the word "if" as used herein may be interpreted as "when," "when," or "in response to a determination."
[0026] First, the terms and concepts involved in one or more embodiments of this application will be explained.
[0027] Pointers, also known as memory addresses, are variables used to store memory addresses. Within the same CPU (Central Processing Unit) architecture, different types of pointer variables occupy the same amount of storage space, while variables storing data occupy different amounts of storage space depending on the data type. With pointers, you can manipulate not only the data itself but also the addresses of the variables storing that data.
[0028] In gaming scenarios, especially in fighting or mission-based games, players often need to customize their character's appearance. This includes adorning characters with clothing, shoes, accessories, or weapons; these can be collectively referred to as decorations or components. Components can be further edited, such as adding badges to clothing, stickers to shoes, or gems to weapons; these can be collectively called items or loading units.
[0029] In fighting and mission-based games, different loading units have different unit attributes. These different unit attributes affect the character's appearance attributes, which directly determine the character's gameplay performance and impact the player experience. Current technology adds loading units by recording their unit attributes, then adding the loading unit to a component (the component's loading slot records the loading unit), and then applying the component to the character's appearance. The process involves iterating through the unit attributes of loading units loaded in each slot of the component to obtain the component's attributes, and then iterating through the attributes of all components applied to the character's appearance to obtain the character's attributes. It's clear that obtaining character attributes requires a complex process involving adding loading units, applying components, and attribute iteration. If a loading unit is updated, this process needs to be repeated, resulting in very low efficiency in character generation.
[0030] To address the aforementioned issues, this application provides an object generation method. The method involves obtaining the component bar of a target component, where the component bar records the initial component attributes of the target component and the pre-configured unit attributes of the units to be loaded corresponding to each loading position of the target component. The method extracts the target component attributes from the component bar, where the target component attributes are determined based on the initial component attributes and the unit attributes. Based on the target component attributes, a target object for loading the target component is generated. By using the component bar to record the initial component attributes of the target component and the pre-configured unit attributes of the units to be loaded corresponding to each loading position of the target component, the method avoids the loss of all corresponding loading information due to changes in the component or unit. Furthermore, since the target component attributes are determined based on the initial component attributes and the unit attributes, changes in the unit attributes will cause changes in the component attributes of the target component. The method generates the target object for loading the target component based solely on the target component attributes, eliminating the need to load and adjust the units before loading. It only requires determining whether to generate the target object based on the target component attributes, significantly reducing the time required for target object generation and improving the efficiency of object generation.
[0031] This application provides a method for generating objects. This application also relates to an object generation apparatus, a computing device, and a computer-readable storage medium, which will be described in detail in the following embodiments.
[0032] See Figure 1 , Figure 1 This illustration shows a framework diagram of an object processing system according to an embodiment of the present application. The object processing system includes a server and a client.
[0033] The client is used to display the target object and execute games such as fighting games and mission-based games.
[0034] On the server side, the component bar of the target component is obtained. The component bar records the initial component attributes of the target component and the unit attributes of the units to be loaded corresponding to each loading position of the target component in the pre-configured data. The target component attributes of the target component are extracted from the component bar. The target component attributes are determined based on the initial component attributes and the unit attributes. Based on the target component attributes, a target object for loading the target component is generated. The target object is then sent to the client for display.
[0035] It is worth noting that the object generation method provided in the embodiments of this application is generally executed by the server. However, in other embodiments of this application, the client may also have similar functionality to the server, thereby executing the object generation method provided in the embodiments of this application. In other embodiments, the object generation method provided in the embodiments of this application may also be executed jointly by the client and the server.
[0036] The solution in this application involves obtaining the component bar of a target component, where the component bar records the initial component attributes of the target component and the pre-configured unit attributes of the units to be loaded corresponding to each loading position of the target component. The target component attributes of the target component are extracted from the component bar, where the target component attributes are determined based on the initial component attributes and the unit attributes. Based on the target component attributes, a target object for loading the target component is generated. By using the component bar to record the initial component attributes of the target component and the pre-configured unit attributes of the units to be loaded corresponding to each loading position of the target component, the loss of all corresponding loading information due to changes in the component or unit is avoided. Furthermore, since the target component attributes are determined based on the initial component attributes and the unit attributes, changes in the unit will cause changes in the component attributes of the target component. Ultimately, the target object for loading the target component is generated based on the target component attributes, eliminating the need to load first, adjust the unit, and then load again. It only requires determining whether to generate a target object based on the target component attributes, significantly saving the time spent generating the target object and improving the efficiency of object generation.
[0037] Figure 2 A flowchart of an object generation method according to an embodiment of this application is shown, which specifically includes the following steps:
[0038] Step 202: Obtain the component bar of the target component, where the component bar records the initial component properties of the target component and the unit properties of the units to be loaded corresponding to each loading position of the target component in the pre-configured manner.
[0039] In one or more embodiments of this application, a component bar of the target component can be obtained. The component bar records the initial component attributes of the target component and the unit attributes of the unit to be loaded corresponding to each loading position of the target component in a pre-configured manner. Further attribute extraction is performed based on the component bar, which avoids the situation where all the loading information corresponding to the component or unit is lost due to changes in the component or unit, and provides a data foundation for the generation of the target object.
[0040] Specifically, the target component refers to the component model that needs to be loaded onto the target object. The component model can be two-dimensional or three-dimensional, and can be a decoration that decorates the target object. For example, it can be clothing, shoes, accessories, equipment, etc. worn by the character in the game scene.
[0041] The target component has multiple loading slots, each capable of loading different units. For example, weapons have three fixed loading slots, shoes have two, while jewelry may not have any, meaning jewelry cannot be loaded with any units. The specific unit to be loaded in each slot can be pre-configured by the user. The target component itself possesses certain component properties, which can be referred to as its initial component properties. The units to be loaded corresponding to each loading slot on the target component also have certain unit properties. After the units are loaded onto the target component, these unit properties also apply to the component properties.
[0042] A unit to be loaded refers to a unit model that can be loaded onto a target component. This unit model can be two-dimensional or three-dimensional. For example, it can be a badge worn on clothing in a game scene, a sticker on shoes, or a gem embedded in weapons and equipment.
[0043] The component slots are the locations on a target object where target components will be loaded. They record the initial component properties of the target component and the unit properties of the units to be loaded corresponding to each pre-configured loading position of the target component. Typically, a target object can have multiple component slots, meaning multiple target components can be loaded onto it, and the specific loading position of each target component on the target object can be different. For example, in a game scene, a player's character can have multiple equipment slots, such as weapon slots, gauntlet slots, and shoe slots. A type of equipment can only be loaded into a specific type of equipment slot, such as a weapon in the weapon slot and shoes in the shoe slot.
[0044] The initial component properties of a target component refer to the attribute information that the target component possesses in its initial state. These can be the target object's magic value, attack value, defense value, etc., representing the component's performance parameters when performing a specific task. Typically, the initial state of a target component means that no units to be loaded have been loaded. Therefore, the initial component properties of a target component refer to the most basic attributes that the target component possesses in its initial state without any units to be loaded. However, in some practical applications, some loaded units can be permanently embedded in the target component. These loaded units have higher priority, and their unit attributes can be used as the initial component properties of the target component.
[0045] Therefore, in one possible implementation of this application embodiment, before performing step 202, the following steps may also be performed:
[0046] Identify the initial unit attributes of the loaded units on the target component; determine the initial component attributes of the target component based on the initial unit attributes; obtain the unit attributes of the units to be loaded corresponding to each loading position of the pre-configured target component; record the initial component attributes and unit attributes in the component bar of the target component.
[0047] Specifically, initial unit attributes refer to the basic attribute information possessed by the loaded units on the target component. These can be the magic value, attack value, defense value, etc., representing the performance parameters of the loaded units when performing a specific task. Loaded units already on the target component have high priority, and in practical applications, these units are unlikely to be modified. Therefore, to reduce computational efficiency, the initial component attributes of the target component can be determined to include the unit attributes possessed by the loaded units. Since the inherent attributes of the target component are fixed, the unit attributes possessed by the loaded units can be directly used as the initial component attributes of the target component, or the inherent attributes of the target component can be superimposed with the unit attributes of the loaded units to obtain the initial component attributes of the target component.
[0048] To identify the initial unit attribute of a loaded unit on a target component, one can traverse all loading positions on the target component and check whether a loaded unit exists on each loading position. If a loaded unit exists on a loading position of the target component, the initial unit attribute of that loaded unit is read. Specifically, the unit attributes of each loaded unit can be pre-stored, and after identifying which unit is the loaded unit, its unit attribute can be read directly.
[0049] Since the component bar also needs to record the unit attributes of the units to be loaded corresponding to each loading position of the pre-configured target component, it is necessary to obtain them and then record the obtained initial component attributes and the obtained unit attributes into the component bar of the target component. This makes the information recorded in the component bar more accurate and improves the computational efficiency of subsequent steps in generating the target object.
[0050] After recording the initial component properties of the target component and the unit properties of the units to be loaded corresponding to each loading position of the target component into the component bar, the component bar of the target component can be stored on the target object or stored in a certain storage space. When there is a need to generate the target object, the component bar of the target component can be obtained from the corresponding location.
[0051] Step 204: Extract the target component properties from the component list, where the target component properties are determined based on the initial component properties and the cell properties.
[0052] In one or more embodiments of this application, after obtaining the component bar of the target component, since the component bar records the initial component attributes of the target component and the pre-configured unit attributes of each loading position of the target component corresponding to the unit to be loaded, the target component attributes of the target component can be determined based on the initial component attributes and unit attributes. Therefore, the target component attributes of the target component can be extracted from the component bar. The target component attributes determine the object attributes of the target object, and thus determine the target object to be generated. By extracting the target component attributes from the component bar to determine whether to generate the target object of the target component, the time spent generating the target object is greatly reduced, and the efficiency of generating the object is improved.
[0053] Specifically, the target component properties can be determined based on the initial component properties and the unit properties of the units to be loaded corresponding to each loading position of the target component. Typically, when there is a need to load units, users can directly add the unit properties of the units to be loaded to the loading position in the component bar. By overlaying the initial component properties of the target component with the unit properties of the units to be loaded, the target component properties of the target component can be obtained.
[0054] However, in practical applications, components and loading units have different levels, and the difference in levels affects whether the unit to be loaded can be loaded onto the target component. For example, in a game scene, gems can be loaded onto weapons and equipment, but badges cannot be loaded onto weapons and equipment because the level of the weapons and equipment cannot match the level of the badges.
[0055] To improve the accuracy of loading the unit to be loaded onto the target component, in one implementation of this application embodiment, step 204 can be specifically implemented in the following way:
[0056] Identify the unit-level information of the unit to be loaded and the component-level information of the target component; if the unit-level information and component-level information meet the preset loading conditions, extract the unit attributes of the unit to be loaded from the component bar; based on the initial component attributes and unit attributes, determine the target component attributes of the target component.
[0057] Specifically, level information characterizes the loading priority of target components and units to be loaded, including grade and level. The higher the level information, the higher the loading priority of the target component or unit to be loaded, meaning it can be loaded onto other target components / units to be loaded. To obtain accurate target component attributes, it is first necessary to identify the unit-level information of the unit to be loaded and the component-level information of the target component. The specific identification process can be to directly extract the level information carried by the unit to be loaded and the target component, or it can be to use level identification tools, such as deep learning-based level identification networks, to identify the unit-level information of the unit to be loaded and the component-level information of the target component. The specific identification process is not limited here.
[0058] Preset loading conditions refer to pre-defined criteria for determining whether a unit to be loaded can be loaded into the target component. These preset loading conditions can be a match between the component level information of the target component and the unit level information of the unit to be loaded. Specifically, this could be that the grade of the unit to be loaded is greater than or equal to the grade of the target component, or that the loading level of the unit to be loaded is greater than or equal to the loading level of the target component. In another implementation of this application, the preset loading condition can also be: determining whether the level information of the unit to be loaded is within the loadable level range of the target component; wherein the loadable level range of the target component includes: the upper limit and lower limit of the level of the unit to be loaded.
[0059] If the unit-level and component-level information meet the preset loading conditions, it means that the unit to be loaded is allowed to be loaded onto the target component. Therefore, the unit attributes of the unit to be loaded can be extracted from the component list. Then, based on the initial component attributes of the target component and the unit attributes of the unit to be loaded, the target component attributes of the target component are determined. Specifically, determining the target component attributes of the target component based on the initial component attributes and unit attributes can be achieved by directly superimposing the initial component attributes and unit attributes.
[0060] This embodiment determines the target component attributes of the target component based on the initial component attributes and unit attributes only when the unit-level information and component-level information meet the preset loading conditions. This avoids the problem of mismatch between the unit to be loaded and the target component and improves the accuracy of loading the unit to be loaded onto the target component.
[0061] In one implementation of this application, after the steps of identifying the cell-level information of the unit to be loaded and the component-level information of the target component, the object generation method provided in this application may further include the following steps:
[0062] If the cell-level information of the unit to be loaded and the component-level information of the target component do not meet the preset loading conditions, the initial component property is determined to be the target component property of the target component.
[0063] Specifically, if the unit-level information of the unit to be loaded and the component-level information of the target component do not meet the preset loading conditions, it means that the unit to be loaded cannot be loaded onto the target component. Therefore, the unit attributes of the unit to be loaded cannot be superimposed on the attributes of the target component. Thus, the initial component attributes of the target component can be directly determined as the target component attributes of the target component. By applying this embodiment, the inaccuracy of the target component attributes of the target component caused by level mismatch can be reduced.
[0064] Step 206: Generate a target object for loading the target component based on the target component's properties.
[0065] In one or more embodiments of this application, after obtaining the target component attributes of the target component, since the target component attributes determine the object attributes of the target object, the target object to be generated can be determined. By extracting the target component attributes from the component bar to determine whether to generate the target object that loads the target component, the time spent generating the target object is greatly saved and the efficiency of generating the object is improved.
[0066] Specifically, a target object refers to a virtual object generated based on the attributes of a target component. For example, in a game scenario, a target object can be a virtual character image generated based on equipment and its enhancements. In practical applications, different target objects have different object attributes. During the generation of a target object, the object attributes of the target object can be determined first based on the attributes of the target component, and then the target object loading the target component can be generated based on the object attributes of the target object.
[0067] The target object's object attributes can be obtained by overlaying the target component's attributes onto the target object's basic attributes. These attributes can be numerical values or ranges. The generation criteria are determined based on these attributes, such as whether the target object meets a threshold or falls within a certain range. If so, the target object meets the generation criteria and can be generated as a target object for loading the target component. Specifically, generating the target object for loading the target component can employ image rendering techniques. The target object's layer is rendered at the bottom layer, then the target component is rendered, and finally, the unit to be loaded is rendered at the target component's loading position. Alternatively, the target object, target component, and unit to be loaded can be combined in the backend before being displayed on the frontend.
[0068] Specifically, in one implementation of this application embodiment, step 206 can be implemented as follows: based on the target component attributes, load the unit to be loaded into the corresponding loading position of the target component; load the target component that loads the unit to be loaded into the target object.
[0069] The target component's properties determine whether the target component, after loading the unit to be loaded, meets the requirements. If it does, the unit to be loaded is loaded into the corresponding loading position of the target component, resulting in an updated target component. Then, the updated target component with the loaded unit is loaded into the target object, thus obtaining a target object that meets the requirements. This eliminates the need for a complex rendering process; loading the unit to be loaded, the target component, and the target object before rendering improves the efficiency of generating the target object.
[0070] In the above solution, the unit attributes in the component bar are used to generate the target component attributes of the target component, and then the target object is generated. Normally, this attribute is fixed. If this attribute changes dynamically, the target object will keep changing under certain special tasks. In practical applications, it is desirable to dynamically change the unit attributes while keeping the target object's attributes unchanged during certain special tasks. For example, in a game scenario, if a player wants to strengthen the equipment bar during combat, how can we modify the equipment bar's attributes while ensuring that the attributes applied to the equipment bar remain unchanged during the current combat and are not released prematurely?
[0071] To address the aforementioned issues, in one implementation of this application, after executing step 204, the object generation method provided by this application may further perform the following steps:
[0072] Generate a target pointer based on the target component's properties; load the target pointer into the target object and increment the target pointer's reference count.
[0073] Specifically, a target pointer is a pointer loaded onto a target object, pointing to the memory space of the current target component's property. The target object references the target component's property through the target pointer. The target pointer's reference count is a variable used to record the number of times the target pointer is referenced, providing a basis for the use and destruction of the pointer and the property information it points to.
[0074] Specifically, generating a target pointer can be achieved by: obtaining the target object and creating a target pointer on it; the target pointer records information including its reference count and the target attribute it points to, with the memory space of the target attribute independent of the component bar, and the initial value of the target attribute being empty; obtaining the target component attribute recorded in the component bar and copying this information to the storage space of the target attribute pointed to by the target pointer, thus generating a target pointer containing the target component attribute information and its own reference count. After generating the target pointer, it can be loaded into the target object, and its reference count can be incremented. Specifically, the target object can read the target component attribute pointed to by the target pointer through the loaded target pointer; after generating the target pointer, its reference count is set to 0; when the target object needs to load the target component attribute, the current target pointer is loaded into the target object, and its reference count is incremented.
[0075] After generating the target pointer, you can use it to manage the lifecycle of the current target component's properties, avoiding memory overflow caused by not destroying the properties in time after use.
[0076] By isolating the generation process of target object attributes from that of target component attributes through pointers, dynamic modification of the target object by the target component and unit is realized; this avoids the direct impact of the target component on the target object's attributes when the target component is tampered with, which could lead to errors in the generated result of the target object; it improves the accuracy and stability of target object generation and enhances the scalability of the target object generation process in terms of dynamic modification.
[0077] In practical applications, there are specific tasks that require the target object's attributes to be fixed during the execution of the task. However, the attributes of the target component used to determine the target object's attributes may change during the execution of the specific task, and it is necessary to synchronize the changes in the target component's attributes to the target object's attributes after the specific task is completed. Accordingly, in one implementation of this application embodiment, after executing step 206, the object generation method provided by this application may further execute the following steps:
[0078] In response to the execution instruction of the target task, the target task is executed on the target object, and the reference count of the target pointer is incremented. The target task is a task with fixed object attributes.
[0079] Specifically, the execution instruction for the target task can be generated when there is a need to call the target object to execute the target task. It can be initiated by the user or automatically triggered. For example, the execution instruction for the target task can be the instruction for a virtual character object in a web game to enter battle.
[0080] In response to the execution command of the target task, increasing the reference count of the target pointer means that after receiving the execution command of the target task, the reference count of the pointer loaded on the target object is increased to prevent the reference count of the pointer currently loaded on the target object from dropping to 0 due to other changes, which would cause the target object to stop applying the current attribute, and ultimately cause the target object to change its attribute during the execution of tasks with fixed object attributes. Specifically, a change in the attribute of the target object means that the attribute of the target component referenced by the current target object changes, causing the attribute of the target object to also change. For example, in a game scenario, a player modifies the equipment and equipment bonus item configuration, or upgrades one or more pieces of equipment and equipment bonus items, causing changes to the virtual character object.
[0081] For example, when this method is applied to a game scenario, the reference count is incremented by 1 when the target pointer is generated and loaded onto the virtual character object. At this time, the reference count of the target pointer is 1, and the virtual character object references the equipment attribute corresponding to the target pointer. When the virtual character object performs a task with fixed equipment attributes, the reference count is incremented by 1, and the reference count of the target pointer is 2. The virtual character object continues to reference the target component attribute corresponding to the target pointer.
[0082] By increasing the reference count of the target pointer when the target object performs a task with fixed object properties, the target component property corresponding to the current target object enters a state that is not easily destroyed, thus preventing the target object from no longer applying the current property when the reference count reaches 0, thereby improving the stability of the target object property when performing a task with fixed object properties.
[0083] In practical applications, once the target task is completed, it is no longer required that the target object retain its current attributes. At this point, it is necessary to remove the unchanging state of the current target component attributes corresponding to the target object to avoid interfering with the target object generation process after the task is completed. Accordingly, in one implementation of this application embodiment, the object generation method may further include the following steps:
[0084] In response to the target task's termination instruction, decrease the target pointer's reference count.
[0085] Specifically, the target task is a task with fixed object attributes. The end command of the target task can be initiated by the user or automatically triggered after certain end conditions are met. For example, it can be that it has been executed for a fixed duration or has obtained a specific output result. For example, the end command of the target task can be the exit command sent to the virtual character after the battle ends in a web game.
[0086] Specifically, the decrease in the target pointer's reference count should be equal to the increase in the target pointer's reference count when responding to a task execution command that requires the target object to fix its object attributes. For example, in a game scenario, when a virtual character object fixes its equipment attributes in response to a combat command, the target pointer's reference count increases by 1. During combat, the virtual character object continuously references its current equipment attributes, causing the currently used equipment attributes to enter a fixed state during combat. When the virtual character object ends the fixed equipment attributes in response to a disengagement command, the target pointer's reference count decreases by 1, causing the virtual character object's currently corresponding equipment attributes to leave the fixed state and return to their pre-combat state. Here, the increase and decrease in the target pointer's reference count are the same value, and the specific value is not limited; it can be any integer.
[0087] By responding to the end command of the target task and reducing the reference count of the target pointer, the reference count of the target pointer loaded by the target object is restored to the state before the target task was executed after the target task is completed, thus avoiding interference with subsequent operations on the target object.
[0088] In practical applications, when the properties of a target component change, the target object can no longer reference the current component properties and needs to be replaced. Accordingly, in one implementation of this application, after the step of incrementing the reference count of the target pointer, the object generation method provided by this application can further perform the following steps:
[0089] Decrease the reference count of the target pointer when the target component's properties change.
[0090] Specifically, the change in the target component attributes refers to the generation of modified target component attributes due to changes in the unit to be loaded. For example, the change in target component attributes may be due to the rollback of the target component attribute information recorded on the component bar, and the generation of modified target component attributes based on the initial component attributes of the target component currently recorded on the component bar and the attributes of the unit to be loaded recorded on the component bar. The memory space where the modified target component attributes are located is different from the memory space where the target component attributes were located before the change. After generating the modified target component attributes, a modified target pointer is generated based on the modified target component attributes and its initial value is set.
[0091] Specifically, when a target component's property changes, the decrease in the target pointer's reference count should be equal to the increase in the target pointer's reference count when the target pointer is loaded into the target object. For example, the target pointer's reference count increases by 1 when the target pointer is loaded into the target object, and decreases by 1 when the target component's property changes. Here, the increase and decrease in the target pointer's reference count are the same value; the specific value is not limited and can be any integer.
[0092] By reducing the reference count of the target pointer when the target property changes, the target object stops referencing the target component property before the change. Since the target object also uses a mechanism of incrementing and decrementing the target pointer reference count to control the lifecycle of the target component property when executing and ending tasks related to the fixed object property, the target object will not clear the reference count to 0 before ending the tasks related to the fixed object property. This allows the target object to continue using the property before the change until the tasks related to the fixed object property end, and then stop referencing the target component property before the change after the tasks related to the fixed object property end.
[0093] In practical applications, when the target object ends referencing the target component's attributes before the change, it is necessary to destroy the target pointer and the target component's attributes before the change to avoid memory overflow issues. Accordingly, in one implementation of this application embodiment, after the step of reducing the reference count of the target pointer, the object generation method provided in this application embodiment can further perform the following steps:
[0094] If the reference count drops to 0, delete the target pointer and the target component properties.
[0095] Specifically, the target pointer reference count can decrease to 0 if: the target pointer is applied to the target object and the target component property changes; or the target pointer is applied to the target object, the target object performs a target task with fixed object properties, the target component property changes, and the target object ends the target task after the target component property changes.
[0096] Deleting the target pointer and target component properties can destroy the target pointer and the target component property information pointed to by the target pointer in the memory space, and clear the corresponding information in the component bar.
[0097] For example, in a game scenario, when the target pointer is generated and loaded onto the target object, the reference count is incremented by 1. At this time, the reference count of the target pointer is 1, and the target object references the target component property corresponding to the current target pointer. If the target component property changes, the reference count is decremented by 1, the target pointer reference count decreases to 0, and the target object stops referencing the target component property corresponding to the target pointer.
[0098] For example, in another game scenario, when the target pointer is generated and loaded onto the target object, the reference count is incremented by 1. At this point, the target pointer's reference count is 1, and the target object references the target component property corresponding to the target pointer. When the target object performs a task to fix the target component property, the reference count is incremented by 1, and the target pointer's reference count is 2. The target object continues to reference the target component property corresponding to the target pointer. When the target component property changes, the reference count is decremented by 1, and the target pointer's reference count decreases to 1. At this point, the target pointer's reference count has not yet decreased to 0, so the target object can continue to reference the target component property corresponding to the target pointer. When the target object finishes the task of fixing the target component property, the reference count is decremented by 1, and the target pointer's reference count decreases to 0. The target object then stops referencing the target component property corresponding to the target pointer.
[0099] Furthermore, after the reference count of the target pointer currently loaded into the target object is reduced to 0, the memory space is searched to identify the target pointers that have not been loaded by the target object, and the target pointers that have not been loaded by the target object are loaded onto the target object. The target pointers that have not been loaded by the target object are the target pointers that point to the changed target component attribute information after the target component attributes have been changed.
[0100] By deleting the target pointer and the previous target component property it points to when the target pointer reference count decreases to 0, memory leaks are avoided when the target object ends its reference to the current target component property and the previous target component property information is not cleared.
[0101] In practical applications, the target object needs to temporarily unload the unit attributes of the units to be loaded recorded in the target column during a specific unit unloading task. Accordingly, in one implementation of this application embodiment, after executing step 206, the object generation method provided by this application can further perform the following steps:
[0102] In response to the execution command of the unit unload task, remove the unit attribute of the unit to be loaded from the component bar and unload the unit to be loaded from the target component.
[0103] Specifically, a unit unloading task refers to a task that temporarily prevents a unit from being loaded onto a target component. For example, in a web game, this might involve disabling the effects of equipment bonus items embedded in equipment during specific gameplay modes. The unit unloading task stipulates that a target component cannot load a particular unit. Therefore, upon receiving the execution instruction for the unit unloading task, the unit attribute of the unit to be loaded needs to be removed from the component list, and the unit to be loaded needs to be unloaded from the target component. Unloading the unit to be loaded from the target component means only deleting the unit to be loaded, while retaining log and other record information, including unit information loaded on the target component before the unloading command was executed. For example, in a game scene, when a virtual character enters a specific scene requiring the unloading of all equipment bonus items, all equipment bonus item attributes are deleted from the equipment list, and all equipment bonus items are removed from the equipment, but certain record information is retained. This record information includes, but is not limited to, generating log information, using variables to record changes, and retaining record bits in the equipment list or on the equipment to record the equipment bonus items loaded before the unloading was executed, providing basic information for reloading equipment bonus items after leaving the scene.
[0104] By unloading the units to be loaded from the target component, the determination of the target component's properties is not affected by the unit properties when responding to the execution command of the unit unloading task, thus achieving the effect of temporarily unloading the unit.
[0105] However, after the unit unloading task is completed, when the target object is restored to its state before unloading, the unit that was unloaded during the task execution needs to be loaded back onto the target component. Accordingly, in one implementation of this application embodiment, the object generation method may further perform the following steps:
[0106] In response to the end command of the unit unloading task, the unit properties of the unit to be loaded are re-added in the component bar.
[0107] Adding the unit attribute of the unit to be loaded again in the component bar can determine the unit to be loaded based on the unit information loaded on the target component before executing the uninstall command, and then load the unit to be loaded onto the target component. By adding the unit attribute of the unit to be loaded again in the component bar, the uninstalled unit can be reloaded onto the target component.
[0108] The following is in conjunction with the appendix Figure 3 Taking the object generation method provided in this application as an example of generating character objects in web games, the object generation method will be further explained. Figure 3 The flowchart of an object generation method according to an embodiment of this application is shown, and the specific steps include steps 302 to 322.
[0109] Step 302: Identify the equipment enhancement items loaded on the target equipment.
[0110] The target equipment is the target component in the above embodiments, and the equipment enhancement item is the unit to be loaded in the above embodiments.
[0111] Step 304: Generate the initial attributes of the target equipment based on the equipment bonus items already loaded on the target equipment and the attributes of the target equipment itself.
[0112] Step 306: Obtain the equipment slots of the target equipment, which record the initial attributes of the target equipment and the attribute information of the pre-configured equipment bonus items.
[0113] Step 308: If the grade of the equipment enhancement item recorded in the equipment slot is greater than or equal to the grade of the target equipment, load the attributes of the equipment enhancement item recorded in the equipment slot onto the target equipment.
[0114] Step 310: Extract the target equipment attributes recorded in the equipment inventory from the information recorded in the equipment inventory.
[0115] The target equipment attributes recorded in the equipment slot are generated based on the initial attributes of the target equipment in the equipment slot and the attribute information of the equipment bonus items loaded thereon.
[0116] Step 312: Generate a target pointer based on the target equipment attributes and initialize the target pointer reference count.
[0117] Step 314: Load the target pointer into the character object and increment the reference count of the target pointer by 1.
[0118] Step 316: Generate a character object based on the target equipment attributes pointed to by the target pointer.
[0119] Step 318: In response to the engagement command, the target pointer's reference count is incremented by 1.
[0120] Step 320: In response to the disengage command, the reference count of the target pointer is decremented by 1.
[0121] Step 322: Delete the target pointer if the target pointer reference count has decreased to 0.
[0122] During the character object generation process, the initial attributes of the target equipment are formed by identifying the equipment bonus items already loaded on the target equipment. This preserves the equipment bonus items already loaded on the equipment, reducing the efficiency of determining the target equipment attributes due to repeated loading. By loading equipment bonus items that meet the level requirements for loading onto the target equipment, the optimal loading of equipment bonus items is achieved, thereby achieving the optimal generation of the target equipment attributes. By separating the target equipment attributes currently referenced by the character object from the target equipment attributes recorded in the equipment slot, and by incrementing the reference count of the target pointer after entering combat mode, the reference count is kept greater than 0 regardless of whether the equipment bonus items change. This ensures that the character object's attributes do not change during combat, preventing the character from using incorrect attributes in battle due to changes in equipment and equipment bonus items, thus improving the game experience.
[0123] Corresponding to the above method embodiments, this application also provides an object generation apparatus, such as... Figure 4 As shown, Figure 4 This illustration shows a schematic diagram of an object generation apparatus according to an embodiment of the present application. The apparatus includes:
[0124] The acquisition module 402 is configured to acquire the component bar of the target component, wherein the component bar records the initial component attributes of the target component and the pre-configured unit attributes of the units to be loaded corresponding to each loading position of the target component;
[0125] Extraction module 404 is configured to extract target component attributes of a target component from the component bar, wherein the target component attributes are determined based on initial component attributes and unit attributes;
[0126] Module 406 is configured to generate a target object that loads the target component based on the target component's properties.
[0127] Optionally, the object generation apparatus further includes: a recording module;
[0128] The recording module is configured to identify the initial unit attributes of the loaded units on the target component; determine the initial component attributes of the target component based on the initial unit attributes; obtain the unit attributes of the units to be loaded corresponding to each loading position of the target component in a pre-configured manner; and record the initial component attributes and unit attributes in the component bar of the target component.
[0129] Optionally, the extraction module 404 is further configured to identify the unit-level information of the unit to be loaded and the component-level information of the target component; if the unit-level information and the component-level information meet the preset loading conditions, extract the unit attributes of the unit to be loaded from the component bar; and determine the target component attributes of the target component based on the initial component attributes and unit attributes.
[0130] Optionally, the extraction module 404 is also configured to determine the initial component attribute as the target component attribute of the target component if the unit-level information and component-level information do not meet the preset loading conditions.
[0131] Optionally, the generation module 406 is further configured to load the unit to be loaded into the corresponding loading position of the target component based on the target component attributes; and to load the target component that loads the unit to be loaded into the target object.
[0132] Optionally, the object generation apparatus further includes: a pointer module;
[0133] The pointer module is configured to generate a target pointer based on the target component's properties; load the target pointer into the target object; and increment the target pointer's reference count.
[0134] Optionally, the pointer module is also configured to execute the target task against the target object in response to the execution instructions of the target task, and to increment the reference count of the target pointer, wherein the target task is a task with fixed object properties.
[0135] Optionally, the pointer module is also configured to decrement the reference count of the target pointer in response to the end instruction of the target task.
[0136] Optionally, the pointer module is also configured to reduce the reference count of the target pointer if the target component's properties change.
[0137] Optionally, the pointer module is also configured to delete the target pointer and the target component property when the reference count is reduced to 0.
[0138] Optionally, the object generation apparatus further includes: an unloading module;
[0139] The unload module is configured to remove the cell attribute of the cell to be loaded from the component bar and unload the cell to be loaded from the target component in response to the execution command of the cell unload task.
[0140] Optionally, the unloading module is also configured to re-add the cell properties of the cell to be loaded in the component bar in response to the end command of the cell unloading task.
[0141] By using the component bar to record the initial component attributes of the target component and the pre-configured unit attributes of each loading position of the target component, the loading information of the corresponding unit is not lost due to changes in the component or unit. Furthermore, the target component attributes are determined based on the initial component attributes and unit attributes. That is to say, if the unit changes, the component attributes of the target component will change. Finally, the target object for loading the target component is generated based on the target component attributes. It is not necessary to load first, then adjust the unit, and then load again. It is only necessary to decide whether to generate the target object for loading the target component based on the target component attributes, which greatly saves the time spent on target object generation and improves the efficiency of object generation.
[0142] The above is an illustrative scheme of an object generation apparatus according to this embodiment. It should be noted that the technical solution of this object generation apparatus and the technical solution of the object generation method described above belong to the same concept. For details not described in detail in the technical solution of the object generation apparatus, please refer to the description of the technical solution of the object generation method described above.
[0143] Figure 5 A structural block diagram of a computing device 500 according to an embodiment of this application is shown. The components of the computing device 500 include, but are not limited to, a memory 510 and a processor 520. The processor 520 is connected to the memory 510 via a bus 530, and a database 550 is used to store data.
[0144] The computing device 500 also includes an access device 540, which enables the computing device 500 to communicate via one or more networks 560. Examples of these networks include Public Switched Telephone Network (PSTN), Local Area Network (LAN), Wide Area Network (WAN), Personal Area Network (PAN), or combinations of communication networks such as the Internet. The access device 540 may include one or more of any type of wired or wireless network interface (e.g., a Network Interface Controller (NIC)), such as an IEEE 802.11 Wireless Local Area Network (WLAN) wireless interface, a Wi-MAX (Worldwide Interoperability for Microwave Access) 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.
[0145] In one embodiment of this application, the aforementioned components of the computing device 500 and Figure 5 Other components, not shown, can also be connected to each other, for example, via a bus. It should be understood that... Figure 5 The block diagram of the computing device shown is for illustrative purposes only and is not intended to limit the scope of this application. Those skilled in the art can add or replace other components as needed.
[0146] Computing device 500 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 personal computers (PCs). Computing device 500 can also be a mobile or stationary server.
[0147] The processor 520 is used to execute computer-executable instructions that implement the steps of the object generation method described above.
[0148] The above is an illustrative scheme of a computing device according to this embodiment. It should be noted that the technical solution of this computing device and the technical solution of the object generation method described above belong to the same concept. For details not described in detail in the technical solution of the computing device, please refer to the description of the technical solution of the object generation method described above.
[0149] An embodiment of this application also provides a computer-readable storage medium storing computer instructions that, when executed by a processor, are used to implement the object generation method described above.
[0150] The above is an illustrative scheme of a computer-readable storage medium according to this embodiment. It should be noted that the technical solution of this storage medium and the technical solution of the object generation method described above belong to the same concept. For details not described in detail in the technical solution of the storage medium, please refer to the description of the technical solution of the object generation method described above.
[0151] The foregoing has described specific embodiments of this 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 that shown in the embodiments and may still achieve the desired results. Furthermore, the processes depicted in the drawings do not necessarily require the specific or sequential order shown to achieve the desired results. In some embodiments, multitasking and parallel processing are also possible or may be advantageous.
[0152] The computer instructions include computer program code, which may be in the form of source code, object code, executable file, or some intermediate form. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording media, USB flash drive, portable hard drive, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electrical carrier signals, telecommunication signals, and software distribution media, etc. It should be noted that the content included in the computer-readable medium may be appropriately added to or subtracted according to the requirements of legislation and patent practice in the jurisdiction. For example, in some jurisdictions, according to legislation and patent practice, computer-readable media may not include electrical carrier signals and telecommunication signals.
[0153] It should be noted that, for the sake of simplicity, the foregoing method embodiments are all described as a series of actions. However, those skilled in the art should understand that this application is not limited to the described order of actions, as some steps may be performed in other orders or simultaneously according to this application. Furthermore, those skilled in the art should also understand that the embodiments described in the specification are preferred embodiments, and the actions and modules involved are not necessarily essential to this application.
[0154] In the above embodiments, the descriptions of each embodiment have different focuses. For parts not described in detail in a certain embodiment, please refer to the relevant descriptions of other embodiments.
[0155] The preferred embodiments disclosed above are merely illustrative of this application. The optional embodiments do not exhaustively describe all details, nor do they limit the invention to the specific implementations described. Clearly, many modifications and variations can be made based on the content of this application. These embodiments are selected and specifically described in this application to better explain the principles and practical applications of this application, thereby enabling those skilled in the art to better understand and utilize this application. This application is limited only by the claims and their full scope and equivalents.
Claims
1. An object generation method, characterized in that, include: Obtain the component bar of the target component, wherein the component bar records the initial component attributes of the target component and the pre-configured unit attributes of the units to be loaded corresponding to each loading position of the target component; From the component list, extract the target component attribute of the target component, wherein the target component attribute is determined based on the initial component attribute and the unit attribute; Based on the target component attributes, a target pointer is generated, the target pointer is loaded into the target object, and the reference count of the target pointer is incremented; Based on the target component attributes, a target object for loading the target component is generated; In response to the execution instruction of the target task, the target task is executed for the target object, and the reference count of the target pointer is incremented, wherein the target task is a task with fixed object attributes.
2. The object generation method according to claim 1, characterized in that, Before retrieving the component bar of the target component, the following is also included: Identify the initial cell attributes of the loaded cells on the target component; Based on the initial unit attributes, determine the initial component attributes of the target component; Obtain the unit attributes of the units to be loaded corresponding to each loading position of the target component that are pre-configured; Record the initial component attributes and the unit attributes in the component column of the target component.
3. The object generation method according to claim 1 or 2, characterized in that, The step of extracting the target component attributes from the component bar includes: Identify the unit-level information of the unit to be loaded and the component-level information of the target component; If the unit-level information and the component-level information meet the preset loading conditions, extract the unit attributes of the unit to be loaded from the component bar. Based on the initial component attributes and the unit attributes, the target component attributes of the target component are determined.
4. The object generation method according to claim 3, characterized in that, After identifying the unit-level information of the unit to be loaded and the component-level information of the target component, the method further includes: If the unit-level information and the component-level information do not meet the preset loading conditions, the initial component attribute is determined to be the target component attribute of the target component.
5. The object generation method according to claim 1, characterized in that, The step of generating a target object that loads the target component based on the target component attributes includes: Based on the target component attributes, the unit to be loaded is loaded into the corresponding loading position of the target component; The target component of the unit to be loaded is loaded into the target object.
6. The object generation method according to claim 1, characterized in that, Also includes: In response to the termination instruction of the target task, the reference count of the target pointer is reduced.
7. The object generation method according to any one of claims 1 and 6, characterized in that, After incrementing the reference count of the target pointer, the method further includes: If the target component's properties change, reduce the reference count of the target pointer.
8. The object generation method according to claim 7, characterized in that, After reducing the reference count of the target pointer, the method further includes: If the reference count decreases to 0, delete the target pointer and the target component property.
9. The object generation method according to claim 1, characterized in that, After generating the target object for loading the target component based on the target component attributes, the method further includes: In response to the execution instruction of the unit unloading task, the unit attribute of the unit to be loaded is deleted from the component bar, and the unit to be loaded is unloaded from the target component.
10. The object generation method according to claim 9, characterized in that, Also includes: In response to the end command of the unit unloading task, the unit attributes of the unit to be loaded are re-added in the component bar.
11. An object generation apparatus, characterized in that, include: The acquisition module is configured to acquire the component bar of the target component, wherein the component bar records the initial component attributes of the target component and the pre-configured unit attributes of the units to be loaded corresponding to each loading position of the target component; based on the target component attributes, a target pointer is generated, the target pointer is loaded into the target object, and the reference count of the target pointer is incremented; The extraction module is configured to extract target component attributes of the target component from the component bar, wherein the target component attributes are determined based on the initial component attributes and the unit attributes; The generation module is configured to generate a target object that loads the target component based on the target component attributes; in response to the execution instruction of the target task, execute the target task on the target object and increment the reference count of the target pointer, wherein the target task is a task with fixed object attributes.
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 implement the object generation method according to any one of claims 1-10 when executing the computer-executable instructions.
13. A computer-readable storage medium, characterized in that, The device stores computer instructions that, when executed by a processor, implement the object generation method according to any one of claims 1-10.
Citation Information
Patent Citations
Method and equipment for displaying game role equipment
CN111265875A