Game Development
Modified 2023-12-17
Libraries
Core
Logging
Concepts
Delta Time
The idea behind delta time is to stop thinking in changing x pixels per frame, and think in pixels per second. The variable delta time bases displacements on real elapsed time, and makes the physics non-deterministic.
double deltaTime = (SDL_GetTicks() - msPreviousFrame) / 1000.0f;
playerPosition.x += 20 * deltaTime;It's still possible to set the framerate constant for performance reasons, but there's nothing stopping you from preventing to re-calculate everything at 2000 FPS.
Entity Component System
- Entities
simple ID, representing objects in the game scene
- Components
pure data, organized by data itself rather than by entity, makes it easier for the processor to go through the data in memory
- Systems
logic, transforming components from one state to the next