A* pathing algorithm for detecting blocks in a tower defense game?

SH4D0WS1N

New Member
Reaction score
2
[Resolved]A* pathing algorithm for detecting blocks in a tower defense game?

Could someone please make the A* pathing algorithm (or a better one if you know one that will work) with a condition I can use to check if a path from point A to point B is there == true?

Note:
A* uses eight directions, but for what I need it only needs it use four direction (up, down, left, and right)
 

emootootoo

Top Banana
Reaction score
51
Code:
Comparison((PointPathingIsConnected((UnitGetPosition((EventUnit()))), (UnitGetPosition((EventUnit()))))), ==, true)

that maybe?

though i guess you might have to put ground pathing down your lanes for it to work and id assume towers would override it with no pathing
 

SH4D0WS1N

New Member
Reaction score
2
It doesn't appear to take into account buildings or the drawable pathing (red color), as I can't get this to return false.

EDIT2: It takes into account doodads, now with my extreme lack of knowledge of the data editor, I get to try how to replicate the pathing of a doodad.

EDIT3: The above was unsuccessful, however, I have come up with an inefficient work around, basically I'm going to make all of my towers have no pathing, them I'm going to create a (most likely) invisible doodad underneath them that will prevent pathing.

EDIT4: Doodads created by triggers appear to have no pathing, testing completely right now...
 

Arkless

New Member
Reaction score
31
You can find what you search for in the advanced ai functions, it returns the distance for some specific unit to a specific point (returns an integer, -1 if there is no way). It is a gui function btw..

edit: the name is "AI Pathing Cost Unit"
 

SH4D0WS1N

New Member
Reaction score
2
You can find what you search for in the advanced ai functions, it returns the distance for some specific unit to a specific point (returns an integer, -1 if there is no way). It is a gui function btw..

edit: the name is "AI Pathing Cost Unit"

You sir, are a god.
 

Frozenwind

System maker
Reaction score
99
Hm, that guy found a smart alternative. Checking the towerline instead of the creepline. Doesn't really work for a maze around a checkpoint though. Yet you are able to detect a circle in there. Though, if the towerline splits up, it'll slowly become harder.
Oh well, add all checked towers to an unit group and if it circles, you know it blocks somehow.
 

Arkless

New Member
Reaction score
31
Hm, that guy found a smart alternative. Checking the towerline instead of the creepline. Doesn't really work for a maze around a checkpoint though. Yet you are able to detect a circle in there. Though, if the towerline splits up, it'll slowly become harder.
Oh well, add all checked towers to an unit group and if it circles, you know it blocks somehow.

Wich is still a pretty old method, and it only works in a limited space OR is so slow that you cant do shit with it. I found a faster way in wc3 already, in case you are interested I could explain it... but you will never ever reach the speed of the built in function for that (except if you use a bigger scale for your pathing grid/use another pathing system).
 

Frozenwind

System maker
Reaction score
99
I'm a physcian/mathematician, so yes, I'm always interested in stuff like this ;)

One time I tried to create a "custom maze TD" (wc3) in which people could draw their only creeping lines. The checktrigger (or algorithm, if it's officially called like that) simply always went straight forward unless it was unable to do so. I was also making it advanced making it find any solution (so not only go straightforward, but also turn left/right and create a new array for it), but that made people get like 3x the same circle and then go to the end, lol. Custom circle TD? xD

Oh well, everything is possible if you take your time. For the algorithms you basically have 2 possiblities, the creepway or the towerway. If it concerns a checkpoint, a creepway will most-likely be the best option, as you can't check wall-to-wall. Yet I'm afraid there's nearly always a way to fool the system if you know how it works. Or if people build at a random spot between the 2 checkpoints (yet this means the towers hit a wall and thus a towercheck algorithm would do the job), you might need possibility "#infinity", but I guess I'm thinking into the wrong way atm.
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top