Mobile Game Resolutions

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By djmick

I am making my first mobile game and I have no idea what resolution to use. Between all the different android phones and ios there are tons of different resolutions to try and cover. Does anyone know what resolution I should use and what settings I should use to try and have it work on all phones? The game is not pixel art it is hand drawn if that helps. Thanks!

:bust_in_silhouette: Reply From: AuthorSan

Use this resolution:
Width: 600
Height: 270
(this works for most of the phones. But to make your screen adapt to the bezel-less phones, add the following function)

Add this function to your global script :

func SetDisplay():
var viewPort = get_node("/root").get_child(1).get_viewport_rect().size
var camera = get_node("/root").get_child(1).find_node("MainCamera")
print(camera.name)
View_port_scale = 600/viewPort.x
camera.set_zoom(camera.get_zoom()*View_port_scale)
print(camera.zoom)

If the game is 600 by 270 though, that’s much smaller than a phone resolution, so how would it upscale to fit? And would the aspect ratio stay the same?

djmick | 2021-03-06 18:45

:bust_in_silhouette: Reply From: Calinou

Everything you need to know is in the Multiple resolutions documentation :slight_smile:

If you don’t know what to do: use a 1280x720 window size in the Project Settings, use the 2d stretch mode, expand stretch aspect and configure your UI nodes’ anchors correctly to support multiple aspect ratios.

Thanks! Will this expand to fit any screen or will I need some code to make it do that?

djmick | 2021-03-07 15:37

It will expand to any resolution and aspect ratio automatically (with 2D elements scaled), as long as you configure UI anchors correctly in your Control nodes.

Calinou | 2021-03-09 01:07