Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
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
Can$27.98 Can$39.99
Paperback
Can$49.99
Subscription
Free Trial

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
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 : 9781785880957
Vendor :
Google
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

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

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.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
$199.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 Can$6 each
Feature tick icon Exclusive print discounts
$279.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 Can$6 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total Can$ 173.97
Android Programming for Beginners
Can$69.99
Learning Android Game Development
Can$49.99
Mastering Android Game Development with Unity
Can$53.99
Total Can$ 173.97 Stars icon
Banner background image

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

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.