Almost missed it by a whisker!

170Arrrrg-Swaity-RED-EYESI’ve been putting together a small scrolling arcade / casual game for the Tizen App Challenge called Ragin’ Pirates, which the deadline for was this evening, December 8, 2013, shortly before midnight.

I was late to the game for this contest, which opened in July. I started development mid-November. Everything was a frantic pace, and many late nights after work, but I feel the game came together really well in the end. Chris Clark, over at ginik.ca, put together a fantastic tileset that I used, Kurt Barlowe made my awesome icon and title screen. I used some assets from Reiner ‘Tiles’ Prokein at reinerstilesets.de, and David E. Gervais created the art I used in my level select screen. Thanks guys! I have lots of various people to thank for the sound effects and music, too many to list in a blog post. Thank you all. Thank you to my beta testers for the valuable input and suggestions.

The development process was likely what most would encounter. A concept that progressively matures and gets refined to the point its something half entertaining. Then scrapped and started over as something better. A few minor bugs were encountered and fixed and while it doesn’t have as many levels as I would have like to have had in it for the challenge, I do plan on releasing a level pack as an update.

Almost missed it by a whisker – Submission into the Tizen app store didn’t go 100% as expected. First two tries I was rejected! Panic! With the deadline so close I didn’t have time for anything major. It took some time to find out what was happening, turns out their icons size is 117×117 (mine was), with a 2px transparency boarder around the icon. Mine also had that boarder, with the exception of ONE half transparent pixel, from the tip of my pirate’s moustache poking into it. Resized, submitted, and 8 hours later, near the deadline for certification, I passed. Absolutely nothing wrong with anything at their end. Their seller store is actually pretty neat, I don’t have anything to compare it to yet, but I do like the layout and information provided. Anyway, I’m in! I’m excited to be a launch day indie game developer for a new platform with my cheesy little game.

Check it out here: Ragin’ Pirates!

Android Display Metrics in Unity 3D

When designing your Unity 3D GUI for iOS, you get to work with set resolutions and can target each one exactly. But with Android, you have a multitude of devices you can target. How can you make sure a button is the same physical size on all devices? You don’t want a nicely sized button to be suddenly an inch across when running on a tablet.

Luckily you don’t really have to do much work to create UI that is physically the same size across all Android devices. Google has already done the hard work for you and given you the data you need to scale your UI correctly.

Everything in the standard Android SDK layout is based on DiP, or DP (Device independent pixels). When you design a layout for Android, you build it in DPs instead of pixels. A DP is 1 pixel on a device that has a physical 160 DPI.

The simplest way, and the way I do it, is to build my GUI (with NGUI at the moment) as if I am building it for a 160DPI screen. And attach a script to each object to scale it at run-time. All the script does is multiply the current size of the GUI element by DisplayMetricsAndroid.Density.

The code below allows you to grab a lot of info about the Android device you are running on, Density will give you exactly what you need to multiply your 160DPI GUI to re-size it to be the exact same physical size on each device.

For instance, on a phone with 320DPI, DisplayMetricsAndroid.Density will be 2.0; Your GUI will need to be scaled twice as large as if it was on a 160DPI phone screen. On a tablet with 320DPI, DisplayMetricsAndroid.Density might actually still be 1.0. Because the tablet has a larger screen, you don’t need to change your GUI scale, it’s already the correct physical size.

You might have to play around a little bit to understand what’s going on, but until then. Just build for 160DPI, and scale each element at run-time by multiplying it by DisplayMetricsAndroid.Density. You can read a LOT more in Google’s areticle about how they support multiple screen sizes and density support.