So I was learning how to use SFML on my own for fun, but I've realized when things are moving at a medium speed, my screen gets a little choppy. Poking around the forums (which I should've done a long time ago...) I found countless links to http://gafferongames.com/game-physics/fix-your-timestep/ .
I just don't know how to implement this! My home-made loop is almost identical, except I don't have the last step of "combining" two different states into one in order to draw an "in-between" representative. (I also don't have a fancy state-updating function a la integrate-- but everything moves linearly in what I've made so that's okay.)
I currently just have a sf::RenderWindow that I draw everything on, and then display that window, and repeat. How would I do the following in SFML?
State state = currentState * alpha + previousState * ( 1.0 - alpha );
I'm sorry if this is a common question, as it probably is. I tried to search, but I don't think I know the proper terminology, so searching was fruitless.
Thank you!
The simplest way is
Entity.move(horizontal speed * deltatime,vertical speed * deltatime);
Movement speed equals something like 200 pixels per second so that when multiplied by a number usually around 15 to 30-60 milliseconds you'll have a directly proportional movement. You must use a sf::Clock and call clock.restart().asSeconds() each frame for your deltatime.
The simplest way is
Entity.move(horizontal speed * deltatime,vertical speed * deltatime);
Movement speed equals something like 200 pixels per second so that when multiplied by a number usually around 15 to 30-60 milliseconds you'll have a directly proportional movement. You must use a sf::Clock and call clock.restart().asSeconds() each frame for your deltatime.
Thanks, but that's unrelated to my issue.
If I know what the screen looks like at time T1 = 1.00 seconds, and I know what the screen looks like at time T2 = 1.05 seconds, I want to be able to draw the game at a time T3 = 1.01 seconds as if it were a blend of 80% T1 and 20% T2. I want to know how to do do that.