Showing posts with label iPhone. Show all posts
Showing posts with label iPhone. Show all posts

Friday, March 5, 2010

Doodle Blast! - Day 6 - Global Scores

Stats: 66 code files, 5811 lines of code, 6 textures, 247 world flags, 21 sounds

Today, I mostly played with global scores. iPhone has a very sexy control called UITableView. It is essentially a scrollable table of items with lots of possibilities for customization, supporting both linear and hierarchical data visualization. The trouble is that if you want to use all this goodness, you need to learn it first and that takes time. Fortunately for me, Apple has some pretty good documentation about it along with some fun sample code. Plus I found some even more interesting tutorial online. Good thing we have the internet!

Then I had to make sure that the table of scores showed up in Cocos2D mixed in with all the OpenGL goodness. Once again, I was in luck – lots of samples and, actually, a very clean way of doing it:
_tableController = [[ScoreTableController alloc] initWithStyle:UITableViewStylePlain];
UITableView* table = _tableController.tableView;
[[[CCDirector sharedDirector] openGLView] addSubview:table];
I wrote a custom ScoreTableController that subclasses UITableViewController and deals with all the custom display logic. Then I simply added the table that the controller manages as a sub-view of the root OpenGL view. I love it when frameworks actually make your life easier.

The one glitch I ran into was fading. The page that hosted the table view fades in and out of black when it first appears as well as when the user navigates back to the main menu. Cocos2D has a nice set of transitions built into it. However, the table wasn’t part of the OpenGL world and, hence, it was completely independent as far as fading was concerned. So what I ended up doing was fading in the table after the background was already fully there and, vice-versa, fading out the table before fading out the rest of the background. If you look for it in the final product, you can see it, but most people don’t notice.

Sunday, February 28, 2010

Doodle Blast! - The Idea

Shortly after I released Pop Fizz, I ended up being sick in bed with some flu. As I was lying there, I was thinking that it would be really fun to produce something else. However, at that point I wasn’t ready to invest two more months into something that would just disappear into the app void again. That just seemed like too long of a time to waste. A week, on the other hand, didn’t seem that long. So, the thought occurred to me – what can I crank out in seven days?

I chatted with my brother and we remembered our Sybila Soft days and the game with a tank and an ever-growing stack of guns. Then, just to prove his point, he sent me the following sketch:


I was sold. More importantly, I wanted to play that tank because it looked like fun. So, I was presented with a challenge: how can I turn that picture into a game in seven days or less?

The first thing I did was I cheated. I turned the first day into a weekend to create a simple prototype and test the feasibility of the idea. And that’s where we begin our daily count-down...

Pop Fizz is born!

Skip forward to last year, when I discovered that iPhone is actually a cool platform to code against and started playing with it. I ran across Cocos2D and Chipmunk as two independent, community-supported frameworks that made the job considerably easier. Cocos2D is a well-polished set of libraries that abstracts all the OpenGLES goo away from you and gives you a clean interface to manipulate 2D sprites (along with a whole bunch of other goodness). I worked with several other frameworks in the past and I must say I was very impressed and thankful for all the good work that went into it. Similarly, Chipmunk is a simple, but powerful physics engine that takes care of all the physics goo for you so, in the end, all you have to worry about is the game dynamic itself. Here is a big shout out to the Cocos2D and Chipmunk creators and contributors – thank you!

Back to the story, though. I was on a bus from Syracuse to Boston last November. For those of you who aren’t familiar with the route, let’s just say that the trip is a full-day joyride on sketchy inter-urban buses. Fortunately for me, Greyhound just upgraded their buses to have power plugs and WiFi onboard. The WiFi was nonexistent, but the power plugs worked (at least the one at my seat), which gave me whooping 8 hours of uninterrupted computer play during which I was trying to come up with a simple game for the iPhone. This is what I came up with:


A bunch of duplicate symbols on the screen – you match two identical symbols, they pop and disappear from the screen. Simple, but fun (or at least fun enough to make an 8-hour bus ride bearable). Following that trip, I spent two months turning that idea into a game, which eventually became Pop Fizz:


I managed to squeeze in quite a few features into the original idea – three different worlds with their own set of rules each, three different game types within each world giving you nine total game permutations, close to thirty achievements, InApp purchase integration, Twitter support, global leader boards, animated menus, ... you name it. In the end, I was very excited about the result. However, the game didn’t do particularly well. A lot of people downloaded the free version, but only a handful upgraded to the paid one, and eventually Pop Fizz got lost in the sea of other arcade games out there.

The good news was that I solved a lot of common problems (like writing a silly dialog box that allows the user to enter their name – I thought that would be an iPhone freebie, but no…) and I got quite comfortable with the platform and its tools (although there are days when I still curse Xcode’s auto-completion logic or the compiler’s ability to generate warnings but then hiding them from you and claiming success).

Saturday, February 27, 2010

Good ol' 80s

The idea for Doodle Blast! has been hatching around for at least two decades. In the 80s, I was growing up in Europe and, back then, Sinclair ZX Spectrum was the pinnacle of home computing as we knew it. It was a pretty cool black box. It came with 48k of RAM (which is less than the size of most icons these days), a built-in BASIC editor and interpreter, whooping 16 colors (only two of which could occupy any 8x8 pixel area), and a jack for a tape recorder that allowed you to store programs on audiotapes as 5mins of screechy noise. In short, it was daBomb! The best parts about it were that coding it was rather simple and that an independent person could sit down and create something that maxed out the capabilities of the machine. In short, it wasn’t very different from the iPhone today.

Back then, my brother and two of our friends decided to form a “company” (and I use that term very loosely) called Sybila Soft to write games for the Spectrum and distribute it to our friends. Friend-to-friend distribution was the modus operandi of the time and we were often surprised ourselves at how far our games travelled. The best part is that those games are still alive and floating around the Internet today, ready to be downloaded and replayed in some java-based Sinclair emulator running as a widget on your desktop.

Anyway, that was the first time we came up with the idea of a tank with an ever-growing tower of more and more obscure guns. However, we grew up out of our teens, moved on with our lives, and the idea never came to fruition.

The Making of Doodle Blast!

It’s two days after I published Doodle Blast! on iTunes. Originally, I thought about writing a day-to-day blog as I was writing the app, chronicling the process and some of the decisions that went into making it. However, what ended up happening is that I spent most of my time cranking out code, having little time for anything else. So, now that I have some time on my hands, I’m going to write a little post-mortem blog instead. I have saved daily snapshots of the code base, so I can re-create the progress and share it here with you.

Now, I’m not much of a blogger, so if I’m going too slow, too fast, or too dull, lemme know. I’m open to suggestions.