Really jerky performane

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
exal
Posts: 60
Joined: Tue Feb 24, 2004 9:05 am

Really jerky performane

Post by exal »

Hi guys

I am working on an Asteroids clone. But when moving my objects they are really jumpy as if the FPS jumps up and down or there is something wrong with the FPS counter.

Does anyone have the time to try out the code and see if they have the same problem and if why then?

The source and objects are only like 20k so I can mail it.

Thanks
exal
Posts: 60
Joined: Tue Feb 24, 2004 9:05 am

Post by exal »

You can find the code at

http://www.mick.nu/torrent/files/asteroids.zip

Thanks
Gorgon Zola
Posts: 118
Joined: Thu Sep 18, 2003 10:05 pm
Location: switzerland

Post by Gorgon Zola »

Hi exal,

nice code so far :)

I guess there's a problem with the clock.
the resolution of GetTickCount() might be too low try to use
the irrlicht internal timer object ( ITimer* timer=driver->getTimer(); )
this function uses the highperformance timer if availble...

Then, try to multiply your movement units with a frame-timefactor in your case this would be:

Code: Select all

float frameWeight=ourTickCounter/1000.0;  // units per seconds
// provided 'ourTickCounter' are milliseconds not too shure about that
...
// example for playerclass
//Call superclass move to actually move the object
MoveOSZ(myCurrentSpeed * frameWeight);
There's a nice tutorial in the FAQs Forum about FPS independent movement.

T see you don't like the event-receiver stuff, well, if i may give you a hint there:
try to pack the things in GameMain into a class and let that class extend the IEventReceiver this way you'll have it easier to handle events with irrlicht.

cheers
Gorgon
exal
Posts: 60
Joined: Tue Feb 24, 2004 9:05 am

Post by exal »

Thanks for the excellent advice. I will pack that into a class. I was thinking of placing it in a singleton first. But this seems like a better solution.

i will look into the Performance counter. I hope that will help a lot.

Thanks i am doing my best to keep the code clean :)
Post Reply