Delta timing

Last updated

Delta time or delta timing is a concept used amongst programmers in relation to hardware and network responsiveness. [1] In graphics programming, the term is usually used for variably updating scenery based on the elapsed time since the game last updated, [2] (i.e. the previous "frame") which will vary depending on the speed of the computer, and how much work needs to be done in the program at any given time. This also allows graphics to be calculated separately if graphics are being multi-threaded.

Contents

In network programming, due to the unpredictable nature of internet connections, delta timing is used in a similar way to variably update the movement information received via the computer network, regardless of how long it took to receive the next data packet of movement information. [3]

It is often done by calling a timer every frame per second that holds the time between now and last call. Thereafter the resulting number (delta time) is used to calculate how far, for instance, a video game character would have travelled during that time. This results in the character taking the same amount of real world time to move across the screen regardless of the rate of update, and whether the delay is caused by lack of processing power or a slow internet connection.

In graphics programming, this avoids the gameplay slowing down or speeding up depending on the complexity of what is happening at any given time, which would make for an inconsistent, jarring experience (e.g. time slowing down the more characters walk onto the screen, or running too fast because only one character is on screen). In network programming, this keeps the game world of each computer in sync with the others, by making sure each client eventually sees the same activity at the same time, even if more time has passed since the last update for some clients than others.

Big enough delays will eventually negatively affect the gameplay experience, but using Delta Time keeps the gameplay consistent so long as the computer and internet connection meet the minimum hardware requirements of the game.

Delta-timing measurement in programming

Delta time can be used to measure how long a given program took to execute in real-time. The python snippet below shows how an example function's execution time can be calculated using the delta of times before and after execution.

Python

# time()# returns the seconds since the epoch as a floating-point numberfromtimeimporttime# define is_prime(x)defis_prime(x):foriinrange(2,x):if(x%i)==0:print(x,"is not prime")returnprint(x,"is prime")# measure delta timet0=time()# start of measurementis_prime(13)# call functiont1=time()# end of measurementdeltaTime=t1-t0print("is_prime(13) takes",deltaTime,"seconds to execute!")

Delta-time and frame rate

Delta-time and frame rate are not always related. Video games fall into one of two categories regarding frame rate: frame rate dependent or frame rate independent. Frame rate Dependent games have a frame rate that varies based on the computer running the software. For example, if a frame rate dependent game runs at 300 frames per second (fps) on a computer with a refresh rate of 120 hertz (Hz), then it would run at 150 fps on a computer with a refresh rate of 60 Hz. A standard delta-time expression can create pause screens and intentional slow-motion effects in frame rate-dependent games. Standard delta-time formulas are seldom used for standard game-play because the delta-time between frames varies greatly depending on the refresh rate of the computer on which it is running.

If a game is frame rate independent, the frame rate is preset and runs identically across all computers regardless of their specifications. Frame rate independence limits the maximum graphics quality to make the game available to more consumers. Frame rate independence is particularly popular in mobile games and games optimized for lower-end computers such as Chromebooks. In frame rate independent games, the delta-time between frames is consistent across the entire game. This standardization means that one delta-time expression can create a consistent frame rate for all users on all types of computers. [4]

When to use delta-time

Delta-timing can excel anytime a game’s frame rate needs to be independent of its hardware. One example of this could be games that need to run on mobile devices or low-end computers. In some cases, video game developers use delta-timing to standardize the movement speed of an object on the screen. For example, if a character moves across the screen at a constant rate, delta-timing can ensure that this movement speed is consistent and does not fluctuate. Using delta-timing for movement is particularly useful for users who possess inconsistent internet or low-end computer hardware. This method can also regulate the movement of on-screen objects.

One disadvantage of using delta-timing for movement is that it can be complicated for games that incorporate a wide variety of movements and movement speeds. For example, a game could have a specified walking speed and sprinting speed for all characters; however, characters may also drive cars, boats, planes, and other vehicles. If the developer wants each of these movement speeds to be different (to make the game as realistic as possible), they would need a separate delta-time expression for each movement speed (that is only assuming these movements occur at a constant rate). If the movements do not occur at a constant rate, delta-timing expressions are rendered ineffective. [5]

See also

Related Research Articles

<span class="mw-page-title-main">Computer animation</span> Art of creating moving images using computers

Computer animation is the process used for digitally generating moving images. The more general term computer-generated imagery (CGI) encompasses both still images and moving images, while computer animation only refers to moving images. Modern computer animation usually uses 3D computer graphics.

<span class="mw-page-title-main">Amiga Original Chip Set</span> Chipset used in Amiga personal computer

The Original Chip Set (OCS) is a chipset used in the earliest Commodore Amiga computers and defined the Amiga's graphics and sound capabilities. It was succeeded by the slightly improved Enhanced Chip Set (ECS) and the greatly improved Advanced Graphics Architecture (AGA).

Real-time computing (RTC) is the computer science term for hardware and software systems subject to a "real-time constraint", for example from event to system response. Real-time programs must guarantee response within specified time constraints, often referred to as "deadlines".

<span class="mw-page-title-main">Video Graphics Array</span> Computer display standard and resolution

Video Graphics Array (VGA) is a video display controller and accompanying de facto graphics standard, first introduced with the IBM PS/2 line of computers in 1987, which became ubiquitous in the IBM PC compatible industry within three years. The term can now refer to the computer display standard, the 15-pin D-subminiature VGA connector, or the 640 × 480 resolution characteristic of the VGA hardware.

<span class="mw-page-title-main">Framebuffer</span> Portion of random-access memory containing a bitmap that drives a video display

A framebuffer is a portion of random-access memory (RAM) containing a bitmap that drives a video display. It is a memory buffer containing data representing all the pixels in a complete video frame. Modern video cards contain framebuffer circuitry in their cores. This circuitry converts an in-memory bitmap into a video signal that can be displayed on a computer monitor.

The refresh rate, also known as vertical refresh rate or vertical scan rate in reference to terminology originating with the cathode-ray tubes (CRTs), is the number of times per second that a raster-based display device displays a new image. This is independent from frame rate, which describes how many images are stored or generated every second by the device driving the display. On CRT displays, higher refresh rates produce less flickering, thereby reducing eye strain. In other technologies such as liquid-crystal displays, the refresh rate affects only how often the image can potentially be updated.

<span class="mw-page-title-main">Tektronix 4010</span> Text and graphics computer terminals

The Tektronix 4010 series was a family of text-and-graphics computer terminals based on storage-tube technology created by Tektronix. Several members of the family were introduced during the 1970s, the best known being the 11-inch 4010 and 19-inch 4014, along with the less popular 25-inch 4016. They were widely used in the computer-aided design market in the 1970s and early 1980s.

<span class="mw-page-title-main">Scrolling</span> Sliding motion vertically or horizontally over display devices

In computer displays, filmmaking, television production, and other kinetic displays, scrolling is sliding text, images or video across a monitor or display, vertically or horizontally. "Scrolling," as such, does not change the layout of the text or pictures but moves the user's view across what is apparently a larger image that is not wholly seen. A common television and movie special effect is to scroll credits, while leaving the background stationary. Scrolling may take place completely without user intervention or, on an interactive device, be triggered by touchscreen or a keypress and continue without further intervention until a further user action, or be entirely controlled by input devices.

<span class="mw-page-title-main">Sprite (computer graphics)</span> 2D bitmap displayed on top of a larger scene

In computer graphics, a sprite is a two-dimensional bitmap that is integrated into a larger scene, most often in a 2D video game. Originally, the term sprite referred to fixed-sized objects composited together, by hardware, with a background. Use of the term has since become more general.

<span class="mw-page-title-main">Attribute clash</span>

Attribute clash is a display artifact caused by limits in the graphics circuitry of some colour 8-bit home computers, most notably the ZX Spectrum, where it meant that only two colours could be used in any 8×8 tile of pixels. The effect was also noticeable on MSX software and in some Commodore 64 titles. Workarounds to prevent this limit from becoming apparent have since been considered an element of Spectrum programmer culture.

<span class="mw-page-title-main">Multi-monitor</span> Use of multiple physical display devices

Multi-monitor, also called multi-display and multi-head, is the use of multiple physical display devices, such as monitors, televisions, and projectors, in order to increase the area available for computer programs running on a single computer system. Research studies show that, depending on the type of work, multi-head may increase the productivity by 50–70%.

<span class="mw-page-title-main">Real-time computer graphics</span> Sub-field of computer graphics

Real-time computer graphics or real-time rendering is the sub-field of computer graphics focused on producing and analyzing images in real time. The term can refer to anything from rendering an application's graphical user interface (GUI) to real-time image analysis, but is most often used in reference to interactive 3D computer graphics, typically using a graphics processing unit (GPU). One example of this concept is a video game that rapidly renders changing 3D environments to produce an illusion of motion.

<span class="mw-page-title-main">Active shutter 3D system</span> Method of displaying stereoscopic 3D images

An active shutter 3D system is a technique of displaying stereoscopic 3D images. It works by only presenting the image intended for the left eye while blocking the right eye's view, then presenting the right-eye image while blocking the left eye, and repeating this so rapidly that the interruptions do not interfere with the perceived fusion of the two images into a single 3D image.

<span class="mw-page-title-main">Software rendering</span> Generating images by computer software

Software rendering is the process of generating an image from a model by means of computer software. In the context of computer graphics rendering, software rendering refers to a rendering process that is not dependent upon graphics hardware ASICs, such as a graphics card. The rendering takes place entirely in the CPU. Rendering everything with the (general-purpose) CPU has the main advantage that it is not restricted to the (limited) capabilities of graphics hardware, but the disadvantage is that more transistors are needed to obtain the same speed.

<span class="mw-page-title-main">Screen tearing</span> Visual artifact in video display

Screen tearing is a visual artifact in video display where a display device shows information from multiple frames in a single screen draw.

<i>Final Fantasy VII</i> (NES video game) Unofficial Chinese Famicom game

Final Fantasy VII is an unlicensed "Shanzhai" demake of SquareSoft's role-playing video game Final Fantasy VII, originally released for PlayStation in 1997. The two-dimensional "port" was developed and published by Chinese company Shenzhen Nanjing Technology for Subor, a Famiclone. The cartridge itself is unique, as it is structurally different from licensed Famicom cartridges in terms of hardware and programming.

<span class="mw-page-title-main">Screenshot</span> Digital image output of computer display

A screenshot is a digital image that shows the contents of a computer display. A screenshot is created by the operating system or software running on the device powering the display.

A variety of computer graphic techniques have been used to display video game content throughout the history of video games. The predominance of individual techniques have evolved over time, primarily due to hardware advances and restrictions such as the processing power of central or graphics processing units.

Adaptive tile refresh is a computer graphics technique for side-scrolling video games. It was most famously used by id Software's John Carmack in games such as Commander Keen to compensate for the poor graphics performance of PCs in the early 1990s. Its principal innovation is a novel use of several EGA hardware features to perform the scrolling in hardware. The technique is named for its other aspect, the tracking of moved graphical elements in order to minimize the amount of redrawing required in every frame. Together, the combination saves the processing time that would be otherwise required for redrawing the entire screen. Carmack designed the software engine based on a scrolling display for large images from the 1970s.

<span class="mw-page-title-main">FreeSync</span> Brand name for an adaptive synchronization technology

FreeSync is an adaptive synchronization technology for LCD and OLED displays that support a variable refresh rate aimed at avoiding tearing and reducing stuttering caused by misalignment between the screen's refresh rate and the content's frame rate.

References

  1. "Game Making Software - Construct 3 ★★★★★".
  2. "Time-based Animation with HTML 5 Canvas and JavaScript | Viget".
  3. Cook, Shane (2012-12-28). CUDA Programming: A Developer's Guide to Parallel Computing with GPUs. Newnes. ISBN   978-0-12-415988-4.
  4. Ashley (2017-09-26). "Delta-Time and Framerate Independence". Construct.net. Unknown. Retrieved 2022-02-05.
  5. Drew Coleman (2019-07-24). "Understanding Delta Time". Medium.com. Unknown. Retrieved 2022-02-05.