Exit game at certain frames per second?

When a game is at something like 10 frames per second and going on for 15+ seconds, how do I make the game to automatically quit so the player doesn’t lag when trying to exit the game manually?
Basically, I want the game to automatically quit when the player is reaching a certain about of FPS for a certain amount of time.

Here’s an example how I implemented a simple FPS counter that updates once a second. It adds delta seconds value to a float variable every tick, and once a second it calculates the average fps. You can try doing something similar, but also calculate the average of the latest 10 seconds or so.

I know it must be not the most efficient solution, but maybe it may somehow help you.

So if the event tick is the key to capture the FPS, i think i may be able to make use of it. Your code seems like it can help me get a sense of how to capture the specific fps. Thanks so much!

Delta Time returns the time between the last two frames. If your fps is 30, delta time will be .033333(3) etc.

There’s also a node called [Get World Delta Seconds] that returns the same value, but it’s just a separate node in case you use Event Tick somewhere else and don’t want to drag spaghetti throughout the BP.

308866-screenshot-86.png

So, when i see what is being recorded, i cant match the .333333 thing whenever im about 30fps. Keep in mind, my graphics max is 60fps, as its the intel hd 640

You can match the colors from whats indecated in the blueprints, by what is showing in the in-game screenshot

I don’t understand what you mean. Can you elaborate?

I have relised something, that using the “print text”, the number seems more accurate, and that the lower fps i get, the higher the numbers on “print text” is. I get about 0.08 at about 10fps

I actually found out something. Ok so this may seem funny, but the less fps i get, the higher number is logged. Like for example, when i get 60fps, the print text shows 0.020, when im at about 10fps, the print string shows 0.17. So i did make up a system, however theres a little buggy that sometims when i start up the level, it auto quits. My game idea is dumb, its suppose to be called “Dont lag”, which is basically if you lag down to like 5fps, the game exits while the scores is done tracked before you “crash”. So basically the idea is to create a “Fake Crash when reached at 10fps”

So this is my final, the bug is that sometimes when i start up the game, the delta second glitches “greater than 0.18”. Then sometimes when i start up the game, its perfectly normal, meaning when i get into 5fps, that print text value shows 0.18, which makes the game auto quit. And that good, all i want it to fix this start up bug.

Oh, alright. I understand that now, lol

Oh nevermind, fixed it, just needed a delay on event tick. I strongly appreciate the help from you! I also learned new thing about the event tick from you! So really the main problem (which is now solved) was to calculate and log the fps at a blueprint kind of thing.

It seems to be just rounded to 3 decimal points, but it’s the same number basically.

the less fps i get, the higher number
is logged

That’s the idea. It’s the time the last frame took to render, so if you have 60 fps, the delta time will be 1 / 60 = 0.0166, etc.