Increase Frame per Second

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
KAHIMA
Posts: 19
Joined: Sun Mar 01, 2009 7:44 am

Increase Frame per Second

Post by KAHIMA »

What's usually that make the frame per second decrease ?
Before this, i try to run my program, and the fps > 300 but know i run the program the fps just = 4, what should I check first to solve this problem??

Code: Select all

int fps = driver->getFPS();
			if (lastFPS != fps)
			{	core::stringw str = L"";
			str += "Tinggi Jalan : ";
			if(cam.Z<47700)
				str += terrain->getHeight(camera->getAbsolutePosition().X, camera->getAbsolutePosition().Z);
			if(cam.Z>=47700)
				str += terrain1->getHeight(camera->getAbsolutePosition().X, camera->getAbsolutePosition().Z);
			str += "   ";
			//Cetak Posisi
			str += "Titik Awal : ";
			str += cam.Z;
			str += "  ";
			str += "Kecepatan : ";
			str += koor1;
			str += "  ";
			str += "Tinggi : ";
			str += target.Z;
			str += "Jarak : ";
			str += target.X;
			str += "  FPS :";
			str +=  fps;
			//str += "W :";
			//str +=  beban1;
			
			device->setWindowCaption(str.c_str());
			lastFPS = fps;}
	}		
Sylence
Posts: 725
Joined: Sat Mar 03, 2007 9:01 pm
Location: Germany
Contact:

Post by Sylence »

I don't understand a word.

What is your problem?
The code looks fine.
Software documentation is like sex. If it's good you want more. If it's bad it's better than nothing.
shadowslair
Posts: 758
Joined: Mon Mar 31, 2008 3:32 pm
Location: Bulgaria

Re: Increase Frame per Second

Post by shadowslair »

KAHIMA wrote:What's usually that make the frame per second decrease ?
Umm... usually the calculations your PC does takes some time and the more calculations it does, the more time it takes, so the FPS are the number of times your PC runs through the whole program code for 1 second (1000 milliseconds).
Before this, i try to run my program, and the fps > 300 but know i run the program the fps just = 4, what should I check first to solve this problem??
Well, you should optimize your program code or not use many of the features you may have implemented. You should check if you`re rendering a big number of polys, using too many nodes, effects or whatever. Try keeping the fps above 30. 15 is a bare minimum. Believe it or not, it highly depends on your program. :D

PS: Ah, and the code you posted only shows the frames per second- it doesn`t affect them in any way.
"Although we walk on the ground and step in the mud... our dreams and endeavors reach the immense skies..."
JP
Posts: 4526
Joined: Tue Sep 13, 2005 2:56 pm
Location: UK
Contact:

Post by JP »

Setting the window caption can be rather intensive, I'd avoid doing that and printing the stuff out in some gui text or something. Plus, depending on the size of your terrain, getting the height of a point in it could be expensive, although probably not too much as it's probably doing that already with collision detection and the like...
Image Image Image
Post Reply