Scaling for different resolutions

Hi all,

We are having some trouble setting up our camera and scaling across devices. Our current camera functions the same as the Match 3 example project and sets the orthowidth based on the device’s resolution. This seems to work fine on 16:9 devices (picture 1). However, on devices with a 4:3 aspect ratio, our background and some other game elements are cut off (picture 2). This seems like a similar issue to this question: https://answers.unrealengine.com/questions/257982/background-image-fit-to-any-device-resolution-pape.html

Is there a way to scale the camera (without letterboxing on the iPhone) or game objects, uniformly across devices with different aspect ratios? If so, how does this scale relate to Unreal units?

Thanks in advance

Heya rcp1,

In Match 3 there’s a few things going on:

  1. Match 3 is Portrait only. So we just use the “Short Side” as the max size of our play grid. But that could push other Elements off screen on 4:3.
  2. UI Scaling (Project Settings → User Interface) which will adjust how large we render UMG UI elements based on a custom DPI curve based on the Long Side of the device’s screen. This lowers the chance of elements being pushed off screen.
  3. The Play Grid (and the bomb power bar) have some delayed math that actually take the screen position of 2 invisible Actors on the Play Grid, and calculates how large a dead space needs to be in order to have the grid remain square and seated at the bottom of the screen. This also prevents the play grid from being too large on 4:3 devices.
  4. There is some math on the camera, but it’s based on getting the grid to be exactly the res it needs to be. In this case, the resolution on the Iso camera is the width of the play grid in pixels (which happens to match its size in World Units/UU/cm).

So to your questions:

You can attempt to disable “Constrain Aspect Ratio,” but this will lead to clipping.
If you do a straight scale of what you render, you’ll get stretching.
Ortho width on the camera is in World Units/UU/cm.

The most applicable thing I have for you, is the idea of setting up a play area that has to be on screen, and you can set a boundary for those using hidden Actors getting their projected screen space (which can be well off screen, in the positive or negative directions), and doing some math (based on the known screen dimensions) to adjust your ortho width so that your play area fits on screen (similar to the play grid adjustments we do in Match3). The rest ends up being… letter boxed or clipped, but you’ll be able to fill it in with art or non-gameplay related elements.

Essentially given the diverse nature of screen resolutions and aspect ratios, you’ll have to build for them.