Anti-Walling Algorithm

This algorithm is designed to work with any set of walls, regardless of position or number. All you need to do is tell it which walls are where. It only works for 2x2 regular blockers right now. If you need something more complicated (i.e. multiple radii), I can probably make it.

When a building is created, a search is conducted for nearby buildings with custom values or adjacency, that is being next to a wall. If it is either of these, it is either given the custom value of the building adjacent to it or the wall adjacent to it. If it's not next to anything, it is given the custom value of zero. Then, it looks for nearby buildings which do not have custom values. If a building is to be given two custom values or a custom value of -1, it is prevented. Alternatively, if the SCV is literally on top of the build site, since Blizzard gave no way to delay building, the new building is removed and the player is given a total refund.

This algorithm is much faster and more efficient than its competitors, since it needs to only make one check each time. It's also very easy to use, since you need only write where buildings can't be built and reassign the spell to your build spell if it isn't already that.

It also comes with a much less efficient remove function which allows for removal of maze structures without issue. This function works by unassigning all of the towers that were adjacent to the one removed and so on and placing the ones adjacent to walls in a separate group. It then re-expands from the walls to make it like it was before. This occurs very, very quickly as well. This is set to happen when any building dies.


Comments

Posts Quoted:
Reply
Clear All Quotes

About This Project

  • Project ID
    25258
  • Created
    Aug 1, 2010
  • Last Released File
    Aug 1, 2010
  • Total Downloads
    881
  • License

Categories

Members

Recent Files