Battle operation method and device for virtual objects in virtual reality game
By receiving the battle situation status in the UE4 engine to judge the operation of virtual objects, and controlling them to perform appropriate combat operations in virtual reality games, the problem of switching combat states of virtual objects in game scenes is solved, and reasonable combat behavior of virtual objects is realized.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- SHENZHEN REALIS MULTIMEDIA TECH CO LTD
- Filing Date
- 2022-09-28
- Publication Date
- 2026-04-17
AI Technical Summary
In the UE4 engine, how can we effectively control virtual objects to perform appropriate combat operations in virtual reality games to meet the needs of the game scene?
By receiving the battle situation status in the virtual game, it determines whether it is in combat, performs operations such as being on alert or finding a shooting position, controls the virtual object to move to a position where the enemy can be seen, and performs tactical lateral movement until the enemy is eliminated or the alert state is switched, and generates a new virtual object to replace the fallen object.
It enables virtual objects to switch between different states of battle within the UE4 virtual engine, meeting the combat requirements of game scenarios and ensuring the reasonable combat behavior of virtual objects.
Smart Images

Figure CN115888107B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of virtual engine technology, and in particular to a method, apparatus, computer device, and storage medium for combat operation of virtual objects in virtual reality games. Background Technology
[0002] UE4 is an open-source, cross-platform game development engine. It is suitable for heavyweight game development, with a focus on PC games and high-end mobile games. UE4 supports Blueprints and C++, but has a higher learning curve.
[0003] When developing games using the UE4 engine, virtual objects in UE4 virtual reality need to enter appropriate combat states and perform actions to attack enemies based on the requirements of the game scene. How to control virtual objects to perform appropriate combat actions in UE4 virtual reality is a pressing problem that needs to be solved in current UE4 engine game development. Summary of the Invention
[0004] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method, device, computer equipment and storage medium for combat operation of virtual objects in virtual reality games, which can control virtual objects to perform combat operations in virtual reality implemented by the UE4 virtual engine to meet the needs of game scene settings.
[0005] To address at least one of the aforementioned technical problems, embodiments of the present invention provide a method for combat operations involving virtual objects in a virtual reality game, the method comprising:
[0006] Receive the current battle status in the virtual game and determine whether the game is in combat.
[0007] If not in combat mode, receive the first control command to perform alert operations; otherwise, receive the second control command to perform operations to find firing positions.
[0008] If a second control command is received, the virtual object is moved to a position where the enemy can be seen, and a tactical lateral movement operation is performed.
[0009] Determine if all enemies have been eliminated. If so, receive the first control command to continue the alert operation. If not, receive the second control command to continue the operation of finding a firing position.
[0010] If the system is not in combat mode, it receives a first control command to perform a warning operation; otherwise, it receives a second control command to perform a search for firing positions, including:
[0011] If the current battle situation is not a combat situation, the virtual object receives the first control command and goes to the preset warning point to perform a warning operation.
[0012] If the current battle situation is in combat, determine whether there are enemies in the current battle situation. If so, the virtual object receives the second control command to find and go to a location where it can attack the enemy. If not, change the current battle situation to alert state and control the virtual object to go to the preset alert point for alert.
[0013] If the current virtual object is destroyed by the enemy, a new virtual object will be generated at the set spawn point.
[0014] After the virtual object sees an enemy, it is controlled to fight the nearest enemy.
[0015] When the virtual object is engaged in combat, it is rotated so that it can fight standing or crouching.
[0016] The operation of finding the firing position includes:
[0017] The scene query system EQS is used to query locations in a virtual reality (VR) scene that meet preset conditions. The distance between the location that meets the preset conditions and the current location of the virtual object and the target location meets a set positional relationship.
[0018] From the locations that meet the preset conditions, unreachable locations are filtered out to obtain reachable locations;
[0019] Determine the firing position from the reachable positions.
[0020] The execution of the tactical translation operation includes:
[0021] Obtain the 3D coordinates of the target location and the 3D coordinates of the current location of the virtual object;
[0022] Determine the distance between the three-dimensional coordinates of the target location and the three-dimensional coordinates of the current location of the virtual object;
[0023] If it is determined that the distance is greater than a first preset threshold, then the virtual object is controlled to move closer to the target position;
[0024] If it is determined that the distance is less than the second preset threshold, then the virtual object is controlled to move away from the target position;
[0025] If it is determined that the distance is within the range of the first set threshold and the second set threshold, then the distance is kept within the range of the first set threshold and the second set threshold, and the device is shifted left and right.
[0026] A device for controlling virtual objects in a virtual reality game, the device comprising:
[0027] The judgment module is used to receive the current battle status in the virtual game and determine whether the game is in a combat state.
[0028] The receiving module is used to receive a first control command to perform a warning operation if the unit is not in combat mode; otherwise, it receives a second control command to perform a firing position search operation.
[0029] The control module is used to, upon receiving a second control command, control the virtual object to move to a position where enemies can be seen and perform a tactical lateral movement operation; determine whether all enemies have been eliminated, and if so, receive a first control command to continue the alert operation; otherwise, receive a second control command to continue the operation of finding a firing position.
[0030] In addition, embodiments of the present invention also provide a computer device, which includes: a memory, a processor, and an application program stored in the memory and executable on the processor, wherein the processor executes the application program to implement the steps of any of the methods described above.
[0031] In addition, embodiments of the present invention also provide a computer-readable storage medium having an application stored thereon, which, when executed by a processor, implements the steps of any of the methods described above.
[0032] In this embodiment of the invention, the current battle status in the virtual game is first received to determine whether the game is in combat. If it is not in combat, a first control command is received to perform a vigilance operation; otherwise, a second control command is received to perform a search for a firing position. If the second control command is received, the virtual object is controlled to move to a position where enemies are visible, and a tactical lateral movement operation is performed. It is then determined whether all enemies have been eliminated. If so, the first control command is received to continue performing the vigilance operation; otherwise, the second control command is received to continue performing the search for a firing position until all enemies are eliminated. This scheme enables the control of virtual objects to perform combat operations in a virtual reality environment implemented with the UE4 virtual engine, thus meeting the requirements of the game scene settings. Attached Figure Description
[0033] Figure 1 This is a flowchart illustrating a method for combat operation of virtual objects in a virtual reality game according to an embodiment of the present invention;
[0034] Figure 2 This is a schematic diagram illustrating the process of a virtual object performing an attack on an enemy in an embodiment of the present invention;
[0035] Figure 3 This is a schematic diagram of the structure of a virtual object combat operation device in a virtual reality game according to an embodiment of the present invention;
[0036] Figure 4This is a schematic diagram of the structural composition of a computer device in an embodiment of the present invention. Detailed Implementation
[0037] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0038] This invention provides a method for controlling virtual objects in a virtual reality game, such as... Figure 1 As shown, the method includes the following steps:
[0039] S102 receives the current battle status in the virtual game and determines whether the game is in a combat state.
[0040] In virtual reality, virtual objects (hereinafter referred to as AI) need to take appropriate actions to attack enemies, which requires setting up a commander role in the virtual game and the AI's own thinking. The AI will ask the commander about the current battle situation, that is, receive the current battle situation in the virtual game and determine whether it is in a combat state.
[0041] S104: If not in combat mode, the AI receives the first control command and performs a guard duty operation; otherwise, it receives the second control command and performs a firing position search operation. The commander will command the AI to perform corresponding operations based on the current battle situation. There are two battle situations: combat mode and guard duty mode. These two states can be switched based on the presence of enemies in the virtual game scene. For example, if enemies are present, the AI switches to combat mode, and the commander will instruct the AI to find and move to a position where it can see the enemy to engage in combat. If no enemies are present, the AI switches to guard duty mode, and the commander will instruct the AI to go to a pre-set guard point for guard duty.
[0042] Specifically, if the current battle situation is not a combat situation, the virtual object receives the first control command and goes to the preset warning point to perform a warning operation.
[0043] If the current battle situation is in combat, determine whether there are enemies in the current battle situation. If so, the virtual object receives the second control command to find and go to a location where it can attack the enemy. If not, change the current battle situation to alert state and control the virtual object to go to the preset alert point for alert.
[0044] If the current virtual object is destroyed by the enemy, a new virtual object will be generated at the designated spawn point. Since AI can be killed by the enemy during combat, new AI will be generated on the battlefield. When an AI dies, the system will generate a new AI at the designated spawn point, and the new AI will also perform corresponding operations according to the commander's orders.
[0045] The above-mentioned operation of finding the firing position includes:
[0046] The scene query system EQS is used to query locations in a virtual reality (VR) scene that meet preset conditions. The distance between the locations that meet the preset conditions and the current location of the virtual object and the target location meets a set positional relationship. Unreachable locations are filtered out from the locations that meet the preset conditions to obtain reachable locations. The shooting position is determined from the reachable locations.
[0047] S106, if a second control command is received, the virtual object is moved to a position where the enemy can be seen, and a tactical lateral movement operation is performed;
[0048] Once the virtual object spots an enemy, it can be controlled to engage the nearest enemy in combat. While fighting, the virtual object can be rotated to allow it to stand or crouch during combat.
[0049] The aforementioned tactical translation operation includes:
[0050] Obtain the three-dimensional coordinates of the target location and the three-dimensional coordinates of the current location of the virtual object; determine the distance between the three-dimensional coordinates of the target location and the three-dimensional coordinates of the current location of the virtual object; if the distance is determined to be greater than a first preset threshold, control the virtual object to move closer to the target location; if the distance is determined to be less than a second preset threshold, control the virtual object to move away from the target location; if the distance is determined to be within the range of the first preset threshold and the second preset threshold, maintain the distance within the range of the first preset threshold and the second preset threshold, and translate left and right.
[0051] S108: Determine if all enemies have been eliminated. If so, receive the first control command to continue the alert operation. If not, receive the second control command to continue the operation of finding a firing position.
[0052] Specifically, such as Figure 2As shown, when the AI starts a battle, it will randomly choose to attack the enemy by standing, crouching, or tactical movement. The attack behavior usually lasts for one second. Then it will determine whether the target enemy is dead. If not, it will return to the step of randomly choosing to stand, crouch, or tactically move to continue attacking the enemy. If the target enemy is dead, it will determine whether there are other enemies. If so, it will receive a second control command to continue searching for and moving to a location where it can attack enemies, preparing to continue the battle. If not, it will change the battle status to alert status and control all AI to move to the alert point to stand guard.
[0053] In summary, this invention provides a method for controlling virtual objects in a virtual reality game, enabling virtual objects in UE4 virtual reality to switch battle states according to battle logic in order to perform alert or combat operations.
[0054] In one embodiment, the present invention also provides a device for controlling the combat of virtual objects in a virtual reality game, such as... Figure 3 As shown, the device includes:
[0055] The judgment module 302 is used to receive the current battle status in the virtual game and determine whether the game is in a battle state.
[0056] The receiving module 304 is used to receive a first control command to perform a warning operation if it is not in combat mode, and otherwise to receive a second control command to perform a firing position search operation.
[0057] The control module 306 is used to, upon receiving a second control command, control the virtual object to move to a position where the enemy can be seen and perform a tactical lateral movement operation; determine whether all enemies have been eliminated, and if so, receive a first control command to continue performing a vigilance operation; if not, receive a second control command to continue performing a shooting position search operation.
[0058] Specific limitations regarding the combat operation device for virtual objects in a virtual reality game can be found in the above-described limitations regarding the combat operation method for virtual objects in a virtual reality game, and will not be repeated here. Each module in the aforementioned combat operation device for virtual objects in a virtual reality game can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0059] This invention provides a computer-readable storage medium storing an application program. When executed by a processor, the program implements a virtual object combat operation method in a virtual reality game according to any of the above embodiments. The computer-readable storage medium includes, but is not limited to, any type of disk (including floppy disk, hard disk, optical disk, CD-ROM, and magneto-optical disk), ROM (Read-Only Memory), RAM (Random Access Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electrically Erasable Programmable Read-Only Memory), flash memory, magnetic cards, or optical cards. In other words, the storage device includes any medium that can store or transmit information in a readable form by a device (e.g., a computer, a mobile phone), such as a read-only memory, a disk, or an optical disk.
[0060] This invention also provides a computer application that runs on a computer and is used to execute a virtual object combat operation method in a virtual reality game according to any of the above embodiments.
[0061] also, Figure 4 This is a schematic diagram of the structural composition of a computer device in an embodiment of the present invention.
[0062] This invention also provides a computer device, such as... Figure 4 As shown. The computer device includes a processor 602, a memory 603, an input unit 604, and a display unit 605, among other components. Those skilled in the art will understand that... Figure 4 The illustrated device structure is not intended to limit all devices and may include more or fewer components than shown, or combine certain components. Memory 603 can be used to store application program 601 and various functional modules. Processor 602 runs application program 601 stored in memory 603, thereby performing various functional applications and data processing of the device. Memory can be internal memory or external memory, or both. Internal memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), flash memory, or random access memory. External memory may include hard disks, floppy disks, ZIP disks, USB flash drives, magnetic tapes, etc. The memory disclosed in this invention includes, but is not limited to, these types of memory. The memory disclosed in this invention is only an example and not a limitation.
[0063] Input unit 604 is used to receive signal input and user-input keywords. Input unit 604 may include a touch panel and other input devices. The touch panel can collect user touch operations on or near it (such as operations performed by the user using a finger, stylus, or any suitable object or accessory on or near the touch panel) and drive the corresponding connection device according to a pre-set program; other input devices may include, but are not limited to, one or more of physical keyboards, function keys (such as play control buttons, power buttons, etc.), trackballs, mice, joysticks, etc. Display unit 605 can be used to display user-input information or information provided to the user, as well as various menus of the terminal device. Display unit 605 may be in the form of a liquid crystal display, organic light-emitting diode, etc. Processor 602 is the control center of the terminal device, connecting various parts of the entire device through various interfaces and lines, performing various functions and processing data by running or executing software programs and / or modules stored in memory 603, and calling data stored in memory.
[0064] As one embodiment, the computer device includes: one or more processors 602, a memory 603, and one or more application programs 601, wherein the one or more application programs 601 are stored in the memory 603 and configured to be executed by the one or more processors 602, and the one or more application programs 601 are configured to perform a virtual object combat operation method in a virtual reality game according to any of the above embodiments.
[0065] Furthermore, the above provides a detailed description of the combat operation method, apparatus, computer equipment, and storage medium for virtual objects in a virtual reality game provided by the embodiments of the present invention. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for operating a virtual object in a virtual reality game, characterized by, The method includes: Receive the current battle status in the virtual game and determine whether the game is in combat. If not in combat mode, receive the first control command to perform alert operations; otherwise, receive the second control command to perform operations to find firing positions. If a second control command is received, the virtual object is moved to a position where the enemy can be seen, and a tactical lateral movement operation is performed. Determine if all enemies have been eliminated. If so, receive the first control command to continue the alert operation. If not, receive the second control command to continue the operation of finding a firing position. If the current virtual object is destroyed by the enemy, a new virtual object will be generated at the set spawn point; because the virtual object is killed by the enemy during the battle, a new virtual object will be generated on the battlefield; when the virtual object is destroyed, the system will generate a new virtual object at the set spawn point, and the new virtual object will also perform corresponding operations according to the commander's orders. The execution of the tactical translation operation includes: Obtain the 3D coordinates of the target location and the 3D coordinates of the current location of the virtual object; Determine the distance between the three-dimensional coordinates of the target location and the three-dimensional coordinates of the current location of the virtual object; If it is determined that the distance is greater than a first preset threshold, then the virtual object is controlled to move closer to the target position; If it is determined that the distance is less than the second preset threshold, then the virtual object is controlled to move away from the target position; If it is determined that the distance is within the range of the first set threshold and the second set threshold, then the distance is kept within the range of the first set threshold and the second set threshold, and the device is shifted left and right.
2. The battle operation method according to claim 1, wherein If the system is not in combat mode, it receives a first control command to perform a warning operation; otherwise, it receives a second control command to perform a search for firing positions, including: If the current battle situation is not a combat situation, the virtual object receives the first control command and goes to the preset warning point to perform a warning operation. If the current battle situation is in combat, determine whether there are enemies in the current battle situation. If so, the virtual object receives the second control command to find and go to a location where it can attack the enemy. If not, change the current battle situation to alert state and control the virtual object to go to the preset alert point for alert.
3. The battle operation method according to claim 1, wherein If the current virtual object is destroyed by the enemy, a new virtual object will be generated at the set spawn point.
4. The battle operation method according to claim 1, wherein After the virtual object sees an enemy, it is controlled to fight the nearest enemy.
5. The battle operation method according to claim 4, wherein When the virtual object is engaged in combat, it is rotated so that it can fight standing or crouching.
6. The battle operation method according to claim 1, wherein The operation of finding the firing position includes: The scene query system EQS is used to query locations in a virtual reality (VR) scene that meet preset conditions. The distance between the location that meets the preset conditions and the current location of the virtual object and the target location meets a set positional relationship. From the locations that meet the preset conditions, unreachable locations are filtered out to obtain reachable locations; Determine the firing position from the reachable positions.
7. A virtual object battle operation device in a virtual reality game, characterized by, The device includes: The judgment module is used to receive the current battle status in the virtual game and determine whether the game is in a combat state. The receiving module is used to receive a first control command to perform a warning operation if the unit is not in combat mode; otherwise, it receives a second control command to perform a firing position search operation. The control module is used to, upon receiving a second control command, control the virtual object to move to a position where the enemy can be seen and perform a tactical lateral movement operation; determine whether all enemies have been eliminated, and if so, receive a first control command to continue the alert operation; if not, receive a second control command to continue the operation of finding a shooting position. If the current virtual object is destroyed by the enemy, a new virtual object will be generated at the set spawn point; because the virtual object is killed by the enemy during the battle, a new virtual object will be generated on the battlefield; when the virtual object is destroyed, the system will generate a new virtual object at the set spawn point, and the new virtual object will also perform corresponding operations according to the commander's orders. The execution of the tactical translation operation includes: Obtain the 3D coordinates of the target location and the 3D coordinates of the current location of the virtual object; Determine the distance between the three-dimensional coordinates of the target location and the three-dimensional coordinates of the current location of the virtual object; If it is determined that the distance is greater than a first preset threshold, then the virtual object is controlled to move closer to the target position; If it is determined that the distance is less than the second preset threshold, then the virtual object is controlled to move away from the target position; If it is determined that the distance is within the range of the first set threshold and the second set threshold, then the distance is kept within the range of the first set threshold and the second set threshold, and the device is shifted left and right.
8. A computer device comprising a memory, a processor, and an application stored on the memory and executable on the processor, wherein the application comprises: When the processor executes the application, it implements the steps of the method according to any one of claims 1 to 6.
9. A computer readable storage medium having stored thereon an application program, the application program comprising the steps of: When the application is executed by a processor, it implements the steps of the method according to any one of claims 1 to 6.