Annotation Beginning Android C++ Game Development introduces general and Android game developers like you to Android's pown the NDKHow to do professional level, quality game design, starting the Droid Runner case study that's used throughout this book to illustrate the key conceptsHow to build a game engineHow to write a rendererHow to build the Droid Runner game app with entities, game levels and collisionsHow to insert perspectives using cameras and moreHow to create or integrate audio into your game appHow to submit to the Android app stores like Google Play and Amazon Appstore Who this book is forThis book is for game developers looking to get into Android development for the first time, as well as Android game developers who have never used the Native Development Kit (NDK). Table of Contents Section 1: An Introduction to Android and Game Programming 1. An Introduction To Game Development 2. An Introduction to the Android Game Development Ecosystem. (A First Game: HelloDroid) 3. Game Design For Beginners - Droid Runner (Case Study begins: Droid Runner) 4. Building a Game Engine 5. Writing a Rendeerful Native Development Kit (NDK). The Android NDK platform allows you to build the most sophisticated, complex and best performing game apps that leverage C++. In short, you learn to build professional looking and performing game apps like the book's case study, Droid Runner. In this book, you'll learn all the major aspects of game design and programming using the Android NDK and be ready to submit your first professional video game app to Google Play and Amazon Appstore for today's Android smartphones and tablet users to download and play. The techniques contained in this book include building a game engine, writing a renderer, and building a full game app with entities, game levels and collisions. As part of the tutorial you'll also learn about inserting perspectives using cameras and including audio in your game app. What you'll learn How to build your first real-world quality game app for Android smartphones and tablets using the power of the Android C++ APIs as found irer Section 2: Building Droid Runner Game App 6. Game Entities 7. Building Game Levels With Collision 8. Virtual Cameras 9. Lighting and Materials 10. Game Audio 11. Self-Publishing 101 Appendices: A. Developing with the Android NDK and Eclipse. B. Android Hardware C.C++ and Design Patterns D.C++ Math Contents at a Glance Contents About the Author About the Technical Reviewer Acknowledgments Introduction Chapter 1: An Introduction to Game Development A Brief History of Video Games Who Makes Games? The Difference between Computer Games and Board Games Comparing Mobile Phones to Game Consoles An Overview of Game Engines Summary Chapter 2: An Introduction to the Android Game Development Ecosystem Java and the Dalvik Virtual Machine C++ and the NDK Fragmentation and the Android Ecosystem Android Versions Screen Resolution and Aspect Ratio Input Device Support GPUs HelloDroid - Our First Android Game Creating a New Eclipse Project Adding NDK Support A Look at the NDK Build System Modifying the Build File Adding Application-Level Build Options Enabling Debugging Running the Game Summary Chapter 3: Game Design for Beginners: Droid Runner An Introduction to Design Documents Creating a World, Telling a Story, and Setting the Scene The Droid Runner Design Overview Section 1 - Game Overview Defining the Gameplay and Mechanics Section 2 - Gameplay and Mechanics Section 2.1 - Gameplay Section 2.2 - Mechanics Section 2.2.1 - Movement Section 2.2.2 - Obstacles Section 2.2.3 - Pickups Level Design Pacing Aesthetics Scale Technical Requirements Summary Chapter 4: Building a Game Engine Creating an Application Object Creating the Game Loop Using a Kernel and Tasks Starting the Kernel Class Defining the Task Interface Examining the Kernel Methods Android’s Native App Glue Timekeeping Summary Chapter 5: Writing a Renderer Initializing the Window and OpenGL Using EGL An Introduction to Shaders An Introduction to Vertex Shaders in OpenGL ES 2.0 An Introduction to Fragment Shaders in OpenGL ES 2.0 Creating a Shader Program Rendering a Quad with OpenGL Representing Geometry Creating a Renderable Creating the Basic Shader Creating an App-Specific Application and Task Applying Textures to Geometry Loading a File Loading a TGA File Representing a GL Texture Creating TextureShader Initializing Textures and Shaders Loading Textures in a Task Summary Chapter 6: Game Entities What Is a Game Entity? Communicating with Game Objects via Events The Event Class The EventHandler Classes The EventManager EventManager’s Friend Functions Big O Notation EventManager’s Interface Methods Rendering an Object The TransformComponent Class The Transform Class The RenderableComponent The TransformShader Class The Player Object Making the Player Jump A Basic AI Entity Summary Chapter 7: Building Game Levels with Collision Representing Game World Objects with Collision Data Building a Game Level Broad-Phase Filtering Quadtrees and Octrees Binary Space Partitions Broad-Phase Filtering in Droid Runner Collision Bins The Collision Manager Narrow-Phase Collision Detection Responding to Collisions Running the Collision Test Using the Z Buffer Summary Chapter 8: Virtual Cameras The Model and View Matrices The Projection Matrix Defining a Camera Object Updating the Renderer Concatenating the Model, View, and Projection Matrices Updating the Camera’s Transform Adding a Camera to DroidRunnerLevel Proper App Behavior When Pausing and Resuming Adding Events for Pausing and Resuming Handling the Pause and Resume Events in the Renderer View Frustum Culling The View Frustum Culling Test Summary Chapter 9: Lighting and Materials A Basic Lighting and Material Model Per-Vertex or Per-Fragment Shading Representing Materials Ambient Lighting Vertex Normals Diffuse Lighting Diffuse Component Vertex Shader Diffuse Component Fragment Shader Initializing the Shader Using OpenGL ES 2.0 Specular Lighting Specular Component Vertex Shader Specular Component Fragment Shader Initializing TransformAmbientDiffuseSpecularShader Different Types of Lights Forward Shading Point Lights Spotlights Deferred Rendering Bidirectional Reflectance Distribution Functions Summary Chapter 10: Game Audio The Physics of Sound Amplitude Frequency Other Types of Sound Waves Aliasing Audacity The Chirp Generator Effects Creating a Jump Sound Effect with Audacity Playing Audio Using OpenSL ES Creating the AudioManager An Introduction to OpenSL ES Creating OpenSL ES Player Objects for Files SDBM Hashes Playing Sounds Using OpenSL Cleaning Up Sounds Adding Sound Effects to Droid Runner Summary Chapter 11: Self-Publishing 101 The Google Play Developer Console Keys, Keystore, and Digital Signatures Signing an APK for the Play Store Uploading to the Google Play Developer Center Monetization App Quality Summary Appendix A: Using the Android Development Environment Setting Up the Android SDK and Eclipse Installing the Android NDK Building a Native App Appendix B: Android Hardware Overview CPU Architectures ARM MIPS x86 GPU Architectures PowerVR Mali and Adreno Tegra Appendix C: C++ Programming The Friend Keyword Templates The Singleton Pattern Appendix D: C++ Math Vectors Matrices Identity Matrix Rotation Matrices Multiplying Matrices Matrix Transpose Transforming Vectors Planes Index This book covers all of the major aspects of game design and programming using the Android Native Development Kit (NDK). The techniques contained in this book include building a game engine, writing a renderer, and building a full game app with entities, game levels and collisions