How High Dpi and Retina screens work (SOLVED)

I’m new to Defold and trying to understand how to get high res graphics for Retina screens working. For example when using a standard game object with a sprite attached - how do I set it up to use a double sized sprite (and scale down)? I cant find any way to set the size of the actual sprite. See attached screen:

You can set the high_dpi flag in game.project.

The sprite will always be given the size in pixels of original image. You can scale the game object to change the size.

As a rule of thumb you should make your art in the target resolution size, and if running on a smaller screen you scale down.

Thanks!

Ok, to have the double resolution (sprite) I should set my game object to scale 0.5?

So, for example to target iPhone X I would set my project to the full Super Retina resolution at 2436x1125?

You have two options:

  1. Use high_dpi and set game.project to half the resolution and scale game objects
  2. Don’t use high_dpi and set game.project to full resolution and let the render script scale everything (default behaviour)
1 Like

Thanks again! Now I’m understanding the concepts how it’s handled in :defold:.

Any pros and cons on using high_dpi vs. going full res?

How are others doing it when targeting platforms like macOS or iOS with Retina? Any best practices?

Easy to test on your computer since the resolution isn’t as extreme, but the drawback is that you must scale everything.

Arigato :pray: I’ll try that path.

I’m also interested in how this can work. I’m used to having multiple assets (@2,@3) in a different game engine.

Am I understanding correctly that if I want the game to be sharp on all devices I need to cater for the HIGHEST resolution only, and Defold scales it down on lower resolution devices (or go high res and scale it manually)?

@JRIN did you test this in the end?

Hi @totebo - I went with scaling everything, which I think is a bit annoying to be honest. I’m also used to having multiple assets as you mention.

1 Like

Could you please explain what does it mean to “…set game.project to half the resolution and scale game objects” ?

I find this answer intriguing. Back in my old Gamemaker days , I remember reading that scaling sprites down was costly performance-wise, and indeed some of my prototypes did have performance issues on mobile when running on a lower resolution than the original. Was that something exclusive to gamemaker then, is Defold the exception in this case, or did I misunderstood something?

Well, it is not something that is totally free. Having very large textures does if nothing else increase the amount of memory required to store the textures, on disk and in memory at runtime.

I’m still confused about the best way to go about this.

I’m targeting mobile only and I want to have the most crisp graphics possible.

I’m currently designing my tiles and sprites in 2x the size they’re appearing in game. I’m then using factories to create everything at 50% scale.

Everything works, but I’m not sure if that’s what will get me the best results.