Online Book Reader

Home Category

iPhone Game Development - Chris Craft [110]

By Root 1554 0
research, which can spiral out of control if not managed properly. Development costs can increase in terms of both time and money when you consider all the research and trial and error that come into play when pulling it together. Here are a few things to keep in mind while managing a project like this:

Physics engines require a lot of trial and error. Be sure to abstract out all of your control variables so you can tweak without refactoring.

Peer-to-peer can be difficult to debug. With one application that behaves differently as client or host, you end up with lots of conditional logic. When making changes, you will need to redeploy over and over on two separate devices and then establish a connection between them to test. This can take a few minutes to test out a single change.

Caution

When developing sophisticated peer-to-peer applications, you should not rely on the iPhone Simulator. At least two devices are required for proper testing and debugging. The performance differences between device models means that the serious P2P developer should have at least one of each model of device. For instance, the 2G iPod touch has a faster CPU and fewer background processes and connections to manage than the iPhone 3G.

Summary

AmuckPuck is an application that we love to play ourselves. In fact, some of our beta testers, our kids, enjoyed it so much we had to fight with them to get the devices back. In many cases, your experiences with an application can translate to how well your clients will like it.

In this chapter you learned about the challenges presented when developing multiplayer games and a few techniques for dealing with those challenges. You learned how to use Game Kit to establish a peer-to-peer connection between two devices using Bluetooth. Also, as a bonus, you learned a little about implementing game physics and how important it is to create a believable and immersive experience for your players.

AmuckPuck turned out to be well suited to a peer-to-peer connection. The game play is natural and responsive. This is very encouraging; especially since peer-to-peer is a new technology and will hopefully only get better in future versions. Be prepared for the wave of peer-to-peer applications that will flood the shelves on the App Store.

Chapter 8: Taking Turns with Other Players


In This Chapter

Examining turn-based game play

Understanding game design: Strategy

Choosing your connection options

Finding friends to compete against

Programming: Amuck-Tac-Toe

Analyzing business aspects

Now that you have been exposed to connecting players in real time, the transition to turn-based game play should be relatively straightforward. Turn-based games do not carry the technical obstacles you face in real-time game development. The game state in a turn-based game is much more portable and the players' moves are not as time sensitive. With fewer obstacles, you can connect players in many more ways.

Of course, you can (and should) still use peer-to-peer and head-to-head connections, but now you can easily connect players who are miles away with the assistance of a Web server. In this chapter we'll guide you through the process of creating the client side of an app that calls Web services to share messages between players. This by itself is powerful, but then you are going to throw fuel on the fire by adding push notification. With push notification you can give a player the power to initiate a game with a friend who may not even have your application up and running. Push notification can update a badge, display an alert, and play a sound. When the opponent accepts the challenge from the alert, the game can launch as soon as his friend is ready.

We have chosen to discuss these topics in the context of our version of the classic game tic-tac-toe, which we are calling it Amuck-Tac-Toe. Most turn-based games closely follow the same pattern as a board game. This version of Amuck-Tac-Toe is no different. There are turns, moves, and a common game state for the server to manage and the client to display.

You have

Return Main Page Previous Page Next Page

®Online Book Reader