Monday, 4 November 2019

Game Loop (Tencent Gaming Buddy)

    The game loop is the overall flow control for the entire game program. It’s a loop because the game keeps doing a series of actions over and over again until the user quits. Each iteration of the game loop is known as a frame. Most real-time games update several times per second: 30 and 60 are the two most common intervals. If a game runs at 60 FPS (frames per second), this means that the game loop completes 60 iterations every second.
There can be many variations of the game loop, depending on a number of factors, most notably the target hardware. Let’s first discuss the traditional game loop before exploring a more advanced formulation that’s designed for more modern hardware.You can check wins computer launcher available for your device. Custom desktop your phone style launcher windows for android with the unique look wins theme and feel of the fastest windows quick search for Emulator.

Traditional Game Loop

    A traditional game loop is broken up into three distinct phases: processing inputs, updating the game world, and generating outputs. At a high level, a basic game loop might look like this Each of these three phases has more depth than might be apparent at first glance. For instance, processing inputs clearly involves detecting any inputs from devices such as a keyboard, mouse, or controller. But those aren’t the only inputs to be considered; any external input must be processed during this phase of the game loop.

Multithreaded Game Loops

    Although many mobile and independent titles still use a variant of the traditional game loop, most AAA console and PC titles do not. That’s because newer hardware features CPUs that have multiple cores. This means the CPU is physically capable of running multiple lines of execution, or threads, at the same time.All of the major consoles, most new PCs, and even some mobile devices now feature multicore CPUs. In order to achieve maximum performance on such systems, the game loop should be designed to harness all available cores. Several different methods take advantage of multiple cores, but most are well beyond the scope of this book. However, multithreaded programming is something that has become prevalent in video games, so it bears mentioning at least one basic multithreaded game loop technique.


    But there is a catch to this: What should the main thread do while the rendering thread is drawing We don’t want it to simply wait for the drawing to finish, because that would be no faster than performing all the actions on one thread. The way this problem is solved is by having the rendering thread always lag one frame behind the main thread. So every frame, the main thread is updating the world while the rendering thread draws the results of the last main thread update.


Post a Comment