Frame rate control method, device, storage medium and electronic device for virtual game
By adjusting the rendering cycle of the virtual game to match the average rendering time, the problem of low stability of the virtual game frame rate control is solved, frame rate fluctuations and picture lags are reduced, and the game fluency and responsiveness are improved.
Patent Information
- Application Number
- CN202411113749.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-11-08
- Estimated Expiration
- 2044-08-14
AI Technical Summary
The frame rate control stability of virtual games is low, and the prior art has failed to effectively solve the problem of frame rate fluctuations caused by insufficient performance of hardware devices.
By obtaining the average rendering time of the virtual game and adjusting the rendering cycle when it is time-consuming for each frame when it is greater than the frame rate setting, to match the average rendering time, extending the rendering between the completion of each frame and the beginning of the next frame. Time interval, adapt to the actual rendering speed of the hardware.
It reduces picture stuttering and jumping caused by frame rate fluctuations, improves the frame rate control efficiency of virtual games, and achieves more stable frame rate control.
Smart Images

Figure CN118615705B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular, to a frame rate control method, device, storage medium and electronic device for a virtual game. Background Art
[0002] Virtual games usually have high rendering requirements, especially in complex game scenes. If the performance of the player's hardware devices (such as CPU, GPU, etc.) is not sufficient to stably support the high frame rate rendering of the game, the frame rate will fluctuate, resulting in the problem of low stability of the frame rate control of virtual games. Therefore, there is a problem of low stability of the frame rate control of virtual games.
[0003] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0004] The embodiments of the present application provide a method, device, storage medium and electronic device for controlling the frame rate of a virtual game, so as to at least solve the technical problem of low stability of the frame rate control of the virtual game.
[0005] According to one aspect of an embodiment of the present application, a frame rate control method for a virtual game is provided, comprising: when the running status of the virtual game satisfies a frame rate control condition, obtaining an average rendering time of the virtual game, wherein the average rendering time is used to indicate the average time taken for rendering each frame of the virtual game within a historical time period; when the average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the virtual game, adjusting a rendering cycle of the virtual game to match the average rendering time, wherein the rendering cycle is used to indicate the time interval between the completion of rendering of each frame of the virtual game and the start of rendering of the next frame.
[0006] According to another aspect of an embodiment of the present application, a frame rate control device for a virtual game is also provided, including: a first acquisition unit, used to obtain the average rendering time of the above-mentioned virtual game when the running status of the virtual game meets the frame rate control condition, wherein the above-mentioned average rendering time is used to indicate the average time taken for rendering each frame of the above-mentioned virtual game within a historical time period; a first adjustment unit, used to adjust the rendering cycle of the above-mentioned virtual game to match the above-mentioned average rendering time when the above-mentioned average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the above-mentioned virtual game, wherein the above-mentioned rendering cycle is used to indicate the time interval between the completion of rendering of each frame of the above-mentioned virtual game and the start of rendering of the next frame.
[0007] As an optional solution, the above-mentioned device also includes: a second acquisition unit, which is used to obtain the CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time of the above-mentioned virtual game before obtaining the average rendering time of the above-mentioned virtual game, wherein the above-mentioned CPU preprocessing time is used to indicate the time spent by the CPU in the above-mentioned historical time period on preparation work before performing rendering, the above-mentioned CPU drawing submission time is used to indicate the time spent by the CPU in the above-mentioned historical time period on preparing and submitting graphics drawing commands to the GPU, and the above-mentioned GPU rendering execution time is used to indicate the time spent by the GPU in the above-mentioned historical time period from receiving the above-mentioned graphics drawing commands to completing the rendering work; the above-mentioned first acquisition unit includes: a first acquisition module, which is used to obtain the above-mentioned average rendering time according to the above-mentioned CPU preprocessing time, the above-mentioned CPU drawing submission time, and the above-mentioned GPU rendering execution time.
[0008] As an optional scheme, the above-mentioned first acquisition module includes: a first acquisition sub-module, used to obtain the cumulative time sum of the above-mentioned CPU preprocessing time, the above-mentioned CPU drawing submission time, and the above-mentioned GPU rendering execution time within a 1-second time period, wherein the above-mentioned historical time period includes the above-mentioned 1-second time period; a second acquisition sub-module, used to obtain the target number of frames rendered by the above-mentioned virtual game within the above-mentioned 1-second time period; a first determination module, used to determine the ratio between the above-mentioned cumulative time sum and the above-mentioned target frame number as the above-mentioned average rendering time.
[0009] As an optional solution, the second acquisition unit includes: a second determination module, which is used to determine the time from the time when the first function is called to the time before the second function is called to start rendering as the CPU preprocessing time, wherein the first function is used to make the application of the virtual game wait for an appropriate time to start rendering before rendering a new frame, and the second function is used to mark the start of the rendering process after confirming the rendering timing, so that the application starts to prepare and submit rendering data for the current frame; a third determination module, which is used to determine the time from the time when the game calls the second function to start rendering the current frame to the time when the third function is called to submit the rendered texture to the target component as the CPU drawing submission time, wherein the third function is used to mark the end of the rendering of the current frame and submit the rendered image data, and the target component is used to receive and process the image data submitted by the third function; a fourth determination module, which is used to determine the time from the time when the virtual game calls the third function to submit the rendered texture, the GPU starts to receive the graphics drawing command, and the GPU completes all texture drawing work as the GPU rendering execution time, wherein the rendering work includes all texture drawing work.
[0010] As an optional solution, the above-mentioned device also includes: an optimization unit, which is used to optimize the picture content of the next frame of the above-mentioned current frame according to the picture content of the above-mentioned current frame after adjusting the rendering cycle of the above-mentioned virtual game to match the above-mentioned average rendering time, when the above-mentioned rendering cycle is greater than or equal to a preset threshold.
[0011] As an optional solution, the above-mentioned optimization unit includes: a second acquisition module, used to acquire the first dynamic element and the first static element in the picture content of the above-mentioned current frame; a first prediction module, used to predict the position characteristics of the above-mentioned first dynamic element in the picture content of the above-mentioned next frame, and use the above-mentioned position characteristics to optimize the second dynamic element in the picture content of the above-mentioned next frame; a second prediction module, used to predict the visual characteristics of the above-mentioned first static element in the picture content of the above-mentioned next frame, and use the above-mentioned visual characteristics to optimize the second static element in the picture content of the above-mentioned next frame.
[0012] As an optional solution, the above-mentioned device also includes: a second adjustment unit, which is used to adjust the above-mentioned rendering cycle to match the rendering time per frame corresponding to the frame rate setting of the above-mentioned virtual game after adjusting the rendering cycle of the above-mentioned virtual game to match the above-mentioned average rendering time, when the running status of the above-mentioned virtual game does not meet the frame rate control conditions.
[0013] As an optional solution, the second adjustment unit includes: an adjustment module, which is used to adjust the rendering cycle to match the rendering time per frame corresponding to the frame rate setting of the virtual game when the running mode of the virtual game is switched from the first mode to the second mode, wherein the first mode is a game mode that meets the frame rate control conditions, and the second mode is a game mode that does not meet the frame rate control conditions.
[0014] According to another aspect of the embodiments of the present application, a computer program product or a computer program is provided, the computer program product or the computer program includes computer instructions, and the computer instructions are stored in a computer-readable storage medium. A processor of an electronic device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the electronic device executes the frame rate control method of the virtual game as described above.
[0015] According to another aspect of an embodiment of the present application, there is also provided an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the frame rate control method of the virtual game through the computer program.
[0016] In an embodiment of the present application, when the running status of the virtual game meets the frame rate control conditions, the average rendering time of the above-mentioned virtual game is obtained, wherein the above-mentioned average rendering time is used to indicate the average time taken for rendering each frame of the above-mentioned virtual game within a historical time period; when the above-mentioned average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the above-mentioned virtual game, the rendering cycle of the above-mentioned virtual game is adjusted to match the above-mentioned average rendering time, wherein the above-mentioned rendering cycle is used to indicate the time interval between the completion of rendering of each frame of the above-mentioned virtual game and the start of rendering of the next frame.
[0017] Since the average rendering time is calculated based on the rendering time of each frame in the historical time period, it can accurately reflect the actual rendering efficiency of the game under the current hardware conditions. Next, this embodiment compares the average rendering time with the per-frame rendering time corresponding to the frame rate setting of the game. If the average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting, it means that the rendering capability of the hardware device cannot stably support the high frame rate set by the game. In this case, if the original rendering cycle is maintained, the frame rate will fluctuate because the GPU cannot complete the rendering task within the specified short time.
[0018] In this regard, this embodiment adopts a strategy of adjusting the rendering cycle. By extending the rendering cycle, that is, increasing the time interval between the completion of rendering of each frame and the start of rendering of the next frame, the actual rendering speed of the hardware is adapted, so that it is no longer dependent on a fixed frame rate setting, but the rendering cycle is adjusted according to the actual rendering efficiency of the game and the hardware performance, thereby achieving the purpose of reducing the screen freeze and jump caused by frame rate fluctuations, thereby achieving the technical effect of improving the frame rate control efficiency of virtual games, and thus solving the technical problem of low frame rate control stability of virtual games. BRIEF DESCRIPTION OF THE DRAWINGS
[0019] The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The illustrative embodiments of the present application and their descriptions are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
[0020] Figure 1 is a schematic diagram of an application environment of an optional frame rate control method for a virtual game according to an embodiment of the present application;
[0021] Figure 2 is a schematic diagram of a process of an optional frame rate control method for a virtual game according to an embodiment of the present application;
[0022] Figure 3 is a schematic diagram of an optional frame rate control method for a virtual game according to an embodiment of the present application;
[0023] Figure 4 is a schematic diagram of another optional frame rate control method for a virtual game according to an embodiment of the present application;
[0024] Figure 5 is a schematic diagram of an optional frame rate control device for a virtual game according to an embodiment of the present application;
[0025] Figure 6 It is a schematic diagram of the structure of an optional electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] According to one aspect of an embodiment of the present application, a frame rate control method for a virtual game is provided. Optionally, as an optional implementation, the frame rate control method for the virtual game can be applied to, but is not limited to, Figure 1 In the environment shown, the environment may include, but is not limited to, a user device 102 and a server 112 . The user device 102 may include, but is not limited to, a display 104 , a processor 106 , and a memory 108 . The server 112 includes a database 114 and a processing engine 116 .
[0029] The specific process can be as follows:
[0030] Step S102, the user device 102 obtains the running status of the virtual game;
[0031] Step S104, sending the operation status to the server 112 via the network 110;
[0032] Steps S106-S110, the server 112 determines whether the running status of the virtual game meets the frame rate control condition through the processing engine 116, and obtains the average rendering time of the virtual game if the running status of the virtual game meets the frame rate control condition; if the average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the virtual game, adjusts the rendering cycle of the virtual game to match the average rendering time, and obtains a rendered game screen;
[0033] Step S112 , sending the rendered game screen to the user device 102 via the network 110 , the user device 102 displays the rendered game screen on the display 104 via the processor 106 , and stores the rendered game screen in the memory 108 .
[0034] remove Figure 1 In addition to the examples shown, the terminal device may be a terminal device configured with a target client, which may include but is not limited to at least one of the following: mobile phones (such as Android phones, iOS phones, etc.), laptops, tablet computers, PDAs, MIDs (Mobile Internet Devices), PADs, desktop computers, smart TVs, virtual reality related devices (such as VR headsets, handles / controllers, game consoles), etc. The target client may be a video client, an instant messaging client, a browser client, an education client, etc. The network may include but is not limited to: a wired network, a wireless network, wherein the wired network includes: a local area network, a metropolitan area network, and a wide area network, and the wireless network includes: Bluetooth, WIFI and other networks that implement wireless communication. The server may be a single server, or a server cluster consisting of multiple servers, or a cloud server. The above is only an example, and no limitation is made to this in this embodiment.
[0035] Optionally, as an optional implementation, Figure 2 As shown, the frame rate control method of the virtual game can be executed by an electronic device, and the electronic device can be, for example, Figure 1 The user device or server shown in the figure comprises:
[0036] S202, when the running status of the virtual game meets the frame rate control condition, obtaining an average rendering time of the virtual game, wherein the average rendering time is used to represent the average time taken to render each frame of the virtual game in a historical time period;
[0037] S204, when the average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the virtual game, adjust the rendering cycle of the virtual game to match the average rendering time, wherein the rendering cycle is used to indicate the time interval between the completion of rendering of each frame of the virtual game and the start of rendering of the next frame.
[0038] Optionally, in this embodiment, the frame rate control method of the above virtual game can be applied to multiple scenes, such as highly complex game scenes. These scenes contain a large number of polygons, textures, and light and shadow effects, which place high demands on the rendering capabilities of the hardware. The game engine continuously monitors the running status of the game, and when the frame rate control conditions are met, calculates and obtains the average rendering time over the past period of time. The game engine compares the average rendering time with the per-frame rendering time corresponding to the game frame rate setting. If it is found that the average rendering time exceeds the preset per-frame rendering time, the game engine will automatically adjust the rendering cycle to match the current average rendering time.
[0039] Another example is a game scenario running on a low-configuration hardware device. When the game starts, the player's hardware device is tested for performance. Based on the hardware performance, the game's rendering cycle and frame rate settings are dynamically adjusted to ensure a relatively stable frame rate on different devices. During the game, the average rendering time is continuously tested, and the rendering cycle is dynamically adjusted based on the actual situation.
[0040] Another example is a massively multiplayer online role-playing game (MMORPG) scenario where multiple players gather in the same area to fight or engage in activities. The server continuously monitors the performance and rendering time of each client. It collects and analyzes the average rendering time data of all clients. When it is found that the average rendering time of one or some clients exceeds the preset value, the server will dynamically adjust the rendering cycle of these clients.
[0041] Another example is the virtual reality (VR) scenario. When the running of a virtual game or VR application meets the frame rate control conditions, the (VR) system will detect and calculate the average rendering time. This average rendering time reflects the average time it takes for the VR environment to render each frame over a period of time. This indicator is crucial for evaluating the performance of VR applications.
[0042] If the average rendering time exceeds the frame rendering time corresponding to the frame rate setting of the virtual game or virtual reality application, then the rendering cycle needs to be adjusted. The frame rate setting usually determines the ideal rendering time for each frame. For example, a setting of 60 frames per second means that the ideal rendering time for each frame should be 1 / 60 second.
[0043] When the actual rendering time is higher than this ideal value, if no adjustment is made, it may cause image freezes or delays, seriously affecting the user experience. Therefore, by adjusting the rendering cycle, that is, the time interval between the completion of each frame rendering and the start of the next frame rendering, the performance of the virtual reality application can be optimized.
[0044] Specifically, if the average rendering time is long, the system can automatically increase the rendering cycle to ensure that each frame has enough time for high-quality rendering. Although this may cause a drop in frame rate, it can ensure the smoothness and stability of the picture, thereby improving the user experience.
[0045] On the contrary, if the average rendering time is short, it means that the system has sufficient performance to handle a higher frame rate. At this time, the rendering cycle can be appropriately reduced to increase the frame rate, thus bringing users a smoother and more delicate virtual reality experience.
[0046] In summary, by dynamically adjusting the rendering cycle to match the average rendering time, a smoother and more stable visual effect can be achieved in the virtual reality scene, improving the user's immersion and satisfaction. In addition, by adjusting the rendering cycle in real time to match the actual rendering time, unnecessary waste of computing resources can be avoided. When the system detects that the rendering task is relatively easy, the rendering cycle can be appropriately shortened to increase the frame rate; conversely, when the rendering load is heavy, the rendering cycle can be extended to ensure picture quality while avoiding hardware overheating or overload.
[0047] Optionally, in this embodiment, "the operation status of the virtual game" may refer to various states and performances of the virtual game during operation. This includes but is not limited to the game's fluency, picture quality, response speed, etc. The quality of the operation directly affects the player's gaming experience.
[0048] Optionally, in this embodiment, "frame rate control conditions" may refer to some standards or parameters set in the virtual game to ensure that the frame rate of the game (i.e., the number of frames displayed per second) remains within a stable and ideal range. These conditions may involve hardware performance, network latency, game internal logic, and other aspects.
[0049] Optionally, in this embodiment, the "historical time period" may refer to the time range considered when calculating the average rendering time. This time period may be a few seconds, a few minutes, or longer, depending on the needs and purpose of the analysis.
[0050] Optionally, in this embodiment, the "average rendering time" may refer to the average time taken by the virtual game to render each frame within a period of time. This time reflects the computing power and time cost required by the game engine to render each frame.
[0051] To further illustrate, let's assume that a virtual game has rendered 3,600 frames in the past minute. The rendering time of each frame may vary depending on factors such as scene complexity, hardware performance, etc. In order to get an overall performance indicator, the "Average Rendering Time" calculates the total rendering time of these 3,600 frames and divides it by 3,600 to get an average value, such as 5 milliseconds per frame.
[0052] Optionally, in this embodiment, "the rendering time per frame corresponding to the frame rate setting of the virtual game" may refer to the theoretical time that each frame of the picture should be rendered corresponding to the frame rate set in the virtual game (such as 60fps, 30fps, etc.). The frame rate indicates the number of frames displayed per second, so the rendering time per frame is the time obtained by dividing 1 second by the frame rate.
[0053] To further illustrate, for example, if the game's frame rate is set to 60fps (frames per second), then theoretically each frame should take 1 / 60 seconds to render, or about 16.67 milliseconds. This means that in order to maintain a 60fps frame rate, the game engine needs to render a frame every 16.67 milliseconds.
[0054] Optionally, in this embodiment, the "rendering cycle of the virtual game" may refer to the total time interval from when the game engine starts rendering a frame to when the rendering of the frame is completed and then to when the next frame starts rendering. This cycle includes all the steps required to render a frame, such as scene preparation, geometry processing, rasterization, pixel shading, etc., as well as any possible synchronization or waiting time.
[0055] Optionally, when the average rendering time of the game (the average value of the time actually measured for rendering each frame) is higher or lower than the expected rendering time for each frame, this embodiment adjusts the rendering cycle to ensure stable operation of the game.
[0056] If the average rendering time is higher than the expected rendering time per frame, you can increase the rendering cycle to give each frame more rendering time to prevent screen problems caused by incomplete rendering. Doing so may reduce the actual frame rate of the game, but it can ensure the integrity and stability of the picture. Conversely, if the average rendering time is lower than expected, you can try to reduce the rendering cycle to increase the frame rate of the game, thereby providing a smoother visual experience.
[0057] For further example, assuming that the frame rate of a virtual game is set to 60fps, theoretically, the rendering time of each frame should be 1 / 60 second, that is, about 16.67 milliseconds. If the average rendering time monitored is 20 milliseconds, which exceeds the theoretical value, then this embodiment will automatically adjust the rendering cycle, such as increasing it to 20 milliseconds, to ensure that each frame has enough time to render, thereby avoiding screen freezes or frame drops.
[0058] It should be noted that the description of this embodiment involves a performance optimization strategy for a virtual game. First, when the running of the game meets certain frame rate control conditions, this embodiment will monitor and calculate the average time it takes for the game to render each frame in a historical time period. If it is found that this average time exceeds the rendering time that each frame should have under the game frame rate setting, then this embodiment will adjust the rendering cycle of the game to ensure smooth operation of the game.
[0059] By monitoring the average rendering time of the game in real time and adjusting the rendering cycle as needed, this strategy can ensure that the game can maintain a stable frame rate when facing high load or performance fluctuations. This not only improves the smoothness and responsiveness of the game, but also reduces the phenomenon of screen freezes or frame drops caused by hardware performance mismatch.
[0060] To further illustrate, the optional Figure 3 As shown, when the running condition of the virtual game meets the frame rate control conditions (such as abnormal conditions such as jitter or tailing of the screen content of the game screen 302), the average rendering time 304 of the virtual game is obtained; when the average rendering time 304 is greater than the per-frame rendering time 306 corresponding to the frame rate setting of the virtual game, the rendering cycle 308 of the virtual game is adjusted to match the average rendering time. For example, the game screen 310 after adjusting the rendering cycle 308 has a more stable frame rate than the game screen 302 before adjusting the rendering cycle 308.
[0061] Through the embodiments provided by the present application, since the average rendering time is calculated based on the rendering time of each frame in the historical time period, it can accurately reflect the actual rendering efficiency of the game under the current hardware conditions. Next, this embodiment compares the average rendering time with the rendering time per frame corresponding to the frame rate setting of the game. If the average rendering time is greater than the rendering time per frame corresponding to the frame rate setting, it means that the rendering capability of the hardware device cannot stably support the high frame rate set by the game. In this case, if the original rendering cycle is maintained, the frame rate will fluctuate because the GPU cannot complete the rendering task within the prescribed short time. In this regard, this embodiment adopts a strategy of adjusting the rendering cycle. By extending the rendering cycle, that is, increasing the time interval between the completion of rendering of each frame and the start of rendering of the next frame, the actual rendering speed of the hardware is adapted, so that it is no longer dependent on the fixed frame rate setting, but the rendering cycle is adjusted according to the actual rendering efficiency and hardware performance of the game, thereby achieving the purpose of reducing the image freeze and jump caused by frame rate fluctuations, thereby achieving the technical effect of improving the frame rate control efficiency of the virtual game.
[0062] As an optional solution, before obtaining the average rendering time of the virtual game, the method further includes: obtaining the CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time of the virtual game, wherein the CPU preprocessing time is used to indicate the time spent by the CPU in the historical time period on preparation work before rendering, the CPU drawing submission time is used to indicate the time spent by the CPU in the historical time period on preparing and submitting graphics drawing commands to the GPU, and the GPU rendering execution time is used to indicate the time spent by the GPU in the historical time period from receiving graphics drawing commands to completing rendering work;
[0063] Get the average rendering time of the virtual game, including: get the average rendering time according to the CPU preprocessing time, the CPU drawing submission time, and the GPU rendering execution time.
[0064] Optionally, in this embodiment, the CPU preprocessing time may refer to the time spent by the CPU on preparatory work before rendering (such as scene construction, resource loading, etc.) during a historical time period.
[0065] Optionally, in this embodiment, the CPU drawing submission time may refer to the time spent by the CPU in preparing and submitting graphics drawing commands to the GPU in a historical time period, which may include but is not limited to steps such as generating drawing commands and organizing rendering data.
[0066] Optionally, in this embodiment, the GPU rendering execution time may refer to the time taken from the GPU receiving the graphics drawing command to the final completion of the rendering work in the historical time period, which may include but is not limited to the GPU executing the rendering pipeline, processing shaders, texture mapping and other tasks.
[0067] Optionally, in this embodiment, the average rendering time may refer to the average time calculated based on the CPU preprocessing time, the CPU drawing submission time and the GPU rendering execution time, which represents the average time for rendering each frame of the virtual game in the historical time period.
[0068] It should be noted that in the description of this embodiment, before obtaining the average rendering time of the virtual game, three key time parameters need to be obtained: CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time. These three time parameters represent the preparation time of the CPU before executing rendering, the time for the CPU to prepare and submit graphics drawing commands to the GPU, and the time from receiving commands to completing rendering by the GPU. The average rendering time is obtained based on these three time parameters.
[0069] By breaking down the different stages of the rendering process, you can more accurately understand where the game rendering performance bottlenecks are. For example, if the CPU preprocessing time is too long, it may mean that the game scene is too complex or there is room for optimization of resource loading. If the GPU rendering execution time is too long, it may indicate that there are efficiency issues in the graphics rendering pipeline or that more efficient hardware support is needed.
[0070] To further illustrate, suppose that in a period of time, the CPU preprocessing time is 10 milliseconds, the CPU drawing submission time is 5 milliseconds, and the GPU rendering execution time is 20 milliseconds. Then, the total rendering time of this frame is the sum of these three times, which is 35 milliseconds. If you monitor multiple frames and average these times, you can get the average rendering time.
[0071] By recording and analyzing the CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time in detail, game developers can more accurately locate performance bottlenecks and optimize game rendering efficiency. This not only helps to improve the overall running speed and smoothness of the game, but also ensures that players can get a good gaming experience in various hardware environments.
[0072] As an optional solution, the average rendering time is obtained based on the CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time, including:
[0073] S1-1, obtain the cumulative sum of CPU preprocessing time, CPU drawing submission time, GPU rendering execution time within a 1-second time period, where the historical time period includes a 1-second time period;
[0074] S1-2, obtaining the target number of frames rendered by the virtual game within a 1 second period;
[0075] S1-3, the ratio between the total accumulated time and the target number of frames is determined as the average rendering time.
[0076] Optionally, in this embodiment, the CPU preprocessing time, the CPU drawing submission time, and the GPU rendering execution time, these time parameters can respectively represent the preparation time of the CPU before executing rendering, the time for the CPU to prepare and submit graphics commands to the GPU, and the time from the GPU receiving the command to the completion of rendering.
[0077] Optionally, in this embodiment, the cumulative total time within a 1-second time period may refer to the cumulative total of the above three time parameters (CPU preprocessing time, CPU drawing submission time, GPU rendering execution time) within the 1-second time period.
[0078] Optionally, in this embodiment, the target frame rate can be understood as the number of frames that the virtual game is planned to render within a 1-second time period.
[0079] Optionally, in this embodiment, the average rendering time can be calculated by dividing the total accumulated time within 1 second by the target number of frames, which represents the average time for rendering each frame within this 1 second.
[0080] It should be noted that this embodiment describes a method for calculating the average rendering time of a virtual game, involving three key time parameters: CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time. The average rendering time of each frame is calculated by obtaining the cumulative sum of these times within 1 second and combining them with the target number of frames rendered by the game within this 1 second.
[0081] By monitoring these detailed time parameters, developers can gain a deeper understanding of the rendering process of the game and identify possible performance bottlenecks. In addition, this embodiment can also be used to compare the impact of different hardware configurations or optimization measures on game performance.
[0082] To further illustrate, let's assume that within 1 second, the cumulative total of CPU preprocessing time is 200 milliseconds, the cumulative total of CPU drawing submission time is 100 milliseconds, and the cumulative total of GPU rendering execution time is 400 milliseconds. If the goal of the game within this 1 second is to render 60 frames, then the cumulative total time is 700 milliseconds. The average rendering time is 700 milliseconds divided by 60 frames, which is approximately 11.67 milliseconds per frame.
[0083] By accurately calculating and monitoring the cumulative sum of the CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time per second, and combining the target rendering frame number to determine the average rendering time, the rendering cycle can be adjusted more accurately to adapt to the actual performance of the hardware. This dynamic adjustment helps reduce frame rate fluctuations and makes the game screen smoother and more stable.
[0084] As an optional solution, obtain the CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time of the virtual game, including:
[0085] S2-1, determining the time from the time when the first function is called to the time before the second function is called to prepare to start rendering as the CPU preprocessing time, wherein the first function is used to make the application of the virtual game wait for an appropriate time to start rendering before rendering a new frame, and the second function is used to mark the start of the rendering process after confirming the rendering timing, so that the application can start preparing and submitting rendering data for the current frame;
[0086] S2-2, the time from when the game calls the second function to start rendering the current frame to when the third function is called to submit the rendered texture to the target component is determined as the CPU drawing submission time, wherein the third function is used to mark the end of the current frame rendering and submit the rendered image data, and the target component is used to receive and process the image data submitted by the third function;
[0087] S2-3, after the virtual game calls the third function to submit the rendered texture, the GPU starts to receive graphics drawing commands, and the time from when the GPU completes all texture drawing work is determined as the GPU rendering execution time, where the rendering work includes all texture drawing work.
[0088] Optionally, in this embodiment, the CPU preprocessing time may be the time from calling the first function to calling the second function to prepare for rendering. The first function is used to make the application of the virtual game wait for an appropriate time to start rendering before rendering a new frame; the second function is used to mark the start of the rendering process after confirming the rendering timing.
[0089] Optionally, in this embodiment, the CPU drawing submission time may be the time from when the game calls the second function to start rendering the current frame to when the third function is called to submit the rendered texture to the target component. The third function is used to mark the end of the current frame rendering and submit the rendered image data; the target component is used to receive and process the image data.
[0090] Optionally, in this embodiment, the GPU rendering execution time may be the time from when the virtual game calls the third function to submit the rendered texture, the GPU starts to receive graphics drawing commands, to when the GPU completes all texture drawing work. The rendering work here specifically refers to all texture drawing work.
[0091] It should be noted that this embodiment describes how to obtain three key time parameters in a virtual game: CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time. These time parameters are determined by specific function calls and rendering processes, so that the time spent in each stage of the game rendering process can be more accurately measured.
[0092] By accurately measuring these time parameters, developers can gain in-depth insights into the game's rendering performance, identify possible bottlenecks, and optimize them. For example, if the CPU preprocessing time is too long, it may mean that there are efficiency issues with the game's scene updates or resource loading; if the GPU rendering execution time is too long, it may indicate that the graphics rendering pipeline needs to be optimized or that the GPU resources are insufficient.
[0093] To further illustrate, let's assume that during the rendering process of a certain frame, the first function is called at time point A, the second function is called at time point B, the third function is called at time point C, and the GPU completes all texture drawing work at time point D. Then, the CPU preprocessing time is BA, the CPU drawing submission time is CB, and the GPU rendering execution time is DC.
[0094] By accurately measuring and detecting the CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time, the rendering strategy can be dynamically adjusted, such as by reducing rendering details, adjusting the viewing distance, or optimizing resource loading to ensure the stability of the frame rate. This dynamic adjustment can maintain the stability of the frame rate to the maximum extent without affecting the visual quality of the game.
[0095] As an optional solution, after adjusting the rendering cycle of the virtual game to match the average rendering time, the method further includes:
[0096] When the rendering period is greater than or equal to a preset threshold, the picture content of the next frame of the current frame is optimized according to the picture content of the current frame.
[0097] Optionally, in this embodiment, the preset threshold may be a preset time value, which is used to determine whether the rendering cycle is too long, thereby triggering the optimization mechanism.
[0098] Optionally, in this embodiment, optimizing the picture content may be improving or adjusting the picture content of the next frame according to the picture content of the current frame to improve rendering efficiency and / or picture quality.
[0099] It should be noted that, during the operation of the virtual game, when the average rendering time of the game exceeds the per-frame rendering time corresponding to the frame rate setting, the rendering cycle of the game will be adjusted to match the average rendering time. After that, if the adjusted rendering cycle is greater than or equal to a preset threshold, this embodiment will optimize the screen content of the next frame according to the screen content of the current frame.
[0100] Optimizing the next frame's screen content may include but is not limited to the following methods: reducing texture resolution, reducing shadow or lighting effects, simplifying model details, adjusting view distance, etc. These optimization measures are designed to reduce the rendering burden of the next frame, thereby maintaining or improving frame rate stability.
[0101] To further illustrate, optionally assume that the frame rate of a virtual game is set to 60 frames per second, and each frame should theoretically take about 16.67 milliseconds. If the average rendering time increases to 20 milliseconds due to some complex scenes or special effects, then the rendering cycle needs to be adjusted to 20 milliseconds to match this time. If the rendering cycle (20 milliseconds) is greater than a preset threshold (such as 5 milliseconds) at this time, this embodiment will start to optimize the next frame based on the screen content of the current frame, such as by reducing unnecessary details, reducing the complexity of certain special effects, etc.
[0102] Through the embodiments provided by this application, the game can adaptively optimize the screen content when the rendering cycle is long to maintain the stability of the frame rate. This can not only improve the fluency of the game, but also provide a more consistent gaming experience under different hardware configurations or complex scenarios. At the same time, this dynamic optimization mechanism also helps to reduce excessive consumption of hardware resources and improve the overall efficiency of game operation.
[0103] As an optional solution, according to the picture content of the current frame, the picture content of the next frame of the current frame is optimized, including:
[0104] S3-1, obtaining a first dynamic element and a first static element in the picture content of the current frame;
[0105] S3-2, predicting a position feature of the first dynamic element in the picture content of the next frame, and optimizing a second dynamic element in the picture content of the next frame by using the position feature;
[0106] S3-3, predicting visual features of the first static element in the picture content of the next frame, and optimizing the second static element in the picture content of the next frame by using the visual features.
[0107] Optionally, in this embodiment, the first dynamic element may be a dynamic (ie, moving or changing) visual element identified in the current frame, and the second dynamic element may be a corresponding or related dynamic element in the next frame.
[0108] Optionally, in this embodiment, the first static element may be a static (ie, non-moving or unchanged) visual element identified in the current frame, and the second static element may be a corresponding or related static element in the next frame.
[0109] Optionally, in this embodiment, the position feature may be a feature such as the position or movement trajectory of the dynamic element in the picture.
[0110] Optionally, in this embodiment, the visual feature may be a visually identifiable characteristic of the static element, such as shape, color, texture, etc.
[0111] It should be noted that this embodiment describes a method for optimizing the content of a virtual game screen. Specifically, the dynamic and static elements in the current frame are first identified, and then the positions and visual features of these elements in the next frame are predicted, and finally these predictions are used to optimize the corresponding elements in the next frame.
[0112] This optimization method can be applied not only to the optimization of a single element, but also to the optimization of the entire scene. For example, based on the position prediction of dynamic elements, scene resources can be loaded and unloaded in advance, thereby reducing resource consumption during rendering; at the same time, based on the visual feature prediction of static elements, the scene's lighting, shadows and other effects can be pre-rendered or adjusted to improve the realism and smoothness of the picture.
[0113] To further illustrate, optionally assume that there is a fast-moving car (first dynamic element) and a stationary building (first static element) in the current frame. The system will first identify these two elements and predict where the car will move to in the next frame (position feature), and how the visual characteristics of the building, such as color and shape, may be presented in the next frame (visual feature). Then, based on these predictions, this embodiment will optimize the corresponding elements (second dynamic element and second static element) in the next frame, such as by preloading relevant resources of the location where the car is about to arrive, or adjusting the rendering details of the building, to improve rendering efficiency and picture quality.
[0114] Through the embodiments provided in this application, the game can achieve intelligent optimization of the content of the next frame. Specifically, the position of dynamic elements and the visual features of static elements can be predicted and optimized in advance, thereby reducing unnecessary calculations and resource consumption when rendering the next frame, improving rendering speed and picture quality. This not only helps to improve the frame rate stability of the game, but also provides players with a smoother and more realistic gaming experience.
[0115] As an optional solution, after adjusting the rendering cycle of the virtual game to match the average rendering time, the method further includes:
[0116] When the running condition of the virtual game does not meet the frame rate control condition, the rendering cycle is adjusted to match the per-frame rendering time corresponding to the frame rate setting of the virtual game.
[0117] Optionally, in this embodiment, the rendering cycle adjustment may be to dynamically change the rendering interval of each frame according to the actual running conditions and frame rate requirements of the game to achieve a desired frame rate.
[0118] It should be noted that this embodiment describes an adjustment strategy, which adjusts the rendering cycle to match the per-frame rendering time corresponding to the frame rate setting of the game when the running status of the virtual game does not meet the frame rate control condition. This is to ensure that the game can run stably at the set frame rate, even when the actual running status does not meet expectations.
[0119] The effect of this strategy is to significantly improve the compatibility and stability of the game. By automatically adjusting the rendering cycle to match the per-frame rendering time corresponding to the frame rate setting, the game can provide a smoother and more consistent user experience on various hardware configurations. Even in the case of insufficient hardware performance or increased complexity of the game scene, this strategy can help the game maintain a relatively stable frame rate, thereby reducing adverse effects such as stuttering and frame drops, and improving player satisfaction.
[0120] For further example, assuming that the frame rate set for a game is 60 frames per second, then theoretically the rendering time for each frame should be 16.67 milliseconds. If the actual operation of the game cannot meet this frame rate requirement due to some reasons (such as insufficient hardware performance, increased complexity of the game scene, etc.), then this embodiment will automatically adjust the rendering cycle, which may increase the rendering time for each frame, such as adjusting it to 20 milliseconds per frame, to ensure that the game can run stably at a lower frame rate without freezing or crashing.
[0121] By automatically adjusting the rendering cycle to match the frame rate setting corresponding to the rendering time of each frame, the game can provide a smoother and more consistent user experience on various hardware configurations. Even when the hardware performance is insufficient or the complexity of the game scene increases, this strategy can help the game maintain a relatively stable frame rate, thereby reducing adverse effects such as lag and frame drops, and improving player satisfaction.
[0122] As an optional solution, when the running condition of the virtual game does not meet the frame rate control condition, the rendering cycle is adjusted to match the per-frame rendering time corresponding to the frame rate setting of the virtual game, including:
[0123] When the running mode of the virtual game is switched from the first mode to the second mode, the rendering cycle is adjusted to match the rendering time per frame corresponding to the frame rate setting of the virtual game, wherein the first mode is a game mode that meets the frame rate control conditions, and the second mode is a game mode that does not meet the frame rate control conditions.
[0124] Optionally, in this embodiment, the first mode may refer to the game running in a mode that can meet the frame rate control conditions, that is, the rendering speed of the game and the frame rate setting are matched, and the game runs smoothly.
[0125] Optionally, in this embodiment, the second mode may refer to the game running in a mode that cannot meet the frame rate control conditions. This may be due to the increased complexity of the game scene or limited hardware resources, resulting in the actual frame rate of the game being lower than the set value.
[0126] Optionally, in this embodiment, when the game mode is switched, in order to maintain the smoothness of the game, the rendering interval of each frame will be automatically adjusted according to the frame rate requirements under the new game mode.
[0127] It should be noted that this embodiment describes a rendering cycle adjustment strategy in a specific scenario. When the virtual game switches from a mode that meets the frame rate control condition (first mode) to another mode that does not meet the frame rate control condition (second mode), this embodiment will adjust the rendering cycle accordingly to ensure that in the new game mode, the rendering cycle of the game can match the rendering time per frame corresponding to the frame rate setting.
[0128] The implementation of this strategy may rely on the game's internal optimization mechanism, including but not limited to dynamically adjusting picture quality, reducing unnecessary rendering elements, using hardware acceleration, etc. Through these optimization measures, the game can more flexibly adjust the rendering cycle in different modes to adapt to different frame rate requirements.
[0129] To further illustrate, optionally assume that a game is running in a normal scene (first mode), the frame rate is stable and meets the setting requirements. However, when the player enters a complex battle scene (second mode), due to the increase in elements that need to be rendered, the frame rate of the game begins to drop and no longer meets the original frame rate control conditions. At this time, this embodiment will automatically adjust the rendering cycle, such as by increasing the rendering time of each frame, to ensure that the game can still run at a relatively stable frame rate in the new complex scene.
[0130] By automatically adjusting the rendering cycle when switching game modes, the game can provide a more stable and consistent user experience in various scenarios. Even when hardware performance is limited or the complexity of the game scene increases, this strategy can help the game maintain a relatively reasonable frame rate, thereby reducing lag and frame drops and improving the player's gaming experience.
[0131] As an optional solution, for ease of understanding, the frame rate control method of the above virtual game is applied to the game scene of virtual reality, in which deep support for head-mounted display devices is the key to ensuring an immersive experience. Although some solutions perform well in supporting head-mounted display devices, there are still limitations in cross-platform adaptability, especially on the Windows platform, which is usually limited to specific rendering technologies, such as Direct3D. Considering that many VR games on the Windows platform use streaming technology to transmit audio-visual content to head-mounted display devices, this embodiment proposes a virtual head-mounted display (HMD) device. This device focuses on the game streaming function, effectively making up for the shortcomings of existing solutions in Windows VR game streaming, and bringing users a smoother and more comprehensive VR gaming experience. This innovation not only expands the application scenarios of VR technology, but also improves the consistency and quality of user experience.
[0132] Optionally, in the virtual game rendering process, in order to ensure a smooth and stable visual experience, the rendering process needs to be finely controlled. This embodiment detects the rendering time of the game in real time and dynamically adjusts the rendering cycle to adapt to changes in system resources, thereby achieving the purpose of optimizing frame rate stability and picture quality.
[0133] Specifically, in the game rendering process, the generation of each frame needs to be carefully calculated and controlled. In order to maintain the stability of the frame rate, this embodiment obtains the predicted rendering display time and frame interval time from the system runtime through a specific interface before starting to render each frame. This frame interval time actually reflects the average rendering frame rate and is an important basis for adjusting the rendering cycle.
[0134] In addition, this embodiment can record key time points, such as the wake-up time, start time, submission time, and GPU completion time of the frame by calling relevant interfaces. These data provide a benchmark for calculating the time consumption of each link for this embodiment, so that the rendering cycle of the next frame can be predicted and adjusted more accurately.
[0135] When the (virtual reality) system detects that the time taken for a certain link exceeds the preset rendering cycle, this embodiment will gradually increase the rendering cycle to ensure the rendering speed and reduce the screen freeze. However, under high load conditions, this dynamic adjustment may lead to unstable frame rate. To solve this problem, this embodiment further optimizes the frame rate control mechanism.
[0136] Specifically, this embodiment records the rendering time of each frame and calculates the average rendering time after a period of time. This average is then used as a new rendering cycle to ensure that the game can be rendered at a smoother frame rate. This method can not only effectively reduce the jitter and jump feeling of the picture, but also significantly improve the player's gaming experience.
[0137] In order to implement the above solution, Figure 4 As shown, this embodiment can call the following interface:
[0138] 1. xrWaitFrame: Before starting to render a frame, use this interface to obtain the predicted rendering display time and frame interval time from the system runtime.
[0139] 2. xrBeginFrame and xrEndFrame: used to record the start and end time of the frame for subsequent calculation of rendering time.
[0140] 3. Customized time calculation and rendering cycle adjustment interface: used to dynamically adjust the rendering cycle of the next frame according to the recorded time point and time data.
[0141] Through the combined use of these interfaces, this embodiment can achieve fine control over the game rendering process, thereby ensuring that players can enjoy a smooth and stable virtual reality gaming experience.
[0142] Specifically, in order to improve the stability of game rendering and improve the picture quality, this embodiment proposes time-consuming detection and a refined frame rate averaging algorithm. Specifically, the frame rate averaging algorithm includes the rendering time of each frame, which covers the pre-drawing time from wake-up to the start of drawing, the CPU execution drawing time, and the GPU execution drawing time. These data provide the frame rate averaging algorithm with accurate time information for each link in the rendering process, forming the basis for subsequent optimization of the frame rate control strategy.
[0143] After continuous rendering for more than 1 second, this embodiment starts to calculate the average frame time. By comprehensively considering the time before drawing, the CPU drawing time and the GPU drawing time, and combining it with the actual number of rendered frames in 1 second, a key performance indicator can be obtained - the average rendering time in the last second, such as (time before drawing + CPU drawing time + GPU drawing time) / number of frames in 1 second. This indicator deeply reflects the rendering efficiency of the game within a specific time window.
[0144] Among them, "number of frames in 1 second" represents the number of rendered frames actually completed by the game within 1 second. Although games usually set an ideal frame rate, such as 60fps or 72fps, the actual number of rendered frames may decrease when the system is under heavy load, for example, fluctuating between 30-50fps. This change in frame rate will directly affect the player's visual experience. Therefore, this embodiment uses a sophisticated frame rate control strategy to deal with this situation to ensure a smoother and more stable game screen.
[0145] Next, this embodiment uses the calculated average rendering time as a new rendering cycle. This method aims to render the game at the smoothest possible frame rate, reducing screen jitter and tailing effects caused by frame rate fluctuations. By using the average rendering cycle to control the frame rate, the difference in sleep time between each frame of the game will become more uniform, thereby improving the stability of the overall rendering.
[0146] In addition, the frame rate control algorithm of this embodiment also has the ability to adjust dynamically. As the game rendering load changes, such as when the player switches levels or game modes, the complexity of the rendering scene may change. In this case, the algorithm of this embodiment can automatically adjust the rendering cycle to adapt to the new load conditions. When the rendering load decreases, the rendering cycle will automatically return to a preset frame rate, such as 60fps or 72fps, to ensure that the game can provide the best visual experience in various scenarios.
[0147] By implementing the frame rate averaging algorithm, the visual effects of the game in the head-mounted display device have been significantly improved. The tailing and jitter phenomena are basically eliminated, providing players with a more stable and smooth virtual reality experience.
[0148] In addition, it should be noted that in the process of improving the virtual reality (VR) experience, ATW (Asynchronous Time Warp) and ASW (Asynchronous Space Warp) technologies do provide effective solutions to the low frame rate problem. However, these two technologies also have certain limitations. They are highly dependent on specific hardware chips and control algorithms, which to a certain extent limits their versatility. At the same time, ATW technology mainly solves the changes in rendering scenes caused by head movement, and has limited ability to compensate for movements within the rendering scene. Although ASW technology can enhance the accuracy of the picture through prediction, its motion detection calculation is large and requires the support of high-performance hardware.
[0149] In view of the above limitations, this embodiment ensures that these technologies can run efficiently on a variety of hardware platforms by designing compatibility and optimization strategies. In addition, this embodiment is deeply integrated with high-performance VR graphics processing hardware to provide necessary motion vectors and reduce the burden on the graphics engine, ensuring the efficient implementation of ASW technology.
[0150] Specifically, this embodiment firstly conducts a comprehensive detection and optimization of the game rendering process through a sophisticated time-consuming record and frame rate averaging algorithm. On this basis, this embodiment further introduces ATW technology to deal with possible frame rate instability and delay problems. Using ATW technology, when the VR headset cannot update the next frame in time, the system will automatically use the data of the previous frame to generate a new virtual image to ensure the smoothness of the animation effect. This not only effectively reduces motion distortion, but also significantly improves the comfort and realism of the VR experience.
[0151] At the same time, in order to further enhance the image quality, this embodiment also adopts ASW technology. By deeply analyzing the previously rendered images, ASW technology can accurately detect action information and predict the position of scene elements in the next frame based on it. This prediction mechanism makes the secondary projected images more accurate after being fully rendered, thereby greatly improving the dynamic visual effects of the VR scene.
[0152] Through the embodiments provided in this application, it is possible to effectively reduce abnormal situations such as visual tailing or screen jumps that may occur in VR games or applications during streaming, especially under high load conditions. The main purpose of this improvement is to improve the compatibility of VR streaming in different hardware performance environments, especially for those scenarios with relatively low hardware performance, so as to ensure that a wider range of users can enjoy a smooth and stable VR experience. It also means that when users experience VR content, they can get a smoother and non-jumping visual experience, whether on high-performance or low-performance hardware devices.
[0153] It is understandable that in the specific implementation of this application, related data such as user information is involved. When the above embodiments of this application are applied to specific products or technologies, user permission or consent is required, and the collection, use and processing of relevant data need to comply with relevant laws, regulations and standards of relevant countries and regions.
[0154] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0155] According to another aspect of the embodiment of the present application, a frame rate control device for a virtual game is provided for implementing the frame rate control method for the virtual game. Figure 5 As shown, the device comprises:
[0156] The first acquisition unit 502 is used to acquire an average rendering time of the virtual game when the running condition of the virtual game meets the frame rate control condition, wherein the average rendering time is used to represent the average time taken by the virtual game to render each frame in a historical time period;
[0157] The first adjustment unit 504 is used to adjust the rendering cycle of the virtual game to match the average rendering time when the average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the virtual game, wherein the rendering cycle is used to indicate the time interval between the completion of rendering of each frame of the virtual game and the start of rendering of the next frame.
[0158] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling the frame rate of a virtual game, which will not be described in detail in this example.
[0159] As an optional solution, the device further includes: a second acquisition unit, used to acquire the CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time of the virtual game before acquiring the average rendering time of the virtual game, wherein the CPU preprocessing time is used to indicate the time spent by the CPU in the historical time period before performing the preparation work before rendering, the CPU drawing submission time is used to indicate the time spent by the CPU in the historical time period to prepare and submit the graphics drawing command to the GPU, and the GPU rendering execution time is used to indicate the time spent by the GPU in the historical time period from receiving the graphics drawing command to completing the rendering work;
[0160] The first acquisition unit 502 includes: a first acquisition module, which is used to acquire the average rendering time according to the CPU preprocessing time, the CPU drawing submission time, and the GPU rendering execution time.
[0161] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling the frame rate of a virtual game, which will not be described in detail in this example.
[0162] As an optional solution, the first acquisition module includes:
[0163] The first acquisition submodule is used to obtain the CPU preprocessing time, the CPU drawing submission time, the GPU rendering execution time, and the cumulative time sum within a 1-second time period, where the historical time period includes a 1-second time period;
[0164] The second acquisition submodule is used to obtain the target number of frames rendered by the virtual game within a 1-second period;
[0165] The first determination module is used to determine the ratio between the total accumulated time and the target number of frames as the average rendering time.
[0166] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling the frame rate of a virtual game, which will not be described in detail in this example.
[0167] As an optional solution, the second acquisition unit includes:
[0168] The second determination module is used to determine the time from the time when the first function is called to the time before the second function is called to prepare to start rendering as the CPU preprocessing time, wherein the first function is used to make the application of the virtual game wait for an appropriate time to start rendering before rendering a new frame, and the second function is used to mark the start of the rendering process after confirming the rendering timing, so that the application can start preparing and submitting rendering data for the current frame;
[0169] A third determination module is used to determine the time from when the game calls the second function to start rendering the current frame to when the third function is called to submit the rendered texture to the target component as the CPU drawing submission time, wherein the third function is used to mark the end of the current frame rendering and submit the rendered image data, and the target component is used to receive and process the image data submitted by the third function;
[0170] The fourth determination module is used to determine the time from when the GPU starts receiving graphics drawing commands after the virtual game calls the third function to submit the rendered texture, to when the GPU completes all texture drawing work as the GPU rendering execution time, wherein the rendering work includes all texture drawing work.
[0171] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling the frame rate of a virtual game, which will not be described in detail in this example.
[0172] As an optional solution, the device also includes:
[0173] The optimization unit is used to optimize the picture content of the next frame of the current frame according to the picture content of the current frame after adjusting the rendering cycle of the virtual game to match the average rendering time, when the rendering cycle is greater than or equal to a preset threshold. The specific embodiment can refer to the example shown in the frame rate control method of the virtual game above, which will not be repeated in this example.
[0174] As an optional solution, the optimization unit includes:
[0175] A second acquisition module is used to acquire a first dynamic element and a first static element in the picture content of the current frame;
[0176] A first prediction module, used to predict the position feature of the first dynamic element in the picture content of the next frame, and optimize the second dynamic element in the picture content of the next frame by using the position feature;
[0177] The second prediction module is used to predict the visual features of the first static element in the picture content of the next frame, and optimize the second static element in the picture content of the next frame by using the visual features.
[0178] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling the frame rate of a virtual game, which will not be described in detail in this example.
[0179] As an optional solution, the device also includes:
[0180] The second adjustment unit is used to adjust the rendering cycle of the virtual game to match the average rendering time, and when the running status of the virtual game does not meet the frame rate control condition, adjust the rendering cycle to match the rendering time per frame corresponding to the frame rate setting of the virtual game.
[0181] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling the frame rate of a virtual game, which will not be described in detail in this example.
[0182] As an optional solution, the second adjustment unit includes:
[0183] The adjustment module is used to adjust the rendering cycle to match the per-frame rendering time corresponding to the frame rate setting of the virtual game when the mode of running the virtual game is switched from the first mode to the second mode, wherein the first mode is a game mode that meets the frame rate control conditions, and the second mode is a game mode that does not meet the frame rate control conditions.
[0184] For specific embodiments, reference may be made to the examples shown in the above-mentioned method for controlling the frame rate of a virtual game, which will not be described in detail in this example.
[0185] According to another aspect of the embodiment of the present application, an electronic device for implementing the frame rate control method of the virtual game is also provided. The electronic device can be but is not limited to: Figure 1 The user device 102 or the server 112 shown in FIG. 1 is used as an example to illustrate the electronic device as the user device 102. Figure 6 As shown, the electronic device includes a memory 602 and a processor 604. The memory 602 stores a computer program, and the processor 604 is configured to execute the steps in any of the above method embodiments through the computer program.
[0186] Optionally, in this embodiment, the electronic device may be located in at least one network device among a plurality of network devices of a computer network.
[0187] Optionally, in this embodiment, the processor may be configured to perform the following steps through a computer program:
[0188] S1, when the running condition of the virtual game meets the frame rate control condition, obtaining the average rendering time of the virtual game, wherein the average rendering time is used to represent the average time taken to render each frame of the virtual game in a historical time period;
[0189] S2, when the average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the virtual game, adjust the rendering cycle of the virtual game to match the average rendering time, wherein the rendering cycle is used to indicate the time interval between the completion of rendering of each frame of the virtual game and the start of rendering of the next frame.
[0190] Optionally, a person skilled in the art will understand that: Figure 6 The structure shown is for illustration only. Figure 6 The structure of the electronic device is not limited. Figure 6 More or fewer components (such as network interfaces, etc.) as shown in, or with Figure 6 Different configurations shown.
[0191] Among them, the memory 602 can be used to store software programs and modules, such as the program instructions / modules corresponding to the frame rate control method and device of the virtual game in the embodiment of the present application. The processor 604 executes various functional applications and data processing by running the software programs and modules stored in the memory 602, that is, realizing the above-mentioned frame rate control method of the virtual game. The memory 602 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 602 may further include a memory remotely arranged relative to the processor 604, and these remote memories may be connected to the electronic device via a network. Examples of the above-mentioned networks include but are not limited to the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof. Among them, the memory 602 can be specifically used, but not limited to, to store information such as average rendering time, frame rate settings, and rendering cycles. As an example, such as Figure 6 As shown, the memory 602 may include but is not limited to the first acquisition unit 502 and the first adjustment unit 504 in the frame rate control device for the virtual game. In addition, it may also include but is not limited to other module units in the frame rate control device for the virtual game, which will not be repeated in this example.
[0192] Optionally, the transmission device 606 is used to receive or send data via a network. Specific examples of the network may include a wired network and a wireless network. In one example, the transmission device 606 includes a network adapter (Network Interface Controller, NIC), which can be connected to other network devices and routers via a network cable so as to communicate with the Internet or a local area network. In one example, the transmission device 606 is a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0193] In addition, the electronic device further includes: a display 608 for displaying information such as the average rendering time, frame rate setting, and rendering cycle; and a connection bus 610 for connecting various module components in the electronic device.
[0194] In other embodiments, the user device or server may be a node in a distributed system, wherein the distributed system may be a blockchain system, and the blockchain system may be a distributed system formed by connecting the multiple nodes through network communication. Among them, a peer-to-peer network may be formed between the nodes, and any form of computing device, such as a server, user device, or other electronic device, may become a node in the blockchain system by joining the peer-to-peer network.
[0195] According to one aspect of the present application, a computer program product is provided, the computer program product comprising a computer program / instruction, the computer program / instruction comprising a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions provided by the embodiments of the present application are executed.
[0196] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0197] It should be noted that the computer system of the electronic device is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present application.
[0198] The computer system includes a central processing unit (CPU), which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) or the program loaded from the storage part to the random access memory (RAM). In the random access memory, various programs and data required for system operation are also stored. The central processing unit, the read-only memory and the random access memory are connected to each other through a bus. The input / output interface (I / O interface) is also connected to the bus.
[0199] The following components are connected to the input / output interface: an input part including a keyboard, a mouse, etc.; an output part including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker; a storage part including a hard disk, etc.; and a communication part including a network interface card such as a local area network card, a modem, etc. The communication part performs communication processing via a network such as the Internet. A drive is also connected to the input / output interface as needed. Removable media, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., are installed on the drive as needed so that the computer program read therefrom is installed into the storage part as needed.
[0200] In particular, according to an embodiment of the present application, the process described in each method flow chart can be implemented as a computer software program. For example, an embodiment of the present application includes a computer program product, which includes a computer program carried on a computer readable medium, and the computer program contains a program code for executing the method shown in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication part, and / or installed from a removable medium. When the computer program is executed by a central processing unit, various functions defined in the system of the present application are executed.
[0201] According to one aspect of the present application, a computer-readable storage medium is provided, and a processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0202] Optionally, in this embodiment, the computer-readable storage medium may be configured to store a computer program for performing the following steps:
[0203] S1, when the running condition of the virtual game meets the frame rate control condition, obtaining the average rendering time of the virtual game, wherein the average rendering time is used to represent the average time taken to render each frame of the virtual game in a historical time period;
[0204] S2, when the average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the virtual game, adjust the rendering cycle of the virtual game to match the average rendering time, wherein the rendering cycle is used to indicate the time interval between the completion of rendering of each frame of the virtual game and the start of rendering of the next frame.
[0205] Optionally, in the embodiments of the present application, the term "module" or "unit" refers to a computer program or a part of a computer program that has a predetermined function and works together with other related parts to achieve a predetermined goal, and can be implemented in whole or in part by using software, hardware (such as processing circuits or memories), or a combination thereof. Similarly, a processor (or multiple processors or memories) can be used to implement one or more modules or units. In addition, each module or unit can be part of an overall module or unit that includes the function of the module or unit.
[0206] Optionally, in this embodiment, a person of ordinary skill in the art may understand that all or part of the steps in the various methods of the above embodiments may be completed by instructing hardware related to the electronic device through a program, and the program may be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.
[0207] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.
[0208] If the integrated units in the above embodiments are implemented in the form of software functional units and sold or used as independent products, they can be stored in the above computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for enabling one or more computer devices (which can be personal computers, servers or network devices, etc.) to execute all or part of the steps of the methods of each embodiment of the present application.
[0209] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.
[0210] In the several embodiments provided in the present application, it should be understood that the disclosed user equipment can be implemented in other ways. Among them, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, for example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0211] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple 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.
[0212] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0213] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.
Claims
1. A method for controlling the frame rate of a virtual game, characterized in that: include: When the running status of the virtual game meets the frame rate control condition, the average rendering time of the virtual game is obtained, wherein the average rendering time is used to represent the average time taken by the virtual game to render each frame in a historical time period; When the average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the virtual game, extend the rendering cycle of the virtual game to match the average rendering time, wherein the rendering cycle is used to indicate the time interval between the completion of rendering of each frame of the virtual game and the start of rendering of the next frame; When the rendering period is greater than or equal to a preset threshold, the picture content of the next frame of the current frame is optimized according to the picture content of the current frame.
2. The method according to claim 1, characterized in that Before obtaining the average rendering time of the virtual game, the method further includes: obtaining the CPU preprocessing time, CPU drawing submission time, and GPU rendering execution time of the virtual game, wherein the CPU preprocessing time is used to indicate the time spent by the CPU in the historical time period on preparation work before rendering, the CPU drawing submission time is used to indicate the time spent by the CPU in the historical time period on preparing and submitting graphics drawing commands to the GPU, and the GPU rendering execution time is used to indicate the time spent by the GPU in the historical time period from receiving the graphics drawing commands to completing the rendering work; The obtaining of the average rendering time of the virtual game includes: obtaining the average rendering time according to the CPU preprocessing time, the CPU drawing submission time, and the GPU rendering execution time.
3. The method according to claim 2, characterized in that The obtaining the average rendering time according to the CPU preprocessing time, the CPU drawing submission time, and the GPU rendering execution time includes: Obtain the CPU preprocessing time, the CPU drawing submission time, and the GPU rendering execution time, and the cumulative sum of the time within a 1-second time period, wherein the historical time period includes the 1-second time period; Obtain the target number of frames rendered by the virtual game within the 1 second time period; The ratio between the total accumulated time and the target number of frames is determined as the average rendering time.
4. The method according to claim 2, characterized in that: The obtaining of the CPU preprocessing time, the CPU drawing submission time, and the GPU rendering execution time of the virtual game includes: The time from the time of calling the first function to the time of calling the second function to prepare to start rendering is determined as the CPU preprocessing time, wherein the first function is used to make the application of the virtual game wait for an appropriate time to start rendering before rendering a new frame, and the second function is used to mark the start of the rendering process after confirming the rendering timing, so that the application starts to prepare and submit rendering data for the current frame; The time from when the game calls the second function to start rendering the current frame to when the third function is called to submit the rendered texture to the target component is determined as the CPU drawing submission time, wherein the third function is used to mark the end of the rendering of the current frame and submit the rendered image data, and the target component is used to receive and process the image data submitted by the third function; After calling the third function from the virtual game to submit the rendered texture, the GPU starts to receive the graphics drawing command, and the time from when the GPU completes all texture drawing work is determined as the GPU rendering execution time, wherein the rendering work includes all texture drawing work.
5. The method according to claim 1, characterized in that The step of optimizing the picture content of the next frame of the current frame according to the picture content of the current frame includes: Acquire a first dynamic element and a first static element in the picture content of the current frame; Predicting a position feature of the first dynamic element in the picture content of the next frame, and optimizing a second dynamic element in the picture content of the next frame by using the position feature; Predicting visual features of the first static element in the picture content of the next frame, and optimizing the second static element in the picture content of the next frame by using the visual features.
6. The method according to any one of claims 1 to 5, characterized in that After extending the rendering cycle of the virtual game to match the average rendering time, the method further includes: When the running condition of the virtual game does not meet the frame rate control condition, the rendering cycle is extended to match the rendering time per frame corresponding to the frame rate setting of the virtual game.
7. The method according to claim 6, characterized in that When the running condition of the virtual game does not meet the frame rate control condition, extending the rendering cycle to match the per-frame rendering time corresponding to the frame rate setting of the virtual game includes: When the running mode of the virtual game is switched from a first mode to a second mode, the rendering cycle is extended to match the rendering time per frame corresponding to the frame rate setting of the virtual game, wherein the first mode is a game mode that meets the frame rate control condition, and the second mode is a game mode that does not meet the frame rate control condition.
8. A frame rate control device for a virtual game, characterized in that: include: A first acquisition unit is used to acquire an average rendering time of the virtual game when the running condition of the virtual game meets the frame rate control condition, wherein the average rendering time is used to represent the average time consumed by the virtual game to render each frame in a historical time period; A first adjustment unit is used to extend the rendering cycle of the virtual game to match the average rendering time when the average rendering time is greater than the per-frame rendering time corresponding to the frame rate setting of the virtual game, wherein the rendering cycle is used to indicate the time interval between the completion of rendering of each frame of the virtual game and the start of rendering of the next frame; The optimization unit is used to optimize the picture content of the next frame of the current frame according to the picture content of the current frame after extending the rendering cycle of the virtual game to match the average rendering time, when the rendering cycle is greater than or equal to a preset threshold.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein the program executes the method described in any one of claims 1 to 7 when executed by an electronic device.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by a processor, the steps of the method described in any one of claims 1 to 7 are implemented.
11. An electronic device comprising a memory and a processor, characterized in that: A computer program is stored in the memory, and the processor is configured to execute the method according to any one of claims 1 to 7 through the computer program.
