CN111714879B - Physical state updating method and device, storage medium and electronic device - Google Patents
Physical state updating method and device, storage medium and electronic device Download PDFInfo
- Publication number
- CN111714879B CN111714879B CN202010367084.8A CN202010367084A CN111714879B CN 111714879 B CN111714879 B CN 111714879B CN 202010367084 A CN202010367084 A CN 202010367084A CN 111714879 B CN111714879 B CN 111714879B
- Authority
- CN
- China
- Prior art keywords
- physical state
- state
- updating
- physical
- thread
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Active
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/23—Updating
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/50—Controlling the output signals based on the game progress
- A63F13/52—Controlling the output signals based on the game progress involving aspects of the displayed game scene
-
- A—HUMAN NECESSITIES
- A63—SPORTS; GAMES; AMUSEMENTS
- A63F—CARD, BOARD, OR ROULETTE GAMES; INDOOR GAMES USING SMALL MOVING PLAYING BODIES; VIDEO GAMES; GAMES NOT OTHERWISE PROVIDED FOR
- A63F13/00—Video games, i.e. games using an electronically generated display having two or more dimensions
- A63F13/60—Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor
- A63F13/65—Generating or modifying game content before or while executing the game program, e.g. authoring tools specially adapted for game development or game-integrated level editor automatically by game devices or servers from real world data, e.g. measurement in live racing competition
Landscapes
- Engineering & Computer Science (AREA)
- Multimedia (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Databases & Information Systems (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Processing Or Creating Images (AREA)
Abstract
The application discloses a physical state updating method and device, a storage medium and an electronic device. Wherein the method comprises the following steps: determining a first object in the virtual scene, wherein the first object is an object which does not need to be subjected to physical state simulation processing in the virtual scene; updating the object state of the first object; and in the process of updating the object state of the first object, the physical engine is called to update the physical state of the second object and the third object, wherein the second object and the third object are objects which need to be subjected to physical state simulation processing in the virtual scene. The application solves the technical problem of lower processing efficiency of the game flow in the related technology.
Description
Technical Field
The present application relates to the field of games, and in particular, to a method and apparatus for updating a physical state, a storage medium, and an electronic apparatus.
Background
The physical engine mainly comprises mechanical simulation after collision between objects and scenes in the game world and mechanical simulation of skeleton movement of the objects after collision. In recent years, with the development of hardware, a physical engine is widely used in the game industry. The three physical engines in the world are Physx, havok, bullet respectively, wherein the Physx physical engine is an open source physical engine of Nvidia company, the performance is excellent, the simulation effect is stable, and the simulation efficiency is extremely high especially on the display card of Nvidia. The Physx physical engine comprises physical functions of rigid body, joints, vehilce trolley, cloth, crushing and the like, and the functions greatly enrich the development content of the game and promote the effect expression of the game.
The simulation of a game engine is typically split into two parts, one part to update game data and one part to render the game. The simulation of the physical engine requires updated data from the game engine, while the rendering of the game engine requires simulated data from the physical engine. Simulation flow of Physx Physics engine: sending in analog data; starting simulation; ending the simulation; and obtaining a simulation result. The processing efficiency of this procedure is low.
In view of the above problems, no effective solution has been proposed at present.
Disclosure of Invention
The embodiment of the application provides a physical state updating method and device, a storage medium and an electronic device, which are used for at least solving the technical problem of low game flow processing efficiency in the related technology.
According to an aspect of an embodiment of the present application, there is provided a method for updating a physical state, including: determining a first object in the virtual scene, wherein the first object is an object which does not need to be subjected to physical state simulation processing in the virtual scene; updating the object state of the first object; and in the process of updating the object state of the first object, a physical engine is called to update the physical state of a second object and a third object, wherein the second object and the third object are objects which need to be subjected to physical state simulation processing in the virtual scene.
According to another aspect of the embodiment of the present application, there is also provided an apparatus for updating a physical state, including: the determining unit is used for determining a first object in the virtual scene, wherein the first object is an object which does not need to be subjected to physical state simulation processing in the virtual scene; a first updating unit, configured to update an object state of a first object; and the second updating unit is used for calling the physical engine to update the physical state of the second object and the physical state of the third object in the process of updating the object state of the first object, wherein the second object and the third object are objects which need to be subjected to physical state simulation processing in the virtual scene.
According to another aspect of the embodiments of the present application, there is also provided a storage medium including a stored program that executes the above-described method when running.
According to another aspect of the embodiments of the present application, there is also provided an electronic device including a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor executing the method described above by the computer program.
In the embodiment of the application, for the objects in the virtual scene, the processing can be performed according to the following types, wherein one type is a game object (namely a second object and a third object) which needs to use a physical engine to update the physical state; and secondly, a game object (namely a first object) with a physical state updated by a physical engine is not needed, and the objects can be processed in a parallel processing mode instead of serial processing of the objects which are not classified, so that the technical problem of lower processing efficiency of a game flow in the related technology can be solved, and the technical effect of improving the processing efficiency is further achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this specification, illustrate embodiments of the application and together with the description serve to explain the application and do not constitute a limitation on the application. In the drawings:
FIG. 1 is a schematic diagram of a hardware environment of a method of updating a physical state according to an embodiment of the present application;
FIG. 2 is a flow chart of an alternative method of updating physical states according to an embodiment of the application;
FIG. 3 is a flow chart of an alternative method of updating physical states according to an embodiment of the application;
FIG. 4 is a schematic diagram of an alternative physical state updating apparatus according to an embodiment of the present application; the method comprises the steps of,
fig. 5 is a block diagram of a structure of a terminal according to an embodiment of the present application.
Detailed Description
In order that those skilled in the art will better understand the present application, a technical solution in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings in which it is apparent that the described embodiments are only some embodiments of the present application, not all embodiments. All other embodiments, which can be made by those skilled in the art based on the embodiments of the present application without making any inventive effort, shall fall within the scope of the present application.
It should be noted that the terms "first," "second," and the like in the description and the claims of the present application and the above figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
The game engine in the related art performs the game update step including updating the game data and rendering the game data, and if the physical engine is combined, it becomes: updating game data; physX starts the simulation; physX ends the simulation; updating game data dependent on the PhysX calculation result; rendering the game data. The above process must wait for the update of the game data to be completed before the physical simulation is started, and the efficiency is low, so that the process cannot fully play the parallel processing characteristic of the computer equipment.
In order to overcome the problems, according to an aspect of the embodiments of the present application, a method embodiment of a physical state update method is provided, where the method combines device performance and game performance, so that the efficiency can be improved by using multithreading, and the game performance can be completely and truly represented.
Alternatively, in the present embodiment, the above-described update method of the physical state may be applied to a hardware environment constituted by the game engine 101, the physical engine 103, and the control module 105 as shown in fig. 1. As shown in fig. 1, the control module 105 is connected to the physical engine 103 and the game engine 101 through a bus, where the physical engine 103 may be used to provide a service for mechanical simulation after collision between objects and scenes for the game engine 101, so that the game engine 101 may use the simulation result obtained by the physical engine 103 in rendering, and a database 107 (may be on-chip storage, registers, memory, etc.) may be provided on the control module 105 or independent of the control module 105, for providing a data storage service for the control module 105.
The game engine 101, the physical engine 103 and the control module 105 are functionally differentiated, and these modules may be separate chips, for example, the functions of the game engine 101 are implemented based on the graphics processor GPU (Graphics Processing Unit), the functions of the physical engine 103 are implemented based on the physical operation processor PPU (Paralleling and Protection Unit), the control module 105 is the central processor CPU (central processing unit), and the game engine 101, the physical engine 103 and the control module 105 may also exist in the same chip as a module for implementing the corresponding functions, for example, in a CPU, which will be described later; such buses include, but are not limited to: an on-chip bus (corresponding to the three modules being functional modules in the same chip at this time), and an inter-chip bus (corresponding to the three modules being separate chips at this time).
The method for updating a physical state according to an embodiment of the present application may be performed by a central processing unit CPU (or may be jointly performed by a CPU, a GPU, etc.), and fig. 2 is a flowchart of an alternative method for updating a physical state according to an embodiment of the present application, and as shown in fig. 2, the method may include the following steps:
in step S202, when the game data is updated, the central processor determines a first object in the virtual scene, where the first object is an object in the virtual scene that does not need to be subjected to physical state simulation processing, for example, an object that only needs to update information related to game attributes that are not related to physical (such as a change in clothing color, a change in material quality, a change in weapon, etc.).
In step S204, the central processor performs object status update on the first object, that is, updates the object of the information related to the game attribute that is not related to the physical object (such as the color of the clothing, the material changes, the weapon changes, etc.).
In step S206, during the process of updating the object state of the first object, the central processor invokes the physical engine to update the physical states of the second object and the third object, which are objects in the virtual scene that need to be subjected to physical state simulation processing, such as objects with changed postures, physical forms, and the like.
The logic related to the update of the physical state can be realized in a form of hardware, and at the moment, the hardware for realizing the logic is equivalent to special hardware, and can be a special processor (such as a PPU) or a special core (such as a core integrated in a CPU) in the processor, and at the moment, the update of the physical state can be realized by calling corresponding hardware resources when the update of the physical state is needed, for example, the CPU directly calls a chip PPU where a physical engine is located through a corresponding interface, or the CPU directly calls a core where an on-chip physical engine is located; the logic related to the physical state update can also be realized in a software form, the logic related to the physical state update can be written into library files, the library files can be realized on a general-purpose processor (such as a CPU), when the physical state update is required, the corresponding library files are called, for example, the CPU calls a corresponding core, process or thread, and the physical state update is realized by running the logic related to the physical state update in the library files on the core, process or thread.
In the technical scheme of the application, through the steps, the objects in the virtual scene can be processed according to the following types, wherein one game object (namely a second object and a third object) needs to be updated in physical state by using a physical engine; and secondly, a game object (namely a first object) with a physical state updated by a physical engine is not needed, and the objects can be processed in a parallel processing mode instead of serial processing of the objects which are not classified, so that the technical problem of lower processing efficiency of a game flow in the related technology can be solved, and the technical effect of improving the processing efficiency is further achieved. The following further details the technical solution of the present application in connection with the steps shown in fig. 2:
In the technical scheme provided in step S202, when the game data is updated, the central processor determines that the object in the virtual scene that does not need to perform the physical state simulation process is the first object.
In the technical solution provided in step S204, an object state update is performed on the first object.
When the efficiency is improved by utilizing the multithreading, the following scheme can be adopted: after the second game update is finished, finishing the simulation of the physical engine by using the first game update result, storing the simulation result, and then sending the game update data of the second game update to the physical engine, wherein the game engine starts the simulation; the game starts to render, and the saved physical simulation result (namely, the result obtained by simulation by using the first game updating result) is used for game rendering.
In the above scheme, when the physical engine updates the physical state of the object with the dependency relationship, the physical engine uses the physical calculation result of the physical simulation performed by the previous frame, and in this way, the step of updating the game data is not considered, which may depend on the result of the physical output, if the object in the game needs to depend on the result of the physical output, the problem that one frame is worse occurs, so that an incorrect physical expression effect is caused, especially when the physical object between two frames is displaced or rotated greatly, the incorrect expression effect is more obvious, and thus the rendered image is distorted.
In order to facilitate parallel processing and enable a processing result to conform to the actual situation, in the technical scheme of the application, before the object state of the first object is updated, the objects in the virtual scene can be divided into the following three types according to the following mode: firstly, dividing an object which does not need to be subjected to physical state simulation processing in an object to be rendered in a virtual scene into a first object, wherein the object state update of the first object mainly refers to updating the attribute which does not need to depend on a physical state simulation processing result in the attribute of the first object; the second is that the object to be subjected to physical state simulation processing in the object to be rendered in the virtual scene is divided into a second object or a third object, the third object and the second object are the interactive objects, and the updating of the third object depends on the result of the physical state simulation processing of the second object; third, the object used as the input of the physical engine is divided into a fourth object, the fourth object is an object interacted with the second object, and when the second object is subjected to physical state simulation processing, the fourth object is dependent on the second object, for example, the fourth object can be an object collided with the second object.
In an embodiment of the present application, the step S202 and the step S206 are steps that run in parallel, and the parallel running form may include: chip-level parallel operation, as in a multiprocessor device, steps S204 and S206 described above are each run on a different processor chip; the parallel operation of the process level, such as in the chip capable of operating in multiple processes, the step S204 and the step S206 are respectively operated in different processes; the above steps S204 and S206 run on different threads, respectively, in parallel at the thread level, e.g. inside a chip that can run multi-thread.
Taking the last of the three parallel running modes as an example, when the object state of the first object is updated, the first object can be updated from the first object state to the second object state by running a first thread (the first thread and a target thread are threads running in parallel) on the CPU, the first object state is the object state of the first object at a first time, the second object state is the object state of the first object at a second time, the first time is earlier than the second time, and the time in the first time and the second time can be the meaning of time, that is, the scheme of the application can be updated according to time (the frames corresponding to the two times are frame frames, and the frame sequence corresponding to one time sequence can form one frame segment), and the time can be the meaning of time period, that is, the scheme of the application can be updated according to time period (the frames corresponding to the two times are key frame frames, and intermediate process frames can be derived by using the key frames), so that the frame segments can be generated.
In the technical solution provided in step S206, during the process of updating the object state of the first object, the physical engine updates the physical states of the second object and the third object, where the second object and the third object are objects in the virtual scene that need to be subjected to physical state simulation processing.
In the above embodiment, invoking the physical engine to perform a physical state update on the second object and the third object includes: the second object is updated from the first physical state to the second physical state and the third object is updated from the third physical state to the fourth physical state by running the target thread, wherein the target thread is a thread belonging to the physical engine running in parallel with the first thread, the first physical state is the physical state of the second object at the first time, the second physical state is the physical state of the second object at the second time, the third physical state is the physical state of the third object at the first time, and the fourth physical state is the physical state of the third object at the second time.
In the embodiment of the present application, the steps of parallel execution are performed between the step S204 and the step S206, and in the step S206, for unrelated objects, corresponding physical state updates may also be performed in parallel, and similar to the previous steps, the parallel execution at a chip level, the parallel execution at a process level, and the parallel execution at a thread level may be performed, taking the last example, when the second object is updated from the first physical state to the second physical state by executing the target thread, in the case that the second object is multiple, the second object is updated from the first physical state to the second physical state by executing multiple second threads in parallel, where the target thread includes multiple second threads, the number of the second threads is the same as the number of the second objects, each second thread is used for updating the physical state of one second object, and the updated second objects of any two second threads are different.
Optionally, before updating the second object from the first physical state to the second physical state, a fourth object interacting with the second object in the virtual scene may be predetermined, and a fifth physical state of the fourth object is obtained by updating with the physical engine, where the fifth physical state is a physical state of the fourth object at the first time; so that the second object is updated from the first physical state to the second physical state using the fifth physical state when the second object is updated from the first physical state to the second physical state.
Optionally, for each second object, updating the second object from the first physical state to the second physical state and updating the third object from the third physical state to the fourth physical state by running the target thread is performed in the target thread (i.e. the second thread described above) by performing the following steps 1-2:
step 1, firstly, changing the physical state of a second object, and updating the second object from a first physical state to a second physical state by utilizing a fifth physical state, wherein the fifth physical state can be used for representing the influence of a fourth object on the second object, such as collision of the fourth object and the second object, so that the second physical state at the next time can be determined according to the original state and collision condition of the second object;
Step 2, updating the third object from the third physical state to the fourth physical state by using the second physical state, for example, the fourth object collides with the second object, so that the second object contacts with the third object, and the physical state of the fourth object, the physical state of the second object and the physical state of the third object can be sequentially determined by using the physical engine according to the dependency relationship among several objects.
In an alternative embodiment, when the third objects are updated from the third physical state to the fourth physical state by running the target thread, in the case that the third objects interacting with the same second object are multiple, since each third object is separately associated with the second object and no association occurs between each third object, the processing may be performed according to the three parallel processing modes, for example, in a mode of running threads in parallel, the third objects may be updated from the third physical state to the fourth physical state by running multiple third threads in parallel, where the target thread includes multiple third threads, and the number of third threads is the same as the number of third objects, each third thread is used to update the physical state of one third object, and any two third threads update the third objects differently.
In another alternative embodiment, when the third object is updated from the third physical state to the fourth physical state by running the target thread, since each third object is separately associated with the second object, and each third object is not associated with each other, the processing may be performed according to the three parallel processing modes, and considering that the second thread is in an idle state after processing the second object, the update of the physical state of one of the third processes may be continuously processed, or taking a mode of using parallel running of the threads as an example: in the case that the number of the third objects interacting with the same second object is multiple, the second threads and the third threads are operated in parallel to update the third object from the third physical state to the fourth physical state, the number of the second threads and the third threads is the same as the number of the third objects, the second threads are used for updating the physical state of the third object after updating the physical state of the second object, each third thread is used for updating the physical state of one third object, and any two threads in the second threads and the third threads are different from each other for updating the third object.
In the above technical solution, the related thread may be created when the use is required, or may be created in advance, for example, before the object state of the first object is updated, a first thread for updating the object state of the first object is created, a second thread for updating the object state of the second object is created, and a third thread for updating the object state of the third object is created, so that when the use of the corresponding thread is required, the related thread is directly allocated in the created thread.
By adopting the technical scheme of the application, the method for splitting the physically related game objects and then executing the game update flow is provided, so that after splitting, the physically unrelated game object processing and the PhysX processing run in parallel, the efficiency can be improved on the multi-core processor, the two parts run in the same frame strictly according to the dependency relationship, the multithreading characteristic is utilized to the maximum degree, the physical result is not used across frames, the incorrect result which is possibly generated is avoided, the machine performance and the game effect are considered, the efficiency can be improved by utilizing the multithreading, and the physical effect is completely consistent with the actual picture.
As an optional example, the technical solution of the present application is further described below by taking the application of the technical solution of the present application to physical engine PhysX as an example in combination with a specific embodiment.
Preprocessing, namely dividing a game object to be updated into three parts: a physically unrelated game object (i.e., a first object), an object that is a physical input (i.e., a fourth object), an object that depends on the result of the physical output (i.e., a third object, which depends on the simulation result of the second object).
In step 302, the game object that may need to be a physical input (e.g., the fourth object, the thread that processes the fourth object, i.e., the thread corresponding to the second column) is updated first in the main thread (which may be the thread started on the CPU that controls the progress of the entire game). For example, the game object has a physical interactive animation, the game object is updated in the main thread, the animation update task of the working thread can be initiated, and the result of the animation update is used as the input of the physical system; the game object may also initiate other working threads to execute special effect update tasks, and the tasks are irrelevant to physics and are completed before rendering by the main thread.
As shown in FIG. 3, the first thread is the main thread, the 2 nd-4 th columns can run related tasks according to functions, a plurality of threads (which can be started on a CPU) can run in parallel, the overlapping part of time lines among different columns indicates that the related tasks can run in parallel, the broken line indicates that the part above the broken line is completed, and the related threads start to run functions below the broken line, wherein the synchronization means that if the A thread is located below the broken line and the B thread is located above the broken line, the A thread can continue to run after waiting for the B thread to do a certain work.
In step 304, the main thread starts the PhysX simulation (i.e. performs a physical state update), the function returns immediately, and the physical simulation is run by PhysX on the other several working threads (i.e. the second thread handling the second object, such as the thread shown in the third column in FIG. 3), which may be provided by PhysX.
In step 306, the main thread updates the physically unrelated game object, and updates the portion of the game object that supports the multithreading update and that is not physically related, where the updating runs in parallel with the updating of the PhysX, i.e., the first thread (e.g., the thread in the fourth column shown in FIG. 3) and the second thread of the physically unrelated portion are updated.
In step 308, the main thread waits for the relevant thread of PhysX to complete the physical simulation, and after both PhysX simulation and other thread processing are completed, the main thread updates the portion of the game object that depends on PhysX output, i.e., the third object using third line Cheng Gengxin.
In step S310, the main thread performs rendering after waiting for completion of other physically unrelated work threads.
In the scheme, the logic on the main thread is distinguished according to the physical correlation and the physical independence, and the physical independence part and the PhysX are operated in parallel; the method can utilize the characteristic of multithreading to maximize and utilize the parallelism of game logic and PhysX, can promote the efficiency on the multi-core processor, and also ensure the correctness of the physical simulation result.
It should be noted that, for simplicity of description, the foregoing method embodiments are all described as a series of acts, but it should be understood by those skilled in the art that the present application is not limited by the order of acts described, as some steps may be performed in other orders or concurrently in accordance with the present application. Further, those skilled in the art will also appreciate that the embodiments described in the specification are all preferred embodiments, and that the acts and modules referred to are not necessarily required for the present application.
From the description of the above embodiments, it will be clear to a person skilled in the art that the method according to the above embodiments may be implemented by means of software plus the necessary general hardware platform, but of course also by means of hardware, but in many cases the former is a preferred embodiment. Based on such understanding, the technical solution of the present application may be embodied essentially or in a part contributing to the prior art in the form of a software product stored in a storage medium (e.g. ROM/RAM, magnetic disk, optical disk) comprising several instructions for causing a terminal device (which may be a mobile phone, a computer, a server, or a network device, etc.) to perform the method of the various embodiments of the present application.
The game engine in the related art performs the game update step including updating the game data and rendering the game data, and if the physical engine is combined, it becomes: updating game data; physX starts the simulation; physX ends the simulation; updating game data dependent on the PhysX calculation result; rendering the game data. The above process must wait for the update of the game data to be completed before the physical simulation is started, and the efficiency is low, so that the process cannot fully play the parallel processing characteristic of the computer equipment.
In order to overcome the above-mentioned problems, according to an aspect of the embodiments of the present application, according to another aspect of the embodiments of the present application, there is also provided a physical state updating apparatus for implementing the above-mentioned physical state updating method. FIG. 4 is a schematic diagram of an alternative physical state updating device according to an embodiment of the present application, as shown in FIG. 4, the device may include:
a determining unit 401, configured to determine a first object in a virtual scene, where the first object is an object in the virtual scene that does not need to perform physical state simulation processing;
the first updating unit 403 is configured to update an object state of a first object, where the first object is an object in the virtual scene that does not need to perform physical state simulation processing.
And the second updating unit 405 is configured to invoke the physical engine to update the physical state of the second object and the third object in the process of updating the object state of the first object, where the second object and the third object are objects that need to be subjected to physical state simulation processing in the virtual scene.
It should be noted that the determining unit 401 in this embodiment may be used to perform step S202 in the embodiment of the present application, the first updating unit 403 in this embodiment may be used to perform step S204 in the embodiment of the present application, and the second updating unit 405 in this embodiment may be used to perform step S206 in the embodiment of the present application.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. It should be noted that the above modules may be implemented in software or hardware as a part of the apparatus in the hardware environment shown in fig. 1.
Through the modules, for the objects in the virtual scene, the processing can be performed according to the following types, wherein one type is a game object (namely a second object and a third object) which needs to use a physical engine for physical state update; and secondly, a game object (namely a first object) with a physical state updated by a physical engine is not needed, and the objects can be processed in a parallel processing mode instead of serial processing of the objects which are not classified, so that the technical problem of lower processing efficiency of a game flow in the related technology can be solved, and the technical effect of improving the processing efficiency is further achieved.
Optionally, the first updating unit is further configured to: updating the first object from a first object state to a second object state by running the first thread, wherein the first object state is an object state of the first object at a first time, and the second object state is an object state of the first object at a second time, and the first time is earlier than the second time; the second updating unit is further configured to: and updating the second object from the first physical state to the second physical state and updating the third object from the third physical state to the fourth physical state by running the target thread, wherein the target thread is a thread belonging to a physical engine running in parallel with the first thread, the first physical state is a physical state of the second object at a first time, the second physical state is a physical state of the second object at a second time, the third physical state is a physical state of the third object at the first time, and the fourth physical state is a physical state of the third object at the second time.
Optionally, the second updating unit includes: a first updating module for updating the second object from the first physical state to the second physical state; and the second updating module is used for updating the third object from the third physical state to the fourth physical state by utilizing the second physical state.
Optionally, the second updating unit is further configured to: and under the condition that a plurality of second objects are provided, updating the plurality of second objects from the first physical state to the second physical state by running a plurality of second threads in parallel, wherein the target thread comprises a plurality of second threads, each second thread is used for updating the physical state of one second object, and the updated second objects of any two second threads are different.
Optionally, the second updating unit includes: and the third updating module is used for updating the third object from the third physical state to the fourth physical state by running a plurality of third threads in parallel under the condition that the number of the third objects which interact with the same second object is multiple, wherein the target thread comprises a plurality of third threads, each third thread is used for updating the physical state of one third object, and the updated third objects of any two third threads are different.
Optionally, the second updating unit is further configured to: and the fourth updating module is used for updating the third object from the third physical state to the fourth physical state by running a second thread and a third thread in parallel under the condition that a plurality of third objects interact with the same second object, wherein the second thread is used for updating the physical state of the third object after the physical state of the second object is updated, each third thread is used for updating the physical state of one third object, and any two threads in the second thread and the third thread update the third object differently.
Optionally, the first updating module is further configured to: before the second object is updated from the first physical state to the second physical state, a physical engine is utilized to update to obtain a fifth physical state of a fourth object, wherein the fourth object is an object interacted with the second object in the virtual scene, and the fifth physical state is a physical state of the fourth object at the first time; updating the second object from the first physical state to the second physical state using the fifth physical state includes.
When the efficiency is improved by utilizing the multithreading, the following scheme can be adopted: after the second game update is finished, finishing the simulation of the physical engine by using the first game update result, storing the simulation result, and then sending the game update data of the second game update to the physical engine, wherein the game engine starts the simulation; the game starts to render, and the saved physical simulation result (namely, the result obtained by simulation by using the first game updating result) is used for game rendering.
In the above scheme, when the physical engine updates the physical state of the object with the dependency relationship, the physical engine uses the physical calculation result of the physical simulation performed by the previous frame, and in this way, the step of updating the game data is not considered, which may depend on the result of the physical output, if the object in the game needs to depend on the result of the physical output, the problem that one frame is worse occurs, so that an incorrect physical expression effect is caused, especially when the physical object between two frames is displaced or rotated greatly, the incorrect expression effect is more obvious, and thus the rendered image is distorted.
Optionally, in order to facilitate parallel processing and make the processing result conform to practical situations, the apparatus further includes: the dividing unit is used for dividing an object which does not need to be subjected to physical state simulation processing in the object to be rendered in the virtual scene into a first object before the object state update is carried out on the first object, dividing an object which needs to be subjected to physical state simulation processing in the object to be rendered in the virtual scene into a second object or a third object, and dividing an object which is used as input of a physical engine into a fourth object.
Optionally, the apparatus may further include: a creation unit for creating a first thread for object state update of the first object, creating a second thread for object state update of the second object, and creating a third thread for object state update of the third object, before object state update of the first object.
By adopting the technical scheme of the application, the method for splitting the physically related game objects and then executing the game update flow is provided, so that after splitting, the physically unrelated game object processing and the PhysX processing run in parallel, the efficiency can be improved on the multi-core processor, the two parts run in the same frame strictly according to the dependency relationship, the multithreading characteristic is utilized to the maximum degree, the physical result is not used across frames, the incorrect result which is possibly generated is avoided, the machine performance and the game effect are considered, the efficiency can be improved by utilizing the multithreading, and the physical effect is completely consistent with the actual picture.
It should be noted that the above modules are the same as examples and application scenarios implemented by the corresponding steps, but are not limited to what is disclosed in the above embodiments. It should be noted that the above modules may be implemented in software or in hardware as part of the apparatus shown in fig. 1, where the hardware environment includes a network environment.
According to another aspect of the embodiment of the present application, there is also provided a server or a terminal for implementing the above-mentioned method for updating a physical state.
Fig. 5 is a block diagram of a terminal according to an embodiment of the present application, and as shown in fig. 5, the terminal may include: one or more (only one is shown in fig. 5) processors 501, memory 503, and transmission means 505, as shown in fig. 5, the terminal may further comprise input output devices 507.
The memory 503 may be used to store software programs and modules, such as program instructions/modules corresponding to the method and apparatus for updating a physical state in the embodiment of the present application, and the processor 501 executes the software programs and modules stored in the memory 503, thereby executing various functional applications and data processing, that is, implementing the method for updating a physical state described above. Memory 503 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid state memory. In some examples, the memory 503 may further include memory located remotely from the processor 501, which may be connected to the terminal via a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 505 is used for receiving or transmitting data via a network, and may also be used for data transmission between the processor and the memory. Specific examples of the network described above may include wired networks and wireless networks. In one example, the transmission device 505 includes a network adapter (Network Interface Controller, NIC) that may be connected to other network devices and routers via a network cable to communicate with the internet or a local area network. In one example, the transmission device 505 is a Radio Frequency (RF) module, which is used to communicate with the internet wirelessly.
Wherein in particular the memory 503 is used for storing application programs.
The processor 501 may call an application stored in the memory 503 via the transmission means 505 to perform the following steps:
determining a first object in the virtual scene, wherein the first object is an object which does not need to be subjected to physical state simulation processing in the virtual scene;
updating the object state of the first object;
and in the process of updating the object state of the first object, a physical engine is called to update the physical state of a second object and a third object, wherein the second object and the third object are objects which need to be subjected to physical state simulation processing in the virtual scene.
The processor 501 is further configured to perform the steps of:
when the first object is updated in an object state, the first object is updated from the first object state to a second object state by running a first thread, wherein the first object state is the object state of the first object at a first time, and the second object state is the object state of the first object at a second time, and the first time is earlier than the second time;
when the physical engine is called to update the physical states of the second object and the third object, the second object is updated from the first physical state to the second physical state and the third object is updated from the third physical state to the fourth physical state by running the target thread, wherein the target thread is a thread which runs in parallel with the first thread and belongs to the physical engine, the first physical state is the physical state of the second object at the first time, the second physical state is the physical state of the second object at the second time, the third physical state is the physical state of the third object at the first time, and the fourth physical state is the physical state of the third object at the second time.
The processor 501 is further configured to perform the steps of:
under the condition that a plurality of second objects are provided, a plurality of second threads are operated in parallel to update the plurality of second objects from the first physical state to the second physical state, wherein the target thread comprises a plurality of second threads, each second thread is used for updating the physical state of one second object, and the updated second objects of any two second threads are different;
Under the condition that a plurality of third objects interact with the same second object, updating the third object from a third physical state to a fourth physical state by running a plurality of third threads in parallel, wherein the target thread comprises a plurality of third threads, each third thread is used for updating the physical state of one third object, and any two third threads are different in updated third object; or in the case that a plurality of third objects interact with the same second object, updating the third object from a third physical state to a fourth physical state by running a second thread and a third thread in parallel, wherein the second thread is used for updating the physical state of the third object after updating the physical state of the second object, each third thread is used for updating the physical state of one third object, and any two threads in the second thread and the third thread update the third object differently.
The embodiment of the application provides an object state update method for a first object, wherein the first object is an object which does not need to be subjected to physical state simulation processing in a virtual scene; and in the process of updating the object state of the first object, a physical engine is called to update the physical state of a second object and a third object, wherein the second object and the third object are the schemes of the object which needs to be subjected to physical state simulation processing in the virtual scene. For objects in the virtual scene, processing can be performed according to the following types, one is a game object (namely a second object and a third object) which needs to use a physical engine for physical state update; and secondly, a game object (namely a first object) with a physical state updated by a physical engine is not needed, and the objects can be processed in a parallel processing mode instead of serial processing of the objects which are not classified, so that the technical problem of lower processing efficiency of a game flow in the related technology can be solved, and the technical effect of improving the processing efficiency is further achieved. In addition, in the scheme, the logic on the main thread is distinguished according to the physical correlation and the physical independence, and the physical independence part and the PhysX are operated in parallel; the method can utilize the characteristic of multithreading to maximize and utilize the parallelism of game logic and PhysX, can promote the efficiency on the multi-core processor, and also ensure the correctness of the physical simulation result.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments, and this embodiment is not described herein.
It will be appreciated by those skilled in the art that the structure shown in fig. 5 is only illustrative, and the terminal may be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a palmtop computer, a mobile internet device (Mobile Internet Devices, MID), a PAD, etc. Fig. 5 is not limited to the structure of the electronic device. For example, the terminal may also include more or fewer components (e.g., network interfaces, display devices, etc.) than shown in fig. 5, or have a different configuration than shown in fig. 5.
Those of ordinary skill in the art will appreciate that all or part of the steps in the various methods of the above embodiments may be implemented by a program for instructing a terminal device to execute in association with hardware, the program may be stored in a computer readable storage medium, and the storage medium may include: flash disk, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), magnetic or optical disk, and the like.
The embodiment of the application also provides a storage medium. Alternatively, in the present embodiment, the above-described storage medium may be used for program code for executing the update method of the physical state.
Alternatively, in this embodiment, the storage medium may be located on at least one network device of the plurality of network devices in the network shown in the above embodiment.
Alternatively, in the present embodiment, the storage medium is configured to store program code for performing the steps of:
determining a first object in the virtual scene, wherein the first object is an object which does not need to be subjected to physical state simulation processing in the virtual scene;
updating the object state of a first object, wherein the first object is an object which does not need to be subjected to physical state simulation processing in a virtual scene;
and in the process of updating the object state of the first object, a physical engine is called to update the physical state of a second object and a third object, wherein the second object and the third object are objects which need to be subjected to physical state simulation processing in the virtual scene.
Optionally, the storage medium is further arranged to store program code for performing the steps of:
when the first object is updated in an object state, the first object is updated from the first object state to a second object state by running a first thread, wherein the first object state is the object state of the first object at a first time, and the second object state is the object state of the first object at a second time, and the first time is earlier than the second time;
When the physical engine is called to update the physical states of the second object and the third object, the second object is updated from the first physical state to the second physical state and the third object is updated from the third physical state to the fourth physical state by running the target thread, wherein the target thread is a thread which runs in parallel with the first thread and belongs to the physical engine, the first physical state is the physical state of the second object at the first time, the second physical state is the physical state of the second object at the second time, the third physical state is the physical state of the third object at the first time, and the fourth physical state is the physical state of the third object at the second time.
Optionally, the storage medium is further arranged to store program code for performing the steps of:
under the condition that a plurality of second objects are provided, a plurality of second threads are operated in parallel to update the plurality of second objects from the first physical state to the second physical state, wherein the target thread comprises a plurality of second threads, each second thread is used for updating the physical state of one second object, and the updated second objects of any two second threads are different;
under the condition that a plurality of third objects interact with the same second object, updating the third object from a third physical state to a fourth physical state by running a plurality of third threads in parallel, wherein the target thread comprises a plurality of third threads, each third thread is used for updating the physical state of one third object, and any two third threads are different in updated third object; or in the case that a plurality of third objects interact with the same second object, updating the third object from a third physical state to a fourth physical state by running a second thread and a third thread in parallel, wherein the second thread is used for updating the physical state of the third object after updating the physical state of the second object, each third thread is used for updating the physical state of one third object, and any two threads in the second thread and the third thread update the third object differently.
Alternatively, specific examples in this embodiment may refer to examples described in the foregoing embodiments, and this embodiment is not described herein.
Alternatively, in the present embodiment, the storage medium may include, but is not limited to: a U-disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a removable hard disk, a magnetic disk, or an optical disk, or other various media capable of storing program codes.
The foregoing embodiment numbers of the present application are merely for the purpose of description, and do not represent the advantages or disadvantages of the embodiments.
The integrated units in the above embodiments may be stored in the above-described computer-readable storage medium if implemented in the form of software functional units and sold or used as separate products. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, comprising several instructions for causing one or more computer devices (which may be personal computers, servers or network devices, etc.) to perform all or part of the steps of the method described in the embodiments of the present application.
In the foregoing embodiments of the present application, the descriptions of the embodiments are emphasized, and for a portion of this disclosure that is not described in detail in this embodiment, reference is made to the related descriptions of other embodiments.
In several embodiments provided by the present application, it should be understood that the disclosed client may be implemented in other manners. The above-described embodiments of the apparatus are merely exemplary, and the division of the units, such as the division of the units, is merely a logical function division, and may be implemented in another manner, for example, multiple units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be through some interfaces, units or modules, or may be in electrical or other forms.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in the embodiments of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The foregoing is merely a preferred embodiment of the present application and it should be noted that modifications and adaptations to those skilled in the art may be made without departing from the principles of the present application, which are intended to be comprehended within the scope of the present application.
Embodiments of the present application also include these and other aspects defined in the following numbered clauses:
1. a method for updating a physical state, comprising:
determining a first object in a virtual scene, wherein the first object is an object which does not need to be subjected to physical state simulation processing in the virtual scene;
updating the object state of the first object;
and in the process of updating the object state of the first object, a physical engine is called to update the physical state of a second object and a third object, wherein the second object and the third object are objects which need to be subjected to physical state simulation processing in the virtual scene.
2. The method according to clause 1, wherein,
the updating of the object state of the first object comprises: updating the first object from a first object state to a second object state by running a first thread, wherein the first object state is an object state of the first object at a first time, the second object state is an object state of the first object at a second time, and the first time is earlier than the second time;
invoking the physical engine to perform a physical state update on the second object and the third object includes: and updating the second object from a first physical state to a second physical state and updating the third object from a third physical state to a fourth physical state through running a target thread, wherein the target thread is a thread belonging to the physical engine running in parallel with the first thread, the first physical state is a physical state of the second object at the first time, the second physical state is a physical state of the second object at the second time, the third physical state is a physical state of the third object at the first time, and the fourth physical state is a physical state of the third object at the second time.
3. The method of clause 2, wherein updating the second object from the first physical state to the second physical state and updating the third object from the third physical state to the fourth physical state by running a target thread comprises performing the steps of:
updating the second object from the first physical state to the second physical state;
updating the third object from the third physical state to the fourth physical state using the second physical state.
4. The method of clause 2, wherein updating the second object from the first physical state to the second physical state by running the target thread comprises:
and under the condition that a plurality of second objects are provided, updating a plurality of second objects from the first physical state to the second physical state by running a plurality of second threads in parallel, wherein the target thread comprises the plurality of second threads, each second thread is used for updating the physical state of one second object, and the updated second objects of any two second threads are different.
5. The method of clause 2, wherein updating the third object from the third physical state to the fourth physical state by running a target thread comprises:
And in the case that a plurality of third objects interact with the same second object, updating the third object from the third physical state to the fourth physical state by running a plurality of third threads in parallel, wherein the target thread comprises the plurality of third threads, each third thread is used for updating the physical state of one third object, and any two third threads are different from each other.
6. The method of clause 2, wherein updating the third object from the third physical state to the fourth physical state by running a target thread comprises:
and in the case that a plurality of third objects interact with the same second object, updating the third object from the third physical state to the fourth physical state by running a second thread and third threads in parallel, wherein the second thread is used for continuing to update the physical state of the third object after updating the physical state of the second object, each third thread is used for updating the physical state of one third object, and any two threads in the second thread and the third thread update the third object differently.
7. The method according to clause 3, wherein,
before updating the second object from the first physical state to the second physical state, the method further comprises: updating by using the physical engine to obtain a fifth physical state of a fourth object, wherein the fourth object is an object interacted with the second object in the virtual scene, and the fifth physical state is a physical state of the fourth object at the first time;
updating the second object from the first physical state to the second physical state includes: updating the second object from the first physical state to the second physical state using the fifth physical state includes.
8. The method of any of clauses 2-7, wherein prior to object state promotion for the first object, the method further comprises:
creating a first thread for object state updating of the first object, creating a second thread for object state updating of the second object, and creating a third thread for object state updating of the third object.
9. The method of any of clauses 1-7, wherein prior to object state updating the first object, the method further comprises:
The method comprises the steps of dividing an object which does not need to be subjected to physical state simulation processing in an object to be rendered in the virtual scene into a first object, dividing an object which needs to be subjected to physical state simulation processing in the object to be rendered in the virtual scene into a second object or a third object, and dividing an object which is used as input of the physical engine into a fourth object.
10. An updating device for a physical state, comprising:
the device comprises a determining unit, a judging unit and a judging unit, wherein the determining unit is used for determining a first object in a virtual scene, wherein the first object is an object which does not need to be subjected to physical state simulation processing in the virtual scene;
a first updating unit, configured to update an object state of the first object;
and the second updating unit is used for calling a physical engine to update the physical state of a second object and a third object in the process of updating the object state of the first object, wherein the second object and the third object are objects which need to be subjected to physical state simulation processing in the virtual scene.
11. The apparatus according to clause 10, wherein,
the first updating unit is further configured to: updating the first object from a first object state to a second object state by running a first thread, wherein the first object state is an object state of the first object at a first time, the second object state is an object state of the first object at a second time, and the first time is earlier than the second time;
The second updating unit is further configured to: and updating the second object from a first physical state to a second physical state and updating the third object from a third physical state to a fourth physical state by running a target thread, wherein the target thread is a thread belonging to the physical engine running in parallel with the first thread, the first physical state is a physical state of the second object at the first time, the second physical state is a physical state of the second object at the second time, the third physical state is a physical state of the third object at the first time, and the fourth physical state is a physical state of the third object at the second time.
12. The apparatus of clause 11, wherein the second updating unit comprises:
a first updating module for updating the second object from the first physical state to the second physical state;
and a second updating module, configured to update the third object from the third physical state to the fourth physical state by using the second physical state.
13. The apparatus of clause 11, wherein the second updating unit is further configured to:
And under the condition that a plurality of second objects are provided, updating a plurality of second objects from the first physical state to the second physical state by running a plurality of second threads in parallel, wherein the target thread comprises the plurality of second threads, each second thread is used for updating the physical state of one second object, and the updated second objects of any two second threads are different.
14. The apparatus of clause 11, wherein the second updating unit comprises:
and a third updating module, configured to update, when a plurality of third objects interact with the same second object are multiple, the third object from the third physical state to the fourth physical state by running a plurality of third threads in parallel, where the target thread includes the plurality of third threads, each third thread is configured to update a physical state of one third object, and any two third threads update the third object that is different.
15. The apparatus of clause 11, wherein the second updating unit is further configured to:
and a fourth updating module, configured to update, when the number of third objects interacting with the same second object is multiple, the third object from the third physical state to the fourth physical state by running a second thread and a third thread in parallel, where the second thread is configured to update the physical state of the third object after updating the physical state of the second object, each third thread is configured to update the physical state of one third object, and any two threads in the second thread and the third thread update the third object differently.
16. The apparatus according to clause 12, wherein,
the first update module is further configured to: before the second object is updated from the first physical state to the second physical state, updating by using the physical engine to obtain a fifth physical state of a fourth object, wherein the fourth object is an object interacted with the second object in the virtual scene, and the fifth physical state is a physical state of the fourth object at the first time; updating the second object from the first physical state to the second physical state using the fifth physical state includes.
17. The apparatus according to any one of clauses 11-16, wherein the apparatus further comprises:
a creating unit, configured to create a first thread for performing object state update on a first object, create a second thread for performing object state update on a second object, and create a third thread for performing object state update on a third object before performing object state update on the first object.
18. The apparatus according to any one of clauses 10 to 16, wherein the apparatus further comprises:
the dividing unit is configured to divide, before performing object state update on a first object, an object that does not need to perform physical state simulation processing in an object to be rendered in the virtual scene into the first object, divide, among objects to be rendered in the virtual scene, an object that needs to perform physical state simulation processing into the second object or the third object, and divide, as an input of the physical engine, an object into a fourth object.
19. A storage medium, wherein the storage medium comprises a stored program, wherein the program, when run, performs the method of any one of clauses 1 to 9 above.
20. An electronic device comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein the processor performs the method of any one of clauses 1-9 above by the computer program.
Claims (11)
1. A method for updating a physical state, comprising:
determining a first object in a virtual scene, wherein the first object is an object which does not need to be subjected to physical state simulation processing in the virtual scene;
performing object state update on the first object, including: updating the first object from a first object state to a second object state by running a first thread, wherein the first object state is an object state of the first object at a first time, the second object state is an object state of the first object at a second time, and the first time is earlier than the second time;
in the process of updating the object state of the first object, invoking a physical engine to update the physical state of a second object and a third object, wherein the method comprises the following steps: and updating the second object from a first physical state to a second physical state and updating the third object from a third physical state to a fourth physical state through a running target thread, wherein the second object and the third object are objects which need to be subjected to physical state simulation processing in the virtual scene, the target thread is a thread belonging to the physical engine and running in parallel with the first thread, the first physical state is a physical state of the second object at the first time, the second physical state is a physical state of the second object at the second time, the third physical state is a physical state of the third object at the first time, and the fourth physical state is a physical state of the third object at the second time.
2. The method of claim 1, wherein updating the second object from the first physical state to the second physical state and updating the third object from the third physical state to the fourth physical state by running a target thread comprises performing the steps of:
updating the second object from the first physical state to the second physical state;
updating the third object from the third physical state to the fourth physical state using the second physical state.
3. The method of claim 1, wherein updating the second object from the first physical state to the second physical state by running a target thread comprises:
and under the condition that a plurality of second objects are provided, updating a plurality of second objects from the first physical state to the second physical state by running a plurality of second threads in parallel, wherein the target thread comprises the plurality of second threads, each second thread is used for updating the physical state of one second object, and the updated second objects of any two second threads are different.
4. The method of claim 1, wherein updating the third object from the third physical state to the fourth physical state by running a target thread comprises:
And in the case that a plurality of third objects interact with the same second object, updating the third object from the third physical state to the fourth physical state by running a plurality of third threads in parallel, wherein the target thread comprises the plurality of third threads, each third thread is used for updating the physical state of one third object, and any two third threads are different from each other.
5. The method of claim 1, wherein updating the third object from the third physical state to the fourth physical state by running a target thread comprises:
and in the case that a plurality of third objects interact with the same second object, updating the third object from the third physical state to the fourth physical state by running a second thread and third threads in parallel, wherein the second thread is used for continuing to update the physical state of the third object after updating the physical state of the second object, each third thread is used for updating the physical state of one third object, and any two threads in the second thread and the third thread update the third object differently.
6. The method of claim 2, wherein the step of determining the position of the substrate comprises,
before updating the second object from the first physical state to the second physical state, the method further comprises: updating by using the physical engine to obtain a fifth physical state of a fourth object, wherein the fourth object is an object interacted with the second object in the virtual scene, and the fifth physical state is a physical state of the fourth object at the first time;
updating the second object from the first physical state to the second physical state includes: updating the second object from the first physical state to the second physical state using the fifth physical state includes.
7. The method according to any one of claims 1 to 6, wherein prior to object state promotion for the first object, the method further comprises:
creating a first thread for object state updating of the first object, creating a second thread for object state updating of the second object, and creating a third thread for object state updating of the third object.
8. The method according to any one of claims 1 to 6, wherein prior to the object state update for the first object, the method further comprises:
The method comprises the steps of dividing an object which does not need to be subjected to physical state simulation processing in an object to be rendered in the virtual scene into a first object, dividing an object which needs to be subjected to physical state simulation processing in the object to be rendered in the virtual scene into a second object or a third object, and dividing an object which is used as input of the physical engine into a fourth object.
9. An apparatus for updating a physical state, comprising:
the device comprises a determining unit, a judging unit and a judging unit, wherein the determining unit is used for determining a first object in a virtual scene, wherein the first object is an object which does not need to be subjected to physical state simulation processing in the virtual scene;
a first updating unit, configured to update an object state of the first object: updating the first object from a first object state to a second object state by running a first thread, wherein the first object state is an object state of the first object at a first time, the second object state is an object state of the first object at a second time, and the first time is earlier than the second time;
the second updating unit is used for calling a physical engine to update the physical state of the second object and the third object in the process of updating the object state of the first object: and updating the second object from a first physical state to a second physical state and updating the third object from a third physical state to a fourth physical state through a running target thread, wherein the second object and the third object are objects which need to be subjected to physical state simulation processing in the virtual scene, the target thread is a thread belonging to the physical engine and running in parallel with the first thread, the first physical state is a physical state of the second object at the first time, the second physical state is a physical state of the second object at the second time, the third physical state is a physical state of the third object at the first time, and the fourth physical state is a physical state of the third object at the second time.
10. A storage medium comprising a stored program, wherein the program when run performs the method of any one of the preceding claims 1 to 8.
11. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor performs the method of any of the preceding claims 1 to 8 by means of the computer program.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010367084.8A CN111714879B (en) | 2020-04-30 | 2020-04-30 | Physical state updating method and device, storage medium and electronic device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202010367084.8A CN111714879B (en) | 2020-04-30 | 2020-04-30 | Physical state updating method and device, storage medium and electronic device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN111714879A CN111714879A (en) | 2020-09-29 |
CN111714879B true CN111714879B (en) | 2023-10-03 |
Family
ID=72563666
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202010367084.8A Active CN111714879B (en) | 2020-04-30 | 2020-04-30 | Physical state updating method and device, storage medium and electronic device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN111714879B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2006052750A2 (en) * | 2004-11-08 | 2006-05-18 | Ageia Technologies, Inc. | Asynchronous and parallel execution by physics processing unit |
CN110694276A (en) * | 2019-10-14 | 2020-01-17 | 北京代码乾坤科技有限公司 | Physical effect simulation method, physical effect simulation device, storage medium, processor, and electronic device |
CN110889890A (en) * | 2019-11-29 | 2020-03-17 | 深圳市商汤科技有限公司 | Image processing method and device, processor, electronic device and storage medium |
CN111068322A (en) * | 2019-12-28 | 2020-04-28 | 上海米哈游天命科技有限公司 | Object moving method, device, terminal and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US7565279B2 (en) * | 2005-03-07 | 2009-07-21 | Nvidia Corporation | Callbacks in asynchronous or parallel execution of a physics simulation |
-
2020
- 2020-04-30 CN CN202010367084.8A patent/CN111714879B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2006052750A2 (en) * | 2004-11-08 | 2006-05-18 | Ageia Technologies, Inc. | Asynchronous and parallel execution by physics processing unit |
CN110694276A (en) * | 2019-10-14 | 2020-01-17 | 北京代码乾坤科技有限公司 | Physical effect simulation method, physical effect simulation device, storage medium, processor, and electronic device |
CN110889890A (en) * | 2019-11-29 | 2020-03-17 | 深圳市商汤科技有限公司 | Image processing method and device, processor, electronic device and storage medium |
CN111068322A (en) * | 2019-12-28 | 2020-04-28 | 上海米哈游天命科技有限公司 | Object moving method, device, terminal and storage medium |
Non-Patent Citations (1)
Title |
---|
刘剑卓.创建Box2D物理世界.《iPhone***开发从入门到精通》.2012, * |
Also Published As
Publication number | Publication date |
---|---|
CN111714879A (en) | 2020-09-29 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US20210287415A1 (en) | Virtual object display method and apparatus, electronic device, and storage medium | |
CN103997544B (en) | A kind of method and apparatus of resource downloading | |
CN106021421B (en) | method and device for accelerating webpage rendering | |
CN103559730B (en) | A kind of rendering intent and device | |
CN110502310B (en) | Time synchronization method and device of virtual machine | |
CN107890671A (en) | Threedimensional model rendering intent, device, computer equipment and the storage medium of WEB terminal | |
US20150235339A1 (en) | Hybrid engine for central processing unit and graphics processor | |
CN106951298A (en) | A kind of method and apparatus for lifting application toggle speed | |
CN109213607B (en) | Multithreading rendering method and device | |
CN114356578B (en) | Parallel computing method, device, equipment and medium for natural language processing model | |
CN111352896B (en) | Artificial intelligence accelerator, equipment, chip and data processing method | |
CN105354040A (en) | Method, device and terminal for twin-engine game built-in toolbar | |
KR101670958B1 (en) | Data processing method and apparatus in heterogeneous multi-core environment | |
CN105631921B (en) | The processing method and processing device of image data | |
CN111459626B (en) | Method and device for realizing non-branching seamless game world | |
CN112423111A (en) | Graphic engine and graphic processing method suitable for player | |
CN109800078B (en) | Task processing method, task distribution terminal and task execution terminal | |
CN110515690A (en) | Node layout's method and device, storage medium, electronic device | |
CN106874485A (en) | The method and picture that a kind of picture is presented are presented device | |
CN111714879B (en) | Physical state updating method and device, storage medium and electronic device | |
CN109426529B (en) | Method, device and terminal for drawing graphics based on X window system | |
CN106548501B (en) | Image drawing method and device | |
CN113034651A (en) | Interactive animation playing method, device, equipment and storage medium | |
CN108733401B (en) | Method and device for realizing browser compatibility | |
CN111901500A (en) | Image processing method and apparatus, storage medium, and electronic apparatus |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
EE01 | Entry into force of recordation of patent licensing contract |
Application publication date: 20200929 Assignee: Beijing Xuanguang Technology Co.,Ltd. Assignor: Perfect world (Beijing) software technology development Co.,Ltd. Contract record no.: X2022990000514 Denomination of invention: Method and device for updating physical state, storage medium, and electronic device License type: Exclusive License Record date: 20220817 |
|
EE01 | Entry into force of recordation of patent licensing contract | ||
GR01 | Patent grant | ||
GR01 | Patent grant |