Saturday, November 28, 2009

Flash Back : Making of TankX

TankX was my first game, made in C++ 3.0. I could only use the graphic library that came with this version and sixteen colors was my limit. TankX had 936 lines of code and five header files. I made specific header files for player tank, enemy tank, power-ups, score, enemy movement. The main file had stuff to make all these things get together and make a game. There was some really heavy programming included for the collision detection and enemy movement. At first the game was really slow and jittery, because of the afore said heavy functions. I made some nice improvement and really got a performance boost in the gameplay. The limitation with C++ 3.0 was that there was no thread system, everything went in procedural kind of way. So I had to check and maintain the code in a single loop which was to end whenever the player hit something.

At first my collision detection involved checking for the co-ordinates of all the enemy tanks and matching them with the player tank, this was really crappy and took a lot of processor power to run, after that I came up with a solution to this one, instead of checking for collision detection every loop, I just checked the vertical position of enemy and matched it with player's (plus minus the radii of both of them added), if this is true then it means that the enemy is in the same vertical position and then I checked the horizontal value of both and if they match we had a collision.

The other header files were really easy and score.h had a system so as to encrypt the data so that possibly someone will have a hard time changing it manually, this thing was stored in a file and if viewed would show crap values and characters, it was only meant to be read in-game.

Another problem that I faced was limited use of Arrow keys on the keyboard, so I had to make do with WASD for the player movement and k,l to speed up or lower the speed of the tank, this feature I never saw before, all these vertical scrolling games have the level and power-up increase the speed of the player with no option to decrease it.

After all this, I had planned to add more power-up and stuff but I never really got to make it as is with all the indie game developers, we get all other exciting ideas and the old one is scraped. The world of Flash opened up many possibilities for me, and I do plan to make a better version of TankX in Flash. Hope those who play the game like it, it can be downloaded from my games site

No comments: