I have plenty of visual clutter on the screen in some scenes, that is irrelevant for the gameplay itself, but adds to the visual fidelity. I know different approches to optimize the scenes, but then I came with the idea, that “couldnt I just check if the game is running at 60+fps, and make those effects appear only then?”
So, one blueprint node that checks what the current framerate is, and if its above the 60, the branch node after it allows the extra visuals to be spawned. Then I wouldnt need to worry about lower end machines dying to those scenes, and user wouldnt need to mess with graphics settings that much either, since I would take care of the potentially heavier scenes for him automatically.
I know the way to display fps via execute console command, but I cannot make this value a float/string to communicate with the blueprints.
Ah. As often happens, making the topic helped me to figure it out already.
1 divided by the delta time from Tick and connect Tick to float variable “Current FPS”. Then I have the Current FPS making the branches whether extra effects are made.
This does add 1 more constantly ticking variable change and a divination to the blueprint, which uses resources itself though. Doing the checks once per second etc. would be good enough, but for FPS checking the variable must correctly ticked to the frames to work.
You’ll probably want to filter the data. I’d suggest you accumulate the frame times and delta time ~5-10 times per second and then once per second or so, calculate a running average between them. Frame times can vary quite a bit, so an average is a much more reliable means of sampling. You could get fancy and run geometric or RMS averages, but a simple average will probably be plenty enough.
Yeah, thanks, that makes sense, and I keep that in my mind.
For current scene its not that doesnt seem necessary though, as I have just small extra effects spawning rapidly every 0.05-0.1 seconds at random locations, andeven if the frame variation skips a few of those, its not that big of an issue since there will be still lot more to be spawned if framerate allows it. The avarage definitely is required when spawning some big flames etc. that last longer time though.
FPS is not a very reliable means of detecting performance drop as a constant as to the nature of hardware rendering. Sampling the refresh rate might be a better option