Tank Wars!


A game that supports two players over a bluetooth connection as they fire with opposite weapon types.

First the idea started out with just having a multiplayer game were you start at opposite ends of a map. And there are some sample projects that do that.

Then we say well lets control the firing independent of movement. So we could do a dual stick control one moves, one fires, and It just always fires.

And for no real reason, I just felt like I wanted to add an A* (A-Star) class to this project and test the result of sending fewer packets over the bluetooth connection, and ultimately online game center if later used.

Cocos2D has libraries to help here. We decided to download a copy of Tile’d and us the TMX tilemap class. Quickly tile’d let us drop in some Creative Commons tile art sheet and make a level with grass, some water, and walls. Another layer in the TMX would overlay the map serve the purpose of defining open nodes and closed nodes.

Relatively quickly we could condense the tank data object send over the non-wire to just a current point and a destination point only when a player picked a new path, rather than it sending location updates rapidly per-second. Each device would use the two points to path find the tanks travel.

Then this left us with controlling the tanks rotation with a radial touch drag relative to the tank, and firing button to launch an attack in the tank tops direction.

As it got later in the very early morning geometric math got to be less and less our strong suit (as if it ever was) and though we could match the bullet angle with the tanks, the radial to point slope was something that needed more time than we could bring our self to do for one night.

We stopped here happy with nearly 16 hours between two guys, and we could cruise about each other screen with just a tap to desired location, tank rotational aiming, and bullets that sometime flew in the right direction.