Skip to main content
Top

2016 | Book

Beginning Android Games

Authors: Mario Zechner, J. F. DiMarzio, Robert Green

Publisher: Apress

insite
SEARCH

About this book

Learn all of the basics needed to join the ranks of successful Android game developers. You'll start with game design fundamentals and Android programming basics, and then progress toward creating your own basic game engine and playable game apps that work on Android smartphones and tablets. Beginning Android Games, Third Edition gives you everything you need to branch out and write your own Android games for a variety of hardware.

Do you have an awesome idea for the next break-through mobile gaming title? Beginning Android Games will help you kick-start your project. This book will guide you through the process of making several example game apps using APIs available in Android.

What You'll LearnGain the fundamentals of game programming in the context of the Android platform

Use Android's APIs for graphics, audio, and user input to reflect those fundamentals

Develop two 2D games from scratch, based on Canvas API and OpenGL ES

Create a full-featured 3D game

Publish your games, get crash reports, and support your users

Complete your own playable 2D OpenGL games

Who This Book Is For

People with a basic knowledge of Java who want to write games on the Android platform. It also offers information for experienced game developers about the pitfalls and peculiarities of the platform.

Table of Contents

Frontmatter
Chapter 1. An Android in Every Home
Abstract
As kids of the eighties and nineties, we naturally grew up with our trusty Nintendo Game Boys and Sega Game Gears. We spent countless hours helping Mario rescue the princess, getting the highest score in Tetris, and racing our friends in Super RC Pro-Am via Link Cable. We took these awesome pieces of hardware with us everywhere we could. Our passion for games made us want to create our own worlds and share them with our friends. We started programming on the PC, but soon realized that we couldn’t transfer our little masterpieces to the available portable game consoles. As we continued being enthusiastic programmers, over time our interest in actually playing video games faded. Besides, our Game Boys eventually broke . . .
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 2. First Steps with Android Studio
Abstract
The Android Studio and the Android SDK provide a set of tools that enable you to create applications in a short amount of time. This chapter will guide you through the process of building a simple Android application with the SDK tools.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 3. Game Development 101
Abstract
Game development is hard, not so much because it’s rocket science, but because there’s a huge amount of information to digest before you can actually start writing the game of your dreams. On the programming side, you have to worry about such mundane things as file input/output (I/O), user input handling, audio and graphics programming, and networking code. And those are only the basics! On top of that, you will want to build your actual game mechanics. The code for that needs structure as well, and it is not always obvious how to create the architecture of your game. You’ll actually have to decide how to make your game world move. Can you get away with not using a physics engine and instead roll your own simple simulation code? What are the units and scale within which your game world is set? How does it translate to the screen?
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 4. Android for Game Developers
Abstract
As kids of the eighties and nineties, we naturally grew up with our trusty Nintendo Game Boys and Sega Game Gears. We spent countless hours helping Mario rescue the princess, getting the highest score in Tetris, and racing our friends in Super RC Pro-Am via Link Cable. We took these awesome pieces of hardware with us everywhere we could. Our passion for games made us want to create our own worlds and share them with our friends. We started programming on the PC, but soon realized that we couldn’t transfer our little masterpieces to the available portable game consoles. As we continued being enthusiastic programmers, over time our interest in actually playing video games faded. Besides, our Game Boys eventually broke . . .
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 5. An Android Game Development Framework
Abstract
As you may have noticed, we’ve been through four chapters without writing a single line of game code. The reason we’ve put you through all of this boring theory and asked you to implement test programs is simple: if you want to write games, you have to know exactly what’s going on. You can’t just copy and paste code together from all over the Web and hope that it will form the next first-person shooter hit. By now, you should have a firm grasp on how to design a simple game from the ground up, how to structure a nice API for 2D game development, and which Android APIs will provide the functionality you need in order to implement your ideas.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 6. Mr. Nom Invades Android
Abstract
Earlier, we mentioned that we’d want to reuse those paper cutouts from the design phase as our real game graphics. To do this, we first have to make them fit with our target resolution.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 7. OpenGL ES: A Gentle Introduction
Abstract
Mr. Nom was a great success. Because o its solid initial design and game framework, implementing Mr. Nom was a breeze for us. Best of all, the game runs smoothly even on low-end devices. Of course, Mr. Nom is not a very complex or graphically intense game, so using the Canvas API for rendering proved to be a good idea.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 8. 2D Game Programming Tricks
Abstract
Now, it’s time to look at some of the more advanced topics of 2D game programming. You used some of these concepts intuitively when you wrote Mr. Nom, including time-based state updates and image atlases. A lot of what’s to come is also very intuitive, and chances are high that you’d have come up with the same solution sooner or later. However, it doesn’t hurt to learn about these things explicitly.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 9. Super Jumper: A 2D OpenGL ES Game
Abstract
We’ll implement a jump-’em-up game similar to Abduction or Doodle Jump. As with Mr. Nom, we’ll start by defining our game mechanics.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 10. OpenGL ES: Going 3D
Abstract
Super Jumper worked out rather well with the 2D OpenGL ES rendering engine. Now, it’s time to go full 3D. We actually already worked in a 3D space when we defined our view frustum and the vertices of our sprites. In the latter case, the z coordinate of each vertex was simply set to 0 by default. The difference from 2D rendering really isn’t all that big.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 11. 3D Programming Tricks
Abstract
3D programming is an incredibly wide and complex field. This chapter explores some topics that are the absolute minimum requirement in order to write a simple 3D game.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 12. Android Invaders: The Grand Finale
Abstract
We are finally ready to create the last game for this book. This time, we are going to develop a simple action/arcade game, adapting an old classic and giving it a nice 3D look by using the techniques discussed in the previous two chapters.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 13. Going Native with the NDK
Abstract
After all the 3D extravagance in the past three chapters, it’s time to look into one more aspect of programming games for Android. While Java and the Dalvik VM are sufficient for a lot of game genres in terms of execution speed, there are times when you need a bit more power. This is especially true for physics simulations, complex 3D animation, collision detection, and so on. This type of code is best written in more “to-the-metal” languages like C/C++ or even assembly language. The Android native development kit (NDK) lets us do exactly that.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 14. Marketing and Monetizing
Abstract
So, having read the previous 13 chapters, you now are imbued with the skill and knowledge required to build a great Android game. Is it as simple as “build it and get rich?” Certainly not! Making money by marketing and monetizing your game is a skill in itself, and there is a lot you need to learn to become successful at it—not just after your game is completed, but even before you start developing it. The real moneymakers are often designed from the planning stage to become popular and to make money, on top of being well made.
Mario Zechner, J. F. DiMarzio, Robert Green
Chapter 15. Publishing Your Game
Abstract
The last step in becoming an Android game developer is getting your game to your players. There are two possible routes.
Mario Zechner, J. F. DiMarzio, Robert Green
Backmatter
Metadata
Title
Beginning Android Games
Authors
Mario Zechner
J. F. DiMarzio
Robert Green
Copyright Year
2016
Publisher
Apress
Electronic ISBN
978-1-4842-0472-6
Print ISBN
978-1-4842-0473-3
DOI
https://doi.org/10.1007/978-1-4842-0472-6

Premium Partner