Game Development Reference
In-Depth Information
Note The method we just used to create our game design is fine and dandy for smaller games.
This topic is called Beginning Android Games , so it's a fitting methodology. For larger projects, you
will most likely work on a team, with each team member specializing in one aspect. While you can
still apply the methodology described here in that context, you might need to tweak and tune it
a little to accommodate the different environment. You will also work more iteratively, constantly
refining your design.
Code: The Nitty-Gritty Details
Here's another chicken-and-egg situation: We only want to get to know the Android APIs that are
relevant for game programming. However, we still don't know how to actually program a game.
We have an idea of how to design one, but transforming it into an executable is still voodoo
magic to us. In the following subsections, we want to give you an overview of what elements
usually make up a game. We'll look at some pseudocode for interfaces that we'll later implement
with what Android offers. Interfaces are awesome for two reasons: they allow us to concentrate
on the semantics without needing to know the implementation details, and they allow us to
exchange the implementation later (for example, instead of using 2D CPU rendering, we could
exploit OpenGL ES to display Mr. Nom on the screen).
Every game needs a basic framework that abstracts away and eases the pain of communicating
with the underlying operating system. Usually this is split up into modules, as follows:
Application and Window management : This is responsible for creating a
window and coping with things like closing the window or pausing/resuming the
application in Android.
Input : This is related to the window management module, and it keeps track
of user input (that is, touch events, keystrokes, periphery, and accelerometer
readings).
File I/O : This allows us to get the bytes of our assets into our program from disk.
Graphics : This is probably the most complex module besides the actual game. It
is responsible for loading graphics and drawing them on the screen.
Audio : This module is responsible for loading and playing everything that will hit
our ears.
Game framework : This ties all the above together and provides an easy-to-use
base for writing our games.
Each of these modules is composed of one or more interfaces. Each interface will have at least
one concrete implementation that applies the semantics of the interface based on what the
underlying platform (in our case Android) provides.
 
Search WWH ::




Custom Search