misterface
11-03-2006 17:54:45
My game runs perfectly on my pc, but when I export it to a slower pc, everything goes slower (fps drops to 20). So my charachers move slower!
How do you make a game (designed with ogrenew!) fps-independent?
I think the problem is that framelistener is cpu & rendering device (videocard) related. I don't want it to be!
anyone?
HexiDave
11-03-2006 18:03:48
I'm guessing it's not entirely Newton related - how much slower a PC are we talking here? Is the card out-dated and the CPU a lower clock speed? Lower RAM?
An old video card could easily disrupt performance due to not having the latest technologies for rendering objects in bigger batches (big slowdown) as well as not having the memory for it. Slower CPU means it takes longer to process everything you want rendered and less RAM means less information can be stored to computer at any given time.
If you're talking about how your character isn't moving as great a distance because of frame-rate slowdown, check your input system. If your character is moving by pressing a key (would make sense) then OGREs basic input system has problems with framerates. Look into OIS (search the main forum) and that should help a lot.
Kentamanos
11-03-2006 20:33:21
walaber
11-03-2006 20:58:29
please give a detailed explanation of the problem.
misterface
12-03-2006 00:03:29
please give a detailed explanation of the problem.
well... the code of the framelistener of my program is based on example5 of the ogrenew demos.
movement of the car is achieved by pressing the keybord:
f.e.
if (mInputDevice->isKeyDown(Ogre::KC_W)) //qwerty... w=z
torque = ...;
On my pc the fps is +-170, so everything goes smoothly.
On another pc with slower processor and inferior video card (but still a good pc!) the fps drop to +-15fps, so everything moves in steps (instead of smoothly) and not at the same velocity!
The 'moving in steps' on a slower pc is ok with me, if the pc has less performance that is logic... but the speed of the objects have to stay the same (a car of 50km/u at full speed has to be 50km/u on every pc, with 15fps or 1500fps)!
hope I explained the problem clearly. f something needs to be explained further, just ask
HexiDave
12-03-2006 00:10:24
If I'm reading this right from the snippet, you're changing velocity/torque in the frame-listener based on input-per-frame? If so, as I said above, Ogre's basic input system tends to be heavily based on frame-rates.
So if it gets called 1500 FPS, you get 100x the "power" for velocity/torque at 15 FPS. I could be wrong here, but that's my understanding of Ogre's input system. Sinbad always talks about removing it because it's just for BASIC testing and not part of the core.
misterface
13-03-2006 23:22:23
HexiDave, you are right, its normal that fps depend of the type of video card.
but i want my application to be fps independend, e.g. if i go forward for 5sec,
i want to move the same distance on fast and on slow pc, the only difference can be the slow pc shocks, but the real speed has to be the same,
we have the problem explained well now, a solution plz ??
walaber
14-03-2006 00:37:45
please post your frameStarted() function, and any other functions that might help us understand where the problem could be.
HexiDave
14-03-2006 00:43:14
Well, you could cheat and do something like this:
if (mInput->iskeydown(KC_W){
run=true;
}
if (mInput->iskeyup(KC_W){
run=false;
{
ForceTorqueCallback(Body *me){
if(run)
me->addForce(force);
}
Now it'll add constant force until the button is released - it still might be off by a few frames, but it's a lot better than the stop-go-stop-go system. Look into OIS on the main forum (just do a search for OIS) and you'll find a much more powerful input system. The ForceTorqueCallback function is your custom callback function instead of using the setDefaultForceCallback function or whatever it is.