Book Image

iOS Game Development By Example

By : Samanyu Chopra
Book Image

iOS Game Development By Example

By: Samanyu Chopra

Overview of this book

Game development has always been an exciting subject for game enthusiasts and players and iOS game development takes a big piece of this cake in terms of perpetuating growth and creativity. With the newest version of iOS and Sprite Kit, comes a series of breathtaking features such as Metal rendering support, camera nodes, and a new and improved Scene Editor. Conceptualizing a game is a dream for both young and old. Sprite Kit is an exciting framework supported by Apple within the iOS development environment. With Sprite Kit, creating stunning games has become an easy avenue. Starting with the basics of game development and swift language, this book will guide you to create your own fully functional game. Dive in and learn how to build and deploy a game on your iOS platform using Sprite Kit game engine. Go on a detailed journey of game development on the iOS platform using the Sprite Kit game engine. Learn about various features implemented in iOS 8 that further increase the essence of game development using Sprite Kit. Build an endless runner game and implement features like physics bodies, character animations, scoring and other essential elements in a game. You will successfully conceive a 2D game along with discovering the path to reach the pinnacle of iOS game development. By the end of the book, you will not only have created an endless runner game but also have in-depth knowledge of creating larger games on the iOS platform. Style and approach An easy-to-follow, comprehensive guide that makes your learning experience more intriguing by gradually developing a Sprite Kit game. This book discusses each topic in detail making sure you attain a clear vision of the subject.
Table of Contents (17 chapters)
iOS Game Development By Example
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Preface

Sprite Kit is a set of tools to develop 2D games for the Apple iOS platform. Sprite Kit provides powerful features for graphics and the animation of images having texture, and so on. It is one of the best available game engines for iOS devices. It is very simple and powerful, with full support provided by Apple, hence it is more reliable and convenient than any third-party game engine available today.

The Integrated Development Environment (IDE), Xcode, provided by Apple for app development can also be used for Sprite Kit game development. Objective-C or Swift, either of the two programming languages can be used for Sprite Kit game development. Sprite Kit is already being used by many developers for iOS game development. There is a good amount of information available that focuses on Sprite Kit set up and development. However, a structured and concise resource discussing about the complete development process and feature set is not currently available. This book explains the basics of Sprite Kit development and allows a beginner to become skilled in Sprite Kit game development using the Swift programming language with its complete set of development features. This book is a complete guide for Sprite Kit and a perfect starting point for those wanting to set sail on the iOS game industry.

What this book covers

Chapter 1, An Introduction to Sprite Kit, introduces you to the Sprite Kit game engine, along with its various elements and features. It also helps in setting up a new Xcode project for developing a Sprite Kit game.

Chapter 2, Scenes in Sprite Kit, explains an important topic in Sprite Kit, that is, scenes. Along with this, there is a brief about the node tree drawing order.

Chapter 3, Sprites, explains sprites and their properties. It also applies some of the properties in the example game.

Chapter 4, Nodes in Sprite Kit, discusses about nodes and its subclasses in detail. It also explains the implementation of various node subclasses in the example game.

Chapter 5, Physics in Sprite Kit, talks about physics simulation in a Sprite Kit game. It explains the types of physics bodies. Physics capabilities are applied to the example game in this chapter.

Chapter 6, Animating Sprites, Controls, and SceneKit, covers animating nodes and adding controls to a Sprite Kit game. These features are added in the example game. It also talks about SceneKit.

Chapter 7, Particle Effects and Shaders, discusses about particle effects and shaders, along with their implementation in the example game.

Chapter 8, Handling Multiple Scenes and Levels, helps us understand the need for different levels in a game. This chapter also explains how to create multiple scenes.

Chapter 9, Performance Enhancement and Extras, discusses in detail how to improve the performance of a Sprite Kit game, along with performance measuring using instruments. It also explains the scoring system, sound, and player running animation in the example game.

Chapter 10, Revisiting Our Game and More on iOS 9, discusses the various steps involved in the development of a game, and introduces readers to the Game Center and discusses new features that will be introduced in iOS 9.

What you need for this book

Readers will require Xcode, which is the IDE provided by Apple for developing software, and also the sample game for Mac OS X and iOS devices. An iOS-running device will be helpful to the readers for running the example game that is being developed in the book.

Who this book is for

This book is for beginners who want to start their game development odyssey on the iOS platform. If you are an intermediate or proficient game developer hailing from a different development platform, this book will be the perfect gateway into the Sprite Kit engine. The reader does not need to have any prior knowledge of Sprite Kit, and building games on the iOS platform.

Conventions

In this book, you will find a number of text styles 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: "To make a sprite in a game, we have to make an instance of the SKSpriteNode class."

A block of code is set as follows:

init(name: String){
  //it is designated initializer . initialization part

}
convenience init(){
  //Calling the Designated Initializer in same class
  self.init(name: "Hello")
}

New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "Untick the Portrait checkbox and tick Landscape Left under the Device Orientation section."

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 disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.

To send us general feedback, simply e-mail , and mention the book's title in 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 at 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 color images of this book

We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from: https://www.packtpub.com/sites/default/files/downloads/B04201_4694OS_Graphics.pdf.

Downloading the example code

You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. 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 could 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.

To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.

Piracy

Piracy of copyrighted 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 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

If you have a problem with any aspect of this book, you can contact us at , and we will do our best to address the problem.