+2 votes

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

in Engine by (1,469 points)

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?

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

2 Answers

+2 votes

The best what I can suggest for you is to read what official docs are saying in this matter: http://docs.godotengine.org/en/latest/reference/faq.html#how-should-assets-be-created-to-handle-multiple-resolutions-and-aspect-ratios

by (1,291 points)
0 votes

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.

by (846 points)

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 ...

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

iPhone 5 1536x640 (landscape)
WVGA Androi models (landscape)

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

How'd you do the HUD? What do you mean by you "set them"? Like different font sizes?

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

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.