HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Pathfinding

03-21-2004, 01:35 AM#1
Hunter0000
I was wondering... can someone direct me to some sort of tutorial to do a simple maze-crawler pathing AI, or prehaps whip up a test map for me? AL I want it to do is make certain creature types simply wander around in thier current space, stopping and changeing paths if they meet a obstical(I.E. wall or friendly unit) and attacking any enemies they encounter. Hopefully this can also be implemented to manage multiple creatures at the same time, in 4-8(havent decided yet) indenticle mazes/dungeons.

Thanks
03-21-2004, 08:53 PM#2
Hunter0000
no one?

o_O o_O o_O
03-21-2004, 11:33 PM#3
johnfn
http://www.policyalmanac.org/games/aStarTutorial.htm

it looks like a pretty in-depth tutorial. This is the best type of pathfinding. I found it under the second result in google for the search string "pathfinding" so i question how much you searched...

Anyway thats pretty complicated pathfinding, so you might want to settle for less (i.e. a less cpu-intensive alogarithm), but it works well.
03-21-2004, 11:52 PM#4
Hunter0000
Thats not exactly what I meant...

I have no predetermined destinations, I want them to wander. Although, I do have an idea now. I'll write it here so you can point out an inherrit flaws. For each unit set to wander, assign in a custom value from 1-9, excluding 5(think numpad grid) Now, every so many seconds, I determine if the area directly infront of it in its chosen directon is clear, if it is, then move there, if it isnt, then choose another direction and check that and so forth until it finds a viable spot. You think that would work without much lag?

EDIT: On second thought... I have encountered a problem with this method. As far as I know, there is no way to trigger something to loops untill results are found, there are only set loops with a predetermined number of repititions. This creates utter confusion to me, and if anyone can get something to overcome this, PLEASE post it here so I can check it out.
03-22-2004, 12:53 AM#5
ThyFlame
Set Length = 1000000
Loop Integer A (1 to Length)
IF
Blah
Then
Blah
Set length = loop variable integer A
Else
Blah/Do Nothing



Closest thing for looping until you get results.
03-22-2004, 01:19 AM#6
AIAndy
If you want to do that better use JASS. For such algorithms you will have better results then instead of trying to implement them in GUI.
03-22-2004, 01:24 AM#7
warcraft3_oz02
Why don't you just give the unit the Wander ability?
03-22-2004, 01:35 AM#8
Hunter0000
I ended up doing a very very simple trigger that works good enough for my purposes

Code:
Events
    Time - Every 1.00 seconds of game time
Actions
    Unit Group - Pick every unit in (Units in (Playable map area) matching ((Unit-type of (Matching unit)) Not equal to Dungeon Master)) and do (Actions)
        Loop - Actions
            Set TempInt = (Random integer number between ((Custom value of (Picked unit)) - 90) and ((Custom value of (Picked unit)) + 90))
            Unit - Set the custom value of (Picked unit) to TempInt
            Unit - Order (Picked unit) to Attack-Move To ((Position of (Picked unit)) offset by 400.00 towards (Real(TempInt)) degrees)