FPS/Quality Slider or changer

I want people that play my game to be able to change the FPS and/or resolution in my game. How do I do this? I want there to be a dropdown for resolution


For the former, just set up an object that the player can click on to change the resolution ,or a slider bar, or whatever you want. Have it update a variable for to the selection, then use the “Change resolution” action to change the resolution to the one you want (ensure you use trigger once in your event).

For the latter, you cannot. FPS is a project wide setting and is not configurable via events. Whatever you set in the project properties is what the game will run at, unless it is not performing well. As Electron/Chromium has vsync locked on, the game will run at the closest divisor of your max resolution compared to the refresh rate. This is a chromium restriction.
(e.g. if your game has a max framerate of 120 fps, but the player’s monitor is 72hz, they will likely get 60fps because that’s the next step down the FPS can jump to)

WIth that in mind it is also generally not recommended to select unlimited FPS, because on high end PCs that can stress their GPUs as they’ll always try to push as much as they can (and get something like 600 fps.) This will impact any events that you have without trigger once and not using timedelta, so a variable that is increased by 1 every frame will increase MUCH faster with an uncapped framerate vs a 60fps max, etc.

1 Like

When I preview it and click one of the buttons, it makes the screen size bigger.
Based on the events, did I do it right?

I think it’s because the default game resolution is 1080x1920 if this has anything to do with these sizes.
Just provide a picture of the correct events and stuff if possible :slight_smile:

Yes, that’s the correct setup for changing the internal resolution.
If your project has the “Update game resolution based on window size” toggle, your assets will stay the same size but will display more/less of the scene.
If your project doesn’t have that checked, the window will stay the same size but the assets will be zoomed in/out.

Note: you’re making a 2D game, changing the internal resolution (camera size) just means zooming in or out the renderer in most cases. It’s not going to change asset resolution or anything.

1 Like

@Silver-Streak Can you show me an example? It would be appreciated

Idk if you saw my reply but can you show me an example

There’s not really an example, it’s just a setting in your game project:

You want to check/uncheck the box that says “Update resolution” to see how it behaves.

Ok, I will reply back if it works or not. It was originally “no changes to the game size” so hopefully it works,

Ok, it didn’t work. I think that you think i’m wanting players to change screen size which the resolutions seem like it. I want the player to change the quality not game size. Like if the player chooses 3840x2160(4K), the game quality changes to 3840x2160 not the size.

As mentioned in the note above, there is no such thing as “Game Quality” in a 2D game. Your assets are your asset, and will always be the resolution that they are.

You can change the game window size resolution and either have the toggle enabled (Which will shrink/grow the “Viewable space” but the assets will be the same resolution, just smaller or larger on the screen with more of the world viewable) or the toggle disabled (which will scale the whole screen up/down, but not change the actual asset resolution, so they’ll appear bigger on a person’s monitor at larger resolutions or smaller at smaller resolutions, but the world and assets will be in the same ratio as always).

Edit: if you really wanted, you could make different assets for every resolution you want to support, and then switch which objects you’re using (or animations) based off the selected resolution, but that’s a lot of effort for no gain.

Ok, I was really hoping to do this

You haven’t defined what “This” is. If you mean somehow making the graphics better or worse depending on the resolution, even in Hollow Knight, changing the game resolution does not change the assets, it just the scale of the window they’re being rendered in.

If you mean something else, you are going to need to give an example of a game that does what you’re talking about.

I am meaning that I really wanted to add a resolution/quality changer to my game.

Yes, but that doesn’t actually say what you mean.

You can already do the resolution changes via everything done above. The window size changing is changing the resolution.

What do you mean by “quality”.

Idk, I was wanting players to change the resolution to 720p, 1080p, or 4K. Is this possible or do I have to add animations of these resolutions to all the assets? Hopefully I can do it without changing all the assets

Again. The settings above and events you’re using are change the resolution.

The window size is the resolution. When the game is fullscreen the backend resolution is changing. Your assets will not change resolution as part of this, they’ll scale with the rest of the game.

So I’m still not sure what you’re asking. If you want different assets for each resolution, you will have to create those assets, yes. But no 2D game does this, they scale the game, not specific assets, so I’m not sure what you’re trying to accomplish.

If you want to account for pixel density with different drawables I’m not sure we can here.

:neutral_face: I am wanting to allow players to change the game look or whatever. Not to change the game size or to make it more close up, I want players to be able to pick the resolution of there chose. Like 1080p or 4K maybe. I am seeing if I want to add the 4K but I just want the users to choose this. Not to make it look like this.

It needs to be 1080x1920 in size but able to change just the resolution without changing size if you know what I mean.

No not unless you’re just talking about zooming in and out.

The problem is that we don’t know what you mean.

Again, when you change the game resolution using the events above, it does change the game resolution.

This is the game at 640x360. The tilemap on display is 908x400 in size.

This is that same game with the internal resolution changed to 1280x720. The tilemap on display is STILL 908x400, but since the internal resolution is now much higher, the map appears smaller because you have more pixels rendered in the same space (the window has not been changed in size).

When you full screen the game at 640x360 (hit f11 in a preview), GDevelop scales the game to whatever your monitor’s resolution is (in my case 1080p). The assets are still rendered as they were, just stretched (scaled) to the size in question. The internal renderer is still 640x360.

If you are full screen and change the internal renderer to 1920x1080, since your assets are still the same size, they appear smaller as the canvas it is being rendered on is much bigger

You can, if you want, zoom in the camera on the game layers. This has no graphical benefit (your assets are still just scaled up like they were above), but this will allow some mathematical benefits in the backend (more canvas pixels = more pixels to move to, may allow for smoother camera movement, etc). But your assets aren’t somehow higher resolution then they were before, and this map will always be a 908x400 image scaled up.

If you want different assets for different resolutions, you will need to make different assets for each resolution.

Edit, if you’re talking about just changing the window size, don’t change the internal resolution. Just change the window size

Again, this doesn’t change your asset resolution in any way, and has no effect on fullscreen games.