- Home /
What base resolution you aim for when building for Android? (2D games)
Hi,
I'm well aware of Android's fragmentation problem and there is standard resolution for it, but for today's age of Android devices out there, what resolution you consider to be "average" when making your game?
For iOS it's usually iPhone 4's 960x640.
Thanks.
@UnbreakableOne - I suggest to take a moment to read the FAQ and watch the tutorial video, both on the right side of this page. I refer especially to accepting the valid answers. Don' just ask question, read the answer and forget...
I'm actually aware of the Answers mechanism, the reason I'm yet to mark any of my recent questions as answered is due to my daily routine and when I'm actually can get to apply the responses I get to the project.
After I can try out the replies and am able to solve, I'll mark them as answers accordingly.
It all comes that to having 2.5 jobs, I'm sorry if this caused any inconvenience.
No inconvenience at all. The problem is that a lot of people just don't know the rules. In opposite to sites like SO, which are generally visited by people knowing how this kind of sites work, you can find a lot of users here, who simply ask, get answer and vanish.
Thank you very much for explanation, and I hope that you find a lot of solutions here :)
Answer by Briksins · Jan 06, 2014 at 09:59 AM
I dont think it is good solution to aim only for one resolution, there are really big segmentation in Android market, and you have to satisfy all of them.
Here is a tip for you, may be there are better solutions, but thats the way im handling various types of resolutions:
Unity can tell you at launch time it "Screen.Width" and "Screen.Height" each time on different devices it will be different and it will be nightmare to hard code sizes of GUI elements and other GO. What im doing is defining screen area in bloks or parts in percentage
for example you have simple menu with bottom menu bar where you have buttons and header bar where you have logo
At this point you have no idea what size of the buttons in the bottom bar should be as resolution could be different, and you cant hardcode values for each of them.
what you can do is divide screen on parts, lets say 10 parts:
int oneTenth = Screen.Height / 10;
That way it doesn't matter what resolution you are, the proportion of the screen still will be 1 out of 10 on each resolution. So you can set your button height to be equal one tenth of the screen.
The same with width: you know you need to fit 5 buttons at the bottom
so you go:
int btnWidth = Screen.Width / 5;
keep in mind that you dont want button to be very close to each other so you need to add some space or offset to each button
int offset = 5; //5 pix offset for each button
so each your button should have 2 offsets from left and right like this:
offset|BTN1|offset|offset|BTN2|offset... etc.
so far you would have 10 offsets by 5px and 5 buttons, so the formula will be:
int btnWdth = (Screen.Width - offset * 10) / 5;
the same stuff related to the height. you got your one tenth of the screen, but you also can apply height offset within this one_tenth like this:
//offset at the top and bottom of the button
int btnHeight = oneTenth - offset * 2;
that way your app will be scaled in correct proportion in any kind of resolution or platform
Your answer
Follow this Question
Related Questions
Android project debugging.. 1 Answer
resolution is squished horizontal on android 0 Answers
Mobile Game Different Screen Size Issue 2 Answers
Resolution for assets on Android 1 Answer
Resolution Multiplier on Android 1 Answer