Saturday, February 26, 2011

Making a Tutorial?

Ive been thinking about making some kind of tutorial for Color Tower Defense, Im not sure how it would work, or if it would even be a good idea. But what I have noticed, is that not very many people have played tower defense games before, and if they have, then they played something like one level of Bloons Tower Defense on

So I often find myself telling people how to play the game. And I could just make a tutorial and that would be good enough. But unfortunately, I have no clue how to do that, or if it would even be worth it.

Some ideas were to make some kind of video which can be played in game. It would just show off basic gameplay and have captions of whats going on. I could maybe enable tool tips in game. Like little arrows that point around and say "Click on this button to start a new wave!"

But really, I don't know if this would even be worth the time I would have to put in. So I just don't know.

Charter School Regional Science Fair

Science Fair
Thursday night was the big science fair that I have been planning for.  Ill just get the suspense out of the way and say that I was one of the 10% of people who now get to move on to the big regional science fair. The science fairs progress like this.
school fair > district fair (or in the case of charter schools, its the charter regional fair) > regional fair > national fair. 

My project was on how I used the Rapid Application Development model to develop my tower defense game. I knew I would not have any issues explaining my project to the judges since I have spent so much time on it, but I was pretty worried about my poster board and the book that goes with it. Im positive that out of the hundred or so in the room, mine was the only one without any color on it :) 

I also was the only computer science software project in the room, so that may have helped, even though they did not separate the judging based on categories.

Another thing was that out of everyone who judged me, none of them knew much about computer science, or programming at all. I think that may have been a good thing, because I was able to impress them with a whole area of engineering that none of them had a clue about.

Heres my basic presentation walkthrough:

I would meet them, and ask if they had any experience with computer science, then I would show them a little bit of gameplay, and explain some of the features of my game. I would then walk through the RAD model, and show them how I used it to keep track of the new features I was adding. I then explained the project release, testing, and feedback methods that I used. I would then wrap up the presentation by explaining some issues that I faced, and how I was able to fix them. Then I would answer any questions they had, and I would be finished. 

More of the Science Fair
Each project was evaluated by three judges, and each judging took 10 minutes. Believe me, I could have gone a lot longer!

But anyways, It went really good! And I ended up being the last name that they called out of everyone. (there were high school, junior high, and elementary school students there) So that was really suspenseful for me. 

The next fair is at the end of March, so I have awhile to prepare my presentation better. This also means that I will not be able to work on my next game as much. Which I would really like to do. But obviously this science fair thing is way more important. 

In the Near Future
I will be releasing a bug fix version of Color Tower Defense in the next couple weeks here. The last few I've released have had serious issues due to my new game menu hierarchy. But they have mostly been fixed. Im also thinking about redrawing all of the background map tiles into more visually pleasing images instead of the basic green, tan, purple, etc. squares. I may also redraw the enemies. And while i'm at it, I might as well redraw all the images that my friends drew for me during the early stages of the game. Not only could I draw them better (no offense. The images have been a really big help!) But that would also allow me to be able to take more credit for the game, instead of having, well, you know..

Wednesday, February 23, 2011

Color Tower Defense 2.2

I just uploaded version 2.2 of the Source and Windows Exe.


  • Source Works on Mac
  • Fixed incorrect map loading glitch
  • Minor balancing tweaks
  • Fixed Infinite loop depth
  • Fixed Infinite money bug
  • smaller download size
  • typo fix

I will get the Mac version up as soon as I can.
I would really appreciate any last minute testing before I display my game at a district science fair tomorrow.

Wednesday, February 16, 2011

Color Tower Defense 2.11

This update will be pretty much all bug fixes. Thanks to all the people who have tested Color Tower Defense 2.0 I have got a lot of feedback. Heres some of the issues that have showed up.

Incorrect map loading
Infinite money glitch *see bellow
Infinite game loop depth *see bellow
balancing issues

all of which will be fixed in the 2.11

-----*Infinite money glitch-----
I think this is pretty funny :) I never thought I would have this happen to me. Generally speaking, infinite money glitches are very sought after and result in a lot of google searches. It's because this is a glitch that people like. I mean, I think its cool! After you go play and experience everything the game has to offer, you search infinite money glitch and it opens up all this crazy new stuff.

this glitch happens if you sell a tower more than one time. Heres the code before I fixed the glitch:

elif event.key in [pygame.K_4, pygame.K_s]:
    if not placing_tower:
        if turret_selected:
                game_map.set_collision(, 'open') # open the tile

And here is after I fixed the glitch

elif event.key in [pygame.K_4, pygame.K_s]:
    if not placing_tower:
        if turret_selected:
            turret_selected = None
                game_map.set_collision(, 'open') # open the tile

As you can see, the only change is that turret_selected is set to none. Before I fixed it, You could basically sell the same tower multiple times. But obviously, it was a pretty easy fix.

-----*infinite game loop depth-----

this is how I used to set up the menu hierarchy

def start_game():
    def pick_map():

        def start_gameplay():

            # main loop stuff

            if user_wants_to_pick_map:

            if user_wants_to_start_over:


so theoretically, you could play the game, pick a new map, continue to play the game, pick a new map, continue to play the game, pick a new map... You get the idea.

The bottom line is, that this way worked, but It was a terrible way to do it. Here is an example of an error you could get.


Traceback (most recent call last):
  File "/Users/student/Desktop/Color Tower Defense/Scripts/Color Tower", line 722, in <module>
  File "/Users/student/Desktop/Color Tower Defense/Scripts/Color Tower", line 715, in main
  File "/Users/student/Desktop/Color Tower Defense/Scripts/Color Tower", line 713, in start_main_menu
  File "/Users/student/Desktop/Color Tower Defense/Scripts/Color Tower", line 678, in start_map_select
  File "/Users/student/Desktop/Color Tower Defense/Scripts/Color Tower", line 713, in start_main_menu
  File "/Users/student/Desktop/Color Tower Defense/Scripts/Color Tower", line 678, in start_map_select
  File "/Users/student/Desktop/Color Tower Defense/Scripts/Color Tower", line 713, in start_main_menu
  File "/Users/student/Desktop/Color Tower Defense/Scripts/Color Tower", line 575, in start_map_select
    info_bar.display_info(build_turret_button.turret_type, 'upgrade info', False)
  File "/Users/student/Desktop/Color Tower Defense/Scripts/", line 69, in display_info
    if self.displaying_message == False: # if nothing is already displaying, then we can display something new
AttributeError: 'Info_Bar' object has no attribute 'displaying_message'


This error message basically says:

*in a intelligent voice, robot like voice.
inside of the main game, inside of the main menu, inside of the map selection screen, inside of the main menu, inside of the map selection screen, inside of the main menu, inside of the map selection screen, there is an error on line 69 of the HUD module.

Haha, Thats really ridiculous.

Anyways the new way i'm doing it involves while loops

running_program = True
running_map_selection = True
running_main_loop = True

while running_program:
    while running_map_selection:
        while running_main_loop:
            #main loop stuff
            if user_wants_to_pick_map:
                running_main_loop = False
            if user_wants_to_start_over:
                running_main_loop = False
                running_map_selection = False
            if user_quits:

                running_main_loop = False
                running_map_selection = False
                running_program = False

It actually works very well, and was easy to change all my code over to fit this new model. Im happy with it.


Color Tower Defense 2.11 is coming out soon. Stay tuned!

Thursday, February 10, 2011

Color Tower Defense 2.0 Bugs and other issues.

I would like to thank all the people who have play tested version 2.0 of Color Tower Defense. And the comments and feedback have been a big help! 

I have noticed two issues which ill talk a little bit about.

K the first version that has issues is the source download.
The way that I'm doing save files is that i pickle a class which has all of the
useful stats inside of it, such as an open_maps list which holds whether each map has been unlocked or not. It then saves that file into the Resources folder.
So the issue is that Im compressing the source files code into a zip folder using Windows XP. 
And someone once told me that Mac and Windows use different zip file formats (or something like that)
So apparently, when I open the source files on a Mac, the pickled files get all messed up. 

So to fix it i'm either going to use a different save file format, not include the save files with the source (and have the game generate them when it runs, or maybe some kind of other option that I have not thought of.

The second issue involves (im pretty sure) all versions of 2.0. Its come up a lot, from tons of people who have played the game. And so I hear that some of the maps are not loading correctly, It has the right character movement, and the correct tower placement, but the image is all messed up. 
Ive looked into it a little bit. And im pretty sure that the issue is caused by multiple background map images being in the same list. So when (in my main loop) it draws the map, I think its drawing every map in the group. And at random times when you start a new map, the new map will be drawn before the old map. 
Im pretty sure I did a terrible job of explaining that, so ill try to make it more simple.

Theres a list, that holds the map images. My main loop used the list to draw the maps to the screen, all of the maps get drawn in the order that they are arranged in the list. But sometimes, the new map will be placed in the wrong spot in the list. It should be placed on top of the others. But sometimes it gets put in  between other maps. Which means it gets drawn, but immediately it has another map drawn on top of it. So the map you see is is the wrong one.

Im happy with that explanation.

So, I thought I was clearing the map list every time I opened a new map. But For some reason its not working.

Thats all the bugs im aware of at the moment.
Ill get working on them and try to release a new version pretty soon here.

Tuesday, February 8, 2011

Multiplayer Tutorial

This is an article that I have been reading about making multiplayer games using python, pygame, and twisted.

Multiplayer games tutorial

It is really helpful, as far as setting up a MVC structure. Which stands for Model View Controller. It basically separates the input (keyboard, mouse,...) from the display from the game logic. This is so you can use events to send things back and forth over the network. Which is useful for multiplayer.

The issue with this tutorial is that It does a TERRIBLE job of explaining how to use the twisted modules. Instead of starting small, and starting with something like, sending basic text messages to your server, or maybe starting with one object. It gives you an example that allows users to reconnect, multiple connections to the same server, and tons of other way complex stuff that you cant learn unless you understand twisted, which the tutorial doesnt explain.

Im going to look for a new tutorial cause this one isnt doing a good job.

Sunday, February 6, 2011


I just figured out how to add pages to my blog.

It looks amazing now!!!!

Check out the downloads page and videos page at the top of the screen.

Color Tower Defense 2.0 has been uploaded!

Color Tower Defense 2.0 has been uploaded to
Our Downloads Page
Our Download Site

Downloads include python source files, Windows standalone Exe, and Mac standalone App.

you can also view our pygame page at
Pygame Project Page

Lots of updates here: multiple difficulty levels, better heads up displays, better balancing, some bug fixes, and now a total of 22 towers. 

New towers include science, volcano, slowing, and more! 

I also compiled it into a standalone App file. 

I still don't know if It runs correctly on Linux, I would really appreciate any help with testing.