Preface - Sparrow iOS Game Framework Beginner's Guide (2014)

Sparrow iOS Game Framework Beginner's Guide (2014)

Preface

Game development is probably one of the hardest and most rewarding challenges in software development. If we are to start completely from scratch, it will take a very long time to see any results.

With the introduction of the iPhone in 2007 and subsequent devices in the following years, developing applications for mobile devices took off, and more than 1,000,000 apps can now be downloaded from the App Store.

Luckily, Sparrow, an open source game framework for iOS, provides us with a number of predefined classes and methods that will help in our game development process.

Instead of showing how to develop a part of a game example-by-example during the course of the book, we will learn each stage of game development. With each chapter, our game will mature from being just an idea to a complete entity, while extending our knowledge of Sparrow.

What this book covers

Chapter 1, Getting Started with Sparrow, shows us how to set up Xcode, Sparrow, and our game template that we will use throughout the book. This chapter also sets up our goals and expectations for the kind of game we will develop.

Chapter 2, Displaying Our First Objects, explains the concept of display objects, which we need to achieve in order to get anything to show up on the screen, and how to manipulate these objects.

Chapter 3, Managing Assets and Scenes, introduces us to the concepts of scene and asset management and how to implement them for our purposes.

Chapter 4, The Basics of Our Game, deals with setting up our game to work on iPhone, iPod Touch, and iPad in the same manner. We will also create the game skeleton in this chapter.

Chapter 5, Beautifying Our Game, covers moving and animating our entities on the screen. We will also learn how to generate sprite sheets, what to consider when using sprite sheets, and how to integrate them into our game.

Chapter 6, Adding Game Logic, focuses on getting actual gameplay into our game as well as managing our game-relevant data in separate files.

Chapter 7, User Interface, shows us how to implement the user interface in our game, for example, displaying text on the screen, structuring our user interface, and updating the user interface to what is currently happening in the game.

Chapter 8, Artificial Intelligence and Game Progression, explains what we need to know in order to implement basic artificial intelligence and how we need to apply this for our enemies in the game.

Chapter 9, Adding Audio to Our Game, covers loading audio and how to integrate them in our game.

Chapter 10, Polishing Our Game, deals with adding the last 10 percent to our game. We are going to add a main menu, an intro, and tutorial mechanics for a smoother game experience.

Chapter 11, Integrating Third-party Services, takes a look at how we could integrate third-party services such as Apple Game Center in the hope of improving our players' experience.

What you need for this book

In order to develop applications for iOS, you need to have a Mac and, preferably, the latest version of Mac OS X. Although an Apple developer account and iOS Developer Program are not necessary, it is recommended as it allows you to run the examples on actual devices such as the iPod Touch, iPhone, and iPad and distribute your applications to the Apple App Store. Keep in mind that the iOS Developer Program comes with additional costs.

There is no need to have Sparrow and Xcode installed on your system; we will cover the installation process in the first chapter.

Who this book is for

This book is intended for those who are interested in game development, those who have already dabbled in game development but haven't made any games for mobiles yet, and those who wish to publish a game on the Apple App Store in the future.

You need a solid understanding of Objective-C to follow the examples in the book, and some experience in game development is definitely helpful, although is not necessarily required.

Conventions

In this book, you will find several headings appearing frequently.

To give clear instructions of how to complete a procedure or task, we use:

Time for action – heading

1. Action 1

2. Action 2

3. Action 3

Instructions often need some extra explanation so that they make sense, so they are followed with:

What just happened?

This heading explains the working of tasks or instructions that you have just completed.

You will also find some other learning aids in the book, including:

Pop quiz – heading

These are short, multiple-choice questions intended to help you test your own understanding.

Have a go hero – heading

These practical challenges give you ideas for experimenting with what you have learned.

You will also find a number of styles of text that distinguish between different kinds of information. Here are some examples of these styles, and an explanation of their meaning.

Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "This class needs to be inherited from the SPSprite class."

A block of code is set as follows:

// Setting the background

SPSprite *background = [[SPSprite alloc] init];

[self addChild:background];

// Loading the logo image and bind it on the background sprite

SPSprite *logo = [SPImage imageWithContentsOfFile:@"logo.png"];

[background addChild:logo];

When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:

// Setting the background

SPSprite *background = [[SPSprite alloc] init];

[self addChild:background];

// Loading the logo image and bind it on the background sprite

SPSprite *logo = [SPImage imageWithContentsOfFile:@"logo.png"];

[background addChild:logo];

Any command-line input or output is written as follows:

sudo gem install cocoapods

pod setup

touch Podfile

pod install

New terms and important words are shown in bold. Words that you see on the screen, in menus or dialog boxes for example, appear in the text like this: "On the Select Destination Location screen, click on Next to accept the default destination."

Note

Warnings or important notes appear in a box like this.

Tip

Tips and tricks appear like this.

Reader feedback

Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or may have disliked. Reader feedback is important for us to develop titles that you really get the most out of.

To send us general feedback, simply send an e-mail to <feedback@packtpub.com>, and mention the book title through the subject of your message.

If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide on www.packtpub.com/authors.

Customer support

Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.

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.

Errata

Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you would report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the errata submission form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website, or added to any list of existing errata, under the Errata section of that title.

Piracy

Piracy of copyright material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works, in any form, on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.

Please contact us at <copyright@packtpub.com> with a link to the suspected pirated material.

We appreciate your help in protecting our authors, and our ability to bring you valuable content.

Questions

You can contact us at <questions@packtpub.com> if you are having a problem with any aspect of the book, and we will do our best to address it.