Mastering Android Game Development with Unity
By Wajahat Karim and Shekar Siddharth
()
About this ebook
- Develop complex Android games with the help of Unity's advanced features such as artificial intelligence, high-end physics, and GUI transformations.
- Create amazing Graphical User Interfaces (GUIs) with Unity's new uGUI system
- Unravel and deploy exciting games across Android devices
If you are a Unity 5 developer and want to expand your knowledge of Unity 5 to create high-end complex Android games, then this book is for you. Readers are expected to have a basic understanding of Unity 5, working with its environment, and its basic concepts.
Related to Mastering Android Game Development with Unity
Related ebooks
Unity Multiplayer Games Rating: 5 out of 5 stars5/5Blueprints Visual Scripting for Unreal Engine Rating: 0 out of 5 stars0 ratingsUnreal Engine Game Development Cookbook Rating: 0 out of 5 stars0 ratingsUnity Animation Essentials Rating: 0 out of 5 stars0 ratingsUnreal Engine 4 AI Programming Essentials Rating: 0 out of 5 stars0 ratingsGetting Started with Unity 5 Rating: 5 out of 5 stars5/5Building a Game with Unity and Blender Rating: 0 out of 5 stars0 ratingsLearning Android Game Development Rating: 0 out of 5 stars0 ratingsUnity 5 for Android Essentials Rating: 4 out of 5 stars4/5Unity from Zero to Proficiency (Beginner): Unity from Zero to Proficiency, #2 Rating: 5 out of 5 stars5/5Mastering Unity 5.x Rating: 0 out of 5 stars0 ratingsLearning Unreal® Engine iOS Game Development Rating: 0 out of 5 stars0 ratingsGetting Started with 3D Animation in Unity: Getting Started, #1 Rating: 0 out of 5 stars0 ratingsA Beginner's Guide to 2D Platform Games with Unity: Beginners' Guides, #1 Rating: 0 out of 5 stars0 ratingsA Beginner's Guide to 2D Shooter Games: Beginners' Guides, #2 Rating: 0 out of 5 stars0 ratingsUnity 3.x Game Development Essentials: Game development with C# and Javascript Rating: 0 out of 5 stars0 ratingsMastering iOS Game Development Rating: 0 out of 5 stars0 ratingsMastering Unreal Engine 4.X Rating: 0 out of 5 stars0 ratingsMastering Android Game Development Rating: 0 out of 5 stars0 ratingsUnity AI Programming Essentials Rating: 0 out of 5 stars0 ratings3D Game Design with Unreal Engine 4 and Blender Rating: 0 out of 5 stars0 ratingsA Quick Guide to Artificial Intelligence with Unity: Quick Guides, #4 Rating: 0 out of 5 stars0 ratingsA Quick Guide to 2d Infinite Runners with Unity: Quick Guides, #3 Rating: 0 out of 5 stars0 ratingsAndroid Studio Cookbook Rating: 4 out of 5 stars4/5Android System Programming Rating: 5 out of 5 stars5/5Swift 2 Design Patterns Rating: 0 out of 5 stars0 ratingsPractical Game AI Programming Rating: 0 out of 5 stars0 ratingsCreating Dynamic UIs with Android Fragments - Second Edition Rating: 0 out of 5 stars0 ratingsA Quick Guide to Card Games with Unity: Quick Guides, #5 Rating: 0 out of 5 stars0 ratingsVideo Game Careers - Beginners Guide: Video Game Careers, #1 Rating: 0 out of 5 stars0 ratings
Data Modeling & Design For You
Data Visualization: a successful design process Rating: 4 out of 5 stars4/5Thinking in Algorithms: Strategic Thinking Skills, #2 Rating: 5 out of 5 stars5/5The Secrets of ChatGPT Prompt Engineering for Non-Developers Rating: 5 out of 5 stars5/5Mastering Agile User Stories Rating: 4 out of 5 stars4/5Supercharge Power BI: Power BI is Better When You Learn To Write DAX Rating: 5 out of 5 stars5/5Data Analytics for Beginners: Introduction to Data Analytics Rating: 4 out of 5 stars4/5Raspberry Pi :Raspberry Pi Guide On Python & Projects Programming In Easy Steps Rating: 3 out of 5 stars3/5Living in Data: A Citizen's Guide to a Better Information Future Rating: 4 out of 5 stars4/5WordPress For Beginners - How To Set Up A Self Hosted WordPress Blog Rating: 0 out of 5 stars0 ratingsData Analytics with Python: Data Analytics in Python Using Pandas Rating: 3 out of 5 stars3/5Logic Design: A Review Of Theory And Practice Rating: 0 out of 5 stars0 ratingsLearn T-SQL Querying: A guide to developing efficient and elegant T-SQL code Rating: 0 out of 5 stars0 ratings150 Most Poweful Excel Shortcuts: Secrets of Saving Time with MS Excel Rating: 3 out of 5 stars3/5Think Like a Data Scientist: Tackle the data science process step-by-step Rating: 0 out of 5 stars0 ratingsBrainstorming and Beyond: A User-Centered Design Method Rating: 0 out of 5 stars0 ratingsThe Systems Thinker - Mental Models: The Systems Thinker Series, #3 Rating: 0 out of 5 stars0 ratingsR in Action, Third Edition: Data analysis and graphics with R and Tidyverse Rating: 0 out of 5 stars0 ratingsA Concise Guide to Object Orientated Programming Rating: 0 out of 5 stars0 ratingsText as Data: A New Framework for Machine Learning and the Social Sciences Rating: 0 out of 5 stars0 ratingsSpreadsheets To Cubes (Advanced Data Analytics for Small Medium Business): Data Science Rating: 0 out of 5 stars0 ratingsDAX Patterns: Second Edition Rating: 5 out of 5 stars5/5Learning Cypher Rating: 0 out of 5 stars0 ratingsNeural Networks: Neural Networks Tools and Techniques for Beginners Rating: 5 out of 5 stars5/5Graph Databases in Action: Examples in Gremlin Rating: 0 out of 5 stars0 ratings
Related categories
Reviews for Mastering Android Game Development with Unity
0 ratings0 reviews
Book preview
Mastering Android Game Development with Unity - Wajahat Karim
Title Page
Mastering Android Game Development with Unity
Exploit the advanced concepts of Unity to develop intriguing, high-end Android games
Siddharth Shekar
Wajahat Karim
BIRMINGHAM - MUMBAI
Copyright
Mastering Android Game Development
with Unity
Copyright © 2017 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system,
or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the authors, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: May 2017
Production reference: 1180517
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham
B3 2PB, UK.
ISBN 978-1-78355-077-7
www.packtpub.com
Credits
About the Authors
Siddharth Shekar is a game developer with over 5 years of experience in the game development industry and 11 years of experience in C++, C#, and other programming languages. He is adept at graphics libraries and game engines such as Unity and Unreal Engine. He has also published games on the app stores of iOS, Android, Amazon, and Windows.
Siddharth is the author of the books Learning Cocos2d-x Game Development, Learning iOS 8 Game Development Using Swift, and Cocos2d Cross-Platform Game Development Cookbook and the technical reviewer for iOS Programming Cookbook, all by Packt Publishing.
Currently, he is a lecturer at the games department at Media Design School, Auckland, New Zealand. He teaches graphics programming and PlayStation 4/PS Vita native game development and mentors final year production students.
To know more about Media Design School on their website. You can also find Siddharth on Twitter at @sidshekar.
I would like to thank my parents for supporting me in everything that I choose to do. I would also like to thank Media Design School for encouraging me to continue working on this book. Finally, I would like to thank Packt for putting this book together and offering me the opportunity to write this book.
Wajahat Karim is a seasoned mobile app and game developer with extensive experience in diversified technologies, as well as more than 7 years of software development experience.
Wajahat received his information and communication systems engineering degree from the NUST School of Electrical Engineering and Computer Sciences (SEECS), Islamabad, Pakistan. He has been working on games since he was 14 years old and is skilled in many platforms, including Android SDK, AndEngine, Adobe Flash, Adobe AIR, Game Maker, and Unity3D.
He is skilled, not only in programming and coding, but also in computer graphic designing tools such as Adobe Photoshop, Adobe Illustrator, Adobe Flash, and Autodesk Maya. Recently, he also worked with the government of Oman in Muscat, to create a real-time election monitoring app for Android and iOS for their Shura Elections, 2015. He has run multiple startups from time to time and has also worked in a virtual reality and augmented reality startup.
Currently, besides being a full-time development manager at a multinational company, he is working with a startup that allows Android developers to boost their app growth and reward their users through in-app perks.
Wajahat has deep passion in game development, entrepreneurship, and writing. He has previously coauthored the book Learning Android Intents by Packt Publishing.
You can reach Wajahat on his personal website.
First of all, I would like to thank to ALLAH (the Almighty) for everything and this life. I would like to thank a very good friend of mine, Fazal Hayat aka Faizi, who helped me initiate this book and made me believe that I could complete this book. I would also like to thank my lovely sisters, Navera Karim and Sumera Aijaz, who have always been proud of me and have always encouraged and motivated me to pursue my dreams and focus on the book. Not to forget, I would like to thank my father, Abdul Karim Memon, and my aunt who is more than a mother to me for their unlimited prayers, unconditional love, and untiring efforts to make me what I am today. I would also like to thank my friends, Ayaz Ahmed, Sheeraz Ahmed, Fayaz Ahmed, Azizullah Memon, Mubashir Hassan, Ali Hussain, Arslan Abro, and the new one on this list, Hasan Ali, who are more than brothers to me and add color to my life, making it funny and enjoyable.
A deep, heartfelt thanks goes to my wife, Gul Sanober, for her tireless and unconditional support and cooperation, which helped me focus on this book, and for her ongoing support that allows me to do what I truly enjoy in life. I have taken away a lot of her deserved hours to author this book, and I am grateful and proud to have her in my life as my partner.
Last but not least, I would like to say a big thank you to Packt Publishing for their support, their understanding throughout the book, and with their complete cooperation, their help in setting this whole project in motion, and believing in me for this book.
About the Reviewers
Asema Hassan is a game developer, AI researcher, and tutor. She is currently writing her master’s thesis at Otto von Guericke University, Magdeburg, Germany. Her major research focus is on artificial intelligence in games. She also works part time at the German Center for Neurodegenerative Diseases, where she develops 3D VR simulations in Unity along with her team.
She previously worked in Pakistan's game industry for almost 3 years. At Agnitus, she worked as a software engineer for more than 2 years and developed various 2D/2.5D games for Android/iOS. She has deep knowledge of Unity Engine, C#, and C++. She is also a supervisor for the PakGamers community, where her main responsibility is to guide new students on the game development process.
She likes to travel a lot and take photographs. You can find out more about her on http://asemahassan.blogspot.de.
I would like to thank Packt Publishing for giving me a chance to be a reviewer on this book and would also like to appreciate all efforts of the authors to make this book a good read.
Engin Polat has been involved in many large-scale and medium-scale projects on .NET technologies as a developer, architect, and consultant and has won many awards since 1999.
Since 2008, he has been conducting training for many large enterprises in Turkey on Windows development, web development, distributed application development, software architecture, mobile development, cloud development, and so on.
Apart from this, he organizes seminars and events in many universities in Turkey on .NET technologies, Windows platform development, cloud development, web development, game development, and so on.
He shares his experiences on his personal blog (http://www.enginpolat.com).
He has MCP, MCAD, MCSD, MCDBA, and MCT certifications.
In 2012, he was recognized as a Windows development MVP (Most Valuable Professional) by Microsoft, and in 2017, he got recognized as a Visual Studio and Development Technologies MVP too.
Between 2013 and 2015, he was recognized as a Nokia Developer Champion; very few people in the world are given this award. In 2015, he was recognized as the regional director by Microsoft.
He has worked on several books by Packt, including Mastering Cross Platform with Xamarin, Xamarin Blueprints, Xamarin by Example, and Mastering Xamarin UI Development.
I'd like to thank my dear wife, Yeliz, and my beautiful daughter, Melis Ada, for all the support they gave me while I was working on this book. I also want to give a warm welcome to the newest member of my family, my dear son, Utku Ege.
www.PacktPub.com
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.comand as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at service@packtpub.com for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www.packtpub.com/mapt
Get the most in-demand software skills with Mapt. Mapt gives you full access to all Packt books and video courses, as well as industry-leading tools to help you plan your personal development and advance your career.
Why subscribe?
Fully searchable across every book published by Packt
Copy and paste, print, and bookmark content
On demand and accessible via a web browser
Customer Feedback
Thanks for purchasing this Packt book. At Packt, quality is at the heart of our editorial process. To help us improve, please leave us an honest review on this book's Amazon page at https://www.amazon.com/dp/1783550775.
If you'd like to join our team of regular reviewers, you can e-mail us at customerreviews@packtpub.com. We award our regular reviewers with free eBooks and videos in exchange for their valuable feedback. Help us be relentless in improving our products!
Table of Contents
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Reader feedback
Customer support
Downloading the example code
Downloading the color images of this book
Errata
Piracy
Questions
Introduction to Android Game Development with Unity3D
Introduction to Android
Android versions
Google Play - the market store for Android
Unity3D and game engines
Unreal Engine
Adobe Flash professional
Game Maker Studio
Unity3D
Features of Unity3D
Basics of Unity game development
Unity editor interface
Scene View
Transform tools
Scene View navigation
Scene View control bar
Game View
Game View control bar
Hierarchy View
Project browser panel
Inspector panel
Configuration of empty game projects
Perky Penguin game
Perky Penguin gameplay
Adding the penguin
Importing the penguin Sprite
Creating penguin game object
Adding script behavior on penguin object
Limiting the penguin between screen bounds
Summary
Finishing the Perky Penguin 2D Game
Adding Particle Systems
What is a Particle System?
Basics of Particle System
Creating a rocket fire Particle Effect for a game
Adding game-level backgrounds
Camera management
Making the penguin move forward
Making the camera follow the Penguin
Prefabs and level management
Prefabs
Creating a Level Block Prefab
The level block generator concept
The BlockGenerator.cs code
Adding ice spikes to the game
Summary
Adding Player Character for an Action Fighting Game
Configuring Project for 3D Games in Unity
Importing 3D models
3D models
Modelling tools
Importing 3D models in Unity3D
Importing FBX Model
Applying textures and materials
Textures
Texture Importer
Applying texture in shaders
Shaders
Materials
Applying textures on a farmhouse model
Generic and humanoid rigs
What are humanoid characters?
Importing humanoid models
Configuring the avatar of humanoid models
Humanoid animation using Unity
Legacy Animation System
Mecanim animation system
Creating layer character for the fighting game
Summary
Enemy Characters with AI
Importing the player model
Player Animation Controller
Scripting player controls
Adding an enemy character
Enemy behavior and AI
Finalizing the fight
Summary
Gameplay, UI, and Effects
Finishing up gameplay
Understanding Unity uGUI
Adding GUI for health and gameover
Introduction to Particle Effects
Creating confetti Particle Effect
Summary
GameScene and SceneFlow
Adding buttons to the startScene
Organizing the folder structure
Adding a game restart button in the startScene
Adding a pause button to the startScene
Adding a main menu button to the startScene
Creating MainMenu scene
Summary
Gamestats, Social, IAP, and Ad Integration
Running the app on the device/ emulator
Android Developer Console
Adding achievements in the game
Saving game stats
Ad integration
In-App purchasing
Adding social media integration
Summary
Sound, Finishing Touches, and Publishing
Adding sound
Handling multiple resolutions
Optimizing the APK
Preparing the build for publishing
Publishing the game
Summary
Preface
Unity has come a long way from its humble beginnings; however, since the last couple of years, it has almost become an industry-wide used tool that almost all independent game developers use to develop their games. It is very easy to use to develop prototypes, and when you have a successful idea, it is flexible enough to expand the small prototype to a full-fledged game.
Despite its professional capacity, Unity is so simple to use that even a complete novice person can develop a basic game within a matter of hours. And with a little more effort, a very polished game can be developed with excellent lighting and animation.
With the current version, Unity makes game development even more accessible to everyone.
In this book, we will cover a variety of topics both in 2D and 3D game development. We will see how to develop a game similar to JetPack Joyride in 2D, and a 3D fighting game with full 3D animation, lighting, and camera. We will also see how to add buttons, text, and screen transitions. Finally, once we have created the game, we will see how to monetize it by adding in-app purchases and ads.
What this book covers
Chapter 1, Introduction to Android Game Development with Unity3D, covers the basic concepts of Android game development, a brief history of Android games, the building blocks of Android games in Unity3D, and the basic flow of games.
Chapter 2, Finishing the Perky Penguin 2D Game, extends 2D game development by finishing the Jetpack Joyride clone game. The chapter introduces various topics, such as particle systems, camera management, prefabs, animations, triggers, colliders, and basic GUI systems.
Chapter 3, Player Character for Action Fighting Game, covers the basic setup for 3D action fighting game, importing models and textures, setting rigging for the characters, applying animations on models, and controlling the player character with a virtual on-screen joystick.
Chapter 4, Enemy Character with AI, covers the aspect of creating the enemy model of the game from importing models to applying animations to decision making with AI.
Chapter 5, Gameplay, UI, and Effects, shows how to finish the gameplay loop, add a UI,
add text for scoring the game, and add particle effects to the game.
Chapter 6, GameScene and SceneFlow, covers the creation of MainMenu Scene, explains Options Scene, and demonstrates how to transition between the scenes in the game.
Chapter 7, Gamestats, Social, IAP and Ad integration, demonstrates how to save in-game progress, add social media integration such as Facebook and Twitter, ad integration,
and In-App purchases to add monetization.
Chapter 8, Sound, Finishing Touches, and Publishing, lets us add finishing touches to the game and add sound. We will see how to run the game on the device and publish the game to the Android Play Store.
What you need for this book
You will need the latest version of Unity, which you can download from their website, and a computer that can run Unity. A basic understanding of C# is required as the code in this book is written in C#. Although the game can run on an Android emulator, to see the actual performance of the game, an Android device would be required.
Who this book is for
This book is geared toward novice or intermediate Unity3D developers who want to expand their knowledge of Unity3D and create high-end, complex Android games. You are expected to have a basic or intermediate understanding of Unity3D, working with its environment, basic concepts such as Game Objects and Prefabs, Unity Scripting using
C# or JavaScript, and how to develop basic 2D/3D games using Unity3D.
The book is very useful for those Unity developers who have created basic/simple games for Android and want to learn