aspect ratio for a game on different mobile device screens - android

i am making a game on different platforms, and i need to maintain a fixed aspect ratio while rescaling the game based on different device screen sizes...
1) so theres many different screen sizes because there are many different android, ios and blackberry devices. is there a suggested aspect ratio for all of them, a universal aspect ratio?
2) Otherwise, do each of these device have a different screen resolution (ie 540X480, 1024X720 etc)? Does that mean i have to target only a fixed number of mobile devices (ie 5), and mathematically find an aspect ratio for the screen resolution of each mobile device?
3) is there a more optimal way to do the above?
much appreciated!

When dealing with game screen sizes, you usually want to have an fixed screen ratio (depending on the type of game), not to give some people an advantage and others a disadvantage (due to users playing your game on different devices).
I develop on a 320x470 ratio (since this is the most common screen ratio for Android mobile devices). I suggest you develop your game based on this ratio.
When actually rendering the framebuffer, you either stretch it to fill the screen or you use a technique called letterboxing. Both have their pros and cons.
I hope this gave you a greater insight and maybe an idea how you are going to tackle your problem.

Related

Unity 2D : How to support multi platform and different aspect ratio devices in Unity 2D?

I am newbie to Unity 2D and creating a game in it. I wanted to run that game on almost all devices (Android, iOS, Mac, Windows and web. I am bit curious to see how Unity2D will handle this scenario and give the same user experience on various devices.
Also I noticed that I can preview my game in different aspect ratios. Is it the aspect ratio of the screen (like how the game would look on this type of screen) or of the camera (would look the same on all screens)? Do I need to provide different image resources based on the device's resolution?
Should I do something special to allow support for different resolutions, aspect ratios, etc?
Any help will be appreciated.
Aspect ratio management is explained in the following blog post: http://2sa-studio.blogspot.com/2015/01/handling-aspect-ratio-in-unity2d.html
Basically the orthographic camera has a size parameter which defines the half-height of the world area which will be rendered on screen.
Unity strategy is: fit rendered area height to screen height. Then the visible width varies depending on the screen ratio.

How to deal with multiple aspect ratios

I'm developing a 2D puzzle like game. I want to target all iOS devices (iphone 4+ ,ipad 2+ and retinas) and as much android devices as possible. The problem is as you already guessed with resolutions and aspect ratios. How to deal with it, and what are the best practices. please share your experience and best approaches with this problem. My approach is , I'm building for 3:4 (the game is in portrait mode) aspect ratio with ipad retina resolution images and using orthographic camera. for different aspect ratios i resize orthographic camera , and as expected I get black bars at the top and bottom . aka pillarbox. so I'll just resize (scale Y) the main scene. (drop everything in an empty gameObject and scale it up). or add 2nd camera to deal with this black bars. But I need the best and the most correct way to deal with this problem , what's the best practices for 2D game development when targeting multiple resolutions,aspect ratios. I've searched the net and forum but couldn't find the CORRECT WAY.

Android game location on screen size

Right now my game is using direct x and y values. I realized that my the S3 was scaling my images double size along with some other size inconsistencies between devices. I read around and learned a bit about android dpi and scaling and stuff.
I'm wondering whats the correct way to do locations and stuff so that it takes into account different screen sizes.
I'm thinking it can be done by setting a target dimension and then scaling all positional values according to the ratio of the target dimension to the actual screen size.
I also read somewhere that you can draw onto a buffer and display that buffer stretched to the screensize, however for this method would android's auto resizing affect the drawn bitmaps?
Thanks
The idea is to use aspect ratio, android auto resizing to your benefit. Every android screen has its own aspect ratio, your game should use the aspect ratio and fill blackborder where ever there is a need to fill space on the screen. So use appropriate root layout fitting attributes.
Android resizes drawables automatically that dont fit. So if you keep only 1 set of drawables, the resizing work for Android increases and it uses Bitmap's internally to do the resize. More the bitmaps more the memory utilization, more the cleanup, more the GC and slower your game. So the best practice here is to create different dpi different image sets to use.
To start with I suggest that you purchase 3 phones, samsung y (small screen), samsung s2 (good screen) and a tab 7 or 10 inch. Copy your original drawables to all the folders, just to get a feel of the game and to eliminate all memory issues. Once your game works nicely, smoothly without any memory issues on all the phone sizes, just walk into a graphic designers office and show him how bad your game looks on some phones. He will create graphics that will work for that dpi.
Its a game of intelligent drawable resolution, sizing and A WHOLE LOAD OF TESTING :).
Hope this has helped.
Edit : Read my answer in memory issues

Better way for Andengine screen size?

I understand that Andengine gives us option to scale our scene to any size screen that the user may have.
My question is if it would be better to develop for a larger resolution, say 1280/800 and scale it down for smaller screens OR to go for smaller resolution, say 800/480 and scale it up on bigger screens?
I did try to test this in a sample game by developing it for 1280/800 and scaling down (by ratioResolutionPolicy) to 800/480, and the results weren't satisfactory, there was stutter every here and there the framerate on the debugger though showed 60+. Is it bad programming on my part or does it have to do with the scaling down of the pixels, should I develop for smaller screen and scale it up?
I guess it depends on what kind of graphics you are using.
Say, for example, you want to create something in a retro-gameboy-pixel style, then it makes more sense to use small images and develop for a small resolution (like 480x320). Pixel graphics can be scaled up without loosing quality, but not down (then the pixels loose form).
But if you want high resolution graphics you are most likely better of developing the whole thing for a big resolution and let the AndEngine scale it down.
In both cases the quality of the pictures also depends on the TextureOption of your TextureAtlases as well.
Anyway, I can imagine that neither scaling down, nor scaling up is more efficient. Scaling is done by openGL and should go quite quickly. The downside of using big resolutions though, is that the device has to hold huge images in it's memory and the of course processing big images always takes more time than processing small images. So maybe the best way is to develop for middle-size devices (e.g. 960x640) ?
I know this isn't much help, unfortunately it is a lot of try and error to get the best results for your specific requirements.
christoph
To achieve good result on all type of android device you have two ways to follow from my perspective.
First, you have to develop and use two graphics to handle all the type of devices. For example one with resolution 1024x600 and other with 480x320. Based on device current resolution you have to load specific one type of graphics.
Second, you choose any single resolution that best suits to you and have great share in the market. Develop and use graphics only for that resolution. For other resolution scale that graphics based on aspect ratio. For this you have to create super class of sprite and change value of x,y,height and with based on aspect ratio calculate.
This was my experience that I share with you. If you have any doubt then feel free to ask it.

Create resolution independent game on Android

I'm quite new to Android game development (and Android development in general).
My first question came when I was creating the background for my first game: which size should I choose?
If I choose 800x480 for example, will it show good on any other resolutions?
And what about my main character? If I make it move 5px/frame (I already know how to make it fps independent, it's just an example), it's not the same to move 5 pixels on a 320px-width screen than on a 800px-width one.
Any advices on this?
Thanks
You should have separate resource files for each of the screen densities you wish to support.
Pick the background size that's supported natively on the device you plan on developing on, and worry about supporting non-native resolutions or adding resources for other resolutions when you're near the end of the project. Don't get bogged down in the weeds.
As #PaulSonier said, don't worry about supporting multiple resolutions until the end.
For now just develop on one device and use 'dp' or 'dip' units whenever possible. This will make it easier at the end to support multiple screen sizes and densities.
As for the background, consider using 9-patches.
You should have a separate set of graphics for each of the resolutions you want to support. If you really want to cover all the current devices and have the crisp and sharp graphics on every one of those and you want to make sure that the aspect ratio doesn't make your game look weird on some devices, you need to prepare your assets in the following resolutions and scales:
854x600 scale 100%
1024x800 scale 120%
1280x1024 scale 160%
1536x1152 scale 192%
1920x1200 scale 240%
2560x1600 scale 320%
Source: http://bigosaur.com/blog/31-android-resolutions-definite-answer
The best solution is to draw all full-screen images at least 2733x2134 pixels and then scale it down. Well, you can scale down images, if you have text, better to use smaller font size and put it over the image. You can do this at run-time or pre-render the text in advance. You can use ImageMagick to automate all that for 6 different sizes so you don't do it manually.

Categories

Resources