Skip to main content
main-content

Über dieses Buch

Do you remember landmark games like Wolfenstein 3D, Doom, and Asteroids? Well, here's an exciting opportunity to build and/or port these games to one of the hottest mobile and netbooks platforms today: Google's Android.

Pro Android Games teaches you how to build cool games like Space Blaster and the classic Asteroids from scratch on the latest Android platform. This book also shows you how to port other classic freeware/shareware games like Doom and Wolfenstein 3D from C using the Java Native Interface (JNI) for Android.

This book is all about a unique perspective in Android game development: a well-balanced, powerful combination of pure Java and hybrid game development, mixing Java and C. By combining the elegant object-oriented features of Java and the raw power of C, there is no limit to the types of games that you can build for the platform. With actionable real-world source code in hand, this book allows you to dive right into games development on Android. You'll definitely have fun, and perhaps you'll even make some money. Enjoy!

Inhaltsverzeichnis

Frontmatter

Chapter 1. Welcome to Android Gaming

Welcome to the world of Android Games! The goal of this book is to help you build the best games for the platform. As you work your way through the chapters, you will learn how to create two kinds of games: pure Java, and perhaps most interestingly, hybrid games that combine the elegant design of Java with the raw power of C for maximum performance. The ability to combine both Java and C in this way is what makes the games in this book unique, as Google does not support this kind of development. But you may ask, “Why even bother with hybrid games?” After all, Java provides all the APIs you need to build any kind of game. This is certainly true. However, there are thousands of games out there written in C that can be brought to Android by compiling the C core and wrapping a Java graphical user interface (GUI) using the Java Native Interface (JNI). In this book, you’ll learn how to bring to the platform two of the great 3D shooter games for the PC: Wolfenstein 3D and Doom.

Chapter 2. Compiling Native Code in Android

In this chapter, we will explore the basics of a simple native program, also known as static binary, to be run in the device. You will also learn how to build a shared library (dynamic binary), and finally how to call that shared library within a simple Android project. Let’s get started.

Chapter 3. Building a Java Game from Scratch

If you don’t like C and want to stay as far away from it as possible, the next two chapters will show you how simple and fun writing a Java-only game can be. We start by taking a look at the differences between Android and the Java Micro Edition (Java ME), which is the standard for mobile development. Next, we take a look at some basic gaming techniques such as sprite rendering and sound manipulation, as an appetizer to the main course—building a real game called Space Blaster. In this fun game, you must shoot or duck incoming asteroids that threaten to destroy your space ship. A shield will also help you in your quest for a high score. Let’s get started.

Chapter 4. Java Games Continued: Fun with Polygons

In this chapter, we take things to the next level with an arcade classic: Asteroids. The goal of this chapter is to illustrate a polygon-based game (Asteroids), as opposed to the previous chapter’s sprite-based game (Space Blaster). Using polygons presents a new set of challenges due to the limited polygon capabilities of Android, as you’ll see in the next section. Nevertheless, Asteroids is a relatively simple game that takes advantage of the high portability of the Java language by reusing code from the standard Java SE Abstract Windowing Toolkit (AWT). Let’s get started.

Chapter 5. Hybrid 3D Graphics with OpenGL and JNI

The classic Asteroids arcade game presented in the previous chapter provided a great introduction to drawing techniques in Android, using polygons and user-defined layouts. Now it’s time to ramp things up a notch.

Chapter 6. 3D Shooters Episode I: Wolfenstein 3D for Android

The next two chapters are my personal favorites and the most exciting of this book. We start by looking at the real thing: Wolfenstein 3D (also referred to as Wolf 3D), the godfather of all 3D shooters. The main goal of this chapter is to show you how easy is to bring Wolf 3D from the PC to the Android device, but also in this chapter, you will learn how to do the following:
  • Maximize code reuse by compiling high-performance native code in a dynamic shared library.
  • Write JNI code to connect Java and C subroutines.
  • Cascade graphics back and forth the native and Java layers.
  • Handle sound requests sent by the native layer with the Android media player.
  • Build the Android project and test in the emulator.

Chapter 7. 3D Shooters Episode II: Doom for Android

This chapter looks at another great game for the PC: Doom. Doom came along shortly after Wolfenstein 3D and put id Software at the lead of the pack in 3D graphics gaming for the PC. In this chapter, you’ll learn how to bring the open source Doom engine (PrBoom) to the Android platform.

Backmatter

Weitere Informationen

Premium Partner

BranchenIndex Online

Die B2B-Firmensuche für Industrie und Wirtschaft: Kostenfrei in Firmenprofilen nach Lieferanten, Herstellern, Dienstleistern und Händlern recherchieren.

Whitepaper

- ANZEIGE -

Best Practices für die Mitarbeiter-Partizipation in der Produktentwicklung

Unternehmen haben das Innovationspotenzial der eigenen Mitarbeiter auch außerhalb der F&E-Abteilung erkannt. Viele Initiativen zur Partizipation scheitern in der Praxis jedoch häufig. Lesen Sie hier  - basierend auf einer qualitativ-explorativen Expertenstudie - mehr über die wesentlichen Problemfelder der mitarbeiterzentrierten Produktentwicklung und profitieren Sie von konkreten Handlungsempfehlungen aus der Praxis.
Jetzt gratis downloaden!

Bildnachweise