You are previewing Beginning Android Games, Second Edition.
O'Reilly logo
Beginning Android Games, Second Edition

Book Description

Beginning Android Games, Second Edition offers everything you need to join the ranks of successful Android game developers, including Android tablet game app development considerations. You'll start with game design fundamentals and programming basics, and then progress toward creating your own basic game engine and playable game apps that work on Android and earlier version compliant smartphones and now tablets. This will give you everything you need to branch out and write your own Android games.

The potential user base and the wide array of available high-performance devices makes Android an attractive target for aspiring game developers. Do you have an awesome idea for the next break-through mobile gaming title? Beginning Android Games will help you kick-start your project. This book will guide you through the process of making several example game apps using APIs available in new Android SDK and earlier SDK releases for Android smartphones and tablets:

  • The fundamentals of game development and design suitable for Android smartphones and tablets

  • The Android platform basics to apply those fundamentals in the context of making a game, including new File Manager system and better battery life management

  • The design of 2D and 3D games and their successful implementation on the Android platform

This book lets developers see and use some Android SDK Jelly Bean; however, this book is structured so that app developers can use earlier Android SDK releases. This book is backward compatible like the Android SDK.

What you'll learn

  • How to set up/use the development tools for creating your first Android game app

  • The fundamentals of game programming in the context of the Android platform

  • How to use the Android's APIs for graphics (Canvas, OpenGL ES 1.0/1.1), audio, and user input to reflect those fundamentals

  • How to develop two 2D games from scratch, based on Canvas API and OpenGL ES

  • How to create a full-featured 3D game

  • How to publish your games, get crash reports, and support your users

  • How to complete your own playable 2D OpenGL games

Who this book is for

This book is for people with a basic knowledge of Java who want to write games on the Android platform. It also offers information for experienced game developers about the pitfalls and peculiarities of the platform.

Table of Contents

  1. Title
  2. Dedication
  3. Contents at a Glance
  4. Contents
  5. About the Authors
  6. About the Technical Reviewer
  7. Acknowledgments
  8. Introduction
  9. Chapter 1: An Android in Every Home
    1. A Brief History of Android
    2. Fragmentation
    3. The Role of Google
    4. Android’s Features and Architecture
    5. The Software Development Kit
    6. The Developer Community
    7. Devices, Devices, Devices!
    8. Compatibility Across All Devices
    9. Mobile Gaming Is Different
    10. Summary
  10. Chapter 2: First Steps with the Android SDK
    1. Setting Up the Development Environment
    2. Creating a New Project in Eclipse and Writing Your Code
    3. Running the Application on a Device or Emulator
    4. Debugging and Profiling an Application
    5. Useful Third-Party Tools
    6. Summary
  11. Chapter 3: Game Development 101
    1. Genres: To Each One’s Taste
    2. Game Design: The Pen Is Mightier Than the Code
    3. Code: The Nitty-Gritty Details
    4. Summary
  12. Chapter 4: Android for Game Developers
    1. Defining an Android Application: The Manifest File
    2. For Those Coming from iOS/Xcode
    3. Android API Basics
    4. Best Practices
    5. Summary
  13. Chapter 5: An Android Game Development Framework
    1. Plan of Attack
    2. The AndroidFileIO Class
    3. AndroidAudio, AndroidSound, and AndroidMusic: Crash, Bang, Boom!
    4. AndroidInput and AccelerometerHandler
    5. CompassHandler
    6. AndroidGraphics and AndroidPixmap: Double Rainbow
    7. AndroidGame: Tying Everything Together
    8. Summary
  14. Chapter 6: Mr. Nom Invades Android
    1. Creating the Assets
    2. Setting Up the Project
    3. MrNomGame: The Main Activity
    4. The Main Menu Screen
    5. The HelpScreen Classes
    6. The High-Scores Screen
    7. Abstracting the World of Mr. Nom: Model, View, Controller
    8. The GameScreen Class
    9. Summary
  15. Chapter 7: OpenGL ES: A Gentle Introduction
    1. What Is OpenGL ES and Why Should I Care?
    2. Before We Begin
    3. GLSurfaceView: Making Things Easy Since 2008
    4. GLGame: Implementing the Game Interface
    5. Look Mom, I Got a Red Triangle!
    6. Specifying Per-Vertex Color
    7. Texture Mapping: Wallpapering Made Easy
    8. Indexed Vertices: Because Re-use Is Good for You
    9. Alpha Blending: I Can See Through You
    10. More Primitives: Points, Lines, Strips, and Fans
    11. 2D Transformations: Fun with the Model-View Matrix
    12. Optimizing for Performance
    13. Summary
  16. Chapter 8: 2D Game Programming Tricks
    1. Before We Begin
    2. In the Beginning . . . There Was the Vector
    3. A Little Physics in 2D
    4. Collision Detection and Object Representation in 2D
    5. A Camera in 2D
    6. Texture Atlas: Because Sharing Is Caring
    7. Texture Regions, Sprites, and Batches: Hiding OpenGL ES
    8. Sprite Animation
    9. Summary
  17. Chapter 9: Super Jumper: A 2D OpenGL ES Game
    1. Core Game Mechanics
    2. Developing a Backstory and Choosing an Art Style
    3. Defining Screens and Transitions
    4. Defining the Game World
    5. Creating the Assets
    6. Implementing Super Jumper
    7. To Optimize or Not to Optimize
    8. Summary
  18. Chapter 10: OpenGL ES: Going 3D
    1. Before We Begin
    2. Vertices in 3D
    3. Perspective Projection: The Closer, the Bigger
    4. Z-buffer: Bringing Order to Chaos
    5. Defining 3D Meshes
    6. Matrices and Transformations, Again
    7. Summary
  19. Chapter 11: 3D Programming Tricks
    1. Before We Begin
    2. Vectors in 3D
    3. Lighting in OpenGL ES
    4. Mipmapping
    5. Simple Cameras
    6. Loading Models
    7. A Little Physics in 3D
    8. Collision Detection and Object Representation in 3D
    9. Summary
  20. Chapter 12: Android Invaders: The Grand Finale
    1. Core Game Mechanics
    2. Developing a Backstory and Choosing an Art Style
    3. Defining Screens and Transitions
    4. Defining the Game World
    5. Creating the Assets
    6. Plan of Attack
    7. The Assets Class
    8. The Settings Class
    9. The Main Activity
    10. The Main Menu Screen
    11. The Settings Screen
    12. The Simulation Classes
    13. The GameScreen Class
    14. The WorldRender Class
    15. Optimizations
    16. Summary
  21. Chapter 13: Going Native with the NDK
    1. What Is the Android NDK?
    2. The Java Native Interface
    3. Setting Up the NDK
    4. Setting Up an NDK Android Project
    5. Creating Java Native Methods
    6. Creating the C/C++ Header and Implementation
    7. Building the Shared Library
    8. Putting It All Together
    9. Summary
  22. Chapter 14: Marketing and Monetizing
    1. Monetizing Your Game
    2. Getting Your Game Discovered
    3. Monetizable by Design
    4. Discoverable by Design
    5. Summary
  23. Chapter 15: Publishing Your Game
    1. A Word on Testing
    2. Becoming a Registered Developer
    3. Signing Your Game’s APK
    4. Putting Your Game on Google Play
    5. More On The Developer Console
    6. Summary
  24. Chapter 16: What’s Next?
    1. Location Awareness
    2. Multiplayer Functionality
    3. OpenGL ES 2.0/3.0 and More
    4. Frameworks and Engines
    5. Resources on the Web
    6. Closing Words
  25. Index