R
R
richardvanstark2014-02-17 22:04:15
Android
richardvanstark, 2014-02-17 22:04:15

Game development on Android\iOS (Unity3D 4.3, Cocos2D) - screen sizes, DPI, sprite scaling?

Good evening/afternoon/morning fellow programmers.
As a hobby project, I am making a game for Android and in the future for iOS. I have already read a lot of materials, but there are still a lot of questions, because this is a completely different area for me.
All devices have different resolutions and screen aspect ratio and DPI. According to the theory, for example, they write that pictures are displayed differently at different DPIs, someone writes what makes the game for one resolution (what ??), someone says that this is a "big topic for another topic", and practical materials on this little topic.
Friends basically have the same phones and tablets, so you can’t check (and you don’t want to “pull” friends on every issue).
If I understand correctly, the only good option (if you do not take memory consumption into account) is to draw sprites for maximum resolution and then scale them relative to the screen resolution?
That is, if we draw a character 100x80 (WxH), then with a base resolution of 768x1280 (Android tablet, portrait), it will be in scale 1 and looks good.
And at a resolution of 480x800 (Android phone, portrait), it will be 62.5x50 (WxH) (proportional reduction).
But this is just a theory :) For desktop solutions, everything is relatively simple - 1024x768 lower limit - you can simply set the game resolution to 800x600 and everything will be just fine.
1) Do I need to consider DPI in sprite sizes? Or does DPI only determine how well the sprites will look on the screen?
2) What about screen resolutions? What is the most ideal option for the game to look approximately the same everywhere? Do scaling or...
3) Unity3D 4.3 has the ability to work with 2D - the camera has a Size indicator (orthographicSize). If you change it, then at the current size of the sprites - they decrease, because the camera seems to "move away".
How to use it correctly along with sprite scaling?
And in general, maybe someone will tell you the basics of the process of creating games for mobile?
Thank you.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergei Borisov, 2014-02-18
@richardvanstark

Density and screen resolution are not directly proportional to each other.
Android has this rule:
LDPI:MDPI:HDPI:XHDPI:XXHDPI=3:4:6:8:12.
for example here: stackoverflow.com/questions/6166677/android-screen...
or on developer.android.com
That is, making a character 100 pixels for xhdpi is a very bad idea. Better, for example, 96 pixels. Since 96 is divided by 6 without a remainder. And the height is not 80, by 78. Then the dimensions of the character will be:
LDPI: 48x39
MDPI: 64x52
HDPI: 96x78
XHDPI: 128x104
XHDPI: 192x156
From here, you can easily calculate in what resolution you need to draw a character in order to avoid non-realistic scaling. Find the least common multiple between the proportions. It will be 24. And we draw your object in 384x312 resolution. From this size, you can easily get all the drawings in all the required sizes. It is better to make a script that, for example, using ImageMagick, scales your original drawing and puts it into folders.
That is, if you want to support all 5 resolutions, then all your original drawings must have dimensions divisible by 24.
However, LDPI need not be considered. Then the proportions are obtained:
MDPI:HDPI:XHDPI:XXHDPI=2:3:4:6.
And in this case, it is obvious that all original drawings must have dimensions divisible by 12. By the way, even if you leave support only for HDPI and XHDPI, you still need a multiplier of 12, which means you get support for both MDPI and XXHDPI cheaply.
For iOS, everything is a little easier. See @Lerg 's comment .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question