O'Reilly logo

iOS Game Programming Cookbook by Bhanu Birani, Chhavi Vaishnav

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Assigning roles to players

In this recipe, we will take our game template to the next step by assigning the roles to our players. This means we will be logically dividing the users and assigning roles to them. This will provide an individual identity to the players.

Getting ready

Before starting with assigning or as we can also call it, an allotment of players identity (which is first player and second player), we should be familiar with the Multipeer Connectivity framework. We must also have a basic knowledge of network packet sending and receiving. In this section we will be assigning the first and second player identities to the players once they are connected using the MCBrowserViewController having just described it in the preceding recipe ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required