Embodiments of this application relate to the field of human-computer interaction, and in particular, to a method and an apparatus for controlling a virtual throwable, a device, a medium, and a program product.
Currently, shooting games have increasingly diverse types and modes.
In the related art, after a shooting game is started, a user may control a virtual object to use a virtual throwable in a virtual environment, and then perform a next action based on a special effect generated by the virtual throwable. For example, the user controls the virtual object to throw a “virtual smoke bomb” in the virtual environment, and performs an attack or escapes under smoke generated by the “virtual smoke bomb”.
However, in the above related art, the special effect is displayed in a specific radius centered around the virtual throwable, and the special effect is constant. A smoke scene simulated in this manner is not realistic.
This application provides a method and an apparatus for controlling a virtual throwable, a device, a medium, and a program product. The technical solutions are as follows:
According to an aspect of this application, a method for controlling a virtual throwable is performed by a computer device, and the method includes:
In some embodiments, the special effect cells are set in the first range centered around the explosion point of the virtual throwable.
The special effect cells in the first range are traversed, and the special effect cell in the first range satisfying the valid diffusion condition is determined as a valid special effect cell.
A quantity of valid special effect cells corresponding to the diffusion range at the ith moment and a first position occupied by a dynamic virtual obstacle are determined based on a diffusion range of the virtual fluid substance at an ith moment.
A quantity of valid special effect cells occupied by the dynamic virtual obstacle is determined in response to the dynamic virtual obstacle moving to a second position at an (i+1)th moment.
Valid special effect cells are equi-proportionally added to the first position based on the quantity of valid special effect cells corresponding to the diffusion range of the virtual fluid substance at the ith moment and the quantity of valid special effect cells occupied by the dynamic virtual obstacle at the second position, and the virtual fluid substance is diffused based on the added valid special effect cells.
A quantity of valid special effect cells corresponding to the diffusion range of the virtual fluid substance varies in a normal distribution over time, and i is a positive integer.
According to another aspect of this application, a computer device is provided, including a processor and a memory, the memory having at least one computer program stored therein, the at least one computer program, when loaded and executed by the processor, causing the computer device to implement the method for controlling a virtual throwable described in the above aspect.
According to another aspect of this application, a non-transitory computer-readable storage medium is provided, having at least one computer program stored therein, the at least one computer program being loaded and executed by a processor, to implement the method for controlling a virtual throwable described in the above aspect.
The technical solutions provided in this application have at least the following beneficial effects:
The computer device sets the special effect cells in the first range centered around the explosion point of the virtual throwable in response to the thrown virtual throwable exploding and releasing the virtual fluid substance in the virtual environment picture; traverses the special effect cells in the first range, and determines the special effect cell in the first range satisfying the valid diffusion condition as a valid special effect cell; and diffuses, when the virtual fluid substance encounters the virtual obstacle during the diffusion, the virtual fluid substance based on the valid special effect cell on the surface of the virtual obstacle. According to this application, through the detection of the valid special effect cells around the virtual obstacle and the diffusion based on the valid special effect cells around the virtual obstacle, a realistic scenario of changing the direction of the virtual fluid substance when the virtual fluid substance encounters the obstacle is simulated, thereby simulating a more realistic diffusion effect of the virtual fluid substance.
To make objectives, technical solutions, and advantages of this application clearer, implementations of this application are described in further detail with reference to drawings.
First, terms involved in embodiments of this application are briefly described.
Virtual environment: It is a virtual environment displayed (or provided) when an application (APP) runs in a terminal. The virtual environment may be a simulated world, a semi-simulated and semi-fabricated three-dimensional (3D) world, or a completely fabricated 3D environment of the real world. The virtual environment may be any one of a two-dimensional (2D) virtual environment, a 2.5-dimensional (2.5D) virtual environment, and a 3D virtual environment. In some embodiments, the virtual environment is configured for a virtual environment battle between at least two virtual objects. The virtual environment has virtual resources available for the at least two virtual objects. In some embodiments, the virtual environment includes a lower left corner region and an upper right corner region that are symmetrical, and virtual objects belonging to two rival camps occupy respective regions.
Virtual object: It is a movable object in a virtual environment. The movable object may be at least one of a virtual character, a virtual animal, and a cartoon character. In some embodiments, when the virtual environment is a 3D virtual environment, the virtual object may be a 3D model. Each virtual object has a shape and a volume in the 3D virtual environment, and occupies a partial space in the 3D virtual environment. In some embodiments, the virtual object is a 3D character constructed based on a 3D human bone technology. The virtual object achieves different appearances by wearing different skins. In some implementations, the virtual object may be implemented by using a 2.5D or 2D model, which is not limited in the embodiments of this application.
Multiplayer online battle arena (MOBA) game: It refers to a game in which different virtual teams belonging to at least two rival camps occupy respective map regions and battle with each other for a victory condition in a virtual environment. The victory condition includes but is not limited to at least one of occupying a stronghold or destroying a rival camp stronghold, killing a virtual object of a rival camp, achieving survival in a specified scene and specified time, snatching a resource, and getting a higher score than an opponent in specified time. A MOBA game may be played in rounds. A map for each MOBA game may not or may vary. Each virtual team includes one or more virtual objects, for example, 1, 2, 3, or 5 virtual objects.
In response to: It indicates a condition or a state on which one or more to-be-performed operations rely. When the condition or the state is satisfied, the one or more operations may be performed in real time or at a set delay. Unless otherwise specified, a sequence in which a plurality of operations are performed is not limited.
Virtual throwable: It is a virtual item in a virtual environment available for a virtual object to throw.
In this application, a prompt interface and a pop-up window may be displayed or voice prompt information may be outputted before and during collection of relevant data of a user. The prompt interface, the pop-up window, or the voice prompt information is configured for prompting the user that relevant data of the user is currently being collected. Therefore, in this application, relevant operations of obtaining user-related data are performed only after a confirmation operation performed by the user on the prompt interface or the pop-up window is obtained. Otherwise (i.e., when no confirmation operation performed by the user on the prompt interface or the pop-up window is obtained), the relevant operations of obtaining user-related data are ended, i.e., the user-related data is not obtained. In other words, all user data collected in this application is collected with the consent and authorization of the user, and the collection, use, and processing of relevant user data need to comply with relevant laws, regulations, and standards of relevant countries and regions.
An embodiment of this application provides a method for controlling a virtual throwable.
As shown in (a) in
In some embodiments, the virtual throwable 20 includes at least one of a virtual smoke bomb, a virtual frangible grenade, a virtual gas bottle, and the like, which is not limited in this embodiment of this application.
Exemplarily, a manner of throwing the virtual throwable 20 includes at least one of a high throw, a low throw, and a rebound from impact of the virtual throwable 20, which is not limited in this application. In other words, the virtual throwable 20 may be thrown through at least one of the high throw, the low throw, and the rebound from impact.
In some embodiments, throwing the virtual throwable 20 through the high throw means throwing the virtual throwable 20 upward. In other words, an initial throwing direction of the virtual throwable 20 is an upward throwing direction. Throwing the virtual throwable 20 through the low throw means throwing the virtual throwable 20 downward. In other words, the initial throwing direction of the virtual throwable 20 is a downward throwing direction. Throwing the virtual throwable 20 through the rebound from impact means throwing the virtual throwable 20 toward an obstacle. In other words, the initial throwing direction of the virtual throwable 20 is a direction toward the virtual throwable 20. The virtual throwable 20 rebounds and switches to another direction when touching the obstacle.
The virtual fluid substance 40 refers to a virtual substance with a fluid property released by the virtual throwable 20. If a virtual smoke bomb is used as an example, the virtual fluid substance 40 refers to smoke released by the virtual smoke bomb.
Exemplarily, when the virtual fluid substance 40 encounters a virtual obstacle 30 during the diffusion, the virtual fluid substance 40 is diffused on a surface of the virtual obstacle 30.
Exemplarily, in response to a virtual object entering a diffusion range of the virtual fluid substance 40, the computer device controls an attribute value of the virtual object.
In some embodiments, the attribute value includes a health point and/or a skill point.
The computer device reduces the health point and/or the skill point in response to the virtual object entering the diffusion range of the virtual fluid substance 40.
For example, the virtual fluid substance 40 is a virtual stink bomb. After the virtual stink bomb explodes, the virtual stink bomb releases stink. When the virtual object enters a diffusion range of the stink, the health point and the skill point both decrease. When the health point of the virtual object is less than a health threshold, the virtual object enters a non-healthy state. When the skill point of the virtual object is less than a skill threshold, the virtual object is prevented from using a skill.
In some embodiments, the computer device sets special effect cells in a first range centered around an explosion point of the virtual throwable 20, the special effect cells being configured for determining the diffusion direction of the virtual fluid substance 40, and the first range being greater than a second range, the second range indicating the diffusion range of the virtual fluid substance 40.
The computer device traverses the special effect cells in the first range, and determines a special effect cell in the first range satisfying a valid diffusion condition as a valid special effect cell. The computer device determines the diffusion direction of the virtual fluid substance 40 based on the valid special effect cell.
The valid diffusion condition includes at least one of the special effect cell being in the second range, the special effect cell not overlapping the virtual obstacle 30, and the special effect cell being not traversed. In some embodiments, the valid diffusion condition includes all of the special effect cell being in the second range, the special effect cell not overlapping the virtual obstacle 30, and the special effect cell being not traversed.
Exemplarily, the computer device uses a special effect cell at which the explosion point is located as a starting special effect cell. The computer device traverses special effect cells adjacent to the starting special effect cell, determines a special effect cell that is adjacent to the starting special effect cell and satisfies the valid diffusion condition as a valid special effect cell, and determines the special effect cell as a next starting special effect cell; and repeats the above operation until all of the special effect cells in the first range are traversed.
In some embodiments, when the special effect cell at which the explosion point is located is a valid special effect cell, the special effect cell at which the explosion point is located is used as the starting special effect cell.
In some embodiments, when the special effect cell at which the explosion point is located is not a valid special effect cell, a special effect cell in the first range satisfying a ray detection condition is used as the starting special effect cell.
The ray detection condition includes that a to-be-detected special effect cell can be connected to the special effect cell at which the explosion point is located by a ray and that the to-be-detected special effect cell does not overlap the virtual obstacle.
In summary, according to method provided in this embodiment of this application, the computer device displays the virtual environment picture; displays the diffusive virtual fluid substance released by the virtual throwable in response to the thrown virtual throwable exploding in the virtual environment picture; and changes the diffusion direction of the virtual fluid substance based on the virtual obstacle in response to the virtual fluid substance encountering the virtual obstacle during the diffusion. According to this application, through the changing of the diffusion direction of the virtual fluid substance based on the virtual obstacle, a realistic scenario of changing the direction of the virtual fluid substance when the virtual fluid substance encounters the obstacle is simulated, thereby simulating a more realistic diffusion effect of the virtual fluid substance. In this way, user experience is improved.
The embodiments of this application provide a method and an apparatus for controlling a virtual throwable, a device, a medium, and a program product, so as to control a virtual throwable in a virtual scene in a flexible and simple manner, thereby improving human-computer interaction efficiency and the user experience. To make it easier to understand the method for controlling a virtual throwable in a virtual scene provided in the embodiments of this application, an exemplary implementation scenario of the method for controlling a virtual throwable in a virtual scene provided in the embodiments of this application is first described. A virtual scene in the method for controlling a virtual throwable in a virtual scene provided in the embodiments of this application may be outputted completely based on a terminal device or outputted collaboratively based on the terminal device and a server.
In some embodiments, the virtual scene may be an environment for virtual objects (for example, target virtual objects) to perform interactions. For example, game roles may battle in the virtual scene. Actions of the game roles may be controlled so that both parties can perform interactions in the virtual scene, thereby enabling a user to relieve life pressure during the gaming.
In an implementation scenario,
In an example, types of the graphics processing hardware include a central processing unit (CPU) and a graphics processing unit (GPU).
When visual sensing of the virtual scene 100 needs to be formed, the terminal device 400 calculates data for display through the graphics computing hardware, completes loading, parsing, and rendering of the displayed data, and outputs a video frame that can form the visual sensing of the virtual scene on the graphics output hardware. For example, a 2D video frame is presented on a display of a smartphone, or a 3D video frame is projected onto lenses of AR/VR glasses. In addition, to enrich a sensing effect, the terminal device 400 may further form one or more of auditory sensing, tactile sensing, motion sensing, and taste sensing through different hardware.
In an example, a client 410 (for example, a stand-alone game APP) runs in the terminal device 400. A virtual scene including role play is outputted during the running of the client 410. The virtual scene may be an environment for game roles to perform interactions, for example, may be a plain, a street, or a valley for game roles to battle. An example in which the virtual scene 100 is displayed from a third-person perspective is used. A primary controlled virtual object 101 is displayed in the virtual scene 100. The primary controlled virtual object 101 may be a user-controlled game role, i.e., the primary controlled virtual object 101 is controlled by a real user, and is to move in the virtual scene 100 in response to an operation performed by the real user on a controller (for example, a touchscreen, a voice-operated switch, a keyboard, a mouse, or a joystick). For example, when the real user moves the joystick (including a virtual joystick and a real joystick) rightward, the primary controlled virtual object 101 moves rightward in the virtual scene 100, or may keep still or jump, and the primary controlled virtual object 101 is controlled to perform a shooting operation and the like.
For example, the primary controlled virtual object 101 is displayed in the virtual scene 100. In response to a thrown virtual throwable 20 exploding in the virtual environment 100, a diffusive virtual fluid substance 40 released by the virtual throwable 20 is displayed. In response to the virtual fluid substance 40 encountering a virtual obstacle 30 during diffusion, a diffusion direction of the virtual fluid substance 40 is changed based on the virtual obstacle 30. Through the changing of the diffusion direction of the virtual fluid substance 40 based on the virtual obstacle 30, a realistic scenario of changing the direction of the virtual fluid substance 40 when the virtual fluid substance encounters the virtual obstacle 30 is simulated, thereby simulating a more realistic diffusion effect of the virtual fluid substance 40. In this way, user experience is improved.
In another implementation scenario,
An example in which visual sensing of the virtual scene 100 needs to be formed is used. The server 200 calculates display data (such as scene data) related to the virtual scene and transmits the display data to the terminal device 400 through a network 300. The terminal device 400 completes loading, parsing, and rendering of the calculated display data through graphics computing hardware, and outputs the virtual scene through graphics output hardware to form the visual sensing. For example, a 2D video frame may be presented on a display of a smartphone, or a 3D video frame is projected onto lenses of AR/VR glasses. The sensing in the form of the virtual scene may be outputted through corresponding hardware of the terminal device 400. For example, auditory sensing is formed by using a microphone, and haptic sensing is formed by using a vibrator.
In an example, the terminal device 400 has a client 410 (for example, an online game APP) running therein, and performs game interactions with other users through connection to the server 200 (for example, a game server), and the terminal device 400 outputs a virtual scene 100 of the client 410. An example in which the virtual scene 100 is displayed from a third-person perspective is used. A primary controlled virtual object 101 is displayed in the virtual scene 100. The primary controlled virtual object 101 may be a user-controlled game role, i.e., the primary controlled virtual object 101 is controlled by a real user, and is to move in the virtual scene 100 in response to an operation performed by the real user on a controller (such as a touchscreen, a voice-operated switch, a keyboard, a mouse, or a joystick). For example, when the real user moves the joystick rightward, the primary controlled virtual object 101 moves rightward in the virtual scene 100, or may keep still or jump, and the primary controlled virtual object 101 is controlled to perform a shooting operation and the like.
For example, the primary controlled virtual object 101 is displayed in the virtual scene 100. In response to a thrown virtual throwable 20 exploding in the virtual environment 100, a diffusive virtual fluid substance 40 released by the virtual throwable 20 is displayed. In response to the virtual fluid substance 40 encountering a virtual obstacle 30 during diffusion, a diffusion direction of the virtual fluid substance 40 is changed based on the virtual obstacle 30. Through the changing of the diffusion direction of the virtual fluid substance 40 based on the virtual obstacle 30, a realistic scenario of changing the direction of the virtual fluid substance 40 when the virtual fluid substance encounters the obstacle is simulated, thereby simulating a more realistic diffusion effect of the virtual fluid substance. In this way, user experience is improved.
In some embodiments, the terminal device 400 may implement the method for controlling a virtual throwable in a virtual scene provided in the embodiments of this application by running a computer program. For example, the computer program may be a native program or a software module in an operating system; or may be a native APP, i.e., a program that needs to be installed in the operating system for running, such as a shooting game APP (i.e., the above client 410); or may be an applet, i.e., a program that merely needs to be downloaded into a browser environment for running; or may be a game applet that can be embedded into any APP. In a word, the above computer program may be an APP, a module, or a plug-in in any form.
An example in which the computer program is an APP is used. During an actual implementation, the terminal device 400 has an APP supporting a virtual scene installed and running therein. The APP may be any one of a first-person shooting game (FPS), a third-person shooting game (TPS), an escape shooting game, a VR APP, an AR program, a 3D map program, a MOBA game, and a simulation game (SLG). A user operates a virtual object in the virtual scene by using the terminal device 400, to perform an activity. The activity includes but is not limited to at least one of adjusting a body posture, crawling, walking, running, riding, jumping, driving, pickup, shooting, attacking, throwing, and building a virtual building. Exemplarily, the virtual object may be a virtual character, such as a simulated character or a cartoon character.
In some other embodiments, this embodiment of this application may be implemented through a cloud technology. The cloud technology is a hosting technology that unifies a series of resources such as hardware, software, and a network in a wide area network or a local area network to realize data computing, storage, processing, and sharing.
The cloud technology is a collective name of a network technology, an information technology, an integration technology, a platform management technology, an application technology, and the like based on application of business models for cloud computing. The technologies may form a resource pool for use on demand, which is flexible and convenient. A cloud computing technology will become an important support. Backend services of a technological network system require a lot of computing and storage resources.
For example, the server 200 in
The first terminal 110 has a client 111 supporting a virtual environment installed and running therein. The client 111 may be a multiplayer online battle program. When the client 111 runs in the first terminal 110, a UI of the client 111 is displayed on a screen of the first terminal 110. The client 111 may be any one of an escape shooting game, a VR APP, an AR program, a 3D map program, a VR game, an AR game, an FPS, a TPS, a MOBA game, and an SLG. In this embodiment, a description is provided by using an example in which the client 111 is a shooting game.
The first terminal 110 is a terminal used by a first user 112. The first user 112 controls a first virtual object in the virtual environment to perform an activity or operates a virtual item owned by the first virtual object by using the first terminal 110. The first virtual object may be referred to as a virtual object of the first user 112. The first user 112 may perform an operation such as assembling, disassembling, or unloading on the virtual item owned by the first virtual object, which is not limited in this application. Exemplarily, the first virtual object is a first virtual character, for example, a simulated character or a cartoon character.
The second terminal 130 has a client 131 supporting a virtual environment installed and running therein. The client 131 may be a multiplayer online battle program. When the second client 131 runs in the second terminal 130, a UI of the second client 131 is displayed on a screen of the second terminal 130. The client may be any one of an escape shooting game, a VR APP, an AR program, a 3D map program, a VR game, an AR game, an FPS, a TPS, a MOBA game, and an SLG. In this embodiment, a description is provided by using an example in which the client 131 is a MOBA game.
The second terminal 130 is a terminal used by a second user 113. The second user 113 controls a second virtual object in the virtual environment to perform an activity or operates a virtual item owned by the second virtual object by using the second terminal 130. The second virtual object may be referred to as a virtual object of the second user 113. Exemplarily, the second virtual object is a second virtual character, for example, a simulated character or a cartoon character.
In some embodiments, the first virtual object and the second virtual object are in the same virtual environment. In some embodiments, the first virtual object and the second virtual object may belong to the same camp, the same team, or the same organization, or may be friends, or may have temporary communication permission. In some embodiments, the first virtual object and the second virtual object may belong to different camps, different teams, or different organizations, or may be rivals.
In some embodiments, the client installed in the first terminal 110 is same as the client installed in the second terminal 130, or the clients installed in the two terminals are clients of the same type on different operating system platforms (Android or IOS). The first terminal 110 may be one of a plurality of terminals, and the second terminal 130 may be another of the plurality of terminals. In this embodiment, only the first terminal 110 and the second terminal 130 are used as an example for description. The first terminal 110 and the second terminal 130 are of the same device type or different device types. The device type includes at least one of a smartphone, a tablet computer, an e-book reader, a moving picture experts group audio layer III (MP3) player, a moving picture experts group audio layer IV (MP4) player, a laptop portable computer, and a desktop computer.
The first terminal 110, the second terminal 130, and the other terminals 140 are connected to the server 120 through a wired or wireless network.
The server 120 includes at least one of one server, a plurality of servers, a cloud computing platform, and a virtualization center. The server 120 is configured to provide a backend service for a client supporting a 3D virtual environment. In some embodiments, the server 120 is in charge of primary computing works, and the terminals are in charge of secondary computing works. Alternatively, the server 120 is in charge of the secondary computing works, and the terminals are in charge of the primary computing works. Alternatively, the server 120 and the terminals perform collaborative computing through a distributed computing architecture.
In an exemplary example, the server 120 includes a processor 122, a user account database 123, a battle service module 124, and a user-oriented input/output interface (I/O interface) 125. The processor 122 is configured to load instructions stored in the server 121, and process data in the user account database 123 and the battle service module 124. The user account database 123 is configured to store data of user accounts used by the first terminal 110, the second terminal 130, and the other terminals 140, for example, avatars of the user accounts, nicknames of the user accounts, combat effectiveness indices of the user accounts, and service regions where the user accounts are located. The battle service module 124 is configured to provide a plurality of battle rooms for users to battle, for example, a 1V1 battle, a 3V3 battle, or a 5V5 battle. The user-oriented I/O interface 125 is configured to establish communication with the first terminal 110 and/or the second terminal 130 through the wireless or wired network to exchange data.
The method for controlling a virtual throwable provided in the embodiments of this application is described below.
Operation 502: Set, in response to a thrown virtual throwable exploding and releasing a virtual fluid substance in a virtual environment picture, special effect cells in a first range centered around an explosion point of the virtual throwable.
A virtual environment is a virtual activity space provided by an APP in a terminal during running, for a virtual object to perform various activities in the virtual activity space.
Exemplarily, the virtual environment is a 2D picture displayed on the terminal obtained through picture capturing of a 3D virtual environment. Exemplarily, a shape of the virtual environment is determined based on a shape of a display of the terminal or a shape of a UI of the terminal. For example, the display of the terminal is rectangular. In this case, the virtual environment picture is displayed as a rectangular picture.
The virtual object is a game role controlled by the terminal. The terminal controls the virtual object to move in the virtual environment based on a received user operation.
Exemplarily, activities of the virtual object in the virtual environment includes walking, running, jumping, climbing, getting down, attacking, releasing a skill, picking up a prop, transmitting a message, and the like, which are not limited in this embodiment of this application.
The virtual throwable refers to a virtual item that can be thrown by the virtual object in the virtual environment.
In some embodiments, the virtual throwable includes at least one of a virtual smoke bomb, a virtual frangible grenade, a virtual gas bottle, and the like, which is not limited in this embodiment of this application.
The virtual fluid substance refers to a virtual fluid substance with a fluid property released by the virtual throwable. The virtual fluid substance has diffusivity. If a virtual smoke bomb is used as an example, the virtual fluid substance refers to smoke released by the virtual smoke bomb.
Exemplarily, the computer device sets the special effect cells in the first range centered around the explosion point of the virtual throwable, the special effect cells being configured for determining a diffusion direction of the virtual fluid substance, and the first range being greater than a second range, the second range indicating a diffusion range of the virtual fluid substance.
Exemplarily, a manner of throwing the virtual throwable includes at least one of a high throw, a low throw, and a rebound from impact of the virtual throwable, which is not limited in this application. In other words, the virtual throwable may be thrown through at least one of the high throw, the low throw, and the rebound from impact.
In some embodiments, throwing the virtual throwable through the high throw means throwing the virtual throwable upward. In other words, an initial throwing direction of the virtual throwable is an upward throwing direction. Throwing the virtual throwable through the low throw means throwing the virtual throwable downward. In other words, the initial throwing direction of the virtual throwable is a downward throwing direction. Throwing the virtual throwable through the rebound from impact means throwing the virtual throwable toward an obstacle. In other words, the initial throwing direction of the virtual throwable is a direction toward the virtual throwable. The virtual throwable rebounds and switches to another direction when touching the obstacle.
Exemplarily, the computer device traverses the special effect cells in the first range, and determines the special effect cell in the first range satisfying the valid diffusion condition as a valid special effect cell.
The valid diffusion condition includes at least one of the special effect cell being in the second range, the special effect cell not overlapping the virtual obstacle, and the special effect cell being not traversed. In some embodiments, the valid diffusion condition includes all of the special effect cell being in the second range, the special effect cell not overlapping the virtual obstacle, and the special effect cell being not traversed.
Operation 506: Diffuse, when the Virtual Fluid Substance Encounters a Virtual Obstacle During Diffusion, the Virtual Fluid Substance Based on a Valid Special Effect Cell on a Surface of the Virtual Obstacle.
Exemplarily, in response to the virtual fluid substance encountering the virtual obstacle during diffusion, the computer device changes the diffusion direction of the virtual fluid substance based on the virtual obstacle.
A virtual smoke bomb is used as an example. After the virtual smoke bomb releases smoke, the smoke diffuses all around. During the diffusion, the smoke encounters a wall. The wall changes the diffusion direction of the smoke, so that the smoke diffuses in a direction of the wall.
Exemplarily, the computer device diffuses, when the virtual fluid substance encounters the virtual obstacle during the diffusion, the virtual fluid substance based on the valid special effect cell on the surface of the virtual obstacle.
In summary, according to the method provided in this embodiment of this application, the computer device sets the special effect cells in the first range centered around the explosion point of the virtual throwable in response to the thrown virtual throwable exploding and releasing the virtual fluid substance in the virtual environment picture; traverses the special effect cells in the first range, and determines the special effect cell in the first range satisfying the valid diffusion condition as a valid special effect cell; and diffuses, when the virtual fluid substance encounters the virtual obstacle during the diffusion, the virtual fluid substance based on the valid special effect cell on the surface of the virtual obstacle. According to this application, through the detection of the valid special effect cells around the virtual obstacle and the diffusion based on the valid special effect cells around the virtual obstacle, a realistic scenario of changing the direction of the virtual fluid substance when the virtual fluid substance encounters the obstacle is simulated, thereby simulating a more realistic diffusion effect of the virtual fluid substance.
A virtual environment is a virtual activity space provided by an APP in a terminal during running, for a virtual object to perform various activities in the virtual activity space.
Exemplarily, a position of the virtual object in the virtual environment may be equivalent to a central position in a map display control, or may be another position in the map display control. In other words, the position of the virtual object in the virtual environment may correspond to a center of the map display control, or may correspond to another position in the map display control.
The virtual throwable refers to a virtual item that can be thrown by the virtual object in the virtual environment.
In some embodiments, the virtual throwable includes at least one of a virtual smoke bomb, a virtual frangible grenade, a virtual gas bottle, and the like, which is not limited in this embodiment of this application.
The virtual fluid substance refers to a virtual fluid substance with a fluid property released by the virtual throwable. The virtual fluid substance has diffusivity. If a virtual smoke bomb is used as an example, the virtual fluid substance refers to smoke released by the virtual smoke bomb.
Exemplarily, a manner of throwing the virtual throwable includes at least one of a high throw, a low throw, and a rebound from impact of the virtual throwable, which is not limited in this application. In other words, the virtual throwable may be thrown through at least one of the high throw, the low throw, and the rebound from impact.
Position information of a first sample point P1:P1=P0+V0*t.
Position information of a second sample point P2:P2=P1+V1*t.
Position information of a sample point Pt between the first sample point and the second sample point:
In the equations, t is a unit time, V1 is throwing speed information at the first sample point, and t1 is a time point corresponding to the sample point Pt between the second sample point and the first sample point.
Operation 604: Use a Special Effect Cell at which the Explosion Point is Located as a Starting Special Effect Cell, Traverse the Special Effect Cells in the First Range, and Determine a Special Effect Cell in the First Range Satisfying a Valid Diffusion Condition as a Valid Special Effect Cell.
Exemplarily, the computer device uses the special effect cell at which the explosion point is located as the starting special effect cell. The computer device traverses special effect cells adjacent to the starting special effect cell, determines a special effect cell that is adjacent to the starting special effect cell and satisfies the valid diffusion condition as a valid special effect cell, and determines the special effect cell as a next starting special effect cell; and repeats the above operation until all of the special effect cells in the first range are traversed.
For example,
In some embodiments, a shape of the first range is at least one of a rectangular cuboid, a cube, a circle, a sphere, a cylinder, and the like, which is not specifically limited in this embodiment of this application.
Exemplarily,
In some embodiments,
To understand the process of traversing the special effect cells in more detail,
As shown in (c) in
As shown in (d) in
As shown in (e) in
As shown in (f) in
The above operation is repeated until no new valid special effect cell exists or until all of the special effect cells in the first range are traversed.
During the above cell traversal, the valid special effect cell is identified through marking of the distance between the special effect cell and the center cell. When the distance value is less than 1000, the special effect cell is determined as a valid special effect cell. In a possible implementation, a valid special effect cell may be marked with an empty tag. To be specific, a valid special effect cell may be marked as “empty”, and an invalid special effect cell may be marked as “solid”. It is determined whether a special effect cell is valid through identification of a mark of the special effect cell.
Operation 606: Diffuse, when the Virtual Fluid Substance Encounters a Virtual Obstacle During Diffusion, the Virtual Fluid Substance Based on a Valid Special Effect Cell on a Surface of the Virtual Obstacle.
Exemplarily, in response to the virtual fluid substance encountering the virtual obstacle during diffusion, the computer device changes a diffusion direction of the virtual fluid substance based on the virtual obstacle.
A virtual smoke bomb is used as an example. After the virtual smoke bomb releases smoke, the smoke diffuses all around. During the diffusion, the smoke encounters a wall. The wall changes the diffusion direction of the smoke, so that the smoke diffuses in a direction of the wall.
Exemplarily, the computer device sets the special effect cells in the first range centered around the explosion point of the virtual throwable, the special effect cells being configured for determining the diffusion direction of the virtual fluid substance, and the first range being greater than the second range, the second range indicating the diffusion range of the virtual fluid substance. The computer device traverses the special effect cells in the first range, and determines the special effect cell in the first range satisfying the valid diffusion condition as a valid special effect cell; and diffuses, when the virtual fluid substance encounters the virtual obstacle during the diffusion, the virtual fluid substance based on the valid special effect cell on the surface of the virtual obstacle.
The valid diffusion condition includes at least one of the special effect cell being in the second range, the special effect cell not overlapping the virtual obstacle, and the special effect cell being not traversed. In some embodiments, the valid diffusion condition includes all of the special effect cell being in the second range, the special effect cell not overlapping the virtual obstacle, and the special effect cell being not traversed.
Exemplarily,
In a possible implementation, when the special effect cell at which the explosion point is located is a valid special effect cell, the special effect cell at which the explosion point is located is used as the starting special effect cell.
The starting special effect cell refers to a special effect cell used as a starting point for traversal other special effect cells. In other words, the starting special effect cell is used as the starting point for traversing the other special effect cells.
In a possible implementation, when the special effect cell at which the explosion point is located is not a valid special effect cell, a special effect cell in the first range satisfying a ray detection condition is used as the starting special effect cell.
The ray detection condition includes that a to-be-detected special effect cell can be connected to the special effect cell at which the explosion point is located by a ray and that the to-be-detected special effect cell does not overlap the virtual obstacle.
Exemplarily,
As shown in (b) in
According to the method provided in this embodiment of this application, the special effect cells are set in the first range centered around the explosion point of the virtual throwable; the special effect cells in the first range are traversed, and the special effect cell in the first range satisfying the valid diffusion condition is determined as the valid special effect cell; and the virtual fluid substance is diffused based on the valid special effect cell on the surface of the virtual obstacle when the virtual fluid substance encounters the virtual obstacle during the diffusion. In this application, the validity of the special effect cells is traversed through the calculation of the distances between the special effect cells, so as to determine the diffusion direction of the virtual fluid substance, thereby reducing a calculation amount, reducing a requirement on a hardware device, and improving human-computer interaction efficiency.
In a possible implementation, in response to the virtual object entering the diffusion range of the virtual fluid substance, the computer device controls an attribute value of the virtual object.
In some embodiments, the attribute value includes a health point and/or a skill point.
Exemplarily, the computer device reduces the health point and/or the skill point of the virtual object in response to the virtual object entering the diffusion range of the virtual fluid substance.
Exemplarily, the computer device sets the special effect cells in the first range centered around the explosion point of the virtual throwable, the first range being greater than the second range, and the second range indicating the diffusion range of the virtual fluid substance. The computer device reduces the attribute value of the virtual object in response to a distance between a special effect cell at which the virtual object is located and the special effect cell at which the explosion point is located being less than a maximum distance value of the second range.
Exemplarily, the computer device sets the special effect cells in the first range centered around the explosion point of the virtual throwable, the first range being greater than the second range, and the second range indicating the diffusion range of the virtual fluid substance. The computer device reduces the health point and/or the skill point of the virtual object in response to the distance between the special effect cell at which the virtual object is located and the special effect cell at which the explosion point is located being less than the maximum distance value of the second range.
For example, the virtual fluid substance is a virtual stink bomb. After the virtual stink bomb explodes, the virtual stink bomb releases stink. When the virtual object enters a diffusion range of the stink, the health point and the skill point of the virtual object both decrease. When the health point of the virtual object is less than a health threshold, the virtual object enters a non-healthy state. When the skill point of the virtual object is less than a skill threshold, the virtual object is prevented from using a skill.
Exemplarily, the computer device reduces the health point and/or the skill point of the virtual object at a first reduction ratio in response to the virtual object moving acceleratedly in the diffusion range of the virtual fluid substance at a first acceleration.
The first reduction ratio is positively correlated with a speed of the virtual object.
For example, the virtual fluid substance is a virtual stink bomb. After the virtual stink bomb explodes, the virtual stink bomb releases stink. When the virtual object enters a diffusion range of the stink, the health point and the skill point of the virtual object both decrease. A larger movement speed of the virtual object results in faster reduction in the health point and the skill point of the virtual object. When the health point of the virtual object is less than a health threshold, the virtual object enters a non-healthy state. When the skill point of the virtual object is less than a skill threshold, the virtual object is prevented from using a skill.
According to the method provided in this embodiment of this application, the health point and/or the skill point of the virtual object are reduced when the virtual object enters the diffusion range of the virtual fluid substance, and it is determined based on the distance between the special effect cell at which the virtual object is located and the special effect cell at which the explosion point is located whether the virtual object is affected by the virtual fluid substance. When the virtual object is affected by the virtual fluid substance, a change in the movement speed of the virtual object affects the health point and/or the skill point of the virtual object. In this application, the distance between the special effect cell at which the virtual object is located and the special effect cell at which the explosion point is located is calculated to quickly determine whether the virtual object is affected. In this way, a new determination manner is provided, which reduces the calculation amount, reduces the requirement on the hardware device, and improves the human-computer interaction efficiency.
In a possible implementation, the computer device displays the virtual fluid substance varying in gradient at different transparencies in response to the virtual fluid substance being diffused in the second range.
Exemplarily, the computer device sets the special effect cells in the first range centered around the explosion point of the virtual throwable. The computer device determines, based on a distance between a current special effect cell and the special effect cell at which the explosion point is located, a transparency of a virtual fluid substance corresponding to the current special effect cell.
The distance between the current special effect cell and the special effect cell at which the explosion point is located is positively correlated with the transparency of the virtual fluid substance corresponding to the current special effect cell. For example, in the diffusion range of the virtual fluid substance, a farther special effect cell from the explosion point corresponds to a higher transparency of the virtual fluid substance.
According to the method provided in this embodiment of this application, when the virtual fluid substance is diffused in the second range, the virtual fluid substance varying in gradient is displayed at different transparencies. In this application, the distance between the current special effect cell at which the virtual object is located and the special effect cell at which the explosion point is located is calculated, to quickly determine the transparency of the virtual fluid substance corresponding to the current special effect cell. In this way, a new determining manner is provided, which can quickly calculate transparencies corresponding to different positions, thereby reducing the calculation amount, reducing the requirement on the hardware device, and improving the human-computer interaction efficiency.
In a possible implementation, in response to the virtual fluid substance encountering a dynamic virtual obstacle during the diffusion, the computer device changes the diffusion direction of the virtual fluid substance based on the dynamic virtual obstacle.
Exemplarily, the computer device sets the special effect cells in the first range centered around the explosion point of the virtual throwable. The computer device traverses the special effect cells in the first range, and determines the special effect cell in the first range satisfying the valid diffusion condition as a valid special effect cell. The computer device determines, based on a diffusion range of the virtual fluid substance at an ith moment, a quantity of valid special effect cells corresponding to the diffusion range at the ith moment and a first position occupied by the dynamic virtual obstacle. The computer device determines a quantity of valid special effect cells occupied by the dynamic virtual obstacle in response to the dynamic virtual obstacle moving to a second position at an (i+1)th moment. The computer device equi-proportionally adds valid special effect cells to the first position based on the quantity of valid special effect cells corresponding to the diffusion range of the virtual fluid substance at the ith moment and the quantity of valid special effect cells occupied by the dynamic virtual obstacle at the second position, and diffuses the virtual fluid substance based on the added valid special effect cells.
A quantity of valid special effect cells corresponding to the diffusion range of the virtual fluid substance varies in a normal distribution over time.
For example, at a first moment, the computer device determines that the quantity of valid special effect cells corresponding to the diffusion range of the virtual fluid substance is 100 and the first position occupied by a virtual vehicle. At the first moment, the quantity of valid special effect cells corresponding to the diffusion range of the virtual fluid substance is 80. In response to the virtual vehicle moving to the second position at a second moment and the virtual vehicle occupying 20 valid special effect cells at the second position, 16 valid special effect cells are added to the first position, and the virtual fluid substance is diffused based on the added valid special effect cells, thereby obtaining a more realistic diffusion effect of the virtual fluid substance. In this way, user experience is improved.
In a possible implementation, the computer device sets the special effect cells in the first range centered around the explosion point of the virtual throwable. The computer device traverses the special effect cells in the first range based on a preset frequency, and refreshes the valid special effect cell in the first range satisfying the valid diffusion condition; and determines the diffusion direction of the virtual fluid substance based on the refreshed valid special effect cell when the virtual fluid substance encounters a dynamic virtual obstacle during the diffusion.
According to the method provided in this embodiment of this application, in response to the virtual fluid substance encountering the dynamic virtual obstacle during the diffusion, the computer device changes the diffusion direction of the virtual fluid substance based on the dynamic virtual obstacle. In this application, the quantity of valid special effect cells corresponding to the diffusion range at the ith moment, the first position occupied by the dynamic virtual obstacle, the quantity of valid special effect cells corresponding to the diffusion range at the ith moment, and the quantity of valid special effect cells occupied by the dynamic virtual obstacle at the second position are calculated, and the valid special effect cells are equi-proportionally added behind the dynamic virtual obstacle during the movement of the dynamic virtual obstacle, thereby simulating a more realistic diffusion effect of the virtual fluid substance. In this way, the user experience is improved.
In summary, according to method provided in this embodiment of this application, the computer device displays the virtual environment picture; displays the diffusive virtual fluid substance released by the virtual throwable in response to the thrown virtual throwable exploding in the virtual environment picture; and changes the diffusion direction of the virtual fluid substance based on the virtual obstacle in response to the virtual fluid substance encountering the virtual obstacle during the diffusion. According to this application, through the changing of the diffusion direction of the virtual fluid substance based on the virtual obstacle, a realistic scenario of changing the direction of the virtual fluid substance when the virtual fluid substance encounters the obstacle is simulated, thereby simulating a more realistic diffusion effect of the virtual fluid substance. In this way, user experience is improved.
Exemplarily, in addition to determining the diffusion direction of the virtual fluid substance, the obtained valid special effect cells may be further configured for rendering the virtual fluid substance.
The computer device generates a mask image based on the valid special effect cell, and then applies the mask image as a transparency to a final transparency of the virtual fluid substance. The computer device determines, based on Manhattan distance information of each valid special effect cell relative to the special effect cell at the position at which the explosion point is located, a color value corresponding to the valid special effect cell. For example, the color value of each valid special effect cell is set to linear color information. In other words, if a color value corresponding to a valid special effect cell is in a range of 0 to 1, the color value of each valid special effect cell may be calculated through a distance value of the valid special effect cell and a maximum diffusion distance of the virtual fluid substance. For example, if a distance of a current valid special effect cell is 4 and the maximum diffusion distance of the virtual fluid substance is 10, a color value corresponding to the special effect cell is 0.4. A rendered image obtained through rendering of the valid special effect cell in (a) in
As shown in (a) in
Exemplarily, the computer device generates a sampling UV coordinate by using a world coordinate center position and a length and a width of the virtual fluid substance, and performs texture sampling by using the UV coordinate to obtain a transparency, and may obtain a final rendering effect by multiplying the transparency by the transparency corresponding to valid special effect cell. However, since a rendering range of the virtual fluid substance is greater than the second range, an incorrect result is easily caused by overflow at the edges of the virtual fluid substance. Therefore, a circle of black edge is added to the original mask image (i.e., to the valid special effect cell), to obtain a better softening effect, as shown in (a) in
Exemplarily, in the above embodiment, the virtual fluid substance is rendered based on a two dimension. The method is further applicable to rendering of a valid special effect cell based on a three dimension. A rendering result of the valid special effect cell based on the three dimension is shown in
Operation 1801: Release a virtual fluid substance.
Exemplarily, in response to a thrown virtual throwable exploding in a virtual environment picture, the computer device displays a virtual fluid substance released by the virtual throwable.
In some embodiments, the virtual throwable includes at least one of a virtual smoke bomb, a virtual frangible grenade, a virtual gas bottle, and the like, which is not limited in this embodiment of this application.
The virtual fluid substance refers to a virtual fluid substance with a fluid property released by the virtual throwable. The virtual fluid substance has diffusivity. If a virtual smoke bomb is used as an example, the virtual fluid substance refers to smoke released by the virtual smoke bomb.
Operation 1802: Set special effect cells.
Exemplarily, the computer device sets special effect cells in a first range centered around an explosion point of the virtual throwable, the special effect cells being configured for determining a diffusion direction of the virtual fluid substance, and the first range being greater than a second range, the second range indicating a diffusion range of the virtual fluid substance. The computer device traverses the special effect cells in the first range, and determines a special effect cell in the first range satisfying a valid diffusion condition as a valid special effect cell.
Operation 1803: Generate distance information based on the special effect cells.
Exemplarily, the computer device generates distance information corresponding to a special effect cell at which a virtual object is currently located based on a special effect cell at the current position at which the virtual object is currently located and a special effect cell at which the explosion point is located.
Operation 1804: Determine whether a virtual object is affected based on the distance information.
Exemplarily, the computer device determines whether the virtual object is affected based on a distance value between the special effect cell at which the virtual object is located and the special effect cell at which the explosion point is located.
Operation 1805: Generate a mask image based on the distance information.
Exemplarily, the computer device determines the valid special effect cell based on the distance information between the special effect cell at which the virtual object is located and the special effect cell at which the explosion point is located, and generates the mask image based on the valid special effect cell.
Operation 1806: Perform rendering based on the mask image.
Exemplarily, the computer device performs rendering based on the mask image, to obtain a diffusion effect image of the virtual fluid substance.
Operation 1901: Traverse special effect cells in a first range.
Exemplarily, in response to a thrown virtual throwable exploding in a virtual environment picture, the computer device displays a virtual fluid substance released by the virtual throwable.
In some embodiments, the virtual fluid substance is at least one of a gas, a liquid, a non-Newtonian fluid, and the like, which is not specifically limited in this embodiment of this application.
Exemplarily, the computer device sets the special effect cells in the first range centered around an explosion point of the virtual throwable, the special effect cells being configured for determining a diffusion direction of the virtual fluid substance, and the first range being greater than a second range, the second range indicating a diffusion range of the virtual fluid substance. The computer device traverses the special effect cells in the first range, and determines a special effect cell in the first range satisfying a valid diffusion condition as a valid special effect cell.
Operation 1902: Determine, based on a current special effect cell, surrounding cells thereof.
Exemplarily, the computer device uses a special effect cell at which the explosion point is located as a starting special effect cell, and traverses special effect cells adjacent to the starting special effect cell.
Operation 1903: Determine whether the special effect cell is in a second range.
Exemplarily, the computer device determines whether the special effect cell is in the second range of the virtual throwable. When the special effect cell is in the second range of the virtual throwable, operation 1904 is performed. When the special effect cell is not in the second range of the virtual throwable, operation 1906 is performed.
Operation 1904: Determine whether the special effect cell overlaps a virtual obstacle.
Exemplarily, when the special effect cell is in the second range of the virtual throwable, it is determined whether the special effect cell overlaps the virtual obstacle. When the special effect cell overlaps the virtual throwable, operation 1906 is performed. When the special effect cell does not overlap the virtual obstacle, operation 1905 is performed.
Operation 1905: Determine whether the special effect cell is traversed.
Exemplarily, when the special effect cell is in the second range of the virtual throwable and the special effect cell does not overlap the virtual obstacle, it is determined whether the special effect cell is traversed. When the special effect cell is traversed, operation 1906 is performed. When the special effect cell is not traversed, operation 1907 is performed.
Operation 1906: Determine that the special effect cell is an invalid special effect cell.
Operation 1907: Mark the special effect cell as traversed and calculate a distance.
Exemplarily, when the special effect cell is in the second range of the virtual throwable, the special effect cell does not overlap virtual obstacle, and the special effect cell is not traversed, the special effect cell is marked as traversed, and a distance between the special effect cell and a center cell is calculated.
Operation 1908: Determine the special effect cell as a new starting special effect cell.
Exemplarily, the special effect cell is determined as the valid special effect cell based on the distance between the special effect cell and the center cell, and is determined as the new starting special effect cell. The above operation is repeated until no new valid special effect cell exists in the first range or until all of the special effect cells in the first range are traversed.
An apparatus for controlling a virtual throwable provided in the embodiments of this application is described below.
The cell setting module 2001 is configured to set, in response to a thrown virtual throwable exploding and releasing a virtual fluid substance in a virtual environment picture, special effect cells in a first range centered around an explosion point of the virtual throwable, the special effect cells being configured for determining a diffusion direction of the virtual fluid substance, and the first range being greater than a second range, the second range indicating a diffusion range of the virtual fluid substance.
The traversal module 2002 is configured to traverse the special effect cells in the first range, and determine a special effect cell in the first range satisfying a valid diffusion condition as a valid special effect cell.
The diffusion module 2003 is configured to diffuse, when the virtual fluid substance encounters a virtual obstacle during diffusion, the virtual fluid substance based on a valid special effect cell on a surface of the virtual obstacle.
The valid diffusion condition includes at least one of the special effect cell being in the second range, the special effect cell not overlapping the virtual obstacle, and the special effect cell being not traversed.
In a possible implementation, the traversal module 2002 is configured to: use a special effect cell at which the explosion point is located as a starting special effect cell, the starting special effect cell being used as a starting point for traversing other special effect cells; traverse special effect cells adjacent to the starting special effect cell, determine a special effect cell that is adjacent to the starting special effect cell and satisfies the valid diffusion condition as a valid special effect cell, and determine the special effect cell as a next starting special effect cell; and repeat the above operation until all of the special effect cells in the first range are traversed.
In a possible implementation, the traversal module 2002 is configured to use the special effect cell at which the explosion point is located as a starting special effect cell when the special effect cell at which the explosion point is located is a valid special effect cell.
In a possible implementation, the traversal module 2002 is configured to use a special effect cell in the first range satisfying a ray detection condition as the starting special effect cell when the special effect cell at which the explosion point is located is not a valid special effect cell.
The ray detection condition includes a to-be-detected special effect cell being connected to the special effect cell at which the explosion point is located by a ray and the to-be-detected special effect cell not overlapping the virtual obstacle.
In a possible implementation, the cell setting module 2001 is configured to set the special effect cells in the first range centered around the explosion point of the virtual throwable, the first range being greater than the second range, and the second range indicating the diffusion range of the virtual fluid substance.
The calculation module 2004 is configured to reduce an attribute value of the virtual object in response to a distance between a special effect cell at which the virtual object is located and the special effect cell at which the explosion point is located being less than a maximum distance value of the second range.
In a possible implementation, the attribute value includes a health point and/or a skill point. The calculation module 2004 is configured to reduce the health point and/or the skill point of the virtual object in response to the distance between the special effect cell at which the virtual object is located and the special effect cell at which the explosion point is located being less than the maximum distance value of the second range.
In a possible implementation, the cell setting module 2001 is configured to set the special effect cells in the first range centered around the explosion point of the virtual throwable.
In a possible implementation, the calculation module 2004 is configured to determine, based on a distance between a current special effect cell and the special effect cell at which the explosion point is located, a transparency of a virtual fluid substance corresponding to the current special effect cell.
The distance between the current special effect cell and the special effect cell at which the explosion point is located is positively correlated with the transparency of the virtual fluid substance corresponding to the current special effect cell.
In a possible implementation, the cell setting module 2001 is configured to set the special effect cells in the first range centered around the explosion point of the virtual throwable.
In a possible implementation, the traversal module 2002 is configured to traverse the special effect cells in the first range, and determine the special effect cell in the first range satisfying the valid diffusion condition as a valid special effect cell; and determine, based on a diffusion range of the virtual fluid substance at an ith moment, a quantity of valid special effect cells corresponding to the diffusion range at the ith moment and a first position occupied by a dynamic virtual obstacle; and determine a quantity of valid special effect cells occupied by the dynamic virtual obstacle in response to the dynamic virtual obstacle moving to a second position at an (i+1)th moment.
In a possible implementation, the calculation module 2004 is configured to equi-proportionally add valid special effect cells to the first position based on the quantity of valid special effect cells corresponding to the diffusion range of the virtual fluid substance at the ith moment and the quantity of valid special effect cells occupied by the dynamic virtual obstacle at the second position, and diffuse the virtual fluid substance based on the added valid special effect cells.
A quantity of valid special effect cells corresponding to the diffusion range of the virtual fluid substance varies in a normal distribution over time, and i is a positive integer.
Generally, the computer device 2100 includes a processor 2101 and a memory 2102.
The processor 2101 may include one or more processing cores, for example, a 4-core processor or an 8-core processor. The processor 2101 may be implemented in at least one hardware form of a digital signal processor (DSP), a field programmable gate array (FPGA), and a programmable logic array (PLA). The processor 2101 may alternatively include a main processor and a coprocessor. The main processor is a processor configured to process data in a wake-up state, which is also referred to as a CPU. The coprocessor is a low-power processor configured to process data in a standby state. In some embodiments, the processor 2101 may have a GPU integrated therein. The GPU is configured to render and draw content that needs to be displayed on a display. In some embodiments, the processor 2101 may further include an AI processor. The AI processor is configured to process computing operations related to machine learning.
The memory 2102 may include one or more computer-readable storage media. The computer-readable storage media may be tangible and non-transient. The memory 2102 may further include a high-speed random access memory and a non-volatile memory, for example, one or more disk storage devices or flash storage devices. In some embodiments, the non-transient computer-readable storage medium in the memory 2102 is configured to store at least one instruction. The at least one instruction is configured to be executed by the processor 2101 to implement the method for controlling a virtual throwable provided in the embodiments of this application.
In some embodiments, the computer device 2100 may include a peripheral device interface 2103 and at least one peripheral device. Specifically, the peripheral device includes at least one of a radio frequency (RF) circuit 2104, a touch display 2105, a camera assembly 2106, an audio circuit 2107, and a power supply 2108.
The peripheral device interface 2103 may be configured to connect the at least one peripheral device related to input/output (I/O) to the processor 2101 and the memory 2102. In some embodiments, the processor 2101, the memory 2102, and the peripheral device interface 2103 are integrated on the same chip or circuit board. In some other embodiments, any one or both of the processor 2101, the memory 2102, and the peripheral device interface 2103 may be implemented on an independent chip or circuit board, which is not limited in this embodiment.
The RF circuit 2104 is configured to receive and transmit an RF signal, which is also referred to as an electromagnetic signal. The RF circuit 2104 communicates with a communication network and another communication device through the electromagnetic signal. The RF circuit 2104 converts an electric signal into an electromagnetic signal for transmission, or converts a received electromagnetic signal into an electric signal. In some embodiments, the RF circuit 2104 includes an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a DSP, a codec chipset, a user identity module card, and the like. The RF circuit 2104 may communicate with another terminal through at least one wireless communication protocol. The wireless communication protocol includes but is not limited to the World Wide Web, a metropolitan area network, the Intranet, various generations of mobile communication networks (2G, 3G, 4G, and 5G), a wireless local area network, and/or a wireless fidelity (Wi-Fi) network. In some embodiments, the RF circuit 2104 may further include a near field communication (NFC)-related circuit, which is not limited in this application.
The touch display 2105 is configured to display a UI. The UI may include graphics, texts, icons, videos, and any combination thereof. The touch display 2105 further has a capability of collecting a touch signal on or above a surface of the touch display 2105. The touch signal may be inputted into the processor 2101 as a control signal for processing. The touch display 2105 is configured to provide a virtual button and/or a virtual keyboard, which is also referred to as a soft button and/or a soft keyboard. In some embodiments, one touch display 2105 may be arranged on a front panel of the computer device 2100. In some other embodiments, at least two touch displays 2105 may be respectively arranged on different surfaces of the computer device 2100 or may be folded. In some other embodiments, the touch display 2105 may be a flexible display arranged on a bendable surface or a foldable surface of the computer device 2100. The touch display 2105 may alternatively be arranged as a non-rectangular irregular pattern, i.e., a special-shaped screen. The touch display 2105 may be manufactured by using a material such as a liquid crystal display (LCD) or an organic light-emitting diode (OLED).
The camera assembly 2106 is configured to capture an image or a video. In some embodiments, the camera assembly 2106 includes a front camera and a rear camera. Generally, the front camera is configured to achieve a video call or a selfie, and the rear camera is configured to take a photograph or record a video. In some embodiments, at least two rear cameras are arranged, which are respectively any one of a main camera, a depth-of-field camera, and a wide-angle camera, so as to achieve a background blurring function through fusion of the main camera and the depth-of-field camera, achieve a panoramic photographing function through fusion of the main camera and the wide-angle camera, and achieve a VR photographing function. In some embodiments, the camera assembly 2106 may further include a flashlight. The flashlight may be a single-color-temperature flashlight or a dual-color-temperature flashlight. The dual-color-temperature flashlight is a combination of a warm flashlight and a cold flashlight, and may be configured for light compensation at different color temperatures.
The audio circuit 2107 is configured to provide an audio interface between a user and the computer device 2100. The audio circuit 2107 may include a microphone and a speaker. The microphone is configured to collect a sound wave of a user and an environment, and convert the sound wave into an electrical signal and input the electrical signal to the processor 2101 for processing, or input the electrical signal to the RF circuit 2104 to achieve voice communication. For stereo collection or noise reduction, a plurality of microphones may be respectively arranged at different parts of the computer device 2100. The microphone may alternatively be an array microphone or an omnidirectional collection microphone. The speaker is configured to convert an electrical signal from the processor 2101 or the RF circuit 2104 into a sound wave. The speaker may be a conventional film speaker, or may be a piezoelectric ceramic speaker. When the speaker is the piezoelectric ceramic speaker, the speaker can not only convert an electric signal into a sound wave audible to human beings, but also convert the electric signal into a sound wave inaudible to human beings for ranging and the like. In some embodiments, the audio circuit 2107 may further include a headphone jack.
The power supply 2108 is configured to supply power to components in the computer device 2100. The power supply 2108 may be an alternating current power supply, a direct current power supply, a disposable battery, or a rechargeable battery. When the power supply 2108 includes a rechargeable battery, the rechargeable battery may be a wired rechargeable battery or a wireless rechargeable battery. The wired rechargeable battery is a battery charged through a wired line, and the wireless rechargeable battery is a battery charged through a wireless coil. The rechargeable battery may be further configured to support a fast charging technology.
In some embodiments, the computer device 2100 further includes one or more sensors 2109. The one or more sensors 2109 include but are not limited to an acceleration sensor 2110, a gyroscope sensor 2111, a pressure sensor 2112, an optical sensor 2113, and a proximity sensor 2114.
A person skilled in the art may understand that the structure shown in
An embodiment of this application further provides a computer device. The computer device includes a processor and a memory, the memory having at least one computer program stored therein, the at least one computer program being loaded and executed by the processor, to implement the method for controlling a virtual throwable provided in the above method embodiments.
An embodiment of this application further provides a non-transitory computer-readable storage medium, having at least one computer program stored therein, the at least one computer program being loaded and executed by a processor, to implement the method for controlling a virtual throwable provided in the above method embodiments.
An embodiment of this application further provides a computer program product, including a computer program, the computer program being stored in a computer-readable storage medium. A processor of a computer device reads the computer program from the computer-readable storage medium and executes the computer program, to cause the computer device to implement the method for controlling a virtual throwable provided in the above method embodiments.
“A plurality of” mentioned herein means two or more. “And/or” describes an association relationship between associated objects, and indicates that three relationships may exist. For example, A and/or B may represent the following three cases: only A exists, both A and B exist, and only B exists. The character “/” generally indicates an “or” relationship between the associated objects.
A person of ordinary skill in the art may understand that all or some of the operations implementing the above embodiments may be implemented by hardware, or may be implemented by instructing relevant hardware through a program. The program may be stored in a computer-readable storage medium. The storage medium may be a read-only memory, a disk, an optical disc, or the like.
The above descriptions are merely embodiments of this application, and are not intended to limit this application. Any modification, equivalent replacement, or improvement made within the spirit and principle of this application falls within the protection scope of this application.
Number | Date | Country | Kind |
---|---|---|---|
202211567170.9 | Dec 2022 | CN | national |
This application is a continuation application of PCT Patent Application No. PCT/CN2023/119994, entitled “METHOD AND APPARATUS FOR CONTROLLING VIRTUAL THROWABLE, DEVICE, MEDIUM, AND PROGRAM PRODUCT” filed on Sep. 20, 2023, which claims priority to Chinese Patent Application No. 202211567170.9, entitled “METHOD AND APPARATUS FOR CONTROLLING VIRTUAL THROWABLE, DEVICE, MEDIUM, AND PROGRAM PRODUCT” filed with the China National Intellectual Property Administration on Dec. 7, 2022, both of which are incorporated herein by reference in their entirety.
Number | Date | Country | |
---|---|---|---|
Parent | PCT/CN2023/119994 | Sep 2023 | WO |
Child | 18823553 | US |