0 votes

Hi,

I'am programming a 2d game using a native resolution of 1920 x 1080.

I'd like to be able to make this game working using lower resolutions.

I noticed that a "shrink" option is available in the project settings -> Display -> Window section, but this option only works when compiling the project.

What i'd like to do is to get the game automatically scale down to the current resolution of the screen.
I've got no problem to get the resolution of the screen using get_viewport().size, but what i don't know is how to reduce the game resolution to the screen's resolution.

Any help is welcome.

Thanks

in Engine by (14 points)

1 Answer

–2 votes

I'am programming a 2d game using a native resolution of 1920 x 1080.
I'd like to be able to make this game working using lower resolutions.

What do you mean by this? In Godot go to: Project Settings-> Display -> Window -> Stretch -> Mode
Here set the mode to either 2D or Viewport. This will allow the game to be dynamically sized by scaling the window it runs in.

2D: This calculates the polygons inside the screen to fit the screen. works like most 2D engines. (libGDX, Unity etc.)
It is also the only way to really get pixel perfect look on mobile, but will need custom mips.

Viewport: This calculates the size of images on the fly, the same as adjusting the viewport size would. Some data loss happens with this one.

The Godot manual says to use this one with pixel perfect games in the manual, but fail to mention that only works with constant aspect ratios.
Since most Mobiles and Tablets use inconsistent aspect ratios you will need to calibrate the screen ratio first.

To keep aspect ratio just select one of the options under Mode.
Keepwidth or KeepHeight will render with a black boarder.

enter image description here

What i'd like to do is to get the game automatically scale down to the current resolution of the screen.

You will make code for this. The Viewport node has what you need.
http://docs.godotengine.org/en/3.0/tutorials/viewports/viewports.html

I hope this answers what you are asking, I don't understand what you need.

by (1,440 points)

Thank you for your answer.

I'll try to explain better what I need.

My program resolution is 1920 x 1080 (Full HD).

If I run this program on a computer which can display only a lower resolution (l1600 x 900 for example), only a part of the screen will be visible (the other part is displayed "off screen").

What I'd like to do is to shrink to resolution of the program automatically to the same the resolution of the computer.

Thanks

I'm having the exact same problem as Starfighter mentions.

I have the same problem as well

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.