PDA

View Full Version : Frame based or timed based for smooth scrolling?



Damot
25-09-2009, 03:35 PM
I want to rewrite a tile scrolling game of mine, probably using Asphyre rather than DelphiX that I'm using at the moment.

My problem is I've always written framebased movements, so regardless of the framerate on a particular machine my level and game scrolls at a particular speed.

However everytime another Window process kicks in or does something in the background it slows the frame rate down and you get shuddering/jumping during the scrolling.

How do you achieve super smooth scrolling on Windows machines?

User137
25-09-2009, 04:11 PM
I'm using frame based with TTimer, with interval somewhere between 17-50. As long as render time stays under the tick time there shouldn't be lag with any timer unless the timer itself is bad built. If some insane cpu intensive process takes over for 2 seconds you need to execute all 2000 milliseconds worth of frames (or pause game when it goes inactive). QueryPerformanceCounter or GetTickCount help with those calculations.

cragwolf
28-09-2009, 06:41 AM
Fixed time step + interpolation is best. See this tutorial (http://gafferongames.com/game-physics/fix-your-timestep/) for a description.