Posted by: Morten Nobel-Jørgensen | October 8, 2008

The Oswald Touch Experience


Oswald Touch is an iPhone game I created on the iPhoneDevCamp 2008. In this blog, I’ll describe the 17 hours non-stop coding it took creating the Oswald Touch. Note that this blog is a cross post from iphone.devcamp.dk.

Motivation and goals

I spent the weeks before iPhoneDevCamp thinking about what application I should program on the camp. I was looking for something that used the as little as possible from the rich API the SDK provide, since I didn’t have any experience with development for iPhones (or Mac).

Thanks to a commercial of the Danish TV-2’s 20 years anniversary, I remembered a game about the ice-bear Oswald jumping on ice and whales. The game was broadcasted on TV-2, where the users controlled the bear using their phone.

So I decided to create an Oswald remake for the iPhone. I found some suitable screenshots for the application at http://www.lemon64.com/games/details.php?ID=2548 . I estimated that I could program the game myself on the camp, so I decided to work alone on the project.

Developer Diary

The following diary is based on the plan I made as the first thing after I arrived to iPhoneDevCamp. I figured that I would be unable to plan anything in the middle of the night … but might be able to stick to a plan.

  • 19:00 Setup, Chit-chat, pizza, Tech talk, let the coding begin….
  • 00:00 Create a splash screen. I spent the first 3 hours trying to figure out why the low-level function CGContextDrawImage flipped the image vertically. In the end I gave up, when found out that the higher level object UIImage could also draw itself to a CGContext correctly.
  • 01:00 Creating a background. Started with some water texture, but decided to keep the original blue Oswald water color
  • 01:30 Extract all game graphics from screenshots (ice, whale, Oswald, Oswaldine).
  • 02:30 Create a game model class. Basically the model is an array for each column of objects and an offset to make the object move. The characters both has a x and y coordinate that represents their location (in the array)
  • 03:00 Let the view draw the model
  • 04:00 Implement touch events to move the characters.
  • 06:00 Add a new thread that updated the model so the ice and the whales moved.
  • 08:00 Added some logic (two players cannot be on same location) and fixed some bugs.
  • 10:00 Added game over screen
  • 11:00 Brunch and presentation
  • 11:30 Wow … I won … I bit too tired to realize it.

Application architecture

  • Model-View-Controller pattern
    • 2 views
    • 1 controller
    • 1 model
  • Views: UIView
    • Delegates touch events to controller
    • Overwrites drawRect to do the actual drawing
  • Controller
    • Mapping mouse events to model updates (movement of Oswalds)
  • Model
    • Location of game objects
    • Logic (disallow movement of water, out of bounds, only one bear per location)
    • Game thread – updates the location of game objects
  • Memory management
    • Load everything on startup (and hope it fits in memory)
    • After startup the game does not allocate any new objects, so there shouldn’t be any memory leaks.

Conclusion

What a great way to end the week. I really enjoyed my first experience with the iPhone SDK, it’s a great platform with a better and more complete SDK than any other handheld device I have worked with.
And I want to thank the organizers for all the work they put in it. Great job.

I hope to see you all for the iPhoneDevCamp 09!

Morten Nobel-Jørgensen
http://www.nobel-joergensen.com/

oswald_touch_2-150x150 oswald_touch_splash-150x150

Small video wma

Small video mov

Advertisement

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

Categories

%d bloggers like this: