Right now I have a stack of boxes that I can knock over by tossing more boxes at it.
On my laptop, I have a 1.6GHz dual-core processor, and I get 180 FPS game time, with the simulation updating at 60FPS. I also have a netbook that is also a 1.6GHz dual core processor, with the same amount of RAM as my notebook. On my netbook, the simulation will run at around 180FPS as well so long as the stack of boxes is idle. However, when I toss a box at the stack, the simulation on my netbook will slow to around 10 FPS during the collision. Whereas my laptop will only slow down a little.
Would this be caused simply by the smaller CPU cache in my netbook? I don't know what else might be slowing it down.
This is the way I'm doing the update:
- Code: Select all
void CPhysicsInterface::setCalculationsPerSecond(float calcPerSec){
updateFPS=calcPerSec;
sleepTime=1000.0f/updateFPS;
updateTime=sleepTime/1000.0f;
}
void CPhysicsInterface::Update(float deltaTime){ //delta time is in seconds
accumlativeTimeSlice+=deltaTime*1000.0f;
while(accumlativeTimeSlice>sleepTime){
NewtonUpdate(pWorld,updateTime);
accumlativeTimeSlice-=sleepTime;
}
}
My application calls setCalculationsPerSecond with value of 60 when the application first runs. It calls Update every frame with the elapsed time since the last frame. Is there something I'm doing wrong here that might be causing the bottleneck on my netbook? Is there a better way I can do it?
Also, when I call setCalculationsPerSecond() with a smaller value, the simulation will run in slow motion. With the way the code is written, shouldn't NewtonUpdate() be passed a larger value, which will compensate?

