FPS : is only 40!?!?!

Started by
34 comments, last by Matsy 19 years, 10 months ago
lol... hehehe

OK...

But do the render routines look ok? should i try to perfect anything there? I see some people getting up near 300+ FPS, is there something else I canstill do to increase mine more? I want to get asmuch as possible out of this.
Advertisement
What graphics card you have?
3D Side-Scroller game demo Project-X2 "playable"Lashkar: A 3D Game & Simulation Project demo @ lashkar.berlios.de
You shouldn''t have 1 VB per triangle strip / fan. You should have 1 VB for all objects of the same FVF and type (static / dynamic). Calling SetStreamSource() and setting all the render states for each draw call is very expensive. You''ll really notice it when you start drawing 10+ objects.
I can understand the wish to have code working efficently. There is merit to keeping your frame rates up but also keep in mind that the human eye cant see any difference with frame rates over 40-60fps. I remember reading that somewhere on gamasutra. This maybe more important when you finish and try to optimise rather than when you start though.
High frame rates are more important for smooth animation than they are for what you can see. Your monitor can''t actually display a higher frame rate than it''s refresh rate anyway. If your frame rates are much higher than you expected from your target hardware, you should probably consider boosting the graphical quality.

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

quote:Original post by kevmo
quote: is this do to timeGetTime?


It very well could be. timeGetTime is not a good timer to use to calculate frame rate, as it has such low precision. Try QueryPerformanceCounter() instead - you can check the MSDN or search these forums on how to use it.


TimeGetTime is useless to use if you compute framerate as 1/(now-lasttime) every frame. But the way he used it, counting until 1000 ms and then using FPS is accurate enough.
A quick question for everyone telling him to use QPC instead of timeGetTime...how much accuracy does a person need? Seems like 1 ms precision is plenty if you''re doing a reasonable amount of rendering per frame.
quote:
A quick question for everyone telling him to use QPC instead of timeGetTime...how much accuracy does a person need? Seems like 1 ms precision is plenty if you''re doing a reasonable amount of rendering per frame.


It''s not all about time resolution. timeGetTime() drifts, stutters, and updates irregularly. One query may have you stuck at 1ms, and the next at 3, even though only 1ms has passed.

It''s just not very accurate.

Also, timeGetTime() eats up many more clock cycles than QueryPerformanceCounter().

QPC is not hard to use in any way, shape or form, so there''s no reason why you SHOULDN''T use it (unless the processor doesn''t give an accurate performance reading).

---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.

quote:A quick question for everyone telling him to use QPC instead of timeGetTime...how much accuracy does a person need? Seems like 1 ms precision is plenty if you're doing a reasonable amount of rendering per frame.
Say you are running the game at 300 fps, that means a rendering time of 1/300=0.0033333... and so on. If you are using timeGetTime to get the delta time between frames, you will get 3ms most of the time and 4ms for about every third call. A delta time of 3ms gives you a value of 333.33 fps, while a value of 4 gives you 250 fps, and it will keep on changing between those two, not giving you the actual value. Also, if you're using it for game logic and such too, things might seem jerky (but hopefully not that much, since it's running at such a high framerate anyway).
The same is true for lower fps, but the impact isn't as big.
However, as previouly said, if you are calculating the fps by using timeGetTime to see when a second has gone past, there's no problem.
Hope I got the calculations right, I just wrote 'em down, haven't checked them.

Edit: Here's a simple function for using QPC with timeGetTime as a fallback (like if that would be needed...)
double getSecs(){	static bool first = true;	static bool useHigh = true;	static double res = 0;	static LARGE_INTEGER t;	if (first)	{		first = false;		useHigh = QueryPerformanceFrequency(&t);		if (useHigh)			res = 1.0 / (double)t.QuadPart;	}	if (!useHigh)		return (double)timeGetTime() * .001;	QueryPerformanceCounter(&t);	return (double)t.QuadPart * res;}  


[edited by - Jolle on June 7, 2004 10:26:09 AM]
inline double SmartGetTimeSec()
{
static LARGE_INTEGER t;
static double res = 0;

if (QueryPerformanceFrequency(&t))
{
res = 1.0 / (double)t.QuadPart;
QueryPerformanceCounter(&t);
return (double)t.QuadPart * res;
}
else return (double)(timeGetTime() * 0.001f); //? / .001?
};

Also is timeGetTime() in kiloseconds? Wouldn''t you
timeGetTime() * 100 cause it is in milliseconds?

This topic is closed to new replies.

Advertisement