• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Pathfinding

Status
Not open for further replies.
Level 12
Joined
Nov 20, 2007
Messages
660
Hello everyone,
As the title says, I want to start making a pathfinding system. What is pathfinding ?

Pathfinding allows a certain unit to move across objects / terrain avoiding climbing or go through.

I made a photo of what I want:
attachment.php


1 - our unit
2 - target unit
3 - pillar / hill
4 - how our unit will move usually
5 - how our unit should move

I tried using points, move step by step, checking, changing angles etc
but this bringed a huge amount of lag. Any ideas ?


Check the test map, it should explain better (Warcraft 3 already has this system but I can't use it because I want my units to move faster than 522 movement speed and that's not possible because of engine restriction)

Example in World of Warcraft
 

Attachments

  • Pathfinding.jpg
    Pathfinding.jpg
    24.6 KB · Views: 599
  • Pathfinding.w3x
    18.9 KB · Views: 64
You could use "Unit - Move Unit Instantly" or in JASS "SetUnitPosition".

If you make it in a periodic event (0.03), you can it move faster than than speed 522 to the target point.

It will also check pathing automatically, so you would not to check it.

I know you might already tried it as u said, but you could post your trigger, because usually it should not cause lags.

Might I ask you why you are doing such a system? Just curious.

I also downloaded your map and you leak unit group in a periodic event. Periodic events might be critical if there are memory leaks in it.

You can find a a tutorial about memory leaks in my signature.
 
@IceManBo - doing just that could make it look really weird... that's why you need an actual pathfinding algorithm

anyway, pathfinding can be really laggy due to the amount of calculations needed... though if it's a single unit, it shouldn't really lag... unless ur running the pathfinding algorithm in a very high frequency

also, AFAIK, there are quite a number of possible pathfinding algorithms, so which one do you actually need?
 
Level 21
Joined
Mar 27, 2012
Messages
3,232
MovespeedX moves the unit in the direction it is facing iirc. This causes issues, such as units running in circles.

To fix it you'd need a system that determines the actual movement direction of the unit. This can be done through a periodic loop.
Note that it must also subtract the movement that the system itself causes, or else there will be a never-ending loop.
 
MovespeedX moves the unit in the direction it is facing iirc. This causes issues, such as units running in circles.

To fix it you'd need a system that determines the actual movement direction of the unit. This can be done through a periodic loop.
Note that it must also subtract the movement that the system itself causes, or else there will be a never-ending loop.

It doesn't do it based on facing. It does it based on the unit's new position relative to his last position. Of course, this has its own drawbacks (units might still bounce around), but it is pretty nice overall.

I think I have an updated version that has even fewer issues (and supports sync'd group movement), but it is on my other computer. As for the bouncing-around issues, you can modify the period and hopefully that'll fix some of the problems. Keep in mind that pathfinding is expensive and the native pathfinding will likely outmatch any triggered-pathfinding (because JASS is interpreted, among other factors).
 
@TO:
I'd say don't bother with it. A (good) pathing algorithm is way too complicated to achieve in just the JASS environment. There's just too many variables that need to be adressed. Lots of people tried it before and nobody succeeded.
The reason for that is that JASS is just way too slow to process something that CPU intense.
 
Status
Not open for further replies.
Top