开发者

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:

  1. 854x600 scale 100%
  2. 1024x800 scale 120%
  3. 1280x1024 scale 160%
  4. 1536x1152 scale 192%
  5. 1920x1200 scale 240%
  6. 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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜