Tilemap scale on different resolutions

Godot Version

4.2.1

Question

I am working on a mobile game and playing a bit with a screen scaling. I have an issue with tilemap. Since my phone aspect ratio is 19:9 while i try to work with 16:9, there are more visible tiles on x axis on phone than there are on pc.

16:9

19:9

My app settings are

width: 1920
height: 1080
stretch_mode: canvas_items
stretch_aspect: expand

I am just wondering if it is possible for tilemap to be scaled like this or not.

This is intended, as the expand stretch aspect allows multiple aspect ratios to be used to their full potential when they differ from the base window aspect ratio. This means that if the display aspect ratio is wider than the base aspect ratio, you’ll see more of the scene. This applies to both 2D and 3D.

If you want to compensate for this, you could change the zoom property in the Camera2D node based on the viewport width relative to the base window size. Connecting a method to the root Viewport’s size_changed signal can be helpful here.