Screen resolutions workflow for desktop game [Defold + DefOS]

Hello All :smiley:

Maybe someone has some advice on creating the most straightforward workflow to make a game fit different screen resolutions.

Question 1

Would you create game assets in 4K and downscale them by code? Or is it better to choose to upscale things? (I don’t know if there is a loss of quality when scaling with Defold)

I’ve searched the forum + the internet, and opinions are mixed on this.

Question 2

Would DefOS + Defold’s render options be a good workflow to use?

I don’t know if this is the correct setup in game.project:

[display]
view_width = 3840
view_height = 2160
high_dpi = 1
display_profiles = /builtins/render/default.display_profilesc
fullscreen = 0
width = 3840
height = 2160

[defos]
view_width = 1920
view_height = 1080
view_x = 20
view_y = 40

uncomment in default.render_script

msg.post("@render:", "use_fixed_fit_projection", { near = -1, far = 1 })

Project information
Platform: Desktop
Target OS: Windows/Steam
The most used screen resolutions on Steam are still 1920 x 1080.
Artstyle: Testing 3D and Pixel Art at the moment.

I have a 4K monitor, so it’s possible for me to test different screen resolutions. The player should always see the same things on every screen resolution.

Curious to hear more about it :blush: Thank you.

Hi All :slight_smile:

After reading many things on the Defold website and testing things, I’m happy to tell you that I solved it.

I made a 3840 x 2160 image in Photoshop with different resolutions. (4K, 2K, and 1080)
And I added this image to the DefOS sample project to test the different Defold render settings.

To have the image always in the center of the screen, I used the following positions:

gameobject
X position: 1920
Y position: 1080

sprite:
X position: 120
Y position: 0

And for testing and working on the game, I uncomment in default.render_script:

 msg.post("@render:", "use_fixed_projection", { near = -1, far = 1, zoom = 1.2 })

game.project:

[display]
view_width = 3840
view_height = 2160
high_dpi = 1

[defos]
view_width = 1920
view_height = 1080

*no view_x and view_y

This method may help someone in the future :wink:. Of course, I’m always open to hearing tips on what others do with different screen resolutions :grinning:.

this means your game is going to rendered on 3840x2160 pixel. this is huge and If I’m not mistaken it might cause a significant performance drop.

If you are going to use pixel art, then use smaller display and upscale it. For proper upscaling you can examine this project:

1 Like

I have changed the project to 1920 x 1080, which will upscale to 4K with DefOS. I know that there are also players gaming on 1280 x 720. But if I try to test the game on a resolution below 800 pixels, the game won’t be displayed on the monitor. I read on the forums that it is expected behavior.

I will also have a look at the template project from britzl. Thank you, @selimanac, for giving me some advice on this!

1 Like

I’m not sure what you are referring to?

Hi @Mathias_Westerdahl, I may have misunderstood this topic:

When I set up my monitor to the 1280 x 720 resolution and click build.
The game window will stay in the top left corner, and I can’t display it.