My app runs to fast!

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
Mike

My app runs to fast!

Post by Mike »

Hey there ya all

As the header implies my app runs too fast. It just does everything as fast as it can, which is to fast! I need to control it so it has a fixed speed, not speed related to the numbers of calculations it has to currently do...

What can you do to solve this? 30fps is kind of minimum right?
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

You could turn on VSync (boolean value in the createDevice() function). This will limit the FPS to your monitor's hz (60FPS that is).
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Mike

Post by Mike »

But doeasnt that vsync also do other things? And what if my comp is not capable of running at 60fps, then speed will be nonfixed, right?

All calc in my app is done at a tick-basis. Thats why i wanna control it. Cant I do that? I realize i might have built my system stangely...
bal
Posts: 829
Joined: Fri Jun 18, 2004 5:19 pm
Location: Geluwe, Belgium

Post by bal »

Yeah, vsync just caps at 60FPS, you can still go below. This feature has been asked several times up to now but noone implemented it yet.
General Tools List
General FAQ
System: AMD Barton 2600+, 512MB, 9600XT 256MB, WinXP + FC3
Acki
Posts: 3496
Joined: Tue Jun 29, 2004 12:04 am
Location: Nobody's Place (Venlo NL)
Contact:

Post by Acki »

I would do a pause loop after drawing the scene...
I prefer GeTickCount(), because it has a resolution of 1/1000 seconds...
while(!asleep) sheep++;
IrrExtensions:Image
http://abusoft.g0dsoft.com
try Stendhal a MORPG written in Java
afecelis
Admin
Posts: 3075
Joined: Sun Feb 22, 2004 10:44 pm
Location: Colombia
Contact:

Post by afecelis »

Code: Select all

smgr->addCameraSceneNodeFPS(0,100.0f,300.0f);
the last 2 values are for camera speed and camera rotation speed. Try weaking them and you'll speed will slow down.
Mike

Post by Mike »

Couldn't you use the internal clock to limit it to a certain fps? That is after a entire frame has been done, it waits until 1/30s has been accumulated, then starts the next frame. But how to do this?
Guest

Post by Guest »

does directX support any kind of framerate limit? I'd really hat to limit my game to just openGL because of the speed.
Kaeles
Posts: 37
Joined: Thu Jun 03, 2004 12:43 am
Location: oklahoma
Contact:

Post by Kaeles »

instead of implementing all your movement and such according to the framerate you might want to try doing it independent of framerate....

such as...
moveforward()
{
timefactor = currenttime - starttime;
setposition = movevector* timefactor;
}
something like that, so that no matter what fps you get, the movement is still going to be the same.
William Finlayson
Posts: 61
Joined: Mon Oct 25, 2004 12:11 am

Post by William Finlayson »

I always implement my time-based actions with an update(int ticks) method.

lastTime = timer.getTime()
main loop
currentTime = timer.getTime()
ticks = currentTime - lastTime
thing1.update(ticks)
thing2.update(ticks)
lastTime = currentTime
draw stuff etc
end loop

You mentioned that your calculation was done on a tick basis, so I hope this helps.
Post Reply