Arcade Tonk Tanks - 0.0.6

Koen Lefever (koenlefever)

Tags:

Description

This game has been tested to work on:
- Linux, Windows XP/Vista/7 and Mac OS X
- Python 2.5 and Python 2.6
- Pygame 1.8 and Pygame 1.9.1

This is my first program in Python (my first program in an Object Oriented language for that matter) and I'm rewriting it completely to support client/server multi-player gameplay. For now Arcade Tonk Tanks is a playable demo in which you can play the red tank against the computer.

Credits

Changes

Arcade Tonk Tanks now has new scenery (including water) created by Marc Carson and new explosion graphics created by David Howe. The too-many-bullets-error has been corrected. The source code is no longer in a single file.

(The source code contains a comment that this is not a release version. Please ignore that, I just forgot to delete the comment.)

Releases

Pygame.org account Comments

If you wish to leave a comment with your pygame.org account, please sign in first.

June 26, 2011 9:55pm - Omfgnuts - nickname: (omfgnuts) - 2/5

Why this is always on top?

March 24, 2011 5:09pm - Koen Lefever - nickname: (koenlefever)

@captalex: You can use any sprite editor for your sprites, the graphs in Tonk Tanks were created using The Gimp - which may not be the best choice for a beginner, but really, any editor should do. For the explosion sprites, check the website of David Howe (http://homepage.ntlworld.com/david.howe50/page16a.html). To learn Pygame programming, work through the tutorials (http://www.pygame.org/wiki/tutorials). Good luck with your game.

March 19, 2011 4:05am - me - nickname: (captalex)

nice work man, i'll like to use your idea to create a militant soldier , that is hungry and collects power ups(extra bullets, grenades) and

kebabs as he shoots the opposing rebel forces and maybe eventually add two player support and lan/internet multiplayer), but i dont know how

to draw my own sprites and manipulate you code! . although your explosions would look very cool in my project, do help(pygame beginner)

March 1, 2011 5:11pm - Zachariah Callaway - nickname: (xzcallaway)

a .deb package of Arcade Tonk Tanks is available for download at dotdeb.com in the Arcade section.

August 10, 2010 5:37pm - Koen Lefever - nickname: (koenlefever)

@Kristoffer & all who want to know how to build a windows executable game installer, check this: http://www.cs.iupui.edu/~aharris/pygame/Appendix_C.pdf

July 31, 2010 12:13am - Areal Person - nickname: (arealperson) - 4/5

This is really good.
Anyone can work with this and be productive very quickly !

June 30, 2010 4:15pm - Mad Cloud Games - nickname: (madcloudgames)

Great job on the game its looking really good.
Heres some things that i think could help.

Have a respawn timer
its REALLY disorienting to instantly disapear from one side of the screen to the other every time you die.

Add some life
i think having maybe 3 hits before every tank dies would help with encouraging more strategic ways of playing

powerups
ones you drive over could be fun in this kind of game or maybe kill streaks would power you up

Very nice game. I love the graphics and it's actually pretty fun!
I have a somewhat prosaic question for you though:
How did you make the executable file work? I've tried to create stand alone executables for my game, but i simply can't make it work. I've been using pyinstaller 1.4.

May 30, 2010 12:07am - Steven Johnson - nickname: (shjohnson12) - 5/5

Great game, it made me laugh as I played it. I'll be waiting for updates!

April 18, 2010 2:10pm - Bjarke SÃěrensen - nickname: (gugi9000)

I'm been playing 0.5 which is quite fun. Even more so, once I adjusted the settings to make it more tactical and less of a spray-fest.

March 5, 2010 8:30pm - Koen Lefever - nickname: (koenlefever)

The game engine has been split off from the game and now is a project in its own right: http://code.google.com/p/tonk-engine/ I'm trying to make the Tonk Engine as generic as possible, so that it could be used in a broad class of 2D games with a scrolling background. It is nowhere near a release yet. It does show which way Arcade Tonk Tanks is going, so please stay tuned.

@all who hate the navigation system: I've simplified it vastly.

January 19, 2010 3:05pm - Koen Lefever - nickname: (koenlefever)

@NyRe: Thanks for your suggestions, I'll kick out the acceleration system & rework the respawing system.

January 19, 2010 11:37am - NyRe - nickname: (nyre) - 4/5

Several suggestions and remarks:

1) Acceleration doesn't work out so well in a game like this. I suggest you remove it totally and just move when you hold UP and stop when you don't.

2) You have an error with key holding. Holding UP and RIGHT at the same time doesn't rotate the tank.

3) Block the spawning points from spawning anything for a brief time after respawn. It doesn't feel good when you ride out of it only to an enemy tank to respawn there the moment later and shoot you in the back.

December 31, 2009 11:27am - Neil Tallim - nickname: (flan)

@Lucas: A lot of things don't work with Python 3.x. It's not backwards-compatible with Python 2.x, which most developers still use, by design.

December 30, 2009 5:06pm - lucas92 - nickname: (lucas92)

It doesn't work with python 3.1...

December 28, 2009 8:32am - Koen Lefever - nickname: (koenlefever)

Version 0.0.6 has been released. There are new scenery graphics (with water) by Marc Carson and new explosion graphics by David Howe (http://homepage.ntlworld.com/david.howe50/page16a.html). The too-many-bullets-bug has been corrected (it was unrelated to what I wrote earlier about it, below here). The source code is no longer in a single file. All global variables have been moved into the GameData class. In the mean time, work on the client/server version (0.1.0) is ongoing.

October 26, 2009 11:52pm - Koen Lefever - nickname: (koenlefever)

@Justin: Thanks for playing. The controls seem to be hard at first to more people, with a little bit of practice you'll get used to them. My son advised me to simplify them by dropping the gears system and just having [arrow up]=drive forward & [arrow down]=drive backward. What do others think?

@Jared: Thanks for your advices, I agree fully with them. I'm already avoiding globals & using several files in the current 0.1.0 rewrite. I've googled a bit about your other tip, I guess it is this kind of stuff you mean: <a href="http://www.ibm.com/developerworks/library/l-pyint.html">Guide to Python Introspection"</a> ("instanceof" seems to be Java, this article describes "isinstance"). That's new to me & fascinating indeed - something I'll have to get used to in object/class programming.

October 25, 2009 11:02pm - justin - nickname: (justinc) - 4/5

This is a really nice game.
The movement felt kinda weird to me but overall i liked it.

October 23, 2009 1:14am - Jared - nickname: (jabapyth) - 3/5

looks really cool. quick python tip -- everything doesn't have to be in one file: modularity==flexibility==good. also, don't try to recreate ENUMs...feel free to check whether an object is an instance of a class w/ instanceof(instance, class). In general, GLOBALs are not the best idea ;)
nice game, though.

October 15, 2009 12:23pm - Kevin Dahlhausen - nickname: (kpd)

Koen, The TI tank game was written in either basic or extended basic, I don't recall which. Yup, it was slow.

October 12, 2009 6:53pm - Koen Lefever - nickname: (koenlefever)

Known bug: you get too many bullets :-) This is due to some sloppy programming: cross-variable changing (I don't know what is the correct term for this) between bullet & tank objects in the bullet counter - this is possible in Python but I now see why it's a bad idea of actually doing it. this will be corrected in ongoing rewrite of the game.

October 11, 2009 8:20pm - enderskill - nickname: (enderskill) - 5/5

Extremely impressive game! (One of the reasons I rated it a 5 instead of 4 is because you provided a working Windows installer.)

October 6, 2009 7:23pm - Koen Lefever - nickname: (koenlefever)

The game has been compiled and a Windows installer has been created. You do not need to have Python or Pygame installed to use Setup_ArcadeTonkTanks_005.exe - this installer has been tested on XP and Vista.

September 25, 2009 7:11pm - Koen Lefever - nickname: (koenlefever)

Version 0.0.5 has been released. Marc Carson has created some very cool graphics. Vladislav Malkov a.k.a. Artsense (http://www.myspace.com/artsensepsy) has been so kind to give permission to use his track "Only Depth". If you would prefer the old graphics and no sound, you can still use the previous version (0.0.4) since there are no differences in functionality or gameplay. Have fun!

April 14, 2009 6:19pm - Koen Lefever - nickname: (koenlefever)

@Kevin: Thanks for your encouragement & ideas. I remember the TI99 well: it was the only 16bit machine on my shortlist when I bought my first computer in 1981 -- a lovely machine, I liked it very much. The only reason I did not buy it was because it did not allow for assembler or machine code programming. So, I'm curious to know what language you used to write Tank in on the TI99.
On topic again: I'm still experimenting with both the UDP and AMP protocols and trying to wrap my mind around the Twisted Framework.

April 13, 2009 4:23pm - Kevin Dahlhausen - nickname: (kpd) - 5/5

Tank has always been my favorite game (in fact I was recently able to get the version I wrote for the TI99-4/a home computer off tape and into an emulator). Anyway, this is game is a lot of fun. The controls are intuitive. I like it very much. Don't have a lot to add for suggestions - I added an option for guided missiles that turn based on the normal movement keys once fired. Also added a play element where players shoot random objects on the screen before hitting the other player. The score you get for killing the other tank is derived from the number of objects you had shot before killing the other tank.

April 4, 2009 8:56pm - Koen Lefever - nickname: (koenlefever)

I'm writing the client/server version using the UDP protocol from the MasterMind Network Library by Ian Mallett (geometrian).

April 3, 2009 7:16pm - Koen Lefever - nickname: (koenlefever)

Thanks, I'll have a look at Boardgame & Mastermind. I'm also considering to use the AMP protocol, as provided by the Twisted framework:
http://twistedmatrix.com/documents/current/api/twisted.protocols.amp.html

April 3, 2009 8:04am - Barry - nickname: (isharacomix)

I've been hacking around with networking too (and I was pretty close to trying to port your game to my own server). My results so far can be seen in my other project here (it's called BoardServ). I was actually able to make a sort-of-working server-client system.

Recently, however, I've picked up a network library called MasterMind (also here on Pygame.org), and I've been trying to work with it as well. It makes networking relatively easy compared to what I've been doing. You may want to look into it when you get ready to rewrite your code.

ATT is a really addicting game. I'll actually play it while I wait for my classes to start sometimes. The interface is busy and engaging and the controls are simple. Plus, it's fun to mess around with the options. I'm new to the Pygame scene too, and it was awesome actually being able to help out.

P.S. Way to go on your stance towards bots. More folks need to think this way. I think it would be awesome to have a bunch of players pit their custom bots against each other.

April 2, 2009 5:51pm - Koen Lefever - nickname: (koenlefever)

Thanks for playing Arcade Tonk Tanks. The feedback I get in the Pygame community is really nice and helpful.

I'm interested in hearing whatever idea for the game you may have got. From here on the game can go plenty of ways. I could for example add objects like shields which protect you against bullets when you pick them up. There could be lava walls, which are deadly for the tanks. There could be ground types which cannot be crossed by tanks, but over which bullets could pass... Some more of that and Arcade Tonk Tanks could be turned into a campaign game. However, that is not really the way I'd like to go. (My son is eager to build a campaign game based on this game. I actually wrote Arcade Tonk Tanks to test Python because I was looking for a good programming language to teach my children - I guess I have found what I was looking for :))

The game in its present incarnation (0.0.4) is a quick hack and needs a complete rewrite before I add more whistles, bells and other features.

What I mainly want to concentrate on now is the networking. Players should be able to play against each other and also against each other's bots. In an open source network game there is no way to keep the bots out, let us therefore embrace our artificial opponents completely and integrate them as such in the game by providing a nice interface (most likely a library).

Once the groundwork has been done properly, I want to start adding features. New features at that point would be things which make sense for human2human, human2bot and bot2bot gameplay. I want to keep the game as generic and customizable as possible, every feature should be accessible through the options system. The options system as such needs a complete redesign. It must be possible to save a set of options. There will be preset option groups with names such as "easy" vs "hard", "every bullet counts" vs "sprayfest".

So, now I'm studying how to use Subversion (should go fast, since I've used other version control systems before) and how to program with sockets.

All your thought, comments & criticisms are welcome.

April 1, 2009 6:48pm - Rene Dudfield - nickname: (illume)

I love the graphical style... can't wait to give it a go.

cu.

April 1, 2009 12:24pm - Koen Lefever - nickname: (koenlefever)

In version 0.04, all math.trunc() calls have been replaced by int(). This works in both Python 2.5 and 2.6. I've now running Arcade Tonk Tanks on Linux and Windows. Have fun.

April 1, 2009 11:15am - Koen Lefever - nickname: (koenlefever)

@Barry: Thanks for your help & time. I've just installed Pygame on Linux, so I can start testing my code there. Somebody advised me to use int(math.floor()) en lieu de math.trunc(). I'll try both that and your solution on some different versions.

April 1, 2009 10:29am - Barry - nickname: (isharacomix)

This time, I replaced all occurrences of math.trunc() with the int() function. If math.trunc is used to turn floating point numbers into integers, it looks like int() does pretty much the same thing.

It ran without any complaints, anyway.

April 1, 2009 9:43am - Koen Lefever - nickname: (koenlefever)

Version 0.03: I have changed the filenames in the code, as suggested by Barry. Can somebody using Linux and Python 2.6 please give me feedback if this works or doesn't work? Thanks. I'm still looking for an elegant solution to make the game work on both Python 2.5 and 2.6 (only works on 2.6 for now).

April 1, 2009 6:00am - Koen Lefever - nickname: (koenlefever)

@Barry: thanks for your feedback, I will upload a version with your corrections soon.

March 31, 2009 9:24pm - Barry - nickname: (isharacomix) - 3/5

I tried to run it, and the first glitch was that it couldn't load the images because *nix machines use case-sensitive filenames (in your case, the source code tries to load Color_Bullet.bmp, but the files are named Color_bullet.bmp). You need to make sure that the case of the actual filenames match up with the ones you try to load.

I fixed that up and tried to play again, but it crashed when it attempted to call math.trunc() (because I'm still using Python 2.5). So I erased all instances of 'math.trunc()' from the source and... wouldn't you know it... it worked (in spite of exceptions coming in every step).

It's lots of fun, and has excellent potential as a party game. The up/down acceleration system is a little awkward (especially if you spawn at the top of the screen). Good luck on adding the networking. I can't wait to see this project move forward.

March 31, 2009 5:43pm - Koen Lefever - nickname: (koenlefever)

Version 0.02 is here already :)

I've quicly implemented Pymike's advice. The program will prompt you now to select full screen or windowed mode.

March 31, 2009 2:37pm - Koen Lefever - nickname: (koenlefever)

@pymike: OK, I'll take care of that.

March 31, 2009 2:33pm - pymike - nickname: (pymike)

Went into fullscreen and then crashed X on Ubuntu 8.10, PyGame 1.8.1, Python 2.5.2 - had to reload it and nearly lose some of my coding work.

Plead to programmers/good advice: NEVER start games in fullscreen by default.