Returns the frames per second capped at room speed.


GML Code Example


Returns: Real


In GameMaker: Studio there are two main ways that can be used to tell the speed at which your game runs. The room_speed (as specified in the room editor) and the fps (frames per second). These values are often confused, but basically one is the number of game steps that GameMaker: Studio is supposed to be completing in a second, while the other (the fps) is the number of CPU steps that GameMaker: Studio is actually completing in a second up to a maximum value of the room speed itself. To get the true fps, ie. the actual number of cpu steps per game step, use the fps_real variable.

This read-only variable returns the current fps as an integer value. Please note that the function will only update once every step of your game and so may appear to "jump" from one value to another, but this is quite normal.


GML Code Example

if debug_mode
    draw_text(32, 32, "FPS = " + string(fps));

The above code will check to see if the game is in debug mode and if it is it will display the current fps on the screen.

Back: Debugging
Next: fps_real

No Examples Submitted

Does this page need better examples? Be the first to Submit

No Edits Suggested

Is this page unclear or not descriptive enough? Suggest an edit to the page and with enough upvotes your changes will be made.

No Questions Have Been Ask

Do you have a question about this page? Ask it Here