Book Image

Learning Unity iOS Game Development

Book Image

Learning Unity iOS Game Development

Overview of this book

Table of Contents (14 chapters)
Learning Unity iOS Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
6
Main Menu, iAds, Leaderboards, Store Purchases, and Achievements
Index

Creating the Bundle ID and Game App


In the top-left corner of the screen, you will see a blue + sign; click on it.

Before you enter any of the information, click on Developer Portal at the bottom of the window. This allows you to set up the Bundle ID before creating the application.

Once at Developer Portal, the App ID Description can be the name of the application. The App ID Prefix should be filled out for you. I will use Team ID. I used Explicit App ID and used the reverse-domain name style: com.mycompanyname.appname. For App Services, I will use Game Center and In-App Purchase:

Click on Continue.

On the next page, Confirm your App ID will display the information that you have entered. If correct, click on Submit. It should follow with the Registration Complete page.

Go back to the My Apps page in iTunes Connect. Again, click on the blue + sign and then New iOS App.

In the popup window that shows, enter the name, version, language, SKU, and bundle ID. If you are curious about what any of these are, you can click on the question mark sign next to the name.

Note

SKU stands for Stock keeping unit. It is a unique tracking number that is used in the app store, which is specific to your application. You can use anything you like as long as it's unique from any of your other apps. For example, you can use com.mycompanyname.appname or your birth date 01012015.

If the name you chose is not taken, you will be taken to the My Apps page for your new game app.

Setting up App pricing and territories

On the App settings page, click on Pricing. You can get here by clicking on My Apps and then opening your game by clicking on its icon.

Pricing is the page where you can choose the initial cost of your application and the territories that will be available.

Availability Date should be the date, in which you will create this application. You can leave it as default for now. In the future, if you want to change the price for something, such as a sale, Availability Date will dictate how long this pricing tier can last.

For my game, it will be free. To set this or any other price, click on the Price Tier drop-down list and select the price.

To use Discount for Educational Institutions, use your own discretion:

The last thing you need to do on this page is click on specific territories at the bottom of the settings page. Everything is defaulted to be selected. If there are any territories you don't wish to have your game available on, click on the checkbox next to it. When done, click on Save at the bottom of the page.

The page should load back to Rights and Pricing and have the Completed box at the top of the page.

Creating an in-app purchase

First, click on the My Apps drop-down list at the top of the page and select My Apps. Then, click on your game to go back to the settings page.

Next, click on In-App Purchases.

The page will read No In-App Purchases have been set up for this app. To set one up, click on Create New.

Then, click on Non-Consumable.

There are five purchase types:

  • Consumable

  • Non-Consumable

  • Auto-Renewable Subscriptions

  • Free Subscription

  • Non-Renewing Subscription

Reference Name is the name that will be displayed in iTunes Connect and in Sales Trend reports. It is not displayed on the App Store. It's a way for us to have a reference to what it is we will sell when we look at reports.

Name it Remove_Ads with an underscore.

The product ID is a unique ID that is used to report the purchase. Typically, I would name this as gamename.referencename. Generally, this would be written as <<gamename>>.<<referencename>>, which symbolizes that you can put anything between these fields; however, as not all of you are aware that these symbols represent a dynamic field—meaning that it is about the formatting and not the literal text—gamename.referencename is the literal view of how it's inputted.

As I don't know the name of your games and we will both have to use this in the future chapters, the naming will have to match.

Name the product ID as G_RemoveAds with an underscore.

Under Pricing and Availability, select Yes for Cleared for Sale. For Price Tier, I have selected Tier 1, which is $0.99USD. If you are curious about the pricing matrix, click on View Pricing Matrix.

At the bottom of the page, click on Add Language.

A pop-up window will appear. Select English as the language if not already selected. Display Name is the name of the in-app purchase that will be seen by customers.

Enter Remove Ads.

Description is the description of the in-app purchase that will be used by App Review during the review process. It is used to describe what the purchase will do.

Enter Stops displaying iAds in the game.

Then, click on Save.

For Hosting Content With Apple, select No.

There is no need to have Review Notes.

We will add a screenshot of the purchase in the game when it is done in a later chapter. As a note, without screenshots, Apple will not be able to put the game on the App Store.

Now, click on Save.

The page should load to show the purchase we just made and have the status of Waiting for screenshot. We will add a screenshot in a later chapter.

Click on Done. This should load you back to the App page. If not, click on My Apps and then select My Apps. Now, select your game.

Game Center, leaderboards, and achievements

When you are back at your game settings page, click on Game Center. The Enabled bar should already be set. If you see Disabled, click on it. The bar should turn to Enabled, and the color should turn to blue.

The next tab has two options: Single Game and Group of Games. Select Enable For Single Game.

Under Leaderboards, click on Add Leaderboard.

On the next page, under Single Leaderboard, click on Choose.

The next page will load with similar settings as the in-app purchase. For Leaderboard Reference Name, enter Distance.

For Leaderboard ID, enter G_Distance.

The Type of Score Format is Integer. This allows you to have a value that keeps track of the distance the player has moved. By whole distance, I mean a nondecimal-based value, such as 1, 2, 3, 4, and so on.

The Type of Score Submission should be set to Best Score. Leave this as it is. This way, we can save the distance with the player, save the profile locally, and only submit the score when its distance is greater than what they had done previously.

Sort Order is the order in which the leaderboards will appear. As the distance we are looking for is the highest value, change this to High to Low. This way, the player with the farthest distance will be at the top of the list.

As we have not programmed the value to calculate the distance, go ahead and leave Score Range blank. This will give us plenty of room to work with.

At the bottom of the window, click on Add Language.

Set Language to English and Name to Distance.

Score Format is a way to set a difference in the formatting of the score. For example, if our score was based on money, we would want to use a comma to separate the numbers. However, as we will use this value as a distance, we need to separate the values with a decimal point. Select Fixed Point (10.000.012,218 ).

The Score Format suffix is what will be added to the end of the score. Like before, if we were using money, we could end the formatting with "Dollars "or "Coins". As we will use this as a distance traveled, enter Yards.

Leave the Image field blank.

Then, click on Save.

The page should load back to the Add Leaderboard page with the information you have set.

Now, click on Save.

Tip

For the purposes of this book, one leaderboard is enough. Feel free to add more though! You could include things, such as "Deaths", "Pickups Collected", or "Attempts".

The page should load back to the Game Center page. If not, go back to My Apps, select your app and then Game Center.

For the achievements, we will set three of them. One for surviving "100 yards", one for "collecting 100 pickups", and one for "Play 10 Rounds". At the bottom of the page, click on Add Achievement.

For Reference Name of Achievement, enter 100Yards.

For ID of Achievement, enter G_100Yards.

Again, usually games would refer to these IDs with a format such as <<gamename>>.G_100Yards or literally gamename.G_100Yards, but because these names have to match the code that we are writing together and the game name is going to vary, you can use the direct achievement name: G_100Yards.

Point Value is the number of achievement points the Game Center account will be credited with when the achievement is collected. The value is completely arbitrary; you can enter anything you want. I will use 10.

Tip

Make sure to leave room for the next two achievements because if you use all 1000 points with this one, you won't be able to make any more achievements.

Select No for Hidden. If you use Yes, the achievement won't be in the list of achievements for our game until they have earned it if the user was to look at Game Center. As I would like the players to see their achievements, they can earn before earning them; selecting No will allow them to do this.

For Achievable More Than Once, select No. This is a one time achievement.

At the bottom of the page, click on Add Language.

The Title is 100 Yards.

The Pre-earned Description tab is what will appear in Game Center if the user is to look it up. You can enter what you like to describe this achievement. I will use Survive for 100 yards.

The Earned Description tab is what will display on Game Center after the user collects the achievement. Again, this is open. I will use You survived 100 yards!.

A package of art is included with this book. In the iTunes_Connect_Achievements folder, use the image called 100Yards.png for Choose File.

Tip

Downloading the example code

You can download the example code files for all Packt books you have purchased from your account at http://www.packtpub.com. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.

The three files look similar to the following image:

Click on Save.

Back on the Add Achievement page, it should list the information for the 100 Yards achievement. Then, click on Save.

Follow the same method for the next two achievements with the following settings:

  • [100 Pickups]:

    • Reference Name: 100Pickups

    • Achievement ID: G_100Pickups

    • Points: 10

    • Hidden: No

    • Achievable More Than Once: No

    The following is the Language setting for [100 Pickups]:

    Language: English

    Title: 100 Pickups

    Pre-earned Description: Collect 100 Pickups

    Earned Description: You have collected 100 Pickups!

    Image: 100_Pickups.png

  • [Play 10 Rounds]:

    • Reference Name: 10Rounds

    • Achievement ID: G_10Rounds

    • Points: 10

    • Hidden: No

    • Achievable More Than Once: No

    The following is the Language setting for [Play 10 Rounds]:

    Language: English

    Title: 10 Rounds

    Pre-earned Description: Play 10 rounds

    Earned Description: You have played 10 rounds!

    Image: 10_Rounds.png

Go back to the main page for your app and scroll down to where you see Game Center. The button should be grayed out. Click on it and it should turn green.

Click on the + sign next to Leaderboards. In the window that pops up, select the single leaderboard that we set up and then click on Done.

Now, click on the + sign next to Achievements. Select all the achievements we set up and then click on Done.

At the top of the screen, there is a Save button. Click on it to save the settings.

Tip

Once your game goes live, the achievement IDs and the point values for them is impossible to change. Make sure that during testing, you decide on these options as soon as the game is on the store; you will never be able to alter them.