better handling of very slow computers
git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/trunk/supertuxkart@1827 178a84e3-b1eb-0310-8ba1-8eac791a3b58
This commit is contained in:
parent
376786da88
commit
8909c02cda
@ -75,7 +75,12 @@ void GameManager::run()
|
||||
{
|
||||
m_curr_time = SDL_GetTicks();
|
||||
dt =(float)(m_curr_time - m_prev_time);
|
||||
|
||||
|
||||
// don't allow the game to run slower than a certain amount.
|
||||
// when the computer can't keep it up, slow down the shown time instead
|
||||
static const float max_elapsed_time = 3.0f*1.0f/60.0f*1000.0f; /* time 3 internal substeps take */
|
||||
if(dt > max_elapsed_time) dt=max_elapsed_time;
|
||||
|
||||
//This avoid wasting CPU cycles
|
||||
//1000 miliseconds / 125 frames = 125 miliseconds per frame
|
||||
if( dt < 8.0f)
|
||||
|
@ -95,7 +95,7 @@ void Physics::update(float dt)
|
||||
|
||||
// Maximum of three substeps. This will work for framerate down to
|
||||
// 20 FPS (bullet default frequency is 60 HZ).
|
||||
m_dynamics_world->stepSimulation(dt, 20);
|
||||
m_dynamics_world->stepSimulation(dt, 3);
|
||||
|
||||
// Now handle the actual collision. Note: rockets can not be removed
|
||||
// inside of this loop, since the same rocket might hit more than one
|
||||
|
Loading…
x
Reference in New Issue
Block a user