This is following up on my motivation to break into game programming. You can check it out here. So let’s crack on and get an idea.
Coming up with an idea for the game
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:
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.
In the next article the game architecture will be introduced in its basic form.