Is there a reason not to set a high base resolution (vs. "high dpi" ing everything)?

I started down the path of having a “base” 1280x720 resolution, toggling on “High Dpi,” and then piece by piece scaling elements down. This is a bit of a hassle, especially once I got into nested GUI elements, and frankly I’d prefer to just think about my game in terms of a single high DPI like 2560x1440.

I’d set the camera to zoom and the GUI to fit, disable “High Dpi,” and then let Defold render at whatever the window’s actual resolution is. Then during development I’ll window.set_size(1280, 720) for convenience.

Is there any reason not to do that? The presence of a “High Dpi” option makes me wonder if there’s some tradeoff that I’m missing here. For instance, I’m assuming that a game set to a resolution of 2000x1000, when running in a window of size 200x100, will only have a real canvas size of 200x100, will only rasterize onto a 200x100 bitmap surface, etc. But that may be a false assumption.

Cheers,
Hunter

I wonder if disabling high DPI will instruct high DPI displays that high DPI is not available, making your graphics upsampled instead of high DPI. But that’s just a logical supposition; I am not very familiar with high DPI displays.

Is there any reason not to do this?

Upscaling something can be done very accurately. If I have a 100x100 px texture and scale it to a 1000x1000 texture, (0,0) stays the same, (0,1) becomes (0,10) and (1,0) becomes (10,0) and so on.

Downscaling always requires a loss of information. Flipping the example, we now have to turn the 10 pixels between (0,0) and (0,10) into just (0,0) and (0,1).

So if you can put all of the required detail into the smaller resolution, it will upscale flawlessly. Pixel graphics scale really easily because of this (for integer scales, at least).

For instance, I’m assuming that a game set to a resolution of 2000x1000, when running in a window of size 200x100, will only have a real canvas size of 200x100, will only rasterize onto a 200x100 bitmap surface, etc. But that may be a false assumption.

If your game is set to 2000x1000, the default render script will draw 2000x1000 pixels, and zoom the content in or out as needed to fit the window size.

The presence of a “High Dpi” option…

For what it’s worth, the High DPI setting is under consideration for removal as Defold does it automatically after 1.9.2 (using GLFW): `display.high_dpi` does nothing on Windows (always enabled) · Issue #9311 · defold/defold · GitHub

3 Likes

Wow the defold forums are great - thanks for the information & the link. I read through the github issue & now I have a better understanding of what it’s really (always now) doing: just rendering at native “real pixel” resolution, and presenting some consistent “logical pixel” resolution for editing/physics/etc. Which is what I wanted anyway!

3 Likes