libdonut
2.3.2
Application framework for cross-platform game development in C++20
|
Transient information about the current tick of an Application. More...
#include <donut/application/TickInfo.hpp>
Public Attributes | |
Time< float > | tickInterval |
The average time, in seconds, that should elapse between each tick. More... | |
std::size_t | processedTickCount |
Number of ticks that have been fully processed since the start of the application. More... | |
Time< float > | processedTickTime |
The accumulated time, in seconds, of all ticks that had been processed since the start of the application at the beginning of the current tick. More... | |
Transient information about the current tick of an Application.
Time<float> donut::application::TickInfo::tickInterval |
The average time, in seconds, that should elapse between each tick.
This is calculated as the reciprocal of the desired application tick rate, i.e. tickInterval = 1 / ApplicationOptions::tickRate, assuming the tick rate is positive. If not, the value will be 0.
The tick interval should be used as the time delta when updating physics, timers, etc. within a tick. This will ensure a fixed update interval, which generally results in more stable, predictable and consistent behavior compared to using a variable update interval, especially with regard to floating-point errors and numerical integration methods which may produce different results depending on the step size.
To achieve a higher perceived update rate for the user, some form of interpolation and/or extrapolation should be used in the variable-rate Application::display() callback in order to smooth out the result of the fixed-rate ticks when applicable.
std::size_t donut::application::TickInfo::processedTickCount |
Number of ticks that have been fully processed since the start of the application.
Time<float> donut::application::TickInfo::processedTickTime |
The accumulated time, in seconds, of all ticks that had been processed since the start of the application at the beginning of the current tick.