I've been searching for several hours, and tweaking my code, trying to determine exactly what's causing my problem, but to no avail.
I've been spending the past few days tweaking my game and making it frame-rate independent, and running into frametime inconsistencies that I can't seem to eliminate. I've been working on implementing a time step like that described in Gaffer's "Fix your timestep" article (fixed physics update intervals, variable rendering w/ interpolation), and I understand the loop inside and out, but I for some reason can't eliminate some timing discrepancies.
I've commented out every game loop aspect besides
1) Calculating frametime (to determine how many fixed-interval physics updates to calculate per cycle)
2) Basic drawing of debug info. And I've even tried not printing the debug info, and still I get spikes(just printing spikes to the console).
No matter what pollrate and fps settings I use, I still get frametime spikes every 5-6 seconds or so. This is manageable, considering the game adjusts for the increased frametime, and updates the physics more times per cycle to compensate, but the noticeable hitching when frametimes sometimes spike above 50-70 ms (I'm trying to have stability at 144 fps, so 7-8 ms) is very irritating, and I can't seem to figure out why this is happening.
I am not using setFrameRateLimit at the moment (my experience is that it limits the speed of the whole thread, and this caused some inconsistencies for me), but even when setting the framerate limit, I still get frame time spikes. Enabling vsync yielded less overall spikes, but the spikes were far higher (sometimes 80+ ms). I can provide my code if needed, but again, literally all it is doing is calculating frametime (at the pollrate, 60-150 times a second, depending on my settings), and drawing debug info (60-144 fps, depending). I have also tried calculating frametimes with millisecond and microseconds, and both still get frametime spikes.
Does anyone have experience running SFML games stable at high refresh rates? Is this a threading problem?
I wasn't sure if multi-threading would solve my problem, but am certainly more than willing to try it at this point, as I'm at my wits' end.
Any help would be greatly appreciated.