Role state control method and device, equipment and medium

CN121550676BActive Publication Date: 2026-08-11GUANGZHOU KULUO SHUJIE TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-11-25
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

在传统技术中,游戏逻辑与动画渲染紧耦合,游戏逻辑判定多依赖动画系统的关键帧或视觉表现,但是这种方式导致判定易受动画播放速度、跳帧等因素影响,在不同性能设备上,玩家的交互体验难以一致;并且传统技术在交互时机的监听机制上也有不足,现有技术通常是在整段动画中持续进行碰撞检测或状态查询,这会带来巨大的计算开销,对于短暂又精确的交互时机就会缺乏高效且可靠的监听手段

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121550676B_ABST
    Figure CN121550676B_ABST
Patent Text Reader

Abstract

This application relates to a method, apparatus, and medium for controlling a character's state. The method includes: responding to a resonance attack event triggered by an enemy character casting a resonance skill; starting a duration timer; binding resonance light effect resources to the enemy character's character model; updating the animation playback effect of the resonance light effect resources; obtaining the corresponding animation time window; determining a first timestamp and a second timestamp within the animation time window; activating the enemy character's first resonance state when the duration timer reaches the first timestamp but does not exceed the second timestamp; listening for resonance input events during the duration of the first resonance state; and responding to the resonance input event, reclaiming the resonance light effect resources and updating the enemy character's state to the second resonance state. This application achieves real-time feedback and dynamic state updates in game interaction, optimizes resource management, and improves game operating efficiency, thereby enhancing the game's immersion, strategy, and player experience smoothness.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device, and medium for controlling a role's state. Background Technology

[0002] In the gaming industry, especially in large-scale role-playing and action games, achieving precise interactive control between character states and complex animation events has always been a technical challenge. In traditional technologies, game logic and animation rendering are tightly coupled, with game logic decisions relying heavily on keyframes or visual presentations from the animation system. However, this approach makes decisions susceptible to factors such as animation playback speed and frame skipping, resulting in inconsistent player experiences across different performance devices. Furthermore, traditional technologies are inadequate in their mechanisms for monitoring interaction timing. Existing technologies typically involve continuous collision detection or state queries throughout the entire animation, which incurs significant computational overhead and lacks efficient and reliable methods for monitoring brief and precise interaction moments.

[0003] In terms of game resource management, the traditional approach is to simply bind the playback and destruction of special effects to the animation duration, which cannot be dynamically adjusted according to the actual interaction results. This can easily lead to problems such as memory leaks or display errors. In addition, in the process of synchronizing and switching complex game character states, the state switching in traditional technology is scattered in multiple places in the code, which can easily lead to state conflicts or desynchronization.

[0004] It is evident that existing technologies still have many shortcomings in controlling character states in complex game situations, and a new technical solution is urgently needed to address these issues. Summary of the Invention

[0005] The purpose of this application is to solve the above-mentioned problems by providing a role state control method and corresponding apparatus, devices, non-volatile readable storage media, and computer program products.

[0006] According to one aspect of this application, a role state control method is provided, comprising: In response to the resonance attack event triggered by an enemy character casting a resonance skill in the game scene, a preset duration timer is started, and the resonance light effect resource is bound to the enemy character's character model; The animation playback effect of the resonant light effect resource is updated in real time, the animation time window corresponding to the animation playback effect is obtained, and the first timestamp and the second timestamp in the animation time window are determined, wherein the second timestamp is later than the first timestamp; When the duration timer is detected to have reached the first timestamp but not exceeded the second timestamp, the first resonance state of the hostile character is activated accordingly, and resonance input events are listened for during the duration of the first resonance state. In response to the resonant input event, the resonant light effect resources are recovered, and the character state of the hostile character is updated from the first resonant state to the second resonant state.

[0007] According to another aspect of this application, a role state control device is provided, comprising: The resonant response module is configured to: respond to the resonant attack event triggered by the enemy character casting a resonant skill in the game scene, start a preset duration timer, and bind the resonant light effect resource to the enemy character's character model; The window acquisition module is configured to: update the animation playback effect of the resonant light effect resource in real time, acquire the animation time window corresponding to the animation playback effect, and determine the first timestamp and the second timestamp in the animation time window, wherein the second timestamp is later than the first timestamp; The state activation module is configured to: when the duration timer is detected to have reached the first timestamp but not exceeded the second timestamp, activate the first resonance state of the hostile character accordingly, and listen for resonance input events during the duration of the first resonance state; The state update module is configured to: respond to the resonant input event, reclaim the resonant light effect resources, and update the enemy character's state from the first resonant state to the second resonant state.

[0008] According to another aspect of this application, a role status control device is provided, including a central processing unit and a memory, wherein the central processing unit is used to invoke and run a computer program stored in the memory to perform the steps of the method described in this application.

[0009] According to another aspect of this application, a non-volatile readable storage medium is provided, which stores a computer program implemented according to the role state control method in the form of computer-readable instructions, wherein the computer program, when invoked by a computer, executes the steps included in the method.

[0010] According to another aspect of this application, a computer program product is provided, comprising a computer program / instructions that, when executed by a processor, implement the steps of the method.

[0011] This application achieves stable control and updates of game character states within the game scene. By monitoring the release of resonant skills by enemy characters in the game scene, it can accurately identify and trigger corresponding resonant attack events. Simultaneously, a preset duration timer is activated and resonant light effect resources are bound to the enemy character model, enabling the game to respond in real-time to the enemy character's special skill releases. This ensures timely updates to the game state and synchronization of visual feedback, improving the real-time nature and accuracy of game interaction. This guarantees that the game can react quickly when skills are triggered, providing players with a smoother and more realistic gaming experience. Furthermore, this application ensures tight coupling between animation effects and game logic by updating the animation playback effects of resonant light effect resources in real-time and obtaining the corresponding animation time window, determining the first and second timestamps. This timestamp determination mechanism allows the game to precisely control the activation and switching of character states within a specific time range, avoiding state judgment errors caused by differences in animation playback speed. This allows the game to accurately grasp time nodes during animation playback, thereby achieving a more precise and consistent interactive experience.

[0012] Furthermore, this application activates the first resonant state of the opposing character when the duration timer reaches the first timestamp but does not exceed the second timestamp, and listens for resonant input events during the duration of this state. This mechanism optimizes the efficiency of system resource utilization by limiting the time interval of state activation, avoiding unnecessary state listening during ineffective time periods, thereby improving game performance and responsiveness, ensuring that the game can efficiently process player input during critical time periods, and enhancing the game's interactivity and smoothness. Finally, this application recovers resonant light effect resources by responding to the resonant counterattack operation and updates the opposing character's state to the second resonant state, achieving efficient resource management and smooth transition of character states. This not only avoids resource waste but also ensures the consistency and stability of game states, preventing potential resource leaks or state desynchronization issues. It allows the game to quickly clear unnecessary resources and update character states after the player completes a specific operation, preparing for subsequent game progress, thereby improving the overall performance and stability of the game. Attached Figure Description

[0013] Figure 1 This application provides an exemplary network architecture; Figure 2 This is a flowchart illustrating one embodiment of the role state control method of this application; Figure 3 This is a schematic block diagram of the role state control device of this application; Figure 4 This is a schematic diagram of the structure of a role status control device used in this application. Detailed Implementation

[0014] The technical solution of this application can be widely applied to various network architectures to adapt to different types and scales of game applications. In a network architecture such as... Figure 1 In the typical network architecture shown, the player's terminal device accesses the game service cluster via the network. This cluster consists of multiple game servers 81. A microservice architecture manages and maintains the operational resources of these game servers 81, providing multiple service instances. Each service instance is responsible for a different service. For example, some service instances can be used to maintain the front-end service for the terminal device 80 to access the game, while others can each be responsible for the gameplay service of one or more maps in the game's world map, providing players with corresponding map dungeon gameplay. The player's terminal device 80 has a computer program product installed and running according to the character interaction control method of this application, or the terminal device can be connected to a cloud server container, where the computer program product runs. After the computer program product runs, it accesses the game service cluster, enabling the player to control their in-game character through the terminal device, interact with various service instances of the game, and explore and interact with different maps.

[0015] Each service instance can maintain a real-time connection with the player's terminal device 80 via the network, handling various events and interactions in the game, such as player character movement, attacks, and item usage. The server provides necessary data support to the terminal device to ensure smooth game operation. This data includes, but is not limited to, map model datasets, which contain map model data for each map and resource model data for its scene resources, such as buildings, player character models, non-player character models, and various other creature or non-creature models, used by the terminal device 80 to render and generate corresponding real-time images. Based on the received map model dataset, the terminal device 80 can generate high-quality real-time images and display them in the graphical user interface, presenting the corresponding game scene to the player. Players obtain visual information about the game through real-time images of the game scene, thereby implementing gameplay.

[0016] This application not only applies to the gaming experience for single players but can also be extended to multiplayer online game environments. In multiplayer games, multiple players' (users') terminal devices simultaneously connect to the game service cluster. Each service instance needs to handle interaction requests from multiple players and update the game status in real time. This application ensures that each player receives consistent and high-quality character interaction control in multiplayer game scenarios, while optimizing the resource utilization of servers and terminal devices and improving the overall operational efficiency of the game system.

[0017] In an exemplary application scenario of this application, consider a massively multiplayer online role-playing game (MMORPG) where players can freely explore a vast open-world map and control their character to enter various specific dungeon maps to complete quests. In this game, the player character can frequently switch between different maps, such as switching from a bustling city map to a mysterious dungeon map, or from one room to another.

[0018] This application can be exemplified as a game client or work in conjunction with a server. During game execution, especially in scenarios involving character skill interactions, this application provides a character state control method that can be applied to client-side games, server-side games, or a collaborative environment of both. Taking a common online multiplayer game as an example, the game client is responsible for handling player input, character animation rendering, and real-time interaction with the game world, while the server manages the overall game state, synchronization between multiple players, and complex logical calculations. In this architecture, when an enemy character casts a resonant skill, the client receives the corresponding skill casting command and triggers a series of processing flows. The resonant light effect resource, as a visual feedback element, needs to be precisely bound to the enemy character's model and updated in real-time with the character's actions. This process may include the game engine's access to the model's skeletal nodes, dynamic loading and release of the light effect resource, and synchronization with the character's world transformation matrix.

[0019] As one exemplary implementation of this application, the game engine first monitors the skill casting command of the enemy character to determine whether it is a resonance skill. After confirmation, the client reads the predefined light effect attachment points of the character model and starts a preset duration timer corresponding to the resonance skill. Subsequently, the resonance light effect resource is bound to the designated position of the character model and is rendered and updated in real time with the character's actions. During this process, the game engine continuously monitors the progress of the timer. When the preset time window is reached, the enemy character's special state is activated, and the player's resonance counterattack operation is monitored.

[0020] The fundamental concepts involved in this application include resonance skills, resonance light effect resources, preset duration timers, and character state management. A resonance skill is a game skill with special effects, usually accompanied by unique visual effects and time-sensitive interactive windows. Resonance light effect resources are special effect resources used to visually represent the effects of resonance skills, which need to be precisely bound and synchronized with the character model. Preset duration timers are used to control the duration of resonance skills and interactive windows to ensure the accurate execution of game logic. Character state management refers to controlling and synchronizing the switching of characters between different game states to ensure game stability and player experience.

[0021] Please see Figure 2 The role state control method of this application, in some embodiments, includes the following steps: Step S3100: In response to the resonance attack event triggered by the enemy character casting a resonance skill in the game scene, start a preset duration timer and bind the resonance light effect resource to the enemy character's character model.

[0022] In some role-playing games or action games, players typically experience the game world through their in-game characters, exploring or engaging in combat. These game environments often include a series of enemy characters, serving as elements of the player's experience. When a player encounters an enemy character, a battle ensues. The game environment displays various combat-related elements, such as health bars representing the player and enemy characters' progress, and other dynamic information about the battle can be visualized through various other means. In this application, "enemy character" refers to a character other than the player character; therefore, enemy characters can be various non-player characters (NPCs) or other player characters from opposing factions. Enemy characters may trigger combat with the player character within the game environment. During this combat, enemy characters may unleash a variety of predefined skills to enrich the player's experience. When an enemy character uses a resonance skill, a corresponding resonance attack event can be triggered.

[0023] In one implementation, a resonance skill is a powerful skill triggered by an enemy character. This powerful skill deals significant damage to the player character, but simultaneously, during the enemy character's use of the resonance skill, they expose a vulnerability that the player character can exploit. Thus, while the player character can dodge the powerful skill, they are also provided with a high-risk, but potentially high-reward, opportunity to exploit this vulnerability. When an enemy character uses a resonance skill, a corresponding resonance attack event is triggered. Upon detecting this event, the game client verifies whether the skill is a resonance-effect skill. This can be done by checking the skill's unique identifier or a specific flag in the skill data. Once confirmed as a resonance skill, a series of predefined operations are executed.

[0024] First, the game engine starts a preset timer. The duration of this timer is pre-set according to the game design requirements and can be determined through parameters in the game configuration file or skill data. The timer's purpose is to provide a time reference for the effect of the resonance skill, ensuring that the skill's effect occurs and disappears within the predetermined time range. Next, the resonance light effect resource is bound to the enemy character's model. This involves several sub-operations: First, the game engine accesses the character model's skeletal node data to determine predefined light effect attachment points. These attachment points are usually specified during the character model design phase to ensure that the light effect resource can be correctly aligned with specific parts of the character model. For example, when the resonance skill's effect is triggered based on an enemy character, the light effect attachment point can be set to be located on the chest skeletal node of that enemy character's model. Then, the resonance light effect resource is loaded from the resource manager.

[0025] The resonant light effect resources in this application can be pre-loaded or dynamically loaded as needed, depending on the game's resource management strategy. The loaded resonant light effect resources can include textures, particle systems, and animation sequences, used to visually represent the effects of resonant skills. After the resonant light effect resources are loaded, the game engine binds them to the light effect attachment points of the character model. This can be achieved by setting the initial position, orientation, and scale of the light effect resources to match the corresponding parts of the character model. Furthermore, the light effect resources can be associated with the world transformation matrix of the character model to ensure that when the character model moves or rotates, the resonant light effect resources can synchronously update their position and orientation, maintaining consistency with the character model.

[0026] In one implementation, the game engine notifies the rendering system about newly added lighting resources so that they can be displayed correctly in subsequent rendering cycles. This may include adding the resonant lighting resources to the rendering queue and setting corresponding rendering states and parameters such as blending mode and rendering order.

[0027] In one implementation, the game engine utilizes various optimization techniques, such as using an object pooling pattern to manage instances of lighting resources to avoid performance overhead caused by frequent resource creation and destruction; or using spatial partitioning technology to monitor and bind lighting effects only to enemy characters within the visible area to reduce unnecessary computation.

[0028] In one implementation, the system records the binding relationship between the resonant light effect resources and the character model so that these resources can be accurately updated and recycled in subsequent steps. This includes adding references or pointers to the bound light effect resource instances in the character model's data structure, or recording the association information with the character model in the light effect resource manager.

[0029] Step S3200: Update the animation playback effect of the resonant light effect resource in real time, obtain the animation time window corresponding to the animation playback effect, and determine the first timestamp and the second timestamp in the animation time window, wherein the second timestamp is later than the first timestamp.

[0030] After binding the resonant light effect resources to the enemy character models, in order for the player character to be able to obtain the status change progress of the enemy character when releasing resonant skills in real time, the game interface needs to update the animation playback effect of the resonant light effect resources in real time to ensure that the visual feedback is synchronized with the game logic. The game engine periodically obtains the current playback progress of the resonant light effect resources by calling the preset animation update interface, and determines the current frame or time position of the animation by accessing the animation controller or timeline object. When using a keyframe-based animation system, it queries the index or timestamp of the currently playing keyframe. The animation playback effect of the resonant light effect resources is the dynamic visual change presented by the visual effect resources associated with the resonant skill during game runtime. This effect includes the flickering of light and shadow, the gradation of color, the expansion or contraction of shape, etc., which can enhance the visual expression and immersion of the game. The animation playback effect is controlled by the game engine's animation system and rendered according to the preset time sequence and keyframe data. When an enemy character casts a resonance skill, the light effect on its character model can be a circle shrinking inward, accompanied by periodic changes in brightness, to simulate the visual effect of energy fluctuation. The parameters of the corresponding animation effect, such as duration, color change and transparency, can be configured in the resource file or dynamically adjusted through code to adapt to different game scenes and skill performance requirements.

[0031] After obtaining the current playback progress, the corresponding animation time window is extracted from the preset animation time data. This animation time data can be stored in animation resource files or read from the game's configuration file. The animation time window defines the start and end times of a specific animation effect. For example, a resonant light effect with a duration of 5 seconds has an animation time window from 0 to 5 seconds. Next, a first and second timestamp are determined within the animation time window. These two timestamps define a sub-time interval to control specific events in the game logic, such as state activation or resource recycling. The first timestamp can be determined in various ways, such as calculating it from the window's start time based on a preset time offset, or directly obtaining it from the animation's keyframe data. For example, if the animation time window is from 0 to 5 seconds and the preset time offset is 2 seconds, then the first timestamp is 2 seconds. The second timestamp is generated based on the first timestamp, according to a preset time interval parameter, ensuring it is later than the first timestamp. For example, if the time interval parameter is 2 seconds, then the second timestamp is 4 seconds.

[0032] In one implementation, the game engine utilizes animation events or callback mechanisms. When the animation reaches a specific point in time, a corresponding event is triggered. These events can carry timestamp information to update the game logic. Specifically, event markers can be embedded in the animation resources. When the animation reaches the marked position, the corresponding event is triggered, and the current timestamp is passed to the game logic layer.

[0033] In one implementation, by processing the looping or transition of the animation, interpolation calculations are performed at the boundaries of the animation time window to smoothly transition to the next animation state, so as to avoid visual abruptness and ensure that the animation effect is smoothly connected at the beginning and end of the time window.

[0034] In one implementation, in a multi-threaded environment, animation updates can be configured to occur in the rendering thread, while game logic is executed in the main thread. To ensure data consistency, thread-safe mechanisms such as locks or atomic variables can be used to synchronize the transmission of animation playback progress and timestamp information between different threads.

[0035] Step S3300: When it is detected that the duration timer reaches the first timestamp but does not exceed the second timestamp, the first resonance state of the hostile character is activated accordingly, and the resonance input event is listened to during the duration of the first resonance state.

[0036] To enable players to monitor the real-time changes in the enemy character's state, the game engine continuously monitors the progress of the activated timer. The timer value increments from its initial value, and when it reaches a preset first timestamp, a check event is triggered to verify that the timer value has not exceeded a second timestamp. This check can be executed by the game logic script every frame or at specific time intervals. Once it is confirmed that the timer value is within the range of [first timestamp, second timestamp), the game engine activates the enemy character's first resonance state. This activation process includes updating the enemy character's internal state identifier, for example, updating it from the default state to the first resonance state. This state update operation can be achieved by calling the character state manager's interface functions to pass the corresponding state code or state object. Simultaneously, visual, audio, or physical effects related to the first resonance state can be triggered to enhance the game's immersion.

[0037] After the first resonant state is activated, resonant input events are listened for during the duration of that state. This is achieved by registering an event listener in the game's event handling system. This event listener is specifically responsible for detecting whether the player has triggered a resonant counterattack against an enemy character. The event listener monitors specific game input events, such as keyboard key presses, mouse clicks, or gamepad actions. When these input events are detected, the listener verifies them to ensure that the input event meets the conditions for a resonant counterattack, such as the input combination being correct or the input occurring at the correct game stage.

[0038] In one implementation, an event dispatch mechanism can be used to achieve efficient event listening. Resonance input events are first captured by the game's input system, and then, based on their type and context information, they are dispatched to the corresponding event listeners. When a player presses a preset counter-attack key combination, the input system generates an input event and dispatches it to the resonance counter-attack event listener registered on the opposing character. During the listening process, event filters can be used to reduce unnecessary event processing. For example, the counter-attack input event can only be processed when the opposing character is in the first resonance state. This is specifically achieved by adding state checking logic to the event listener to ensure that the input event is only further processed in the correct state.

[0039] In one implementation, to provide real-time feedback, visual cues of the user interface or character status can be updated during the listening process. During the duration of the first resonance state, a countdown bar or status indicator is displayed on the game interface to indicate the remaining time of the current state and the time window for counterattacks. These visual cues can help players better grasp the rhythm of the game, thereby improving the game's playability and user experience.

[0040] In one implementation, the timer monitoring and event listening can be run in the game's logic update thread. The logic update thread runs at a fixed frame rate of, for example, 60 frames per second, and performs operations such as timer monitoring, state updating, and event listening in each frame. To ensure thread safety, especially in a multi-threaded environment, the system can also use locking mechanisms or lock-free programming techniques to synchronize data access.

[0041] Step S3400: In response to the resonant input event, reclaim the resonant light effect resources and update the enemy character's role state from the first resonant state to the second resonant state.

[0042] When a resonant input event is triggered, it indicates that the player has performed a specific action that can affect both the player and an enemy character. By reclaiming the resonant light effect resources, the game interface can provide clear feedback to the player indicating whether the resonant input event was successfully triggered. Simultaneously, the game engine needs to respond to this specific action by updating the enemy character's status. Upon detecting a resonant input event triggered by a resonant counterattack, the event's validity is first verified. This includes checking the type and timing of the resonant input event and whether it meets preset input conditions. Specifically, it verifies whether the key combination is correct or whether the input occurred within the allowed time window. This verification process is handled by the event handling system, including querying detailed information such as the key code and event timestamp for the resonant input event. After successful validity verification, the resonant light effect resources are reclaimed. This involves unbinding the resonant light effect resources from the enemy character model. The game engine calls the resource management interface, passing the identifier or pointer of the resonant light effect resource to detach it from the character model. After unbinding, the resonant light effect resource no longer updates its position and orientation with the character model, thus ceasing rendering in the game scene.

[0043] Then, the rendering resources and memory occupied by the resonant lighting effect resources are released. This includes deleting the textures, particle system instances, or animation data of the lighting effect resources. The release of resonant lighting effect resources can be handled by the resource manager, which removes resources that are no longer needed from memory and notifies the rendering system to stop referencing these resources. Resonant lighting effect resources can be placed in an object pool for later reuse instead of being destroyed directly, thereby reducing the system overhead of resource creation and destruction.

[0044] Simultaneously, the enemy character's state will be updated, specifically switching from the first resonance state to the second resonance state, and correspondingly updating the enemy character's internal state identifier, for example, updating the internal state identifier from the first resonance value to the second resonance value. This state update operation can be implemented by calling the character state manager's interface function, passing the corresponding state code or state object. The state manager will notify all relevant game systems, such as the animation system, physics system, and AI system, that the enemy character's state has changed. The corresponding systems will then adjust their behavior according to the new state, such as playing new enemy character animations, changing the enemy character's physical attributes, and updating the enemy character's AI logic.

[0045] In one implementation, an event notification mechanism is used to ensure the visibility and consistency of state updates. After a state update, the character state manager triggers a state change event, which carries the new state information. Other game components can receive this state change event by registering listeners and perform corresponding operations. The UI system updates the state indicators on the game interface to reflect the new state of the enemy character.

[0046] In one implementation, the atomicity and orderliness of resource reclamation and state updates are achieved by locking key data structures or using transaction mechanisms to prevent race conditions in a multi-threaded environment. When updating the role state and reclaiming resources, the role's state object and resource manager are locked, and the locks are released only after these operations are completed to ensure data consistency.

[0047] In one implementation, the state change and resource recycling operation of the opposing character are also recorded for debugging or game replay functions. This can be achieved by recording log information such as the time of the operation, the objects involved, and the results through a log system. The corresponding log data can help developers analyze game behavior, optimize performance, or fix problems.

[0048] In another implementation, this application can synchronously insert the light effect animation resource corresponding to the resonant light effect resource during the playback of the skill animation resource corresponding to the enemy character's resonant skill. When the light effect animation resource is in playback state, the player character's resonant attack operation on the enemy character is monitored, triggering the enemy character's first resonant state. During the duration of the resonant state, when a resonant attack operation is triggered, it is regarded as the triggering of a resonant input event. At this time, the enemy character's hit animation resource and resonant animation resource are played asynchronously, and the playback progress of the attack animation resource is jumped to the end frame of the resonant animation resource. At this time, the enemy character's second resonant state is triggered, the enemy character's action animation resource is updated to the hit animation corresponding to the resonant attack, and the resonant attack triggered by the player character is applied to the enemy character.

[0049] As demonstrated by the above embodiments, this application brings a series of significant benefits to character state control and resource management in games. First, by accurately monitoring and responding to the release of enemy characters' resonance skills, the timeliness and accuracy of game event handling are ensured, allowing players to see visual feedback at the right time and enhancing the game's immersion. Second, by introducing a preset duration timer and synchronizing it with animation playback effects, the decoupling of game logic and animation rendering is achieved. This not only improves the consistency of experience across different devices but also effectively avoids judgment errors caused by animation frame rate fluctuations. Third, activating character states and listening to player input within a specific time window optimizes the use of computing resources, reduces performance overhead caused by invalid listening, and improves the overall running efficiency of the game. Furthermore, through an event-driven resource recycling mechanism, it is ensured that light effect resources are released in a timely manner after completing their function, avoiding memory leaks and resource waste, and improving the stability and performance of the game. Finally, the smooth character state update and resource management process ensures the consistency of game states and the synchronization of visual performance, effectively reducing abnormal states and display errors in the game. The above-described implementation methods work together to provide an excellent and practical method for controlling character states, improving game efficiency and resource utilization, enhancing player interaction, and providing richer and smoother gameplay.

[0050] Based on any embodiment of the method in this application, in response to a resonance attack event triggered by an enemy character casting a resonance skill in a game scene, a preset duration timer is started, and the resonance light effect resource is bound to the character model of the enemy character, including: Step S3110: Monitor the skill casting commands of enemy characters in the game scene, and determine whether the skill casting commands correspond to the resonant skill.

[0051] In the current game scenario, the game engine continuously monitors the behavior of the enemy character currently fighting the player character through event listeners or polling mechanisms to capture their skill casting actions. Specifically, it can access the enemy character's behavior state machine or input system to obtain the trigger signal for skill casting. When a skill casting command corresponding to an enemy character is detected, it determines whether the skill casting command corresponds to a resonance skill. This can be based on the unique identifier of the resonance skill or specific flag bits in the skill data. For example, each skill has a unique ID or name in the game's data structure, and its type can be determined by comparing the skill ID. If the game uses skill templates or configuration files to define skill attributes, then the determination process can be performed when the enemy character's AI system triggers the enemy character's skill casting command, by querying the predefined template or configuration to verify whether the skill is a resonance skill.

[0052] In one implementation, this can be achieved by maintaining a skill database or dictionary containing the attributes and behavior definitions of all available skills. When an enemy character casts a skill, this database is queried to retrieve relevant information such as skill type, effect range, and duration. By checking the skill's type field or its associated list of skill effects, it can be determined whether the skill is a resonance skill. For example, assuming the game's skill data structure contains a "SkillType" field, the skill type can be determined by checking the value in this field. If the "SkillType" is "HARMONIC," it is confirmed as a resonance skill. Furthermore, other attributes of the skill, such as skill level and resource consumption, can be verified to ensure the legality and correctness of skill casting.

[0053] To improve judgment efficiency, data structures such as hash tables or binary search trees can be used to quickly look up skill information. In multi-threaded environments, especially in multiplayer online games, access to the skill database requires a synchronization mechanism to prevent data races and inconsistencies. Skill casting instructions can come from network-synchronized data. The client receives skill casting notifications from the server and makes judgments based on the skill information in the notifications. At the same time, the client also parses and processes network messages to ensure message integrity and timeliness, thereby avoiding judgment delays or errors.

[0054] In one implementation, the game engine uses an event dispatch mechanism to distribute skill casting events to the corresponding processing modules. When an enemy character casts a skill, the event system generates a skill casting event and distributes it to the event listener registered on the enemy character. After receiving the event, the event listener executes predefined processing logic, such as determining the skill type.

[0055] In one implementation, specific state transitions are defined in the character's behavior state machine. When the character enters the "cast skill" state, a corresponding event handling function is triggered, in which the skill type judgment logic can be executed.

[0056] Step S3120: When the corresponding resonance skill is confirmed, read the predefined light effect attachment point on the model bone node of the character model and start the duration timer corresponding to the resonance skill.

[0057] When it's confirmed that the enemy character's skill is a Resonance skill, the predefined light effect attachment points on the enemy character's model's skeleton nodes are retrieved. These attachment points are pre-specified during the character model design phase to determine the precise location of the Resonance light effect resources on the character model. If the Resonance skill's effect is primarily concentrated in the character's chest area, then the light effect attachment point can be set on the character model's chest skeleton node. Information about the light effect attachment points is typically stored in the character model's configuration or resource files; the specific attachment point locations are obtained by accessing these files.

[0058] Next, the duration timer corresponding to the resonance skill is activated. The duration of the timer is preset according to the game design requirements and can be determined through parameters in the game configuration file or skill data. One function of the duration timer is to provide a time reference for the effect of the resonance skill, ensuring that the effect of the resonance skill occurs and disappears within the predetermined time range. If the effect of the resonance skill lasts for 5 seconds, then the timer duration is set to 5 seconds. The timer can be activated by calling the game engine's time management interface, passing the preset duration parameter to start the incrementing timer.

[0059] In practice, the light effect attachment point and timer activation can be read in several ways. One approach involves coordination through a character state manager or skill controller. Once the skill controller confirms the skill is a resonant skill, it sends a request to the character model manager to obtain the light effect attachment point information. The character model manager parses the character model's configuration file, extracts the corresponding skeletal node data, and returns it to the skill controller. Simultaneously, the skill controller calls the time manager's interface to create and start a new timer instance, passing the required timing parameters.

[0060] In one implementation, the above implementation process can be optimized. The information of the light effect attachment point can be pre-cached during the game loading stage to reduce the reading latency when the skill is cast. At the same time, the timer management can adopt the object pool pattern. By pre-creating a certain number of timer instances, they can be quickly allocated and used when needed, thereby avoiding frequent memory allocation and release operations.

[0061] In a multithreaded environment, the timing progress of a timer can be passed between different threads using atomic variables or thread-safe queues to ensure the accuracy and timeliness of the timing data.

[0062] Step S3130: Bind the resonant light effect resource to the light effect attachment point, and synchronize the world transformation matrix and special effects rendering effects of the resonant light effect resource and the character model.

[0063] To allow players to intuitively observe the progress of enemy characters during the activation of resonant skills on the game interface, a resonant light effect resource is attached to the enemy character's model. This resource moves with the enemy character and synchronizes with the character's movements within the current game scene, accurately conveying relevant game information to the player. Therefore, after reading the light effect attachment point, the resonant light effect resource needs to be bound to that point on the character model. This is achieved by setting the initial position, orientation, and scale of the light effect resource to match the corresponding part of the character model. If the light effect attachment point is located on the chest bone node of the character model, then the position and orientation of the light effect resource are set to match the position and orientation of that node. One implementation method is to access the character model's bone node data, obtain its world transformation matrix, and then set the transformation attributes of the light effect resource to a matching value. Simultaneously, the light effect resource is also associated with the world transformation matrix of the character model. The world transformation matrix describes information such as the position, orientation, and scaling of a character model in the game world. By associating lighting resources with the world transformation matrix of the character model, it can be ensured that when the character model moves, rotates, or scales, the lighting resources can update their position and orientation synchronously, maintaining consistency with the character model. This is usually achieved by periodically obtaining the latest world transformation matrix from the character model in the lighting resource update logic and applying it to the transformation attributes of the lighting resources.

[0064] In addition, synchronized special effects rendering is required, including adding lighting resources to the rendering queue and setting corresponding rendering states and parameters. For example, to achieve a semi-transparent lighting effect, the rendering state is set to transparent blending mode. The rendering system will correctly render the lighting resources in each frame based on these states and parameters, ensuring proper integration with the character model and other game elements. In practice, these operations can be accomplished in several ways. One approach is through the game engine's component system, where lighting resources can be attached as independent components to the character model's game object. By setting the component's transformation and rendering properties, the binding and synchronization between the lighting resources and the character model can be achieved. Another approach is through script programming, manually updating the transformation and rendering properties of the lighting resources within the character model's update logic.

[0065] In one implementation, to improve performance, an object pool can be used to manage light effect resource instances to avoid frequent creation and destruction operations, or spatial partitioning technology can be used to bind and update light effects only for character models within the visible area, thereby reducing unnecessary computation.

[0066] In one implementation, in a multi-threaded environment, the above implementation can also ensure data consistency and thread safety through synchronization mechanisms. The world transformation matrix of the character model can be configured to be updated in the main thread, while the rendering of lighting effects resources is performed in the rendering thread. Furthermore, to ensure data consistency, locks or atomic variables can be used when updating the world transformation matrix to prevent access by other threads during the update process.

[0067] As can be seen from the above implementation method, by accurately monitoring and judging the resonant skill release of enemy characters, the timeliness and accuracy of game event processing can be ensured, allowing players to see visual feedback at the right time and enhancing the game's immersion. Secondly, by reading the light effect attachment point and starting the timer, precise time reference and position information are provided for subsequent light effect resource binding and state management, ensuring the synchronization of visual effects and game logic. In addition, binding the resonant light effect resources to the character model and synchronizing its world transformation matrix and special effect rendering effects achieves a high degree of consistency between light effects and character actions, improving the game's visual expressiveness and realism. The combined effect of the steps in this embodiment not only optimizes resource management and performance but also provides players with a smoother and richer gaming experience, effectively reducing abnormal states and display errors in the game, and ensuring the accuracy of game interaction and the synchronization of visual effects.

[0068] Based on any embodiment of the method in this application, the animation playback effect of the resonant light effect resource is updated in real time, an animation time window corresponding to the animation playback effect is obtained, and a first timestamp and a second timestamp in the animation time window are determined, wherein the second timestamp is later than the first timestamp, including: Step S3210: Asynchronously update the animation playback effect of the enemy character and the animation playback effect of the resonant light effect resource in the current game scene.

[0069] After binding the resonant light effect resources and light effect attachment points, the game engine uses multi-threading technology to allocate the update tasks of character animation and light effect animation to a dedicated rendering thread, while the game logic continues to be executed in the main thread. This asynchronous processing method can avoid blocking the main thread due to time-consuming animation update operations to a certain extent, thereby ensuring the continuity of game logic and the timeliness of response.

[0070] During the update process, on one hand, the game engine continuously calls the preset animation update interface to periodically obtain the current playback progress of enemy character models and resonant light effect resources. For character animations, it accesses the character's skeletal animation controller to query the current keyframe index or timestamp; for light effect animations, it accesses the animation controller of the light effect resource to obtain the current playback status and time information. On the other hand, based on the obtained playback progress data, it reads the corresponding animation frame data or keyframe information from the preset animation resource file. For character models, it obtains corresponding data, including skeletal transformation data and skinning data, to update the character's appearance and movements; for resonant light effect resources, it obtains the corresponding texture data, particle system state, and color gradient data of the light effect to update the visual appearance of the light effect.

[0071] In one implementation, the animation callback mechanism provided by the graphics API can be utilized to trigger a callback function to update the corresponding rendering data when the animation reaches a specific frame. Alternatively, timestamp-driven interpolation can be used to calculate the intermediate state based on the time difference in each frame, achieving a smooth animation transition. Furthermore, animation blending techniques, such as the synergistic effect of a character's special movements and lighting effects when casting a resonance skill, can be used to mix multiple animation sequences together to achieve more complex animation effects.

[0072] Step S3220: Extract the animation time window corresponding to the animation playback effect of the resonant light effect resource based on the preset animation time data, and determine the first timestamp and the second timestamp within the animation time window based on the preset time offset, so as to form the activation time interval of the first resonant state of the enemy character.

[0073] The preset animation time data in this application can be stored in animation resource files or read from the game's configuration file. The animation time data includes the start and end times of the resonant light effect animation. For example, if a resonant light effect animation is designed to last 5 seconds, then its animation time window is from 0 to 5 seconds. To determine the activation time interval, a first timestamp can be calculated based on a preset time offset. If the preset time offset is 2 seconds, then the first timestamp is the start time of the animation time window plus 1 second, i.e., at 2 seconds. The second timestamp is generated based on the first timestamp, according to a preset time interval parameter, ensuring it is later than the first timestamp. For example, if the time interval parameter is 2 seconds, then the second timestamp is the first timestamp plus 2 seconds, i.e., at 4 seconds. This determines the activation time interval from 1 second to 4 seconds, used to activate the first resonant state of the enemy character. The animation time data can be stored in various formats, such as JSON, XML, or binary files. These files are parsed to obtain the animation's start time, end time, and keyframe information. The preset time offset and time interval parameters can be set by game designers according to game balance and experience requirements and stored in a configuration file or database.

[0074] In one implementation, interpolation or other mathematical methods can be used to ensure the accuracy and consistency of timestamps to achieve a smooth transition effect, especially at the boundaries of the animation time window; at the same time, these timestamps can be associated with events in the game logic to trigger specific state changes or effect activations when timers reach these timestamps.

[0075] The above embodiments not only ensure close synchronization between game visual presentation and logical control, but also improve game efficiency and player experience. By asynchronously updating the animation playback effects of enemy characters and resonant light effects, the game can achieve smooth visual presentation without affecting the execution of the main thread logic, avoiding stuttering or delays caused by animation updates, thereby significantly improving game efficiency and visual smoothness. Simultaneously, by accurately extracting animation time windows based on preset animation time data and determining activation time intervals by combining preset time offsets, the game logic can precisely control the timing of enemy character state activation and light effect performance, ensuring the accuracy and predictability of the game mechanics. This precise time control not only enhances the game's strategy and interactivity but also provides players with a clearer and more consistent gaming experience, enabling players to perform actions within the expected time window and receive corresponding game feedback, further enhancing the game's fun and immersion.

[0076] Based on any embodiment of the method in this application, when it is detected that the duration timer reaches the first timestamp but does not exceed the second timestamp, the first resonance state of the hostile character is activated accordingly, and resonance input events are listened to during the duration of the first resonance state, including: Step S3310: Determine the time interval during which the duration timer reaches the first timestamp but does not exceed the second timestamp as the activation time interval, and update the internal state identifier of the hostile character from the default resonance value to the first resonance value corresponding to the first resonance state.

[0077] In the game scenario, when the duration timer reaches a preset first timestamp but does not exceed a second timestamp, this time period is designated as the active time interval. During this period, the opposing character enters a special state to respond to player actions. At this time, the game checks if the current timer value is within the range of [first timestamp, second timestamp]. This check can be performed by the game logic script every frame or at specific time intervals. Once it is confirmed that the timer value is within this range, the opposing character's internal state identifier is updated, such as changing it from the default resonance value to the first resonance value corresponding to the first resonance state. This update process can be achieved by calling the character state manager's interface function, passing the corresponding state code or state object. The state manager is responsible for maintaining the character's current state and notifying the relevant systems when the state changes.

[0078] To ensure the accuracy and timeliness of state updates, an event can be triggered when a state changes to notify all relevant game components. The animation system can play corresponding animations based on the new state, the physics system can adjust the character's physical attributes, and the AI ​​system can adjust the character's behavioral logic based on the new state. The user interface can also be updated to display the new state of enemy characters, such as displaying a halo with special lighting effects on the screen to indicate the enemy character's current state and available action window. In the implementation, the state identifier can be an enumeration type or an integer value used to distinguish different character states; for example, the default resonance value can be 0, while the first resonance value can be 1. The state manager tracks and manages the character's current state by maintaining a state table or state machine. When a state changes, the state manager broadcasts a state change event, carrying the new state value, for other systems to subscribe to and respond to.

[0079] Step S3320: Based on the interaction logic layer of the game scene, register a resonance listener for resonance input events pointing to the player character within the activation time interval.

[0080] First, the game engine registers a dedicated resonance listener through the event system during the active time period. This listener detects whether the player has triggered a resonance counterattack against an enemy character. The registration process requires calling the game engine's event registration interface, passing the event type and callback function. For example, it can register keyboard events, mouse events, or gamepad events, depending on the game design and the player's input device. When registering the listener, an event filtering condition can be specified to ensure that only input events meeting specific conditions are processed. For example, a filter can be set to only allow input events occurring during the active time period when the enemy character is in the first resonance state, thereby avoiding unnecessary event processing and improving system efficiency.

[0081] In one implementation, the listener can be designed as a separate component or module responsible for handling specific types of input events. There can be a dedicated listener for keyboard input and a listener for mouse input, each of which contains corresponding logic to determine whether the input event meets the conditions for resonant feedback.

[0082] In one implementation, registered listeners can be cached to improve performance, and they can be deregistered promptly after the activation time interval ends. The event system's deregistration interface is called at the end of the activation time interval to remove the corresponding resonant listener, thereby reducing memory usage and unnecessary event detection overhead.

[0083] Step S3330: During the resonant listening state, continuously monitor whether the player character's resonant counterattack operation against the enemy character is triggered in the current game scene, so as to trigger the resonant input event based on the resonant counterattack operation.

[0084] During the resonant listening phase, the game's event handling mechanism can be used to monitor resonant counterattacks. This mechanism detects and responds to input events corresponding to player actions. Specifically, it listens for input events such as keyboard key presses, mouse clicks, or gamepad actions, which may indicate that the player is attempting a resonant counterattack. When an input event is detected, it is verified whether the event meets the conditions for a resonant counterattack. This includes checking the type and timing of the input, as well as whether it is within the allowed time window. For example, it checks whether the player pressed the correct key combination and whether the input occurred during the enemy character's resonant state activation. The verification process may include querying detailed information about the input event, such as key codes and timestamps, to ensure its validity. Once the input event is verified as a valid resonant counterattack, a corresponding resonant input event is triggered. This event is then passed to the game logic layer, which executes the corresponding processing logic, including updating the game state, starting a new timer, or performing other resonant counterattack-related operations.

[0085] To improve the efficiency and accuracy of monitoring, event filters can be used to reduce unnecessary event processing. By adding state check logic to the event listener, the player's input event will only be further processed when the hostile character is in a resonant state and the player's input meets specific conditions.

[0086] In one implementation, an event dispatch mechanism can be used to efficiently process input events. Input events are first captured by the game's input system, and then dispatched to the corresponding event listeners according to the type of event and context information. When a player presses a preset counterattack button, the input system generates an input event and dispatches it to the resonant counterattack event listener registered on the enemy character.

[0087] In one implementation, the animation playback effect of the resonant light effect resource can be configured as a fixed aperture animation and a variable aperture animation that gradually decreases in size. The initial size of the variable aperture can be configured to be larger than the fixed aperture, and the variable aperture will gradually shrink. When the display effect of the variable aperture in the current game screen shrinks to a size similar to the fixed aperture, the time when the variable aperture shrinks to a preset value slightly larger than the fixed aperture is set as the first timestamp, and the time when the variable aperture shrinks to a preset value slightly smaller than the fixed aperture is set as the second timestamp. Then, the player can know a time interval that roughly corresponds to the activation time range in the background processing in the foreground display of the game screen. By triggering the resonant input event of the current player character's resonant counterattack operation when the two apertures are close, such as pressing a specific keyboard key, clicking a certain interface component on the game screen with the mouse, or pressing a specific button on the game controller, the player can trigger the resonant counterattack operation. At this time, the corresponding resonant input event will be triggered according to this resonant counterattack operation.

[0088] Through the synergistic effect of the above embodiments, the accuracy and predictability of game logic can be ensured. The precise state control embodied in the above embodiments not only enhances the strategic nature of the game but also provides players with a clear operation window, enabling them to execute resonant counterattack operations within the expected time and thus obtain corresponding game feedback. Furthermore, by registering resonant listeners in the interaction logic layer based on the game scene, the game can efficiently detect and respond to player input events within the activation time interval. Through event filtering and synchronization mechanisms in a multi-threaded environment, unnecessary event processing can be reduced, detection efficiency can be improved, and player operations can be captured and responded to in a timely manner. At the same time, continuous monitoring of resonant counterattack operations during the resonant listener's registration state further ensures the real-time nature and accuracy of player input. Through event distribution mechanisms and state checking logic, the game can accurately identify valid resonant counterattack operations and trigger resonant input events in a timely manner, thereby achieving seamless interaction between players and the game world. The above steps work together to optimize the game's performance and response speed. Thus, through reasonable event registration and deregistration strategies and synchronization mechanisms, the game can reduce memory consumption and computational overhead while ensuring interactivity, ensuring system stability and smoothness.

[0089] Based on any embodiment of the method in this application, in response to the resonant input event, the resonant light effect resource is recovered, and the role state of the hostile character is updated from the first resonant state to the second resonant state, including: Step S3410: When a resonant input event corresponding to the resonant return operation is detected, cancel the return listening of the resonant input event in the interaction logic layer.

[0090] When a resonant input event is detected, it indicates that the player character's resonant counterattack operation has been successfully responded to. At this point, there's no need to continue listening for resonant input events. The corresponding resonant counterattack event listener can be quickly located based on pre-stored listener identifiers or event types. Specifically, the specific listener instance to be deregistered can be determined through the unique listener ID in the event system or a reference to the event callback function. Next, the event system's deregistration interface is called, passing in the located listener instance or event type, thereby removing the listener's registration information from the event dispatch system. This prevents subsequent identical resonant input events from being captured and processed by the listener, avoiding duplicate responses or logical conflicts. If the observer pattern is being used, the deregistration process involves removing the listener from the event source's observer list. To ensure the accuracy and timeliness of the deregistration operation, deregistration logic is typically embedded in the handler function that triggers the resonant input event. The listener's deregistration operation is executed in the event handling callback function corresponding to the resonant counterattack operation, ensuring that the listener is removed immediately after the resonant counterattack operation is processed, avoiding unnecessary event listening overhead.

[0091] In practical implementation, various methods can be used to manage the lifecycle of listeners. One approach is to automatically register or deregister the corresponding event listeners when the active or disabled state of a game object or component changes. For example, when an enemy character's state returns from a resonant state to its default state, the listener deregistration process is automatically triggered. To optimize performance during implementation, deregistered listener instances can be cached instead of being directly destroyed. For instance, an object pool pattern can be used to manage event listener instances, improving resource reuse. This allows for rapid re-registration of these listeners when needed later, reducing the overhead of memory allocation and deallocation.

[0092] Step S3420: Immediately release the binding relationship between the resonant light effect resource and the light effect attachment point, and release the rendering resources and memory resources occupied by the resonant light effect resource.

[0093] Since one function of the resonant light effect resource at the light effect attachment point is to indicate that the resonant light effect resource corresponds to the enemy character, after triggering the resonant input event corresponding to the enemy character, the corresponding interface change effect should be triggered in the game interface. At this time, the resonant light effect resource used to indicate that the resonant input event can be triggered should be recycled in the game scene so that the player can obtain the information that the current resonant input event has been triggered. Therefore, when the resonant input event triggered by the resonant counterattack operation is detected, it is necessary to immediately release the binding relationship between the resonant light effect resource and the light effect attachment point, and release the rendering resources and memory resources occupied by the resource.

[0094] First, the lighting effect attachment point of the enemy character model is accessed. This attachment point was predefined during the character model design phase and is associated with the resonant lighting effect resource. By calling the game engine's resource management interface, the binding relationship between the resonant lighting effect resource and the lighting effect attachment point can be released. If a component system is currently used, the binding can be released by calling the "Remove" or "Detach" method of the lighting effect component. After the binding relationship is released, the resonant lighting effect resource will no longer update its position and orientation synchronously with the character model's transformation matrix, and the corresponding lighting effect resource will no longer be associated with the character model. The lighting effect will no longer be displayed in the game scene. At the same time, the rendering resources occupied by the resonant lighting effect resource are released, including deleting the lighting effect's texture data, particle system instances, or animation data. If the lighting effect resource uses texture maps, these texture data also need to be removed from video memory.

[0095] Releasing memory resources can be achieved by removing the relevant data structures of the light effect resources from the system's memory. This can be done through the resource manager, which tracks all loaded resources, releases the memory space occupied by the light effect resources by calling the memory management interface, and cleans up the light effect resources when they are no longer needed.

[0096] Step S3430: Update the internal state identifier of the enemy character from the first resonance value to the second resonance value corresponding to the second resonance state, so as to update the character state of the enemy character in the current game scene based on the resonance counterattack operation triggered by the player character.

[0097] When a player character successfully triggers a resonance counterattack, to update the enemy character's state accordingly, the enemy character's internal state identifier is updated from the first resonance value to the second resonance value corresponding to the second resonance state. This is achieved by calling the character state manager's interface function, passing the corresponding state code or state object to complete the state update. If the state identifier corresponding to the first resonance state is 1, then the state identifier corresponding to the second resonance state can be 2. The state manager is responsible for maintaining the character's current state and notifying all relevant systems when the state changes.

[0098] After an enemy character's status is updated, the animation system, physics system, and AI system will be notified that the enemy character's status has changed. At this time, the animation system will play the corresponding animation sequence according to the new status, the physics system will adjust the enemy character's physical attributes, and the AI ​​system will update the enemy character's behavior logic according to the new status. The notification mechanism for the corresponding status change can be implemented based on an event-driven architecture. After the status is updated, the state manager triggers a status change event, carrying the new status information. Other systems receive this status change event by registering listeners and perform corresponding operations.

[0099] To ensure the visibility and consistency of state updates, an event notification mechanism can be used. The UI system updates the state indicators on the game interface to reflect the new state of the enemy character. To ensure the atomicity and orderliness of state updates, key data structures can be locked or a transaction mechanism can be used when updating character states to prevent race conditions in a multi-threaded environment. For debugging or game replay functions, relevant log information about this state change operation can also be recorded. The logging system records information such as the time of the operation, the objects involved, and the result. This can help game developers analyze game behavior and further optimize game performance or fix problems.

[0100] As can be seen from the above embodiments of this application, by promptly canceling the resonant counterattack listener after detecting the resonant counterattack operation, the game can effectively avoid duplicate responses and logical conflicts, reduce unnecessary event listening overhead, and improve the system's response speed and logical accuracy. By releasing the binding relationship between the resonant light effect resource and the light effect attachment point, and releasing related rendering and memory resources, it also helps to prevent memory leaks and performance loss, ensuring the stability and smoothness of the game during long-term operation. Furthermore, by updating the internal state identifier of the enemy character, the game can accurately change the character's state based on the player's resonant counterattack operation, providing the player with timely visual and logical feedback, and enhancing the game's interactivity and immersion.

[0101] Based on any embodiment of the method in this application, it further includes: Step S3510: When no resonant input event is detected within the activation time interval, cancel the echo listening for the resonant input event in the interaction logic layer.

[0102] When the activation time interval ends and no resonant input event is detected, it means the player character did not perform the corresponding operation within the time frame that could trigger the resonant input event. Therefore, the player character can no longer trigger this resonant input event, and the listener for the resonant input event needs to be deregistered in the interaction logic layer. The event listener will identify and locate the corresponding resonant response event listener based on the pre-stored listener identifier or event type. The specific listener instance to be deregistered can be determined through the unique listener ID in the event system or a reference to the event callback function.

[0103] Next, the event system's deregistration interface is called, passing in the located listener instance or event type, thereby removing the listener's registration information from the event dispatch system. To ensure the accuracy and timeliness of the deregistration operation, deregistration logic can also be triggered at the end of the activation time interval. When the timer reaches the second timestamp, the deregistration logic is embedded in the timer's callback function to automatically execute the listener's deregistration operation, ensuring that the listener is removed immediately after the time interval ends. Simultaneously, when the activation or deactivation state of a game object or component changes, the corresponding event listeners can be automatically registered or deregistered. When the state of an enemy character returns from the first resonance state to the default state, the listener's deregistration process is automatically triggered.

[0104] Step S3520: At the end of the animation time window, release the binding relationship between the resonant light effect resource and the light effect attachment point, and release the rendering resources and memory resources occupied by the resonant light effect resource.

[0105] Since one function of the resonant light effect resource at the light effect attachment point is to indicate that the resonant light effect resource corresponds to the enemy character, if no resonant input event is detected within the activation time interval, the corresponding interface change effect needs to be triggered in the game interface. At this time, the resonant light effect resource used to indicate that the resonant input event can be triggered needs to be recycled in the game scene so that the player can obtain the information that the current resonant input event can no longer be triggered. Therefore, it is necessary to release the binding relationship between the resonant light effect resource and the light effect attachment point at the end of the animation time window and release the rendering resources and memory resources occupied by the resource.

[0106] First, the end time of the animation time window needs to be determined. This end time is usually defined by preset animation time data. A timer or timestamp is used to determine whether the end time has been reached. Once the end time is reached, the game engine's resource management interface is called, passing the identifier or pointer of the resonant light effect resource to release the binding relationship between the resonant light effect resource and the light effect attachment point. For example, if a component system is used, the binding can be released by calling the "Remove" or "Detach" method of the light effect component. After unbinding, the resonant light effect resource will no longer update its position and orientation synchronously with the transformation matrix of the character model, and the resonant light effect resource will no longer be displayed in the game scene.

[0107] Next, the rendering resources occupied by the resonant lighting effect need to be released. This includes deleting the corresponding texture data, particle system instances, or animation data. If the lighting effect uses texture maps, these texture data also need to be removed from video memory. The release of rendering resources can be accomplished by the rendering system calling the corresponding rendering interface. Simultaneously, the memory resources occupied by the resonant lighting effect also need to be released. This is done by using the resource manager to remove the relevant data structures of the lighting effect from the system's memory. The resource manager tracks all loaded resources and calls the memory management interface to release the memory space occupied by the lighting effect when the resources are no longer needed.

[0108] Step S3530: Update the internal state identifier of the hostile character from the first resonance value to the default resonance value.

[0109] Even if the player character does not trigger a resonance counterattack within the active event interval, the enemy character's status still needs to be updated accordingly. This involves directly updating the enemy character's internal status identifier from the first resonance value to the default resonance value corresponding to the default state. This can be achieved by calling the character status manager's interface functions, passing the corresponding status code or status object to complete the status update. For example, if the status identifier corresponding to the first resonance state is 1, then the status identifier corresponding to the default resonance state can be configured to 0. The status manager is responsible for maintaining the character's current state and notifying all relevant systems when the state changes.

[0110] After the enemy character's status is updated, the animation system will play the corresponding animation sequence according to the new status, the physics system will adjust the enemy character's physical attributes, and the AI ​​system will also update the enemy character's behavior logic according to the new status. The notification mechanism for the corresponding status change can be implemented based on an event-driven architecture. After the status is updated, the state manager triggers a status change event and carries the new status information. Other systems can receive this status change event by registering listeners and perform corresponding operations.

[0111] The embodiments described above firstly, by promptly unregistering the echo listener when no resonant input event is detected within the activation time interval, the game effectively avoids unnecessary resource consumption and logical complexity, improving system response speed and operating efficiency. Secondly, by unbinding the resonant light effect resource and releasing related resources at the end of the animation time window, memory leaks and performance degradation are prevented, ensuring the stability and smoothness of the game during long-term operation. Furthermore, restoring the internal state identifier of the enemy character to the default resonant value allows the game to accurately reflect changes in the character's state, ensuring the rigor of the game logic and the clarity of state management. These embodiments, through close coordination, not only optimize resource allocation and utilization but also enhance the overall performance of the game, enabling it to maintain efficient operation and a good user experience even in complex scenarios and during long-term operation. Moreover, through refined state management and resource control, the reliability and maintainability of the game are significantly improved, providing players with a more stable and smooth gaming environment.

[0112] Based on any embodiment of the method in this application, after the step of updating the role state of the hostile character from the first resonance state to the second resonance state, the method further includes: Step S3610: Apply the resonance counterattack corresponding to the resonance counterattack operation triggered by the player character to the enemy character, interrupt the resonance skill cast by the enemy character, and update the enemy character's character status information in the current game scene.

[0113] When the enemy character's state updates to the second resonance state, it means the player has successfully countered the enemy character's resonance skill. At this point, the player's resonance counterattack can be applied to the enemy character. Therefore, after the player's resonance input event is detected and verified, it is ensured that the triggered resonance counterattack meets the conditions for a resonance counterattack. By calling the corresponding game logic function, the effect of the resonance counterattack can be applied to the enemy character. The effect of the resonance counterattack can include interrupting the enemy character's ongoing resonance skill, nullifying the enemy character's resonance skill, and inflicting a stun effect on the enemy character. That is, the enemy character will enter a brief stunned state in the current game scene. In this stunned state, the enemy character is relatively vulnerable; while unable to attack the player character, they will still suffer damage from the resonance counterattack.

[0114] If an enemy character possesses a resilience mechanic related to a resilience bar, which is calculated numerically and slowly reduced by the player character's attacks, then the effect of Resonance Counterattack can significantly decrease the enemy character's resilience bar. Once the enemy character's resilience bar reaches 0, they will enter a prolonged state of vulnerability and paralysis, during which they will be unable to move and will take increased damage. Therefore, when an enemy character uses a Resonance skill, the timing of the Resonance Counterattack operation can be configured to be less than 0.5 seconds. If the player successfully executes the operation, they will reap a substantial reward. However, if the player misjudges the timing, they will be highly vulnerable to the enemy character's Resonance skill due to the inability to dodge during the attack. Thus, by configuring the Resonance Counterattack operation and controlling the enemy character's state changes, a more challenging and engaging combat process and a richer gaming experience can be provided.

[0115] Interrupting the resonant skill cast by an enemy character can be achieved by modifying the enemy character's skill status, such as changing the skill status from "casting" to "interrupted". At the same time, the enemy character's character status information can be updated, including the enemy character's defense value, health value, mana value, attack power and tenacity bar, etc., or a new status effect can be applied to the enemy character, such as stun effect, slow effect, freeze effect, poison effect, burn effect and vulnerability effect, etc. The specific configuration can be tailored according to the game type. For example, resonant counterattack can cause the enemy character to enter a brief stun state through the stun effect, making him unable to perform any actions.

[0116] In one implementation, specific interrupted animation effects or damaged visual effects of the enemy character are played by calling the interfaces of the animation and special effects systems, thereby updating the enemy character's visual and audio performance to reflect changes in its state. Simultaneously, various methods can be used to manage state updates and skill interruption logic; a state machine can be used to manage the enemy character's state transitions, or a behavior tree can be used to control the AI's behavioral logic.

[0117] Step S3620: After the preset duration of the second resonance state ends, update the internal state identifier of the hostile character from the second resonance value to the default resonance value.

[0118] After an enemy character enters the second resonance state, and after potentially suffering damage from a resonance counterattack inflicted by the player character, as well as a significant reduction in their resilience, to maintain game enjoyment and combat balance, the enemy character's state needs to be restored to a default state after the relatively short duration of the second resonance state ends. This allows them to continue fighting the player character using their corresponding combat configuration. At this point, the enemy character's internal state identifier needs to be updated from the first resonance value to the default resonance value corresponding to the default state. This update process can be implemented by calling the character state manager's interface functions, passing the corresponding state code or state object to complete the state update. For example, if the state identifier corresponding to the first resonance state is 1, then the state identifier corresponding to the default resonance state can be configured to 0. The state manager is responsible for maintaining the character's current state and notifying all relevant systems when the state changes.

[0119] After the enemy character's status is updated, the animation system will play the corresponding animation sequence according to the new status, the physics system will adjust the enemy character's physical attributes, and the AI ​​system will also update the enemy character's behavior logic according to the new status. The notification mechanism for the corresponding status change can be implemented based on an event-driven architecture. After the status is updated, the status manager triggers a status change event and carries the new status information. Other systems receive this status change event by registering listeners and perform corresponding operations. The game engine can also respond to the corresponding resonance attack event again when the enemy character triggers the next resonance skill.

[0120] Through the synergistic effect of the above embodiments, this embodiment can not only interrupt the enemy character's resonance skill by applying the player's resonance counterattack to the enemy character, but also introduce stun effects and possible resilience mechanisms by updating the enemy character's status information. This greatly enriches the game's combat strategy and interactivity, making the player's timing crucial. A successful counterattack can bring a significant combat advantage, while failure may lead to the player bearing greater risks, thereby increasing the game's challenge and fun. At the same time, this embodiment ensures the balance and continuity of the game's combat. By restoring the enemy character's status to the default state after the preset duration of the second resonance state, the game avoids combat imbalance that may be caused by the enemy character being in a disadvantageous state for a long time. The corresponding process is coordinated by the status manager to ensure the synchronous update of the animation, physics, and AI systems, allowing the combat to continue naturally and smoothly, while preparing for the next possible resonance attack event. This not only enhances the game's strategic depth and interactive experience, but also provides players with a richer and more immersive gaming experience through fine-grained status management and resource control.

[0121] Please see Figure 3 According to one aspect of this application, a character state control device includes a resonance response module 4100, a window acquisition module 4200, a state activation module 4300, and a state update module 4400. The resonance response module 4100 is configured to respond to a resonance attack event triggered by an enemy character casting a resonance skill in a game scene, start a preset duration timer, and bind resonance light effect resources to the enemy character's character model. The window acquisition module 4200 is configured to update the animation playback effect of the resonance light effect resources in real time, acquire the animation time window corresponding to the animation playback effect, and determine a first timestamp and a second timestamp within the animation time window, wherein the second timestamp is later than the first timestamp. The state activation module 4300 is configured to activate a first resonance state of the enemy character when the duration timer reaches the first timestamp but does not exceed the second timestamp, and listen for resonance input events during the duration of the first resonance state. The state update module 4400 is configured to respond to the resonance input event, reclaim the resonance light effect resources, and update the enemy character's character state from the first resonance state to the second resonance state.

[0122] Based on any embodiment of the device in this application, the resonance response module 4100 includes: an instruction monitoring unit, configured to monitor the skill release instructions of an enemy character in a game scene and determine whether the skill release instructions correspond to the resonance skill; a light effect reading unit, configured to, when it is confirmed that the resonance skill is matched, read the predefined light effect attachment point on the model bone node of the character model and start the duration timer corresponding to the resonance skill; and a resource synchronization unit, configured to bind and associate the resonance light effect resource with the light effect attachment point and synchronize the resonance light effect resource with the world transformation matrix and special effect rendering effect of the character model.

[0123] Based on any embodiment of the device in this application, the window acquisition module 4200 includes: an asynchronous update unit, configured to asynchronously update the animation playback effect of the enemy character and the animation playback effect of the resonant light effect resource in the current game scene; and a window determination unit, configured to extract an animation time window corresponding to the animation playback effect of the resonant light effect resource based on preset animation time data, and determine the first timestamp and the second timestamp within the animation time window based on a preset time offset, so as to correspondingly form the activation time interval of the first resonant state of the enemy character.

[0124] Based on any embodiment of the device in this application, the state activation module 4300 includes: a first update unit, configured to determine the time interval during which the duration timer reaches the first timestamp and does not exceed the second timestamp as the activation time interval, and update the internal state identifier of the hostile character from the default resonance value to a first resonance value corresponding to the first resonance state; a listening registration unit, configured to register resonance listening for resonance input events pointing to the player character within the activation time interval based on the interaction logic layer of the game scene; and a counterattack monitoring unit, configured to continuously monitor whether a resonance counterattack operation by the player character on the hostile character is triggered in the current game scene during the resonance listening registration state, so as to trigger the resonance input event based on the resonance counterattack operation.

[0125] Based on any embodiment of the device in this application, the state update module 4400 includes: a listening deregistration unit, configured to deregister the listening for the resonant input event in the interaction logic layer when a resonant input event corresponding to the resonant counterattack operation is detected; a first release unit, configured to immediately release the binding relationship between the resonant light effect resource and the light effect attachment point, and release the rendering resources and memory resources occupied by the resonant light effect resource; and a second update unit, configured to update the internal state identifier of the enemy character from the first resonant value to a second resonant value corresponding to the second resonant state, so as to update the character state of the enemy character in the current game scene based on the resonant counterattack operation triggered by the player character.

[0126] Based on any embodiment of the device in this application, the state update module 4400 further includes: a cancellation response unit, configured to cancel the response listening to the resonant input event in the interaction logic layer when no resonant input event is listened to within the activation time interval; a second release unit, configured to release the binding relationship between the resonant light effect resource and the light effect attachment point at the end of the animation time window, and release the rendering resources and memory resources occupied by the resonant light effect resource; and a third update unit, configured to update the internal state identifier of the hostile character from the first resonant value to the default resonant value.

[0127] Based on any embodiment of the device in this application, it further includes: a counterattack response unit, configured to apply the resonant counterattack corresponding to the resonant counterattack operation triggered by the player character to the enemy character, interrupt the resonant skill released by the enemy character, and update the character state information of the enemy character in the current game scene; a fourth update unit, configured to update the internal state identifier of the enemy character from the second resonant value to the default resonant value after the preset duration of the second resonant state ends.

[0128] Another embodiment of this application also provides a role status control device. For example... Figure 4 The diagram shows the internal structure of a role state control device. This device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. The computer-readable, non-volatile storage medium stores an operating system, a database, and computer-readable instructions. The database stores information sequences, and when executed by the processor, these computer-readable instructions enable the processor to implement a role state control method.

[0129] The processor of the role state control device provides computing and control capabilities to support the operation of the entire device. The memory of the device can store computer-readable instructions, which, when executed by the processor, cause the processor to perform the role state control method of this application. The network interface of the device is used for communication with a terminal.

[0130] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the role status control device to which the present application is applied. The specific role status control device may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.

[0131] In this embodiment, the processor is used to execute... Figure 3 The specific functions of each module are described, and the memory stores the program code and various data required to execute the aforementioned modules or sub-modules. The network interface is used to enable data transmission between user terminals or the server. In this embodiment, the non-volatile readable storage medium stores the program code and data required to execute all modules in the role status control device of this application. The server can call the server's program code and data to execute the functions of all modules.

[0132] This application also provides a non-volatile readable storage medium storing computer-readable instructions, which, when executed by one or more processors, cause the one or more processors to perform the steps of the role state control method of any embodiment of this application.

[0133] This application also provides a computer program product, including a computer program / instructions that, when executed by one or more processors, implement the steps of the method described in any embodiment of this application.

[0134] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments of this application can be implemented by a computer program instructing related hardware. This computer program can be stored in a non-volatile readable storage medium, and when executed, it can include the processes of the embodiments of the above methods. The aforementioned storage medium can be a computer-readable storage medium such as a magnetic disk, optical disk, read-only memory (ROM), or random access memory (RAM).

Claims

1. A method for controlling a character's state, characterized in that, include: In response to the resonance attack event triggered by an enemy character casting a resonance skill in the game scene, a preset duration timer is started, and the resonance light effect resource is bound to the enemy character's character model; The animation playback effect of the resonant light effect resource is updated in real time, and the animation time window corresponding to the animation playback effect is obtained. A first timestamp and a second timestamp in the animation time window are determined, wherein the second timestamp is later than the first timestamp. This includes: asynchronously updating the animation playback effect of the enemy character and the animation playback effect of the resonant light effect resource in the current game scene; extracting the animation time window corresponding to the animation playback effect of the resonant light effect resource based on preset animation time data, and determining the first timestamp and the second timestamp within the animation time window based on a preset time offset, so as to form the activation time interval of the first resonant state of the enemy character. When it is detected that the duration timer reaches the first timestamp but does not exceed the second timestamp, the first resonance state of the hostile character is activated accordingly. During the duration of the first resonance state, the resonance input event is listened to, including: determining the time interval during which the duration timer reaches the first timestamp but does not exceed the second timestamp as the activation time interval, and updating the internal state identifier of the hostile character from the default resonance value to the first resonance value corresponding to the first resonance state. In response to the resonant input event, the resonant light effect resources are recovered, and the character state of the hostile character is updated from the first resonant state to the second resonant state.

2. The role state control method according to claim 1, characterized in that, The response to a resonance attack event triggered by an enemy character casting a resonance skill in the game scene involves starting a preset duration timer and binding the resonance light effect resource to the enemy character's character model, including: Monitor the skill casting commands of enemy characters in the game scene and determine whether the skill casting commands correspond to the resonant skill; When the corresponding resonance skill is confirmed, the predefined light effect attachment point on the model bone node of the character model is read, and the duration timer corresponding to the resonance skill is started; The resonant light effect resource is bound to the light effect attachment point, and the world transformation matrix and special effects rendering effects of the resonant light effect resource and the character model are synchronized.

3. The role state control method according to claim 2, characterized in that, The step of activating the first resonance state of the hostile character when the duration timer reaches the first timestamp but does not exceed the second timestamp, and listening for resonance input events during the duration of the first resonance state, further includes: Based on the interaction logic layer of the game scene, register resonance listeners for resonance input events pointing to the player character within the activation time interval; During the resonant listening period, it continuously monitors whether the player character's resonant counterattack operation against the enemy character is triggered in the current game scene, so as to trigger the resonant input event based on the resonant counterattack operation.

4. The role state control method according to claim 3, characterized in that, The step of responding to the resonant input event, recovering the resonant light effect resources, and updating the enemy character's role state from the first resonant state to the second resonant state includes: When the resonant input event triggered by the resonant return operation is detected, the return listening for the resonant input event is cancelled in the interaction logic layer; Immediately release the binding relationship between the resonant light effect resource and the light effect attachment point, and release the rendering resources and memory resources occupied by the resonant light effect resource; The internal state identifier of the hostile character is updated from the first resonance value to the second resonance value corresponding to the second resonance state, so as to update the character state of the hostile character in the current game scene based on the resonance counterattack operation triggered by the player character.

5. The role state control method according to claim 4, characterized in that, Also includes: When no resonant input event is detected within the activation time interval, the echo listening for the resonant input event is cancelled in the interaction logic layer; At the end of the animation time window, the binding relationship between the resonant light effect resource and the light effect attachment point is released, and the rendering resources and memory resources occupied by the resonant light effect resource are released. The internal state identifier of the hostile character is updated from the first resonance value to the default resonance value.

6. The role state control method according to any one of claims 4-5, characterized in that, After the step of updating the enemy character's state from the first resonance state to the second resonance state, the method further includes: Apply the resonant counterattack corresponding to the resonant counterattack operation triggered by the player character to the enemy character, interrupt the resonant skill cast by the enemy character, and update the enemy character's character status information in the current game scene; After the preset duration of the second resonance state ends, the internal state identifier of the hostile character is updated from the second resonance value to the default resonance value.

7. A character state control device for implementing the character state control method as described in any one of claims 1-6, characterized in that, include: The resonance response module is configured to: respond to the resonance attack event triggered by the enemy character casting a resonance skill in the game scene, start a preset duration timer, and bind the resonance light effect resource to the enemy character's character model; The window acquisition module is configured to: update the animation playback effect of the resonant light effect resource in real time, acquire the animation time window corresponding to the animation playback effect, and determine the first timestamp and the second timestamp in the animation time window, wherein the second timestamp is later than the first timestamp. This includes: asynchronously updating the animation playback effect of the enemy character and the animation playback effect of the resonant light effect resource in the current game scene; extracting the animation time window corresponding to the animation playback effect of the resonant light effect resource based on preset animation time data, and determining the first timestamp and the second timestamp within the animation time window based on a preset time offset, so as to form the activation time interval of the first resonant state of the enemy character. The state activation module is configured to: when the duration timer reaches the first timestamp but does not exceed the second timestamp, activate the first resonance state of the hostile character accordingly, and listen for resonance input events during the duration of the first resonance state, including: determining the time interval during which the duration timer reaches the first timestamp but does not exceed the second timestamp as the activation time interval, and updating the internal state identifier of the hostile character from the default resonance value to the first resonance value corresponding to the first resonance state; The state update module is configured to: respond to the resonant input event, reclaim the resonant light effect resources, and update the enemy character's state from the first resonant state to the second resonant state.

8. The role state control device according to claim 7, characterized in that, The resonant response module includes: The command monitoring unit is configured to monitor the skill casting commands of enemy characters in the game scene and determine whether the skill casting commands correspond to the resonant skill. The light effect reading unit is configured to read the predefined light effect attachment point on the model bone node of the character model when the corresponding resonance skill is confirmed, and start the duration timer corresponding to the resonance skill. The resource synchronization unit is configured to bind and associate the resonant light effect resource with the light effect attachment point, and synchronize the world transformation matrix and special effects rendering effects of the resonant light effect resource and the character model.

9. A role status control device, comprising a central processing unit and a memory, characterized in that, The central processing unit is used to invoke and run a computer program stored in the memory to perform the steps of the method as described in any one of claims 1 to 6.

10. A non-volatile readable storage medium, characterized in that, It stores, in the form of computer-readable instructions, a computer program implemented according to any one of claims 1 to 6, which, when invoked by a computer, executes the steps included in the corresponding method.

Citation Information

Patent Citations

  • Animation playing method and device, equipment and readable medium

    CN114392549A

  • Program, information storage medium, and game device

    JP2011160870A