Book Image

Mastering Android NDK

Book Image

Mastering Android NDK

Overview of this book

Android NDK is used for multimedia applications that require direct access to system resources. NDK is also the key for portability, which in turn allows a reasonably comfortable development and debugging process using familiar tools such as GCC and Clang toolchains. This is a hands-on guide to extending your game development skills with Android NDK. The book takes you through many clear, step-by-step example applications to help you further explore the features of Android NDK and some popular C++ libraries and boost your productivity by debugging the development process. Through the course of this book, you will learn how to write portable multi-threaded native code, use HTTP networking in C++, play audio files, use OpenGL ES 3, and render high-quality text. Each chapter aims to take you one step closer to building your application. By the end of this book, you will be able to create an engaging, complete gaming application.
Table of Contents (17 chapters)
Mastering Android NDK
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Boids


In many game applications, you can usually see moving objects that collide, shoot, chase each other, can be touched or avoided by other objects, or produce similar behaviors. The visible complex behavior of objects can usually be broken down into a few simple states interoperating together. For example, in an arcade game an enemy randomly wanders around until it sees a player controlled character. After the encounter, it switches to the chase state, probably switching to shoot or attack states when in close proximity to the target. If an enemy unit perceives some disadvantage, it may flee from the player. The chase state in turn might not only target the enemy towards the player, but also avoid collisions with the environment. Each object can be differently animated or have different material while being in different states. Let's implement the chasing and wandering algorithms using an established approach invented by Craig Reynolds called Flocking behaviors or Boids (https://en.wikipedia...