Making your game scale for all resolutions in Godot is an important step in creating a game that is accessible and enjoyable for everyone. Fortunately, Godot provides a really simple way to achieve this through the Project Settings.
If you make a game that looks like this…
But when you stretch it it looks like this…
Then this tutorial is for you!
Stretch Mode is a setting in Godot that determines how your game will scale to fit different screen resolutions. There are several different stretch modes to choose from, but for the purpose of this article, we will focus on the “Viewport” stretch mode.
First, open your Godot project and click on “Project” in the top menu bar. From there, select “Project Settings” and then click on the “Display” tab. Under the “Window” section, you will see the “Stretch” section. Click on the drop-down menu next next to “Mode” and select “Viewport.”
Now, your game will automatically scale to fit the resolution of any device it is played on. However, there are a few additional steps you can take to ensure that your game looks great at any resolution.
One important thing to keep in mind is your game’s aspect ratio. Aspect ratio refers to the proportional relationship between the width and height of your game’s display. For example, a common aspect ratio for mobile devices is 16:9, which means that the width of the screen is 16 units for every 9 units of height. Keeping the option for “Aspect” set to keep ensure that the aspect ratio of your game does not change. It accomplishes this using black bars to fill out the space in the window.
To set your game’s aspect ratio, go back to the Project Settings window and select the “Display” tab. Under the “Window” section, you will see the Viewport Width and Viewport Height. Setting these values allows you to specify an aspect ratio that will be held.
Finally, you may want to consider creating different versions of your game’s graphics for different resolutions. This can help ensure that your game looks great at any size. For example, you may want to create high-resolution graphics for larger screens and lower-resolution graphics for smaller screens.
With these steps, you can make your game scale for all resolutions in Godot. By using the Stretch Mode and setting your game’s aspect ratio, you can create a game that looks great on any device.