Recommended base resolution for a modern non-pixel 2D game?

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

Question:
If my game should look crisp in 4K as well as lower resolutions – ignoring future resolutions for now – must I set the base resolution to 4K?

(Context and research below)


Context:
I am working on a non-pixel 2D game

Research done:
I read through the article “Multiple resolutions”, the FAQ “How should assets be created to handle multiple resolutions and aspect ratios?” as well as multiple questions on the topic of “upscaling”, “responsiveness”, etc.

Test:

  • I have an asset in 4K (3840 × 2160)
  • To emphasize the “problem” I set the base resolution to 640 × 360
  • The asset is scaled in game using transform to fit the viewport
  • HiDPI mode is turned on
  • Stretch mode is set to viewport
  • → Outcome when fullscreening the window: Rendering is pixelated (likely 640 × 360 is stretched to cover the whole screen)

Upscaling test in Godot with a 4K asset but base resolution 640x360

Approaches outside Godot: Web
In web development it’s common to provide assets in various sizes and the browser picks the appropriate one (it’s called srcset and basically means old devices load an image in smaller resolution than devices with hidpi screen).

→ There doesn’t seem to something like that in Godot

Approaches outside Godot: Android
On Android there is the unit “DP” which is called density-independent pixel which makes it easy to make things essentially the same size depending no the pixel density of the screen. (A browser does essentially the same but still calls it “px” which can be confusing).

Example:

  • 1 DP on a FullHD 1920 × 1080 screen (with pixel density @1x) = 1px
  • 1 DP on a 4K 3840 × 2016 screen (with pixel density @2x) = 2px

→ Godot doesn’t seem to work with DP

Understanding:
It seems to me that “base resolution” is basically the game’s “maximum resolution” or “render resolution” and then scaled up or down depending on the device’s resolution (possibly with performance optimizations when scaling down).

I am not 100% sure, but it seems that stretch-mode “canvas_items” (formerly called 2D) does the trick (image looks crisp despite base resolution being much smaller than 4K):

This means that everything is rendered directly at the target
resolution

st_phan | 2023-04-11 09:28

:bust_in_silhouette: Reply From: st_phan

I found the following information in the docs (emphasis mine):

To support multiple resolutions with crisp visuals at high resolutions, you will need to use high-resolution source images […].
[Recommended option 1] Use a high base resolution in the project settings (such as 4K), then use the textures at original scale. This is an easier approach.
[…]
After doing this, you may notice that textures become grainy at lower viewport resolutions. To resolve this, enable Mipmaps on textures used in 2D in the Import dock. This will increase memory usage.