Introduction

Hi there, and welcome to the world of Android game development. You came here to learn about game development on Android, and we hope to be the people who enable you to realize your ideas.

Together we’ll cover quite a range of materials and topics: Android basics, audio and graphics programming, a little math and physics, OpenGL ES, an intro to the Android Native Development Kit (NDK), and finally, publishing, marketing, and making money from your game. Based on all this knowledge, we’ll develop three different games, one of which is even 3D.

Game programming can be easy if you know what you’re doing. Therefore, we’ve tried to present the material in a way that not only gives you helpful code snippets to reuse, but actually shows you the big picture of game development. Understanding the underlying principles is the key to tackling ever more complex game ideas. You’ll not only be able to write games similar to the ones developed over the course of this book, but you’ll also be equipped with enough knowledge to go to the Web or the bookstore and take on new areas of game development on your own.

Who This Book Is For

This book is aimed first and foremost at complete beginners in game programming. You don’t need any prior knowledge on the subject matter; we’ll walk you through all the basics. However, we need to assume a little knowledge on your end about Java. If you feel rusty on the matter, we’d suggest refreshing your memory by reading Thinking in Java, by Bruce Eckel (Prentice Hall, 2006), an excellent introductory text on the programming language. Other than that, there are no other requirements. No prior exposure to Android or Eclipse is necessary!

This book is also aimed at intermediate-level game programmers who wants to get their hands dirty with Android. While some of the material may be old news for you, there are still a lot of tips and hints contained that should make reading this book worthwhile. Android is a strange beast at times, and this book should be considered your battle guide.

How This Book Is Structured

This book takes an iterative approach in that we’ll slowly but surely work our way from the absolute basics to the esoteric heights of hardware-accelerated game programming goodness. Over the course of the chapters, we’ll build up a reusable code base that you can use as the foundation for most types of games.

If you’re reading this book purely as a learning exercise, we suggest going through the chapters in sequence starting from Chapter 1. Each chapter builds off of the previous chapter, which makes for a good learning experience.

If you’re reading this book with the intent to publish a new game at the end, we highly recommend you skip to Chapter 14 and learn about designing your game to be marketable and make money, then come back to the beginning and begin development.

Of course, more experienced readers can skip certain sections they feel confident with. Just make sure to read through the code listings of sections you skim over, so you will understand how the classes and interfaces are used in subsequent, more advanced sections.

Downloading the Code

This book is fully self-contained; all the code necessary to run the examples and games is included. However, copying the listings from the book to Eclipse is error prone, and games do not consist of code alone, but also have assets that you can’t easily copy out of the book. We took great care to ensure that all the listings in this book are error free, but the gremlins are always hard at work.

To make this a smooth ride, we created a Google Code project that offers you the following:

  • The complete source code and assets available from the project’s Subversion repository. The code is licensed under the Apache License 2.0 and hence is free to use in commercial and noncommercial projects. The assets are licensed under the Creative Commons BY-SA 3.0. You can use and modify them for your commercial projects, but you have to put your assets under the same license!
  • A quickstart guide showing you how to import the projects into Eclipse in textual form, and a video demonstration for the same.
  • An issue tracker that allows you to report any errors you find, either in the book itself or in the code accompanying the book. Once you file an issue in the issue tracker, we can incorporate any fixes in the Subversion repository. This way, you’ll always have an up-to-date, (hopefully) error-free version of this book’s code, from which other readers can benefit as well.
  • A discussion group that is free for everybody to join and discuss the contents of the book. We’ll be on there as well, of course.

For each chapter that contains code, there’s an equivalent Eclipse project in the Subversion repository. The projects do not depend on each other, as we’ll iteratively improve some of the framework classes over the course of the book. Therefore, each project stands on its own. The code for both Chapters 5 and 6 is contained in the ch06-mrnom project.

The Google Code project can be found at http://code.google.com/p/beginnginandroidgames2.

Contacting the Authors

Should you have any questions or comments—or even spot a mistake you think we should know about—you can contact either Mario Zechner, by registering an account and posting at http://badlogicgames.com/forum/viewforum.php?f=21, or Robert Green, by visiting www.rbgrn.net/contact.

We prefer being contacted through the forums. That way other readers benefit as well, as they can look up already answered questions or contribute to the discussion!

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset