advanced game loop with constant speed and variable FPS