Hello,
so I seem to be experiencing a rather dramatic FPS drop based on the period of time my game has been running for.
(Useful Info):
Using: SFML 2.4.2 with C++ in Visual Studio 2015.
Graphics Card: nVidia 960M
I've stripped my game loop down to just doing a basic
while (m_rWindow.isOpen())
{
Event evnt; //Make an sfml event
while (m_rWindow.pollEvent(evnt))//Get all the events that have occurred
{
if (evnt.type == Event::Closed)
{
m_rWindow.close();
}
if (evnt.type == Event::LostFocus)
{
hasFocus = false;
}
if (evnt.type == Event::GainedFocus)
{
hasFocus = true;
}
if (evnt.type == Event::KeyReleased)
{
if (evnt.key.code == Keyboard::Escape)
{
m_rWindow.close();
}
}
}
++frames;
thisTime = elapsed.getElapsedTime();
setFPSText(lastTime, thisTime, frames);
m_rWindow.clear();
m_rWindow.draw(m_fpsText);
m_rWindow.display();
}
All the loop does now is draw the fps to the screen and display this value. I disabled all rendering and updating of the game to find the cause of my present problem. Through some testing I managed to find:
When the game is initially run on my PC with just this loop (no VSync enabled, and no frame rate limit function call) I achieve 1.7 ms/frame (568 fps). But after a period of maybe 2-3 minutes I can end up at a value of 10 ms/frame (97 fps). This drastic change when I do have the fps capped to 60 and my game running takes me from an average of 16 ms/frame to 32 ms/frame.
There only a black screen with an FPS counter at the top right of the game window. I've profiled the executable a few times and timed the m_renderWindow.clear() to .display() and had variations from 11ms to 110ms when rendering my own game, but then had 6ms - 90ms when only rendering text (with a 60 fps cap on).
(Sorry for the information overload!)