Archive for December, 2008
You Can’t Always Get What You Font
Tuesday, December 9th, 2008
Ouch…sorry about that pun in the subject.
Another big lesson learned this morning: deal with your font licensing as early as possible. My artist has created me amazing user interface artwork for the whole game using a font I’ve just discovered I can’t afford. I had forgotten that games require font licenses that are different than what you usually pay for a font. I contacted the foundry (that’s what a company that designs fonts is called) and asked them about licensing the font. They wrote me back with some fairly large numbers.
The result of all this is that I can’t afford the font I wanted to use. I’ve got a few options now:
- use one of the iPhone’s built-in fonts
- find a font from a cheaper foundry
- find a free font that’s still free to license commercially
- work out some kind of royalties deal with the font foundry
I think it’s time to start looking at new fonts. Crap.
Owen
Good (Audio) News
Monday, December 8th, 2008
There’s a lesson here: read the docs, read more docs, read the forums, go back to the docs, read different docs, find a link to a doc you hadn’t read before and read it. It turns out that I can indeed compress my music tracks using something reasonable, like AAC.
Here’s what the confusion was:
I’m using the SoundEngine code that comes with one of Apple’s example projects. They provide you with a way to play background music along with sound FX. I thought that the whole system was using OpenAL for the audio layer, but it turns out that it’s actually using two systems. It uses OpenAL for the sound FX and it uses something called the Audio Queue Services for the background music track.
If you read through the iPhone documentation on OpenAL it tells you that you may only use PCM or IMA4 for the audio format. I thought this applied to the background music (which it does NOT). The problem I thought I had is that IMA4, while it is compression, doesn’t compress a whole lot. However, if you use Audio Queue Services you get two advantages: 1) you can stream audio off disk 2) you get access to a whole bunch of hardware decoders.
There are limitations: you can only have one hardware decoded track running at once. Which is why the music uses Audio Queue Services but the sound FX do not.
So, the end result is that I’ve compressed the audio tracks using AAC and even at a good sampling rate the tracks are about 1MB each. That’s much more reasonable. So it looks like things are back on track audio-wise. Now I just have to deal with all the other stuff that’s going on…
Owen
Naming the Beast
Monday, December 8th, 2008
Why do Mondays suck so much? I’m feeling a little overwhelmed with everything that’s going on with the game. This is the usual state of mild panic that creeps up on you as you start to get close to Alpha (yes, that’s right, I said it: Alpha).
I’m hoping to have the game in an Alpha state by the end of December, go Beta in mid-January, and ship by the end of January. That’s the plan. There’s a lot of factors that might play with that date, though. The main one being the length of time it will take to get Apple approval.
At any rate, back to the matters at hand. I still haven’t picked a name for the game yet. I’ve gone through dozens of names and I’m finally down to two names I like. It’s just a matter of picking the final one. Once I do that I’m planning to update the Games page of the site with screenshots and information about the game. Real info, like how it’s played and what it’s all about.
And in the category of Mondays sucking, I’ve made a disappointing discovery. My composer has created some really kick-ass music tracks for my game and now I’m starting to wonder how many of them will fit. This is the problem with not trying out my audio stuff sooner. I just tried compressing the music files and they’re between 5-10MB each. For four tracks in the game, my game just got 25MB bigger! On a mobile platform, that’s massive. I looked through all of my favourite games on my iPod and all of them are under 10MB for the whole game. I also noticed that none of them include any music.
If I still end up doing a Mac/PC version of the game I’ll definitely be able to use all the music tracks. But now I need to find a solution for the iPhone version of the game. Do I compress the hell out of the music? Do I pick one or two tracks? I feel really stupid about this.
Owen
UI and Storing User Data
Friday, December 5th, 2008
I continued building out the front-end today. I built three new screens this morning and then started thinking about the high scores screen. This lead me to start thinking about how I was going to tackle storing user data in the game. This is where things started to get frustrating…
I started reading documentation on the different ways to write file data to the disk on the iPhone. It turns out there are about 3 or 4 different ways and the documentation doesn’t really explain why you’d use one way over the others. Then the issue is confused further because there are only certain directories you’re allowed to write into and they all behave differently when your iPhone is synced with iTunes (some are backed up, some aren’t, some are deleted every time you quit your app).
I was trying to find a way to store data about the current state of my game (which should fit in 1-2Kb) to the disk in such a way that if I need to release an update for the game at some point it won’t be deleted. So for anyone else doing iPhone development who is reading this: I think the answer is NSUserDefaults. From what I’ve read it seems to get backed up so that the user’s data is restored in the event of an update. I’m not 100% sure, but I guess I’ll find out when I do some testing.
The UserDefaults stuff is all based around dictionary data structures, so then I spent a little while trying to figure out how to use it properly.
Finally, by the end of the day, I was able to save the game options to the disk and reload them after rebooting the game. Hooray! On Monday I’m going to tackle the much more complicated task of storing the game state so that a user can restore a game in progress…
Have a good weekend!
Owen





