Multiplayer Game: TeenyTank

Hi everyone! I made my first game!

TeenyTank

TeenyTank is multiplayer physics-based game where the ‘aim’ (haha, get it???) is to blow-up your opponent.

Gameplay Video

Just a short little vine that goes over the basic gist of the game. Tanks can actually survive a few hits, so this is after they’ve taken some damage.

https://vine.co/v/iBgJ6UIT7Mg

Controls

The controls are fairly simple:

  • Left/Right: Aim
  • Up/Down: Adjust Power
  • B (gameboy A): Fire
  • A (gameboy B): Hold down for fine aim/power control

It’s pretty simple, it only took me about an hour to get the basic mechanics going, so the code shouldn’t be too hard to understand.

The next thing this needs is a title screen! Then maybe I’ll look into adjusting the number of players, and perhaps adding some basic AI?

7 Likes

The terrain looks pretty neato. I used to play a ton out of Scorched Earth, so thanks for this addition. It was a fun game because you could have a bunch of people play a match on one computer. You reminded me of another post when you said you were thinking about working on multiplayer.

http://community.arduboy.com/t/multi-player-using-a-chrome-app/553

This is so awesome, when I get some time (lol) I want to sit down and add some mods to this! I have a few ideas!

Maybe you could make other kinds of weapons? Power ups?
Could have more than just 2 players, using zoom graphics maybe? Or scrolling?
Custom maps (or control variables)?

Graphics wise I wonder if it would be possible to only draw the top-most line of the horizon so that it’s not the giant block of white? Or even it would be possible to do some kind of dithering fill there?

Adding clouds would be fun too :smile:

I really like this!

Nice work!!

Looks cool! Would be awesome to turn this into a Worms like game :smiley:

1 Like

Hey I was trying to install this (Ks Arduboy, 1.0) and I get this error:


Arduino: 1.6.9 (Windows 10), Board: "Arduboy"

MicroTanks:24: error: redefinition of 'Arduboy arduboy'

 Arduboy arduboy;

         ^

TeenyTank:24: error: 'Arduboy arduboy' previously declared here

 Arduboy arduboy;

         ^

MicroTanks:26: error: redefinition of 'Tank tanks [2]'

 Tank tanks[NUM_TANKS];

                     ^

TeenyTank:26: error: 'Tank tanks [2]' previously declared here

 Tank tanks[NUM_TANKS];

      ^

MicroTanks:27: error: redefinition of 'int curTankIndex'

 int curTankIndex = 0;

     ^

TeenyTank:27: error: 'int curTankIndex' previously defined here

 int curTankIndex = 0;

     ^

MicroTanks:28: error: redefinition of 'int state'

 int state = 0;

     ^

TeenyTank:28: error: 'int state' previously defined here

 int state = 0;

     ^

MicroTanks:30: error: redefinition of 'boolean prevBDown'

 boolean prevBDown = false;

         ^

TeenyTank:30: error: 'boolean prevBDown' previously defined here

 boolean prevBDown = false;

         ^

MicroTanks:33: error: redefinition of 'double bulletX'

 double bulletX = 0;

        ^

TeenyTank:33: error: 'double bulletX' previously defined here

 double bulletX = 0;

        ^

MicroTanks:34: error: redefinition of 'double bulletY'

 double bulletY = 0;

        ^

TeenyTank:34: error: 'double bulletY' previously defined here

 double bulletY = 0;

        ^

MicroTanks:35: error: redefinition of 'double bulletDX'

 double bulletDX = 0;

        ^

TeenyTank:35: error: 'double bulletDX' previously defined here

 double bulletDX = 0;

        ^

MicroTanks:36: error: redefinition of 'double bulletDY'

 double bulletDY = 0;

        ^

TeenyTank:36: error: 'double bulletDY' previously defined here

 double bulletDY = 0;

        ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void intro()':

MicroTanks:39: error: redefinition of 'void intro()'

 void intro()

      ^

TeenyTank:39: error: 'void intro()' previously defined here

 void intro()

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void setup()':

MicroTanks:60: error: redefinition of 'void setup()'

 void setup() {

      ^

TeenyTank:60: error: 'void setup()' previously defined here

 void setup() {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void initRound()':

MicroTanks:72: error: redefinition of 'void initRound()'

 void initRound() {

      ^

TeenyTank:72: error: 'void initRound()' previously defined here

 void initRound() {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void placeTank(Tank*)':

MicroTanks:105: error: redefinition of 'void placeTank(Tank*)'

 void placeTank(Tank *tank) {

      ^

TeenyTank:105: error: 'void placeTank(Tank*)' previously defined here

 void placeTank(Tank *tank) {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void drawTank(Tank)':

MicroTanks:122: error: redefinition of 'void drawTank(Tank)'

 void drawTank(Tank tank) {

      ^

TeenyTank:122: error: 'void drawTank(Tank)' previously defined here

 void drawTank(Tank tank) {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void clearTank(Tank)':

MicroTanks:127: error: redefinition of 'void clearTank(Tank)'

 void clearTank(Tank tank) {

      ^

TeenyTank:127: error: 'void clearTank(Tank)' previously defined here

 void clearTank(Tank tank) {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'bool pointTouchingTank(Tank, int, int)':

MicroTanks:131: error: redefinition of 'bool pointTouchingTank(Tank, int, int)'

 bool pointTouchingTank(Tank tank, int bulX, int bulY) {

      ^

TeenyTank:131: error: 'bool pointTouchingTank(Tank, int, int)' previously defined here

 bool pointTouchingTank(Tank tank, int bulX, int bulY) {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void update()':

MicroTanks:136: error: redefinition of 'void update()'

 void update() {

      ^

TeenyTank:136: error: 'void update()' previously defined here

 void update() {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void updateAim()':

MicroTanks:147: error: redefinition of 'void updateAim()'

 void updateAim() {

      ^

TeenyTank:147: error: 'void updateAim()' previously defined here

 void updateAim() {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void updateBullet()':

MicroTanks:212: error: redefinition of 'void updateBullet()'

 void updateBullet() {

      ^

TeenyTank:212: error: 'void updateBullet()' previously defined here

 void updateBullet() {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void render()':

MicroTanks:286: error: redefinition of 'void render()'

 void render() {

      ^

TeenyTank:286: error: 'void render()' previously defined here

 void render() {

      ^

C:\Arduino\SKETCH\TeenyTank\MicroTanks.ino: In function 'void loop()':

MicroTanks:290: error: redefinition of 'void loop()'

 void loop() {

      ^

TeenyTank:290: error: 'void loop()' previously defined here

 void loop() {

      ^

exit status 1
redefinition of 'Arduboy arduboy'

This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.



Thank you!

Weee I edited your post and used the code block fences for markdown.

So you had the right idea, but use three ```s.

Example entry for code block,

```
stuff
```

will result in,

stuff
MicroTanks:24: error: redefinition of 'Arduboy arduboy'

 Arduboy arduboy;

This looks like you have multiple source files installed, or the software needs a ifndef fence. If anyone has played this on the 1.0 let us know! It was probably programmed for the devkit and may need some tweaking.

When the error is about a redefinition it is letting us know that it has encountered a line where arduboy has been define before. It’s telling you this is the second time it has been defined in the source, and it’s not happy.

I usually try to port these first to Codebender, I will work on this one. Actually I think maybe I did a bit, because I really loved/love scorched earth. It needed some work into it if I recall though, so I probably went for lower hanging fruit.

I was going to do the @TEAMarg games next, but I think this one just got up to the first of the list!

1 Like

I can confirm that I developed this on the dev kit, and haven’t tested it on the version 1.0 Arduboy with the latest library yet

If you manage to fix it, send me a pull request on GitHub!

I got it to work. When I opened TeenyTank.ino it opened a tab for MicroTanks as well, which is why I assume I saw the “redefinition” error.

Now I feel silly. :stuck_out_tongue:

1 Like

Anyone figure out how to change the size of the explosion?

Tried playing around with the code but am a total neb, I only managed to increase the lives to 5 instead of 3 but with the current size of the explosion radius there is always minimal movement of the tank when hit so basically the games most of the time amount to “who can get the first hit wins” because 9/10 times there is little to no adjustment needed for the following shots to hit which makes the game a little less interesting. If we cant have a bounce added to the tanks after a hit, then a more dramatic terrain effect would at the very least cause more player movement.

@TimOnGaming Ah, my bad, I thought I deleted MicroTanks.ino, but I didn’t sync it with github properly.

@whocontrolswho I didn’t structure it very nicely, but the size of the explosion is determined in line 250 and 253. It just draws a circle on the map, and the size of the circle is the explosion.

One way I thought of to make it more interesting is to include wind that changes, so that you have to update your aim each time. Only problem is I’m not sure how to convey that on the screen.

One easy way would be text on the top like WND, an arrow showing the direction and a number indicating the strength.

This is easily one of my favorite games on the system so far.

1 Like

Thanks for the response! I’ll play around with those settings. The wind would be an awesome way to make it interesting. Ive seen 2 very simple yet efficient ways to cenvey wind and direction. I dont know if you have ever played golf video games, specially the older ones, the would represent the wind by adding a very basic arrow pointing towards the wind direction and would render it either longer or shorter depending on the strength. I could easisly imagine you addind a second, centered line under the power line pointing at either direction from the center and extending towards either direction of the screen depending on the strenght. I have also seen a game on the app store where the whole point is to swipe and throw a paper ball into a trash can, wind direction and strength play a huge role and they simply display this by having a very basic arrow and showing a numeric value between 0.0 and 6.0 to display strength and this has also been very effective. Might i also suggest that it would be awesome if you could dispaly the degree of of the angle position while aiming and maybe the % of power. Its easy for me to ask all of this while i really know little to nothing of the actual coding process.

Thanks again!

1 Like

Got the ROM file?