Graphic resources for different resolutions (and density)

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jospic
:warning: Old Version Published before Godot 3 was released.

Hi,
in other game engines there are methods to take the same images (exampe, texture for sprites) in different quality, for different screen resolutions ( phone or tablet ).
In Godot, is there an automatic way to load best images for large screens, and poor images for small ones?
Thanks in advance
-j

Godot generates mipmap to show best quality for different size.
So, you just need largest image for all screen size.
Is there any particular reason to use different resource for different screen size?

volzhs | 2016-04-21 10:43

Unfortunately, for now Godot can not use vector sprites (like svg ) and with large devices sprites appear with low quality…

jospic | 2016-04-21 16:51

:bust_in_silhouette: Reply From: kubecz3k

The best what I can suggest for you is to read what official docs are saying in this matter: Frequently asked questions — Godot Engine (latest) documentation in English

:bust_in_silhouette: Reply From: batmanasb

Handling multiple resolutions seems easy in 3D because the camera does all the work, but in 2D it gets more complicated. So in my 2D games I recently started using the 3D-style approach of setting the camera zoom based on the difference between the default vertical size of the viewport, and the default size. The code looks like this:

var zoom = defaultSize/get_viewport_rect().size.y
camera.set_zoom(Vector2(zoom,zoom))

and I do this by connecting the “size_changed” signal to a function, so it adjusts the camera zoom whenever the viewport size changes. Although I don’t think this is ideal for HUD and other things like text that appear on the screen, and maybe even menus. So I’m still figuring out how to handle that. But if you want to see it in action, I used it in my LD35 entry.

Yes, also I do the same: I change the status of the current camera zoom and set HUD items to make them proportional to the viewport. The problem is the quality of the sprites with very high resolutions …

jospic | 2016-04-22 10:19

The following two images are related to my game work in progress.

The first is a screenshot at 1536 x 640 resolution of an iPhone 5

The second is at 800 x 480 of an Android WVGA models


as seen in the first image are more noticeable sprites artifacts ( for example the snake)

jospic | 2016-04-22 15:53

How’d you do the HUD? What do you mean by you “set them”? Like different font sizes?

batmanasb | 2016-04-22 20:32

For HUD I’ve seen this good tutorial by Andreas Esau

https://www.youtube.com/watch?v=gylnwemFIZc

For text in the HUD I scale its size by viewport scale

jospic | 2016-04-23 12:41