FPS Hazard

Started by
8 comments, last by The C modest god 17 years, 10 months ago
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.
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
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.
-----------------------------------------------The ZoloProject
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.

It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
How did you set up your game and VSync?
Here is the device creation code:

voidDirect3DHardware::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
It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
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 :)
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.


It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.
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
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
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.

It's all about the wheel.Never blindly trust technoligy.I love my internal organs.Real men don't shower.Quote:Original post by Toolmaker Quote:Original post by The C modest godHow is my improoved signature?It sucks, just like you.

This topic is closed to new replies.

Advertisement