Hi Gamdev-Community,
this is my first post on this board, so i'm gonna introduce myself shortly:
My name is Daniel and I'm a Computerscience-Student from Germany.
I stumbled upon a problem I couldn't find a solution for.
I'm using the SDL2-Library and I try to accomplish a game loop that updates 25 times a second and renders as fast as the machine allows it to.
I want the movements for my game objects as smooth as possible but I don't know how.
I made a graphic to show my problem.
[attachment=26011:smooth_render.jpg]
The upper graph shows the type of rendering I'm trying to achieve.
The lower graph shows the actual result I get.
The idea is, when I set for example the speed of a game object to 5, it shouldn't jump from 0 to 5, but from {(0,1), (1, 2), ..., (4, 5)}.
25 times a second the object gets updated so every 25th of a second the object moves from its current position to (current position) + 5.
But between every update it gets rendered as ofthen as the computer allows it to. And in this (rendering)time, it should move smoothly to the new position.
There must be an interpolation or something to achieve this. The problem is that SDL only allows natural numbers (integer) for its x and y values on the screen.
(No OpenGL suggestions please!)
I hope I made my point clear.
Greetings,
Daniel