Additional Work, 8/29/2017

Added keyboard shortcuts for buying towers.

Explored the source destruction problem though restructuring.  Fixed the lone-source destruction problem, but am (almost) back to the old dropped-source destruction problem. Almost, because I can now discern a reason for the problem.  However, this required me to destroy the source in the update, which was something I was considering previously, anyway.

In the restructuring, I can, however, see the problem: somewhere between when the source is inserted in the destruction queue and the destruction of the source, the site is inserted placed after the source in the queue (removing the ground tile in the process, I suspect).  Possibly, before I reordered the code, it was putting the source after itself in the queue.  

If I can make sense of that, then I'll have a game.

Additional Work 8/27/2017

A lot of work on the internal code, cutting up the model into smaller bits, moving some of it into other classes where possible, moving others into Game class methods.

Put all creeps into a creep library so that they're no longer generated on the fly in the model.  Evolution has been moved into the creep objects and currently depends on the wave number; when the board expands more slowly later on (based on base size), I'll base the hits on the wave number and the speed on the board size.

Moved a lot of the site and source generation code into 

Added cursor controls with the arrow keys.  Need to add more keyboard shortcuts for buying and selling towers.  

Additional Work 8/17/2017

Had too many objects asking other objects what they were doing, so I moved timers out of towers and into their effects.  While doing so, I found an error where there was just one master spray effect in the entire game, and all of the slaves were looking to it.  This wasn't a big deal as long as the slaves all pointed at different towers, they operated reasonably independently (but there were minor issues here and there, which is the reason for the refactor).

The minor issues were probably only graphical: the splash effect was only displaying in a minority of affected squares (although it looked like it was killing correctly).  All that's fixed.

Although it looks like the game no longer kills the original source.  Need to fix that.  Maybe I can fix the dropped sources problem as well.

Additional Work 8/10/2017

It's almost a game.

Did some additional work on the bank when a few inconsistencies showed up while creating a scoring mechanism (the score is the total number of points gained by killing creeps right now.  I may modify that to be the total number of points gained by killing creeps with towers, i.e., not counting collisions with walls and towers).  

Created area effect towers that do pulse damage. so that every N milliseconds, the tower damages all creeps in neighboring squares.  I modified how sparks are made slightly in order to see the effect happening.

Turned the destroy source feature back on.  Hoping to use this to help build an end state for the game.  Adding the lose state will turn this into a game.  And, in fact, it does work if none of the sites drop a source before the first source is destroyed.  

Part of the error, though, is the same one that causes problems with the rendering of dropped sources.  All indications now point to, at some point, overwriting the ground with the source itself.  After the source is supposed to be destroyed, it remains, and even regenerates the way it's supposed to (if it survives).

To Do:

  1. Animation for area effect towers.  Although something it happening right now, it's not clear what.
  2. Change sparks so that they have different effect from different sources.  A wall should do what they do now: go backwards from the wall.  A non-destructive hit from the side should have sparks move away from the tower.  A projectile, in the direction of the projectile.  Etc.
  3. Modify AI for direct assault if towers will kill all creeps.
  4. Reprogram the remaining creeps after killing a source so that they go after the next closest source.
  5. Determine a more appropriate end state: No towers connected to sources and not enough money to buy new towers.
  6. Power up creeps each wave/ each time they're called.

Additional Work 8/6/2017

Walls now deregister their effects when they are destroyed.

Creep powerups at sources have been modified in a couple of ways:

  1. The creeps new remember that they're under the influence of the source, and don't repeat the power up each step through the source.
  2. The powerup is now handled in the source object, allowing different effects to occur based on the source type.  Right now, all that happens is the speed and hits of the creep change differently for different color sources.
  3. Each creep has a chance to damage the source that powers it up as it passes through.

The creeps now explode when they hit the target source, exploding with their remaining hits in their fury.  I had to stop the source from taking hits because the game can't handle it right now, but the spoke animation works correctly: when enough hits are taken, the spokes turn from the source color to gray.

Additional Work 8/5/2017

More work on towers:

I made towers destructible.  Creeps no longer pass through them, they hit them in the same way that they hit walls.

I created an Effects sequence for the towers that includes: creating the effect, registering it to the tower's neighbors, and activating the effect when creeps enter the square. The current effect is just changing the color of the creeps, but it is enough to work.  A large fraction of the the continuing work will be in adding and improving effects to create different towers.

I modified the creeps so that they power up when passing though a source.  Right now, they just increase their radius, but they will increase their power, speed, etc., upon power up.  I may also institute special effects, like projectiles and immunities.

Additional Work 8/4/2017

Got the first step of the Tower class down: it fills a square with a phantom tower (the creeps can go right through it, but they don't know that) but only if the tower is placed in a spot where it has supply.  Effectively, that means next to a source of its own color or next to a wall carrying power of that color from a source.

Checking the supply of the square and disallowing building if the square is not in supply were the most time consuming things I did today.

As a bonus, this allowed me to do the same for the walls: you can now only build walls if they would be in supply from some source.  This means that creeps can make dead walls in the middle of the board by destroying parts of your wall structure.

Finally, I found the problem of the phantom supply tiles: the system I put together called set_ground() twice.  That was it.  But -- that did not solve the background problem in the source renderer for any sources placed on the board from a site-drop (sources placed in other ways do not have the problem).  It is, unfortunately, a completely different error that requires a fully separate fix.

Additional Work 8/3/2017

Worked on power flow.  Every aspect was problematic.  

First, I had to deregister power all along the walls, including in the nearby squares. (Coverage will determine if it is possible to build there.)  It took a little while get that to propagate without infinite recursion when there were connected loops in the walls, despite following the formula for powering up which did not do that.

Second, I had to figure out how to not deregister all of the power.  Say, if a red-bearing wall ran parallel to a yellow-bearing wall and the creeps destroyed a link in the yellow-bearing wall.  In this case, the intermediate squares lose their yellow power but not their blue power.  

Third, I had to make sure that when a central tile connecting two sources was destroyed the power colors of the remaining walls matched the source on their side.

I have seen one issue in testing where the blue wasn't deregistered from walls connected only to a red source after the creeps destroyed the connection to blue, but for now that's okay.

It works most of the time, and so I think that I can move to the towers.

So I have to figure out how to do the towers.  

Additional Work, 8/1/2017

:Expanded colors to 8: black, yellow,blue,red,green,orange,purple,black.  This will let me create composite creeps (which, right now, will come from power ups) and towers (which will need to be supplied by two or three different sources).

Expanded AI to be attracted to sources of same color, repulsed by different colors (temporary, just looking for interactions between colors).  This means that paths will differ according to the creep color.

Started in on supply.  Each tile has three sets of supply tokens, delineating the different sources of supply for each tile.  Currently, only the tiles next to sources are supplied, but walls will conduct supply to farther points.  Supply does work for multiple sources.

Error: Sometimes sites will supply tiles when spawning even though they don't hold a source (about 1/5 do).  Whatever this problem is, it has to do with source spawning from inside the sites and could be related to the problem when sources don't produce the correct background color.

July Overview


Simplified board expansion.  If board stays unidirectional, then this stays same.  If I want to expand in more directions, then I'll have to do something else.  This fixed some AI errors and some tracking (ghosting) errors.

Instituted different colors for sites, sources, and creeps.

Improved movement to reflect terrain speed.

Creeps damage wall in self-detonation upon collision:

  • Detect presence of object in square.
  • Explosions of different sizes.
  • Particle effects. 

Creeps have different properties (fast/slow,light/armored)

Improved AI to calculate base on both the underlying terrain (how fast a creep travels on it) and the structure in it (attacted to sources, avoidant of walls).

Reduced AI to single calculation per wave.


  • Scale dependent rendering for sources, sites, and walls
  • Wall indicate connections and turns and so on.
  • Sources animated, with strength indicated in animation.


To Do


Higher order colors (green,orange,purple,white)

Start VCS


AI improvements:
Preference / avoidance of like colors.

Behavior Improvements
Power ups from passing through sources.
Destroying sources during power ups (light, 1 hit) and path ends (full dose)


Power conduction through walls.  Start at sources, terminates at towers.

  • Decide what to do with under powering line.
  • Animate power line; different for different colors and scales.


Start on basic towers (basic towers may be it for PC demo game):

  • Blue - Slide, neighboring tiles
  • Red - Damage, ranged
  • Yellow - Weaken, neighboring tiles


  1. Sources have wrong background colors (their own color, not that of underlying ground).
  2. Occasional (1 / 10 runs) AI crashes on board expansion: no path from one end.

Additional Work 7/31/2017

Fixed up AI so that it separates out the speed component (terrain difficulty) and the building component.  I no longer have to hard code the Source and Wall difficulties, instead I use a linear function a*D+b, where D is the difficulty.  The factors a and b are different for each type of terrain for each type of unit.  These are currently static, but will be evolved later -- once I know the target I want to optimize for.

This fixed the problem that had the units slow down too a standstill after destroying a wall.

I also fixed a problem where the vertical motion didn't work correctly -- there was no slowing vertically on the screen. 

Additional Work 7/30/2017

In the last two days I worked on some graphics and movement stuff.

I have animated the graphics for the sources: rather than being blue dots, they are colored with their power type with an outer and inner circle.  Between them a number of dots equal to the power of the node circle the center.  

Problems with that: sources dropped from sites have a background of the same color, rather than the underlying ground (which I've modified the sources to show; hopefully walls do).  As I understand what I'm doing, I don't think this should be happening and I can't identify the source of the error.

I have also colored the sites and creeps.  Creeps of different color now have different numbers of hits and different speeds.  A creep with more hits does more damage to walls and things.

I've also changed the movement to reflect the underlying ground.  This makes the creeps' paths make sense.  Unfortunately, since I've hacked the Uneven_Ground pathfinding to reflect the presence of walls and sources, when a wall is destroyed the creeps move too slow through the previous space.  To fix this, I will have to start writing the actual AI code.  I can't start optimizing the code yet, though, because there are no trade offs for length of path incorporated into the game, yet. 

Additional Work 7/28/2017

Still mucking around with the expanding board.  I've stopped destroying an board instance and making a new one, and moved to modifying it.  I may have to go back to the old way, but even after the previous modifications, I a few creeps were able to phase through the walls.

I've fixed that by only allowing one line of creeps on the board at the same time.  This will have to change later, but it gets rid of the secondary phasing problem, which occurs when the AI delays get long because of the expanded map size.

These delays hold up the interface, so it looks like improving making the creep ai faster needs to be the next priority.

Additional Work 7/24/2017

Got the dynamic walls up.  Now it's fun just making wall designs.  Also refreshes walls designs when neighbors are destroyed.  Added particle effects upon collisions with creeps.  

Creeps also weren't dying in collisions, just doing damage and passing on through.  taken care of, with the exception down below.

Next up: Power


(1) Creeps seem to hold what I think is the version of the map that was in play when they were created in memory, so sometimes pass through the current walls.

Additional Work 7/23/2017

After a Holiday delay and a few unrelated problems, I'm back at it.

I've fixed up the walls, especially, today.  I found the persistent error in the AI programming that ignored the walls (it wasn't an error really an error in the program: the AI script that was being used was intended to look at the terrain, not the structures built on them; in fact, I'll have to fix the fixes later).  I then made the creeps destroy the walls.  The difficulties in all this were in how storing the terrain in the walls interacted with the expanding board.

All fixed.

Next up: base towers.

Additional work for walls:

(1) Dynamic drawings to indicate connections (right now, they just little white squares).

(2) Carrying power through the walls of different types.

(3) Indicate the power in each of the walls in the dynamic drawings -- at the right scales.

(4) Renderers need to be scale dependent for mini-map and zooming.

Additional Work, 6/29/2017

Got the factories working,  as well as bringing up the factory suite when an individual square is selected.  Had some problems with renderers when highlighting the squares and when placing the walls, but those issues are resolved.

To Do:

(1) Make wall renderer aware of neighboring walls, sources, and towers, giving different drawings for each configuration of neighbors.

(2) Trace power paths through walls and draw color channels through them.

(3) Have creeps get absorbed by wall until walls collapse.

(4) Add in a basic shooting tower, making sure its powered.  The first three towers should be a slide, an area effect, and a shooter.