Before I begin, I would like to thank Andreas for providing me with keys for Texture Packer Pro and Physics Editor ( http://www.texturepacker.com/ ). I will be using and reviewing those tools in future posts.
This week I am going to take a bit of a look at Twelve Months of Doomsday Episode 3: Invasion which was released last week. As I said before, when creating a game that is paying homage to an existing (old by modern standards) game, I like to have my own twists to the game. Anybody familiar with classic arcade games knows the game "Space Invaders". In this game an army of aliens march back and forth across the screen trying to get to the bottom of the screen. The obvious twist for this game is to have a number of formations. This is clearly not an original twist to the game as there are numerous games that did just this. My personal favorite Space Invaders variant would be Gorf.
To me, this is not enough of a twist, so I thought about having a different movement pattern. This got me thinking about another classic arcade game known as centipede. The neat thing about that game was that if you shot the centipede in the middle, half of the centipede would continue on it's existing course while the other half would immediately drop down a row. This would also give me the chance to have lines moving in different directions at the same time.
Implementing this movement logic was a bit more challenging than I originally expected. The core movement logic is easy enough. The aliens are put into "lines" where they follow the head alien which determines the movement for the line. Each alien simply tries to move to the location of the alien ahead of them. Dividing the line into two is simple enough. The new line gets flagged to move down so that is simple to handle. The problem is determining where the aliens can move to and if they have a clear shot. Checking against every alien to see if a collision was going to happen would be very inefficient. Granted, todays computers are more than fast enough that I could probably have gone this route. Instead, I break the play field into a tile grid and mark the location of aliens on the grid with the ability to reserve a tile so you don't end up with multiple aliens trying to go into the same tile.
As I didn't want aliens shooting through each other, this made checking if an alien was in the clear and could take a shot at the player was very simple. The grid is checked to see if there are any aliens in the same column as the alien. If not (and reserved tiles in that column count as aliens) we know that the alien can take a shot without hitting another alien.
Thursday, March 22, 2012
TMoD episode 3 Invasion
Subscribe to: Post Comments (Atom)
Post a Comment