Learning Android Game Development

Book description

Learn the art of making Android games and turn your game development dreams into reality

About This Book

  • 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

Who This Book Is 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

In Detail

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.

Style and approach

This easy-to-understand guide follows a step-by-step approach to building games, and contains plenty of graphical examples for you to follow and grasp quickly, giving you the chance to implement the concepts practically.

Publisher resources

Download Example Code

Table of contents

  1. Preface
    1. What this book covers
    2. What you need for this book
    3. Who this book is for
    4. Conventions
    5. Reader feedback
    6. Customer support
      1. Downloading the example code
      2. Errata
      3. Piracy
      4. Questions
  2. Introduction to Android N and Installation of Android SDK
    1. Introduction to Android N
    2. Software requirements
    3. The nuts and bolts of Android
      1. Package names
      2. Layouts
      3. Android Manifest file
    4. Summary
  3. Getting Familiar with Android Studio
    1. Understanding the Android project structure
      1. Creating your first Android Studio project
      2. Project Structure of an Android Project
      3. Creating our Hello World! program
      4. Setting up the emulator
    2. Summary
  4. Managing Inputs
    1. Resource folder in detail
      1. Taking user inputs
      2. Button input
      3. Hardware button input
      4. Touch input
      5. The Accelerometer input
        1. Building and deploying through USB
        2. Building an apk and installing on device
    2. Summary
  5. Creating Sprites and Interactive Objects
    1. Game Theory
      1. Illusions
      2. Game loop
      3. Game Design Document
        1. Prototyping
        2. Surface and Canvas
      4. Working with colors and images
        1. Creating colors
        2. Creating images
    2. Summary
  6. Adding Animation to Your Game
    1. Adding animations to make your game more awesome
      1. Making our player character
    2. Summary
  7. Collision Detection and Basic Artificial Intelligence
    1. Collision detection
      1. Algorithms for collision detection techniques
        1. Bounding Box Collision
        2. Circle Collision
      2. Detecting collisions in our game
        1. Making our player jump
        2. Dodging incoming rocks
          1. Defining our variables
          2. Tackling the infinite loop situation
          3. Initializing our variables
          4. Collision behavior
          5. Collision function
        3. Drawing our objects on the screen
    2. Artificial Intelligence
      1. History of Artificial Intelligence
      2. Artificial Intelligence Algorithms
        1. Breadth-First Search
        2. Depth-First Search
        3. Bidirectional search
        4. Uniform cost search
        5. Iterative deepening Depth-First Search
          1. Comparison of preceding algorithms complexities
        6. A * search
      3. Creating your own Artificial Intelligence
    3. Summary
  8. Adding Boundaries and Using Sprites to Create Explosions
    1. Adding boundaries
      1. Creating the classes for our boundaries
      2. Creating boundaries in our game
        1. Creating the variables required
        2. Referencing our boundaries
        3. Updating our boundaries
        4. Drawing our boundaries on the screen
        5. Detecting a collision between the ground and player
        6. Maximum and minimum boundary heights
        7. Creating a new game
    2. Creating explosions
    3. Summary
  9. Adding an Explosion and Creating a UI
    1. Adding an explosion to our game
      1. Creating variables
      2. Some optimizations and improvements
      3. Spawning our explosion
      4. Drawing the explosion on the screen
    2. Creating the UI for our game
    3. Summary
  10. Converting Your Game from 2D to 3D
    1. Introduction to OpenGL ES
    2. Learning about the 3D coordinate system
    3. Creating a 3D scene with OpenGL ES
      1. Creating our project folder
      2. Creating a render class and defining a main activity
      3. Defining shapes
    4. Summary
  11. Working Further on 3D Game
    1. Rendering our object on screen
    2. Adding colors to our object
    3. Rotating our object
    4. Creating a pyramid 3D object
      1. Defining the shape
      2. Rendering our 3D object
    5. Summary

Product information

  • Title: Learning Android Game Development
  • Author(s): Nikhil Malankar
  • Release date: May 2017
  • Publisher(s): Packt Publishing
  • ISBN: 9781785880957