Pages

Monday, May 09, 2011

Very Angry Robots: Build 121

Pixel Densities

Previous builds of my Android game, Very Angry Robots, were implemented to run with a viewport of 480x320. This was scaled to fit the screen whilst maintaining the same 3:2 aspect ratio. This worked well on phones with a native resolution of 480x320, but on phones with higher resolution displays (such as the Nexus One which has a native resolution of 800x480) this sometimes looked a little bit odd as the bitmaps were scaled up by a factor of 1.5.

I switched to a virtual viewport using different pixel densities to support different screen sizes. The latest build uses a viewport of 30x20 squares. The game now supports different pixel densities. For smaller screens, such as 480x320, each square is 16 pixels wide. For larger screens, such as 800x480, each square is 24 pixels wide. A different set of graphics is used for each pixel density, leading to the game looking a lot better on larger screens. In theory it could support larger screens, but so far it only has two sets of graphics. Aurelien Ribon explains this better here.

The screen has an aspect ratio of 3:2, but the mazes used in the game are 5x3. Fortunately that’s not a problem. 30x20 has a ratio of 3:2. But by taking a couple of rows of that to display the score, we’re left with 30x18, giving a ratio of 5:3. Perfect!

Download Very Angry Robots

The latest build of Very Angry Robots can be downloaded here, or by scanning the QR code below.

QR code

Feedback is always welcome.

2 comments:

  1. Hi when I run the game on larger screen like Nexus, the map is too small, even smaller than running on HTC ONE, where the game fills up the screen. But for both devices the display of text and scores are weird. I am new to Android and gaming, do you have any suggestions on how to solve this? Thanks!

    ReplyDelete
    Replies
    1. Thanks for the feedback. That's something that I need to fix particularly as resolutions seem to be ever increasing. Oddly enough I have been considering another release.

      Delete