UI and screen resolution in a pixel-art game

Godot Version

Godot Engine v4.2.1.stable.official

Question

I’m farely new to godot. Currently working on a pixel-art style game. I chose 640x360 resolution. However, there seems to be no place to type that in. All the guides just tell to select window size and scale in the project settings. That works fine, I usually select 1280x720 window and 2x scale, which gives me the desired 640x360 pixels in a 720p window. However there is a problem with UI. It doesn’t seem to be affected by this scale. If I put stuff near the borders of CanvasLayer it’s not visible on a 2x scale. There’s another option. Setting the zoom values in the camera node. This gets the job done, however the pixels in the UI elements are now two times smaller than the game pixels.
All in all, I think I am missing something. Would like to know how others approach this.

Welcome! I recommend you read this in its entirety:

There’s a section with recommendations towards the end, with one paragraph explicitly for “Pixel art” games. In a nutshell: Set the viewport width and height to the base resolution of your game (640x360) and the stretch mode to “Viewport”.

Thanks for your reply. I’ve done as it’s said in the docs. It works, but the game window itself is now very small. How do I scale it to 720p automatically keeping the 360p in-game resolution? Should I just set the Window size in code?

If you toggle “Advanced Settings”, you can set a “Window Width/Height Override” under ProjectSettings > Window, just set it to 720p. Or set the “Mode” setting to “Fullscreen” or “Exclusive Fullscreen” to automatically scale up to the screen size.

1 Like