This is the hardest part. Because I am just one guy having limited time I will choose one idea that is realisable in a short time and will contain all elements of an action game.
So I came up with a story for the game. The story goes like this:
The end is nigh! Evil robots from outer space have set up factories on the moon and are sending their ever increasing waves of machines to destroy humanity. For what reason? Beats me but they have laser cannons, missiles, brain washing weapons and a lot of other harmful stuff.
Every man for himself! How long before the end? How long can one survive or maybe defeat the machines by reaching the moon base and annihilate the super brain?
That should be enough. Now let’s design something around this story.
Checking the Android specs we see that we have limited memory and 480×800 pixels to play with. The first game that comes to my mind is robotron. Waves of robots, missiles from everywhere and 2 joysticks. A perfect setup for a handheld device held horizontally.
One thumb for directions and the other one for shooting the baddies in every direction. A classic shoot’em up.
Let’s go retro. Pixelated graphics is cool and the art is in the effects. Will try to do that.
We have one guy. He’s got 3 lives and a gun. He’ll be dropped in the middle of a room and some baddies are trying to kill him already.
We have the basic information to sketch out our game structure.
But, we don’t have a name. Let’s see, droids taking over the planet…checked google for “droidz” and “droidz game” guess what? No droidz game found. I will name this: “droidz”.
I find it a cool name for the first game using android.
Above you have a rough mock-up of what the game will look and feel like. The 2 grey circles are the controllers. Imagine the device being held horizontally and you have your thumbs on the circles. Your left thumb will move our hero while the right thumb will fire the weapon. The direction is being controlled by the position of your thumb relative to the circle’s centre.
Now that we have the idea let’s identify what we need to get the game done.
We need the game objects. Currently there are 2 types of actors in this. Our guy and the droids.
To control our guy we need to receive user input. The user input will be the touch screen. To be more precise the 2 circles defined on the screen. One controls the guy’s position and the other his weapon.
A typical game architecture looks like this:
- Process input
- Update state of game objects. This means calculate new positions for every item, check game logic, collisions etc
- Produce sounds
- Render state to screen
- If game is not over repeat from step 1
For example: Our guy is in the middle. Droids move every 1/10 of the second towards him. Every tenth of a second we check if the screen was touched and if it was touched we move our guy or fire his weapon. If the weapon was fired we check every tick (that’s 1/10 s) if the bullett collided with any droid to destroy him. If collided then droid is destroyed and the bullett is also destroyed. If no collision then both droid’s and bullett’s new positions are calculated according to their speed (droid moves 5 pixels every 1/10 s for ex and the bullett moves 50). We also check if the droid collided (reached) our guy and if so our hero is dead and game over.
This is an overview of how this game will work but will extend it as we go.
- Android Game Development Tutorials Introduction
- Android Game Development – Create The Project
- Android Game Development – A Basic Game Architecture
- Android Game Development – A Basic Game Loop
- Android Game Development – Displaying Images with Android
- Android Game Development – Moving Images on Screen
- Android Game Development – The Game Loop
- Android Game Development – Measuring FPS
- Android Game Development – Sprite Animation
- Android Game Development – Particle Explosion
- Android Game Development – Design In-game Entities – The Strategy Pattern
- Android Game Development – Using Bitmap Fonts
- Android Game Development – Switching from Canvas to OpenGL ES
- Android Game Development – Displaying Graphical Elements (Primitives) with OpenGL ES
- Android Game Development – OpenGL Texture Mapping
- Android Game Development – Design In-game Entities – The State Pattern
- Android Games Article Series