Pro Android Games, Third Edition

Book description

Combining actionable, real-world source code with graphics, Pro Android Games, Third Edition shows you how to build more sophisticated and addictive Android game apps with minimum effort. Harness the power of the latest Android 5.0 SDK to bring countless legendary, action-packed PC games to the Android platform.

With actionable real-world source code, this one of a kind book shows you how to build more sophisticated and addictive Android game apps, by leveraging the power of the recent advancements found in the new Android 5.0 software development kit as well as those you've counted on in earlier releases.

Multi-touch code gives these games and their players dynamic input and exchange ability, for a more realistic arcade game experience. Faster and better performance offers Android game players a more seamless, fun arcade experience like never before. There is also improved native C/C++ integration with Android's NDK as well, which makes coding, compiling, and converting both productive and efficient with gains in app performance.

Pro Android Games, Third Edition features the following improvements:

  • Updates to the latest version of the Android SDK, NDK, plus the latest Android Studio and Eclipse IDEs
  • Greater focus on tablets, ever changing device resolutions, and hardware specs
  • Native game development and hardware accelerated graphics
  • Bigger and better real world engines, such as Quake I and II plus an oldie from the previous edition: Doom
  • Coverage of the new Android TV SDK APIs, UI, UX, multi-touch and multi-tasking features available with the Android 5.0 release
  • Advanced techniques for improving your game playing experience including better multi-tasking, improved performance optimization, battery management and more
  • A "Quake 3D"-like game app case study
  • You’ll definitely have fun, and perhaps you’ll even make some money. Enjoy!

    In the last few years, Android has progressed with the debut of better fonts, new User Interface and Experience (UI/UX) APIs, tablet considerations, multi-touch capabilities, multi-tasking, faster performance, improved battery management techniques, and now the new Android TV SDK Apps for the Android game app developer repertoire.

    Table of contents

    1. Cover
    2. Title
    3. Copyright
    4. Dedication
    5. Contents at a Glance
    6. Contents
    7. About the Authors
    8. About the Technical Reviewer
    9. Acknowledgments
    10. Introduction
    11. Chapter 1: Welcome to Android Gaming
      1. Setting Up Your Machine
      2. Download and Install the SDK
      3. Configure Android Studio
      4. Installing the Native Development Kit
        1. NDK Install
        2. Install Cygwin
        3. Install MinGW
        4. Install Ant
      5. Creating an Android Emulator
        1. Creating an AVD
      6. Configuring a Real Device
      7. Importing the Source Code into Android Studio
      8. Summary
    12. Chapter 2: Gaming Tricks for Phones or Tablets
      1. Setting Up Windows
        1. Windows System Environment Variables
        2. Configuring Cygwin
        3. Creating the Android Project with Native Support
      2. Application Architecture
        1. Build and Run Your First SDK Application
        2. Add Android Native Support
      3. Compiling the Java Application
        1. Native Library
      4. Compiling the Shared Library
      5. Testing the App on a Device
      6. Java Wrappers for C/C++ Event Handling
        1. Handling Audio Independently
        2. Cascading Video Events
      7. Multi-touch Tricks
        1. MultiTouchGesture
        2. MultiTouchScreen
        3. TestActivity
      8. Summary
    13. Chapter 3: More Gaming Tricks with OpenGL and JNI
      1. The Power of Mobile Devices
      2. OpenGL the Java Way
        1. Creating Your First OpenGL Project
        2. Creating an OpenGL and JNI Project
        3. Java Main Activity
        4. Surface View
        5. GL Thread
        6. CubeRenderer Class
        7. Cube Class
      3. Scaling Video Buffers with Hybrid OpenGL ES
        1. Why Use Hybrid Scaling?
        2. Initializing the Surface
        3. Drawing into the Texture
        4. When the Image Is Not a Power of Two
      4. Summary
    14. Chapter 4: Efficient Graphics and Portability with OpenGL ES
      1. Portability
        1. Handling Immediate Mode
        2. Loading Textures
        3. Display Lists, Server Attributes, and Others
        4. Using Library Wrappers
      2. OpenGL ES Compatibility
        1. OpenGL ES 3.0 and 3.1
      3. Superb Efficiency with OpenGL ES 3.1
        1. Shaders
        2. GLSL
        3. Anatomy of a Shader
      4. Invoking OpenGL ES 3.1 in Android
      5. Project Icosahedron
        1. Reviewing the Shape
        2. Tackling the Project
        3. Native Icosahedron
      6. Adding Swipe and Multi-Touch Pinch for Zooming
      7. Compiling and Running
      8. Summary
    15. Chapter 5: 3D Shooters for Doom
      1. The Sky Is the Limit with the Java/C Power Combo
      2. Bringing Doom to a Mobile Device
      3. Game Architecture for Doom
      4. Java Main Activity
        1. Creation Handler
        2. Game Layout
        3. Menu and Selection Handlers
        4. Key and Touch Event Handlers
        5. Native Callback Handlers
        6. Navigation Controls
      5. Handling Audio Independently of the Format
      6. Native Interface Class
        1. Callback Listener
        2. Native Methods
        3. C to Java Callbacks
      7. Native Layer
        1. Native Method Implementations
        2. Original Game Changes
      8. Compiling Doom with the NDK
      9. Testing Doom in the Emulator
      10. Summary
    16. Chapter 6: 3D Shooters for Quake
      1. A Little About the Quake Jargon
      2. The Power of Code Reuse: Quake in Less Than 500 Lines of New Code
        1. OpenGL Is Not the Same as OpenGL ES
        2. Is the Software Renderer a Possible Solution?
        3. NanoGL: The Life Saver
      3. Quake for Android Architecture
        1. Java OpenGL Renderer Architecture
        2. Handling Audio Independently of the Format
        3. Handling Keyboard Events
        4. Handling Touch Events
        5. Game Startup Activity
      4. Changes Required to the Native Quake Engine
        1. Video Handler Changes
        2. Handling Pitch and Yaw
        3. Handling Forward and Side Movement
        4. Audio Handler Changes
        5. Fixing the Game Loop
      5. Running on a Device
      6. Summary
    17. Chapter 7: 3D Shooters for Quake II
      1. Reviewing the Code
      2. Escaping the Shackles of the Java Heap
      3. Taming the Mighty Quake II Engine
        1. Code Reusability
        2. What to Do When Fatal Errors Occur
        3. OpenGL Immediate-Mode Issues
        4. Video Handlers
      4. Building Quake II with the NDK
      5. Running on the Device or Emulator
      6. Summary
    18. Chapter 8: Fun with Bluetooth Controllers
      1. Dissecting the Wiimote
        1. Inquiry Process
        2. Device Connection
        3. Other Neat Tricks
      2. A Wiimote Controller App
        1. The Wiimote Android Project
        2. The WiiC Library
        3. WiiC JNI Interface
        4. Compilation and Test
      3. Zeemote
      4. Summary
    19. Chapter 9: A Look into the Future: Augmented reality (AR) and Android TV
      1. What Is AR?
      2. AR SDKs
      3. AR and Android
        1. Finding a Suitable AR Library
        2. Understanding the ARToolKit (ARTK)
      4. Getting the ARToolKit Running on Android
        1. Getting a Video Feed
        2. Drawing and Application Life Cycle
      5. Other Toolkits Out There
      6. Google TV: The Beginning
      7. Android TV: The Future
      8. Summary
    20. Chapter 10: Deployment and Compilation Tips
      1. Signing Your Application
        1. Creating a Key Store
        2. Signing the Application
        3. Installingthe APK File
      2. JNI Cheat Sheet
        1. JNI Method Syntax
        2. Loading a Java Class as Global Reference
        3. Converting a Java Array to a C array
        4. Invoking Java Within C (Callbacks)
      3. Summary
    21. Chapter 11: Discovering Android Wear
      1. What Is Android Wear?
      2. Android Wear OS and User Interface (UI)
        1. Context Stream
        2. Cue Card
      3. Developing an Android Wear App
        1. Setting Up the Environment
        2. Creating a Wear Emulator
      4. Creating an Android Support Wearable Application
        1. Connecting a Wear App
        2. Understanding the Code
        3. Connecting an Android Device to the AVD Emulator
      5. Final Thoughts
    22. Index

    Product information

    • Title: Pro Android Games, Third Edition
    • Author(s):
    • Release date: February 2015
    • Publisher(s): Apress
    • ISBN: 9781484205877