The Animal Farm

May 21st, 2010

Is There an Android in my Future?

I’m faced with a dilemma.

There are two competing platforms. There’s iPhone, the current “market leader” so to speak. It’s supported by an evil empire.

There’s also Android, the up-and-comer that’s been making significant headway. Perhaps not as widespread, but it’s gaining ground and also supported by a friendly company.

Both require about an equal startup investment - with the iPhone I would need to acquire a Mac and I could steal someone’s iTouch, and with the Android I would need to purchase an unlocked dev phone.

Both are developed primarily in languages I have no real love for - iPhone in Objective-C, which I’m actively using and with which I have grown fairly familiar; Android in Java, which I haven’t used heavily since 1.5 but know pretty well.

Both have markets I’m wary of - Android’s is smaller and I know virtually nothing about it, but conversely iPhone’s is pretty saturated and I’ve heard nothing good about it.

See the Light and Word Duelist need a new audience, and I need a new one-man-friendly platform. I’m shying away from Windows 7 right now, though it would definitely be the most straight-forward port. I’m not, however, sure what direction I want to go in quite yet. Suggestions? Anyone want to donate a dev device?

You have to adjust the loop-locks.

May 21st, 2010

iPhone/iPad Game Dev Best Practices 1

I’ve been mulling over a few relatively Good Ideas while doing iPhone dev. I have more than one post’s worth, so here’s, well, one post’s worth, with more to follow:

(1) Localize Late
Localization will inevitably involve interface changes to suit each language, and thus you’ll be left with multiple versions of the interface. If you then have to change something non-language specific like adding a new view, you have to change that in every unique interface, which is painful at best and problematic at worst. If possible, it’s best to save localization for the last step.

(2) Avoid UIImageView for Representing Sprites
It might be a knee-jerk reaction to make a sprite have an associated UIImageView for display and animation purposes, but this slow. Slow in a way you’re pretty likely to run into.

(3) Test Early and Often on a Device
The emulator is nice and convenient and terribly misleading. It basically has infinite speed and storage as far as an iPhone game is concerned, and thus if you’re having speed or memory issues on a real device, they might go unnoticed for too long. Testing on devices of different qualities is also recommended, as you’re a lot more likely to run out of memory or have severe performance issues on a 2nd gen iPhone than you are on a modern iTouch.

(4) Use Instruments but Don’t Trust It
Instruments is The Tool for iPhone profiling. Which is unfortunate since it will lie to you. Use it often to gather benchmarks and spot memory leaks, but don’t trust it to tell you the whole truth. Make sure you check the iPhone logs and output messages for memory warnings to supplement your benchmarks.

(5) Invoke memory warnings
There’s no better way to spot trouble areas than when a program runs out of memory. When a low memory warning triggers, the iPhone will dump a lot of its unused memory and try to keep going. If your program doesn’t crash in the near future (not necessarily immediately), you’re doing good. If your program does crash, it’s very possible you’ve got a memory management problem hidden somewhere that needs to be addressed. Common culprits are failing to retain an object that you access later. Keep in mind that, while the iPhone simulator does have a “simulator memory warning,” option, it doesn’t behave the same way as it does on the device, so things which quietly keep working on the simulator will go down in flames on the phone.

(6) Frequently Test Application Interrupts
When an app is interrupted because of an SMS message or just falling asleep, weird things can happen. Notably the sound system likes to become corrupted and needs a restart. It’s good to find these problems early, since they can be irritatingly persistent.

OK, that’s all we have time for. This won’t be a long-running series like my game polishing posts, but I have at least enough to fill another post in the near future.

Did you calibrate it to binary white?