Author: Massimo Nardone, Vladimir Silva
Pub Date: 2014
Size: 10 Mb
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.
What you’ll learn
– How to develop and port game apps for the Android platform
– What are some special tricks for Android smartphones and tablets
– How to build a complex 2D game app for Android
– What are some gaming tricks using OpenGL and JNI
– How to integrate efficient graphics and create portability with latest OpenGL ES
– How to build a 3D shooter game app that resembles the popular and once best-selling games Doom, Quake and Quake II
– How to create fun experience using Bluetooth and Android Wear-based controllers
– How to design and port using Android TV SDK
– Who this book is for
This book is for savvy Android app developers who are looking for professional or advanced techniques for porting, augmenting and building 3D game apps that are complex, fun and lucrative.
A Bluetooth connection to a Wiimote is done via the HID (human interface device) protocol. This connection involves the use of the Bluetooth L2CAP protocol with two ports (or PSMs, as shown in Figure 8-2) identified as follows:
- Control Pipe (PSM 11): This is used to send control commands to the Wiimote but it only works with the old controllers. This port is
deprecated in the new Wiimotes (RVL-CNT-01-TR) and will no longer work on devices sold after December 2011. It is strongly
recommended that hosts do not use this port to send control commands. This is the reason why most of the Wiimote emulators out there will not work with the new controllers.
- Data Pipe (PSM 13): Nintendo probably got rid of the PSM 11 to make room for the motion plus support in the new controllers. Therefore the Data Pipe (PSM 13) is where all the communication with the controller must take place. It will work with both old and new controllers alike.
A Wiimote Controller App
This section covers the Wiimote Android app in detail, which is made of three main components:
- An Android project: This contains the Java activity and GUI window that can be run to connect and interact with the Wiimote.
- A native library: This component uses a modified version of the open source WiiClibrary (available online at wiic.sourceforge.net/)
to control Wii devices natively. I should mention that the standard WiiC library does not support the latest Wiimote; I have made changes to the original to get it working.
- A WiiC JNI interface: This is a small C program that binds WiiClibrary calls with the Wiimote Java class of your app, thus allowing for WiiCaccess within your Java code. It is the glue that binds the previous components together.
Let’s create an Android project to host your app (the full source is available from the book’s companion media).