Jump to content
  • Advertisement
Sign in to follow this  
The C modest god

FPS Hazard

This topic is 4398 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

My game's FPS average counter showed a steady 75 (or 100 depends on the screen) FPS. However, from time to time I noticed some hazard in the smooth animation. So I made a graph of the exact FPS and noticed that my suspicion was true. Why do you think this FPS glitch happen? most of the time the FPS is steady and high, but the glitch can happen only once or twice and then be steady or even several times in a few seconds. The second wierd thing is that I use Direct3D and in the Present I set it to not return from the present until the image was actually done. So the FPS shouldnt go above the screen refresh rate more then one frame at a time. (I hope you can notice on the bottom left of the image the drop and then rise of the FPS) Have a look in the screen shot and tell me what you think. Thanks in advance, I appreaciate your help.

Share this post


Link to post
Share on other sites
Advertisement
whats happening or what are you animating in your game at the time the Frames drop? Maybe you could show some code thats being executed at that point.

Share this post


Link to post
Share on other sites
Quote:
Original post by speedie
whats happening or what are you animating in your game at the time the Frames drop? Maybe you could show some code thats being executed at that point.

What you just see on the screenshots.
These are just sprite animations.
However, I can make the character walk back and forth and it wont have any FPS drop, but then suddenly it will happen. So an image can be drawen once and it wont have any FPS drop, but later the same image drawen will cause an FPS drop.
Maybe it is something related to the OS work in the background?
In other words I dont understand what you want me to show you? the code of what?
The code being executed at that point is the whole loop cycle, which includes all the input, logic, drawing the peremitive and then doing present. So its too much code to post it all here.

Share this post


Link to post
Share on other sites
Here is the device creation code:


void
Direct3DHardware::CreateDevice (WORD Width, WORD Height, LPDIRECT3DDEVICE9 & pDevice, D3DPRESENT_PARAMETERS & Parameters)
{
D3DPRESENT_PARAMETERS d3dpp;

ZeroMemory( &d3dpp, sizeof(d3dpp) );
d3dpp.BackBufferWidth = Width;
d3dpp.BackBufferHeight = Height;
d3dpp.BackBufferCount = 1;
d3dpp.BackBufferFormat = D3DFMT_X8R8G8B8;
d3dpp.MultiSampleType = D3DMULTISAMPLE_NONE;
d3dpp.MultiSampleQuality = D3DMULTISAMPLE_NONE;
d3dpp.SwapEffect = D3DSWAPEFFECT_DISCARD;
d3dpp.hDeviceWindow = this->hWnd;
d3dpp.Windowed = FALSE;
d3dpp.EnableAutoDepthStencil = FALSE;
// d3dpp.AutoDepthStencilFormat;
d3dpp.Flags = 0;
d3dpp.FullScreen_RefreshRateInHz = this->GetHighestRefreshRate (Width, Height);
d3dpp.PresentationInterval = D3DPRESENT_INTERVAL_ONE; //IMMEDIATE ONE // TODO: Test if three is possible

// TODO: May need hardware vertex some day
GlobalError::pErrH->HandleDirect3DError(this->pD3D->CreateDevice( this->AdapterNumber, D3DDEVTYPE_HAL, this->hWnd,
D3DCREATE_SOFTWARE_VERTEXPROCESSING,
&d3dpp, &pDevice ));
Parameters = d3dpp;
}




I believe INTERVAL_ONE forces the hardware to sync to the screen's refreshing

Share this post


Link to post
Share on other sites
i mean.. it's maybe dumb to suggest that.. but have you set up windows performance monitor to monitor your system while you're experiencing those glitches in your app? maybe something weird is happening underneath.. at least you could see whether you have a processor peak or io or... well.. something different :)

Share this post


Link to post
Share on other sites
Quote:
Original post by thesimon
i mean.. it's maybe dumb to suggest that.. but have you set up windows performance monitor to monitor your system while you're experiencing those glitches in your app? maybe something weird is happening underneath.. at least you could see whether you have a processor peak or io or... well.. something different :)


The CPU monitor showes usage of 50% of the CPU.
A strange thing is that the CPU usage is split to two graphes, so I dont know what the two mean. I dont have a duel core CPU.


Share this post


Link to post
Share on other sites
Guest Anonymous Poster
it's a hyper-threading cpu then. try adding a few other metrics to the graph (right click) like disk io, memory usage, etc ... try to find out if there's something spiking when your app freaks out. however, this was just a guess. just something i would check before investigating further in my code.

- simon

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
ah i just realized you only had a look at the task manager's graphs. they don't tell you a whole lot. use Run > Perfmon.exe for this. There you can dig a bit deeper into what 's consuming resources on your system.
- simon

Share this post


Link to post
Share on other sites
I have checked with perfmon, and it showed 50% usage of CPU and low usage of memory.
However, I was unable to recreate the glitch for now, so I will check it again late.
I just wanted to put a screenshot of my game with some little imporvement on the look of it.
Please tell me what you think.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!