Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Learning Android Game Development
Learning Android Game Development

Learning Android Game Development: A Beginner's guide to developing popular Android games

eBook
€15.99 €23.99
Paperback
€29.99
Subscription
Free Trial
Renews at €18.99p/m

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Table of content icon View table of contents Preview book icon Preview Book

Learning Android Game Development

Introduction to Android N and Installation of Android SDK

Welcome to the world of Android and game development. You are about to begin a journey that will set up a foundation for you to get started with converting your wildest imaginations into games. This book will be your stepping stone to creating amazing games. If you are a complete newbie, you will go through a steep yet comfortable learning curve, and, by the end of this book, you will have created your own game.
This book's chapters have been divided into extremely easy-to-understand parts, which require no prior experience in game development. Experience in programming, however, is a must.
This chapter will guide you through an introduction to Android N along with steps for installation of required software. In short, you will be learning the following in this chapter:

  • Short introduction to Android N
  • Introduction to game development with a few examples of games that are doing well
  • Installation of Android Studio
  • Components of Android Studio and setting up for Android N
  • Quick introduction to some basic concepts in Android

Introduction to Android N

It all started way back in 2005 when Google acquired a new company, which would later change the course of mobile computing for good. Yes, you guessed it right! The company that was acquired was the developer of the Android operating system. Since then, Android has seen a lot of developments and has grown significantly in terms of its user base because of the might of Google. At the time of writing this book, Android N is the latest version of this OS. Market share of Android has been growing ever since and is currently at 87.6% of total mobile computing devices. This is huge, and therefore, from a developer perspective, it is extremely important to develop for this platform because most of the mobile base are Android users.

Android N stands for Android Nougat. You must be aware of the naming convention for Android versions. If you are not, they are named in an incremented alphabetical fashion and each version is named after a sweet, barring the exception of the first two versions. Here’s a quick look at the different versions of Android:

  • Alpha
  • Beta
  • Cupcake
  • Donut
  • Eclair
  • Froyo
  • Gingerbread
  • Honeycomb
  • Ice Cream Sandwich
  • Jellybean
  • Kit Kat
  • Lollipop
  • Marshmallow
  • Nougat
You can read more about the history of android from the official source at https://www.android.com/history/.

The world of app development is interesting-but even more interesting than that is, one specific field, that is, game development. Mobile games account for the highest number of downloads on the Google Play Store, and, therefore, this is a most exciting time for game developers since Google has established a massive distribution channel and has made it extremely easy for mobile game developers to publish their games. Gone are the days when you’d have to wait for months or even years to crack a publishing deal with a major publisher. In today's times, you can simply sign up on Google Play Store as a developer and in a matter of hours publish your first game, if it is ready, and get feedback from live users.

The world of Android games has seen massive success stories, such as Angry Birds, Candy Crush, Subway Surfers, and so on. Even games with simple gameplay, such as Flappy Bird, have done extremely well, and it was estimated that at the game’s peak it was earning around $50,000 per day in ad revenues. Isn’t that exciting? You are just one click away from getting your game to a potential audience of billions, and, if your game gets noticed, then you’ll be having the time of your life.

You can make a game as simple as a text-based game or as complex as a third-person shooter. You are only as restricted as your imagination. Plus, all the resources you need are available easily today online. This book will serve you as a ready reference to get started in the world of Android game development and will use the latest version of Android, so you are up-to-date with your knowledge. You don’t necessarily need to have prior experience of developing games for Android platform; however, if you do, then that would be a plus. You do need to have a little bit of Java programming experience, though, to get started. However, rest assured that this book’s language is going to be as easy to understand as possible, and in the whole process of developing your first game for Android, you will have a lot of fun.

So, without further ado, let’s dive right into this exciting journey of developing games for Android using the latest components and tools available at our disposal. I hope you have a great time reading and implementing simultaneously from this book and would highly recommend that you make your own notes while going through this book.

Software requirements

To start our journey into game development for Android, we will need certain software installed on your computer. We will use the latest version of Android Studio, as of this writing, to get started. This chapter will guide you through the installation process.

Before you start your installation, make sure that your computer meets the following system requirements:

  • Windows:
    • Microsoft® Windows® 7/8/10
    • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
    • 2 GB of available disk space minimum, 4 GB recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
    • 1280 x 800 minimum screen resolution
    • For accelerated emulator, 64-bit operating system and Intel® processor with support for Intel® VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality
  • Mac:
    • Mac® OS X® 10.10 (Yosemite) or higher, up to 10.12 (macOS Sierra)
    • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
    • 2 GB of available disk space minimum, 4 GB recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
    • 1280 x 800 minimum screen resolution
  • Linux:
    • GNOME or KDE desktop
    • 64-bit distribution capable of running 32-bit applications
    • GNU C Library (glibc) 2.11 or later
    • 3 GB RAM minimum, 8 GB RAM recommended; plus 1 GB for the Android Emulator
    • 2 GB of available disk space minimum, 4 GB recommended (500 MB for IDE + 1.5 GB for Android SDK and emulator system image)
    • 1280 x 800 minimum screen resolution
    • For accelerated emulator, Intel®processor with support for Intel®VT-x, Intel® EM64T (Intel® 64), and Execute Disable (XD) Bit functionality, or AMD processor with support for AMD Virtualization (AMD-V)
Emulator acceleration requires that you install either Intel Hardware Accelerated Execution Manager (Intel HAXM) or Kernel-based Virtual Machine (KVM), which are types of hypervisors. If the needed hypervisor isn't installed, Android Studio typically prompts you to install it. Without acceleration, the emulator takes the machine code from the VM and translates it block-by-block to conform to the architecture of the host computer. This process can be quite slow. However, if the VM and the architecture of the host computer matches (such as x86 on x86), the emulator can skip translating the code and simply run it directly on the actual CPU using a hypervisor. In this case, the emulator can approach the speed of your actual computer.

You can start installing Android Studio from the following URL:

For writing of this book, we have used a Windows 10 system with minimum system requirements. Once you have downloaded Android Studio's .exe file, go through the following steps to finish the installation:

  1. Open the .exe file that you  have just downloaded
  2. Follow the setup wizard and install it using Standard installation

Once you have done this, you will be ready to launch Android Studio with the SDK components needed for Android N; SDK tools version for Android is 25.0.0.

The installation steps are as follows:

Press Next to start with the setup:

Make sure that you have enough space for installation and then proceed by clicking Next:

Once you have read through the terms and agreements, press I Agree to proceed:

Select your desired path for the installation of Android Studio and press Next:

Create a start menu item for quick access and press Install:

Wait until the installation process finishes:

You are now finished with the installation of Android Studio; press Finish to proceed.

Now, you need to configure Android Studio with Android N SDK. The steps to do so, are illustrated as follows:

Since we are installing a fresh copy, select the last option as seen in the screenshot and press OK:

Press Next to proceed:

Select Standard installation for recommended settings:

Press Finish to start downloading the required components.

Once you press Finish, your computer will start downloading the required components for Android N SDK, so ensure that your Internet connection is working and sit back and enjoy a cup of coffee while SDK gets installed on your system:

You have now successfully installed Android Studio and the components needed for Android N.

Once you are done downloading all the components of SDK, you will be ready to start Android Studio and will get the following screen menu:

Congratulations! You are ready to start Android Studio now!

The nuts and bolts of Android

Before you start a new project in Android Studio, there are some basic concepts you must be familiar with. So, let's take a look at a few common terms we will be dealing with in our chapters. 

Package names

The first thing that you will come across is something called a Package Name. It's quite easy to understand actually. A package name is simply like a reverse URL. Think of a package name as your app's domain name-just like a website, only in reverse. For instance, you can think of www.google.com as a website's domain name; in exactly the same way, the naming convention of an Android app is the reverse of a website. So, you can name your app something like com.google.www. There is no strict rule that says that your package name must start from com, but it is the most commonly accepted convention. You can also name your package name randomly using your own set of conventions, such as abc.xyz.lmnmygame.mycompany.mynameand so on. Also, it is extremely important to note that package names must be unique and should not match the package name of any other existing app on the Google Play Store.

It is very important to choose a unique package name since the URL gets indexed by Google and is crucial for your game or app to be noticed on the Google Play Store. So, ensure that you use a unique package name for your game. Also, another interesting fact is that you can predict your app's URL even before it goes live if you have finalized it on your package name. For this reason, you cannot use the same package name of another app since it's already live on Google Play Store. Your app will be live according to the following URL convention:

https://play.google.com/store/apps/details?id=*package_name_here*

So, if your package name is abc.xyz.lmn, then your app's URL will be as follows:

https://play.google.com/store/apps/details?id=abc.xyz.lmn

Layouts

The next concept is Layouts. We will be dealing with Layouts in the next chapter but, just to give you a small introduction, let's provide a few examples. We will make a game, and in a game, we do not need to display the status bar, which means that we need to have a Fullscreen Layout. If you were making an app, then you probably would not mind allowing the status bar to be displayed on top. So, in this case, you can use a Relative Layout or Linear Layout. The really interesting aspect of this book is that, by the end, you will also have a basic idea of how to create a non-gaming app as well. So, it is highly recommended that you grasp the knowledge of the first three chapters properly.

Android Manifest file

Another important concept while making an Android app or a game is the Android Manifest file. To explain this file simply, it contains all the rules or, in more generalized terms, Permissions needed for an app. You must have observed on Google Play Store that, before you download any app, you are prompted with a dialog box that tells you what permissions are needed for the app to run. These permissions are basic rules that are needed to be fed in the Android Manifest file in order to have a transparency to let your user know what information is going to be taken from them. So, for instance, if an app requires access to the Internet, then it is required for the developer to make sure that they include the Internet permission in the manifest file. If the developer does not write this permission in the manifest file, then the app will not be able to access the said functionality, and the same goes for accessing contacts, gallery, camera, and everything else.

These are the three most important things you need to keep in mind before you start developing any Android game or an app.

In the next chapter, we will get started with our first project on Android Studio.

Summary

In this chapter, we have learned some basic information about Android as well as how to install Android Studio, which will help us on our journey to developing our apps. We also configured Android studio with components of Android N; you are now ready to get started with game development in Android.

Now that we have installed Android Studio, we will be learning how to execute/run our first program in the next chapter. Fasten your seatbelts, you are in for a ride!

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • Leverage the latest features of Android N to create real-world 2D games
  • Architect a 2D game from scratch and level up your Android game development skill
  • Transition from developing simple 2D games to 3D games using basic Java code

Description

In this book, we’ll start with installing Android studio and its components, and setting it up ready for Android N. We teach you how to take inputs from users, create images and interact with them, and work with sprites to create animations. You’ll then explore the various collision detection methods and use sprites to create an explosion. Moving on, you’ll go through the process of UI creation and see how to create buttons as well as display the score and other parameters on screen. By the end of the book, you will have a working example and an understanding of a 2D platform game like Super Mario and know how to convert your 2D games to 3D games.

Who is this book for?

If you are a mobile developer who has basic Java programming knowledge, then this book is ideal for you. Previous Android development experience is not needed; however, basic mobile development knowledge is essential.

What you will learn

  • Understand the nuts and bolts of developing highly interactive and interesting games for Android N
  • Link the interface to the code used in games through simple methods
  • Interact with the images on the screen and also learn to animate them
  • Set and save the game state and save high scores, hit points, and so on for your games
  • Get a grasp of various collision techniques and implement the bounding box technique
  • Convert your 2D games to 3D games using Android N
  • Get an understanding of the process of UI creation using Android Studio

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : May 26, 2017
Length: 238 pages
Edition : 1st
Language : English
ISBN-13 : 9781785882913
Vendor :
Google
Languages :
Tools :

What do you get with eBook?

Product feature icon Instant access to your Digital eBook purchase
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want

Product Details

Publication date : May 26, 2017
Length: 238 pages
Edition : 1st
Language : English
ISBN-13 : 9781785882913
Vendor :
Google
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
€18.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
€189.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts
€264.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just €5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total 103.97
Android Programming for Beginners
€41.99
Learning Android Game Development
€29.99
Mastering Android Game Development with Unity
€31.99
Total 103.97 Stars icon

Table of Contents

10 Chapters
Introduction to Android N and Installation of Android SDK Chevron down icon Chevron up icon
Getting Familiar with Android Studio Chevron down icon Chevron up icon
Managing Inputs Chevron down icon Chevron up icon
Creating Sprites and Interactive Objects Chevron down icon Chevron up icon
Adding Animation to Your Game Chevron down icon Chevron up icon
Collision Detection and Basic Artificial Intelligence Chevron down icon Chevron up icon
Adding Boundaries and Using Sprites to Create Explosions Chevron down icon Chevron up icon
Adding an Explosion and Creating a UI Chevron down icon Chevron up icon
Converting Your Game from 2D to 3D Chevron down icon Chevron up icon
Working Further on 3D Game Chevron down icon Chevron up icon

Customer reviews

Rating distribution
Full star icon Full star icon Empty star icon Empty star icon Empty star icon 2
(2 Ratings)
5 star 0%
4 star 0%
3 star 50%
2 star 0%
1 star 50%
Dillon Jul 01, 2017
Full star icon Full star icon Full star icon Empty star icon Empty star icon 3
So far it needs further revision, errors pop up in code that should be explained before the code is presented and the changes the reader is instructed to make should be highlighted/in bold (the changes are not in bold which can be confusing to some readers).
Amazon Verified review Amazon
Galymzhan Sh Aug 09, 2017
Full star icon Empty star icon Empty star icon Empty star icon Empty star icon 1
238 pages of obsolete information with no prior explanation, including OpenGL ES 1 in 2017.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

How do I buy and download an eBook? Chevron down icon Chevron up icon

Where there is an eBook version of a title available, you can buy it from the book details for that title. Add either the standalone eBook or the eBook and print book bundle to your shopping cart. Your eBook will show in your cart as a product on its own. After completing checkout and payment in the normal way, you will receive your receipt on the screen containing a link to a personalised PDF download file. This link will remain active for 30 days. You can download backup copies of the file by logging in to your account at any time.

If you already have Adobe reader installed, then clicking on the link will download and open the PDF file directly. If you don't, then save the PDF file on your machine and download the Reader to view it.

Please Note: Packt eBooks are non-returnable and non-refundable.

Packt eBook and Licensing When you buy an eBook from Packt Publishing, completing your purchase means you accept the terms of our licence agreement. Please read the full text of the agreement. In it we have tried to balance the need for the ebook to be usable for you the reader with our needs to protect the rights of us as Publishers and of our authors. In summary, the agreement says:

  • You may make copies of your eBook for your own use onto any machine
  • You may not pass copies of the eBook on to anyone else
How can I make a purchase on your website? Chevron down icon Chevron up icon

If you want to purchase a video course, eBook or Bundle (Print+eBook) please follow below steps:

  1. Register on our website using your email address and the password.
  2. Search for the title by name or ISBN using the search option.
  3. Select the title you want to purchase.
  4. Choose the format you wish to purchase the title in; if you order the Print Book, you get a free eBook copy of the same title. 
  5. Proceed with the checkout process (payment to be made using Credit Card, Debit Cart, or PayPal)
Where can I access support around an eBook? Chevron down icon Chevron up icon
  • If you experience a problem with using or installing Adobe Reader, the contact Adobe directly.
  • To view the errata for the book, see www.packtpub.com/support and view the pages for the title you have.
  • To view your account details or to download a new copy of the book go to www.packtpub.com/account
  • To contact us directly if a problem is not resolved, use www.packtpub.com/contact-us
What eBook formats do Packt support? Chevron down icon Chevron up icon

Our eBooks are currently available in a variety of formats such as PDF and ePubs. In the future, this may well change with trends and development in technology, but please note that our PDFs are not Adobe eBook Reader format, which has greater restrictions on security.

You will need to use Adobe Reader v9 or later in order to read Packt's PDF eBooks.

What are the benefits of eBooks? Chevron down icon Chevron up icon
  • You can get the information you need immediately
  • You can easily take them with you on a laptop
  • You can download them an unlimited number of times
  • You can print them out
  • They are copy-paste enabled
  • They are searchable
  • There is no password protection
  • They are lower price than print
  • They save resources and space
What is an eBook? Chevron down icon Chevron up icon

Packt eBooks are a complete electronic version of the print edition, available in PDF and ePub formats. Every piece of content down to the page numbering is the same. Because we save the costs of printing and shipping the book to you, we are able to offer eBooks at a lower cost than print editions.

When you have purchased an eBook, simply login to your account and click on the link in Your Download Area. We recommend you saving the file to your hard drive before opening it.

For optimal viewing of our eBooks, we recommend you download and install the free Adobe Reader version 9.