Playmaker Forum

PlayMaker Updates & Downloads => Share New Actions => Topic started by: kiriri on November 07, 2012, 11:26:38 AM

Title: A* pathfinding (stable 0v841)
Post by: kiriri on November 07, 2012, 11:26:38 AM
This project is currently deprecated. Please wait til mid march for an updated version.

What is this package?
This is an implementation of Aron Granberg's A* pathfinding package into PlayMaker. Unlike other actions and addons, it not only offers the functions of the original package as actions, but it also extends and greatly simplifies complex processes. This is why each action is usually rather complex and why progress is seemingly slow :)


What is pathfinding and Why should I use it?
Pathfinding solutions are systems that take your environment and interpret it in a simple way. Then they use this simple data, which is called a "graph" to find a valid path from point a to point b. Depending on your settings the path may avoid walls, holes or even try to avoid grounds that are walkable, but slow, like swamps, if the extra way around them is worth it in the end.
Unity itself has pathfinding too, but it is very weak compared to any of the available packages. If you want to place objects at runtime for example, and then want your actors (the gameObjects that move around, like your enemies) to avoid them, then that will not be possible with the default unity pathfinding.

More information can be found on Aron Granberg's website :
http://arongranberg.com/astar/front

Is it better than XXX?
If you're thinking whether you should use this solution over another then that is a fairly simple question atm. This package is for those who want maximum exposure of settings, and maximum performance. On the other hand there is a real learning curve involved. Aron's package is open source and it's vast. Additionally, I have and will continue to add all kind of stuff to make other things possible or more accessible.
Aron's package is also a wise choice for anyone working on a mobile platform.


 Have a look at the following vid if you do not know how to use specified object variables. The variables involved with the actions are under FsmPathfinding:


Install instructions 0v83free
1) Download the package (see bottom of the thread)
2) extract the content of the 7z into your assets folder.
3) Install python 3 or make sure your python version is 3.0 or later
4) Run the setup.py in the AstarPlayMakerInstaller folder.

Install instructions 0v82 pro
0) Install Aron Granbergs astarPro package in your project (no need for js support anymore, though it doesn't hurt either :D )
1) Download the package (see bottom of the thread)
2) extract the content of the 7z into your assets folder.
3) Install python 3 or make sure your python version is 3.0 or later
4) Run the setup.py in the AstarPlayMakerInstaller folder.


Upgrade to (pro):

 -- Same as Install instructions for pro --

This is a stable release now. I've created a prototype tower defense without any problems and am currently building a full fledged rts, so no worries that this will get lost ;) If you find any bugs, tell me. If you find something odd, tell me and if you have a better idea on how to do things, commit it here or just directly critisize my work. No worries there :D

What we've got so far:
You can create point graphs at runtime and use any type of graph that was setup before.
You can use a custom controller or choose from Transform, CharacterController, RVOController and Rigidbodies/Rigidbodies with fixed velocity.
You can either use a vector3 or a gameObject as a target, and you can run away from it, run towards it, follow it until you're close, follow it forever, copy the movement of the target (shadow it) until you reach it or forever, flee a certain distance from it, flee forever from it or you can just walk randomly around :D
You can smoothly follow a path or use modifiers to actually make the path smooth (currently only subdivisions)
You can access all the node information, graph information and astarPath information (main A* information).
There's also lots of other goodies, like calculating the time of arrival for an actor if he moves along a path, or getting and setting the walkability in an area, but I don't feel like listing them all up. If you feel like something is missing, then just leave a comment and I'll probably integrate it in like 19/20 cases.


Upcoming stuffs:
0v85/0v86 :
- back to c# Since the installer will force a js supporting structure, why bother?
- fix actor failing if the node he's currently standing  on is unwalkable
- fix smooth modifier on point graphs. Implement other modifiers. Merge all in one action.
- add "shadow offset" for group movement
- option to instantly create a path.
- fix auto option which to be honest is ridiculously outdated/broken
- compare nodeType action
- integrate tags into the actions
- add name option to pointgraph creation actions [done] and create a system to access graphs by name (I think this could be rather useful on larger projects)
- create GridGraphAction
- destroy Graph action

long term ideas:
- create a system for actors to smoothly follow a path [in progress]
- create a system for actors that makes them walk in a straight line if possible, ignoring exact node positions, and only using them where necessary (eg corners). This should both save performance and look better, so it should definitely not use recast.
- make system to move multiple actors at once (eg in formation like in rts, this will likely be part of my future "advanced" version)
- general performance boosts.
- claim and release paths for memory optimization (potentially important for mobile, but this needs some reading in)
- Complete grid graph support. (almost established)



Other People involved : ZeroSigma, hannibalov, LampRabbit

Current Status of the tutorial series:

1) Project Setup


2) Graph Basics


3) Movement basics



Astar-PlayMaker Download : https://docs.google.com/file/d/0BwrgibYeepavZ0o0ZmNpWE9lRTg/edit?usp=sharing
Title: Re: A* pathfinding (just getting started)
Post by: kiriri on November 25, 2012, 05:18:10 AM
|FAQ|

1# My MoveTo action never finishes, even when the actor already reached the end of the path. What can I do?

Good question! There may be a number of reasons for this. The least obvious is the usage of the "absolute" FinishDistanceMode, combined with a low FinishDistance. In this case your actor walks to the last node on the path, but even then the absolute distance between him and the target can still be higher than the FinishDistance (eg if you have a Gridgraph and your target is right in the centre of one of those "gridsquares".) In this case you can either :

1) Up your FinishDistance
2) Enable the ExactFinish option which adds your target's center as a last node to the path
3) Change the FinishDistanceMode to something like Last or AbsoluteLast, which  checks the distance between the actor and the last node on the path instead of the distance between the actor and the target.

You should always note that sometimes your target might be underground. In this case you should make sure to check the IgnoreY option, which will also ignore any y coordinates in the FinishDistance modes.


2# I'm confused by the different movement modes. What do they do. When should I use which?

So far there are 9 Different Movement Modes.

   moveTo,
   followTo,
   follow,
   shadowTo,
   shadow,
   followPath,
   fleeTo,
   flee,
   randomPath,

Some come in pairs, like Follow and FollowTo, or Shadow and Shadow To. These pairs are very similar, but the To suffix means that this mode sends a FinishEvent once it arrives at the target location. So the mode FollowTo will finish once it is in FinishDistance of the target, while the mode Follow will continue following the target indefinitely (well, as long as that particular Action/State is active).

Now that we understand the naming, let's have a look at the individual actions to see what they do and when they should be used :
1) MoveTo : This mode is the most simple mode. Use it to get from point A to point B. It is a To Mode, so it will fire an event on Finish. I use this mode in strategy games to send a selected unit to a certain position. The path is never updated.

2) FollowTo : This mode is like MoveTo, but it updates the path every number of frames. You can define the update interval, which stands for the number of frames the action should wait before updating. I rarely use any update interval that is lower than 60 (1second in my game), because this can cost you a lot of performance, especially on long paths. I use this mode to send a unit to attack some other unit. The FinishEvent is directly wired up with my attack stuff.

3) Follow : Exactly like the FollowTo mode, but it never finishes. Useful if your unit is far away from the target but you want to send it to guard the moving target. I do not use it because there are cheaper alternatives (like using a FollowTo until your actor is very close to the target, and to then shadow it, or if the target is slower than your actor, you could also use something like the default SimpleMove action [without any pathfinding whatsoever] ).

4) ShadowTo : Shadow to exactly copies the path of the target. First it calculates a path to the target, and then it checks every frame whether the center of the target is more than a certain distance away from the last node on the path. If it is, it will add the current target position as a last node to the path. Since apart from the first path calculation no Pathfinding is being used, this is much cheaper than say Follow. This is why I use it to follow fleeing units and other targets that are close by.
It can also allow you to "draw" a path. Just create a setup where you do a mouse pick every frame and set the target to that hit position. Then let an actor follow your target. You will now be able to draw a path the actor is going to follow along.

5) Shadow : Just like Shadow To, just without the finish

6) FollowPath : Sometimes you've got loads of units following exactly the same path. An example for this is a tower defense game. Instead of recalculating the same path over and over, you can just save the path in a global variable and use this MoveMode to follow that path. Since there are some options that edit the path, like the option to connect the current actor's position to the closest node on the path, you might want to use the "DuplicatePath" actions before using a path.
All in all this action can be very useful on mobile devices.

7) fleeTo : This is a pro feature from Aron Granberg's package, I really did nothing more than implement it in the action. It allows for a very cheap way to flee from something. You can also use it in the free version, but it is just a cheap mockup of a MoveTo mode with a target that lies somewhere away from the target. So unfortunately it's just as expensive as the normal MoveTo.

8) flee : -"-

9) RandomPath : Like Flee, this is a pro only feature, it can calculate a very cheap random path of a certain length, the free users again use a mockup MoveTo instead.
Title: Re: A* pathfinding (just getting started)
Post by: Voke on November 29, 2012, 06:28:50 AM
Hi, I checked your first script today, but the object only moves to the first waypoint and stops then. Playing around with the variables didn't help. Just to let you know ;)
Title: Re: A* pathfinding (just getting started)
Post by: kiriri on November 29, 2012, 08:10:48 AM
ah about that, sorry, the default values should definitely be different.
Try something like 3 for both failure and next waypoint.
I'll update the action right now...

EDIT:
Updated it!
Title: Re: A* pathfinding (just getting started)
Post by: ZeroSigma on December 05, 2012, 03:26:01 AM
Thanks for this script, I've taken the liberty of cleaning it up a bit and adding a few extra comments.

Edit: Corrected some minor bugs in the stuff I modified. Hehe ;)
Title: Re: A* pathfinding (just getting started)
Post by: kiriri on December 09, 2012, 06:38:49 AM
thank you, that is very appreciated. Can I add it to the top post (with credits of course) ?
I will write a simple wrapper now and implement it in the move to target action. I hate wrapper modules just as much as the second guy, but I see no way around it unless you want to recalculate the entire path each time you want to change it. Furthermore that way we can also implement a follow path action to save performance and make mass movements possible. I picked this up as my current project now so there should be some progress over Christmas etc.

Anyways, the number of downloads do say that there's a bunch of people interested in these actions. That's nice to see :)
Title: Re: A* pathfinding (just getting started)
Post by: hannibalov on December 09, 2012, 07:44:46 AM
Hi, I'm interested in this action, but I can't find it  ??? I tried here https://hutonggames.fogbugz.com/default.asp?W714 , but no cigar. Where is it?

(EDIT) idiot of me, it's included in the post. Sorry for that
Title: Re: A* pathfinding (just getting started)
Post by: then00b on December 09, 2012, 03:44:13 PM
I'm definitely interested to see more of your work in the way of A* actions. It's been challenging trying to work around A* with the default actions.
Title: Re: A* pathfinding (just getting started)
Post by: ZeroSigma on December 10, 2012, 01:22:41 AM
Hey kiriti, its not problem you can add the action to the top post, it is mostly your work I just cleaned it up a bit. ;)

Anyway guys remember to get this working you need to install the A* Pathfinding Project unity package  created by Aron Granberg. There is a free version here: http://www.arongranberg.com/unity/a-pathfinding/ (http://www.arongranberg.com/unity/a-pathfinding/). The Pro version is also worth looking at if you are going to do heavy pathfinding.
Title: Re: A* pathfinding (just getting started)
Post by: hannibalov on December 10, 2012, 12:45:53 PM
Hi, I added angular speed so that agents look towards their next path point. Something cool would be to add a "begin stopping distance" so that you can trigger stop walking animations or so.

PS. I don't care much about credit for just a few lines of code, so if you think this is interesting go ahead and post it without asking
Title: Re: A* pathfinding (just getting started)
Post by: hannibalov on December 10, 2012, 01:17:51 PM
woops, I found an error. Sending the correction with a little addition to play nice with mecanim. Now you can set the variable that sets the moving animation in mecanim.

I would like to have acceleration also, but I'm not sure how to code that
Title: Re: A* pathfinding (just getting started)
Post by: kiriri on December 10, 2012, 02:53:54 PM
@Everyone
I added some more functionality to the base scripts, created a Follow Path and CreatePathToTarget action, and added the actions to check the calculating state of a path as well as its length.
You can now either use a gameObject with a Seeker component on it to save/load a path, or an object variable of the type Seeker. It was important for me to be able to use object variables, though seriously, I forgot why. Anyways, I'm sure it'll come back to me ;D
This package (top post) is alpha for a reason. It'll throw a lot of error messages into yo9ur face, though non of them seem to really cause any problems whatsoever. I'll see if I can find the things causing them tomorrow. Or maybe you guys will spot them. Whatever  ;)

@hannibalov
Thanks, I'll look at it tomorrow and make it merge with the new version I made.

@ZeroSigma
Ok, for now I continued on the basis of those modified scripts, though I may have somewhat destroyed the order while I was trying out new things. I'm definitely not an orderly guy :D
Title: Re: A* pathfinding (just getting started)
Post by: hannibalov on December 10, 2012, 04:09:09 PM
Great :)

Another action could be the FollowObject. It should be quite similar to moveTo, just resending the target whenever it moves. I tried to do that today, but I'm concerned with performance (I'm creating a crowd simulation with lots of agents). Is there a better way to just call the StartPath on and on? Maybe GetNewPath would be more efficient

In addition to all this, local avoidance would be great. I'm new to A* pathfinding, so I don't know how they implement that, but watching this video it looks like they solved the problem. It says 3.2, maybe we'll have to wait...
Title: Re: A* pathfinding (just getting started)
Post by: then00b on December 10, 2012, 04:55:19 PM
Excited to check out the updated action. Thanks for all your work, kiriri!

Edit: just noticed ZeroSigma and hannibalov have also been helping. Thanks, guys!
Title: Re: A* pathfinding (just getting started)
Post by: hannibalov on December 12, 2012, 09:48:55 AM
Hi, I couldn't wait and I decided to implement the FollowTarget action. It works decently with a catch... it's executed as long as you are in a following target state, meaning that you can't set it to follow a target and move on to another state. Anyway, for my project the job gets done, so I just left it like that.

Maybe someone here can improve it. By the way, I was concerned with too many path recalculations, but performance seems ok (100+ agents moving around at 60FPS). If someone knows more about all this, no need to ask for my permission. As this is basically a mashup of kiriri's script, I suppose he would be the one to ask
Title: Re: A* pathfinding (beta)
Post by: kiriri on December 15, 2012, 07:17:48 AM
Sorry for not getting beack to this sooner. I'm a freelancer so I never know when next I'll get work which generally needs to be done ASAP  :o .
Today I'll add some more actions. Like, I've already created an action which cheaply finds out whether a path is possible. It can be used every frame without any noticable frame drop. NExt up is an action which checks if an update graph action would make a path impossible (eg. TowerDefense, tower becomes red if you block the path.)
I'll update the packages at the top in a few hours :)

Hi, I couldn't wait and I decided to implement the FollowTarget action. It works decently with a catch... it's executed as long as you are in a following target state, meaning that you can't set it to follow a target and move on to another state. Anyway, for my project the job gets done, so I just left it like that.

Maybe someone here can improve it. By the way, I was concerned with too many path recalculations, but performance seems ok (100+ agents moving around at 60FPS). If someone knows more about all this, no need to ask for my permission. As this is basically a mashup of kiriri's script, I suppose he would be the one to ask
Nice, I didn't even try that to be honest. I feared that in larger scenes it may cause errors if you recalculate it again and again . However surprisingly enough, your action seems to run smoothly and it really doesn't hit the framerate all that much... Aaron really did some impressive work on his library :)
I'll see if I can find a  more subtle solution than the recalculation of the entire path either way. I think there was something like update path or the like in the documentation. May be more useful if you want a lot of npcs on a mobile device too.

Since I can only really create actions for 3.x (you think twice about updating if it costs the price of a small car :S) I'll let it be up to you to implement the necessary things for 4.x . So to make this easier for everyone downloading the actions from now on we'll just have 2 versions in the top post, one for 3.x and one for 4.x .
Title: Re: A* pathfinding (just getting started)
Post by: hannibalov on December 16, 2012, 08:15:40 AM
I'll have a look at the package on monday, but it looks very promissing. Thank you for the wrap up!
Title: Re: A* pathfinding (just getting started)
Post by: kiriri on December 17, 2012, 07:53:48 AM
alright, I think these 2 should be the last ones missing to make a complete tower defense game:
WillPathBePossible : It checks if, if you were to apply a certain game object to the graph, that game object would block any path from a to b.
IsPathPossible : Is there a possible way between a and b.

WillBePossible was actually hard, since there is apparently no way to theoretically check if a path would be possible. So for now it applies it, and then reverts it after checking if path is possible. This is rather expensive, but oh well, it does work ok if done every frame.

I'll add it to the package in a bit.
Title: Re: A* pathfinding (just getting started)
Post by: kiriri on December 29, 2012, 02:22:19 PM
Instead of making the actions even more complex by adding look at direction, smooth look at, up axis etc pp to it, I simply exposed the direction value now. Save it to a vector3 variable and use a smooth look, lookAt or whatever action you want right after it.

I also added the ability to check if the node closest to a vector3 world coordinate is walkable. It's probably best used with a raycast.
I'm trying to find a way to check if all nodes in a certain area are walkable, but haven't found it yet.

Download the package in the start post.

Have fun ;)
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 01, 2013, 12:18:29 PM
0.6 beta

- update graph area

- check area walkability

- get closest Vector3 on Path

- move to target ignore Y
- follow target ignore Y
- follow Path ignore Y

Title: Re: A* pathfinding (beta)
Post by: KozTheBoss on January 05, 2013, 03:45:35 PM
Hi

I've messed around with Hannibalov's follow target action - it's working pretty well for me, except that if the object reaches it's target once then it will stop following and just stand idle.

I have tried making it repeat the follow target action when it reaches its destination, but that makes it walk backwards away from the target, and generally makes it very spazzy


Don't get me wrong, im incredibly thankful for the action - I would've never gotten that far myself lol.. Just some bug feedback :) I have tried to figure out why it stops, but with no luck..

Also, is there any way to change the rate at which it updates it's route to the target? sometimes it follows the same path for 2-3 seconds before it realises that it's target has run behind it in a complete different direction and it will just continue running the wrong way because it doesn't update the path =(

-Koztheboss
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 05, 2013, 05:59:12 PM
as for the update, I actually don't know either, maybe I'm just tired though. I'll update the script for the next package.

As for the finish, that is because the path is set to null once the character is less than one waypoint away from the target. Do a search for "path = null;". That should be what's causing the stop I think. If removing that does not work I'll have a look at that too (unless hanibalov reads this first and has the time for it). The basic actions are really supposed to work perfectly by now...
Title: Re: A* pathfinding (beta)
Post by: KozTheBoss on January 06, 2013, 10:58:36 AM
Hi Kiriri :) I don't know what happened but as i was testing the game today, the path reset thing was completely gone - All ive done is set the "end of path" event to go right back into the same state and repeat the process, and things are running pretty smoothly now!

I have a different question though, I've used this action for my enemy prefab and it's working great - the only problem im having is that if i set the target object to be a GO variable, it doesn't work at all, like the enemy will not move at all and will just stand still

If, however, I drag-and-drop the player GO to the target then it works no problem - the problem with that is that as a prefab, i can't designate the player as a target without the use of variables which don't work =(

Is there any way to spawn an enemy GO and assign the player as the target automatically now that variables arent working?

Im sorry for asking so many questions, but im not very good at this, and im eager to learn! :)

Thanks for the package btw, it works great!

-Koztheboss
Title: Re: A* pathfinding (beta)
Post by: kolchaud on January 10, 2013, 07:24:37 AM
Hi guyz,

Thanks for the great work ! I'm using Follow Target and it works fine on my heavy desktop computer. But on Tablet (A510) and smartphone (One X), the follower is stuck while the target is moving. And when the target is stopped, the follower moves to it.

I'm not sure but I guess CalculatePath method consumes too many resources for mobil devices.
I'm looking for a new way to perform follow target action, if you have any advises, I'll take :)

Thanks
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 10, 2013, 11:34:37 AM
@Koz
do you have a repro project? I don't have that problem in my own game.  According to your problem it seems to be reasonable though that something must be off in the action, it should not behave so irradically.

@kolchaud
I'll compile my project for Android this evening and try to find out what could be wrong there. Mobile support is very important to me personally too. So far I've ignored it though.

@everyone
sorry for the lack of updates last week. For one I'm back to the classrooms. Additionally new actions become harder and harder to make, at least ones that are useful are. I'm fighting with different problems, like most of the time I'll have to find ways to make the actions work well without using any special object variables, like Path, Node , GridGraph etc.
I think we'll have to use Wrappers in the future, though exposing those in the actions will make them even longer and more unwieldy. I hope this shows the dilemma I'm in. It's Usability vs Functionaliy.
Title: Re: A* pathfinding (beta)
Post by: Carwash on January 10, 2013, 06:14:39 PM
Hi there,

Was pleased to find this addon, but I receive an error when importing the beta package

Quote
Assets/PlayMaker/Actions/Addons/AStar/GetPathLength.cs(64,53): error CS1061: Type `Pathfinding.Path' does not contain a definition for `GetTotalLength' and no extension method `GetTotalLength' of type `Pathfinding.Path' could be found (are you missing a using directive or an assembly reference?)

I've only installed the  AStar Beta 0v6.unitypackage, do I need something else too?
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 11, 2013, 08:26:38 AM
you need the original pathfinding addon by aaron too (see first post), apart from that you should not need anything more. Did you try restarting unity? Do you get any other warnings or errors?
Title: Re: A* pathfinding (beta)
Post by: Carwash on January 12, 2013, 01:01:54 PM
Thanks for the reply Kiriri.

I already had Pathfinding installed, the error appears after the import of AStar Beta 0v6.unitypackage has finished

I did a restart before posting, after my first one Unity crashed and reset my editor layout :(
No other error messages, though, just the below (same as previously posted)


Quote
Assets/PlayMaker/Actions/Addons/AStar/GetPathLength.cs(64,53): error CS1061: Type `Pathfinding.Path' does not contain a definition for `GetTotalLength' and no extension method `GetTotalLength' of type `Pathfinding.Path' could be found (are you missing a using directive or an assembly reference?)


Edit: On restarting Unity, playMaker fails to load properly (no error messages), there's no PM menus. If I delete this addon and restart, then PM loads again.
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 13, 2013, 02:51:07 PM
@ Carwash
This is plain weird, I define the function in the same script... It should not be unable to find it. I've just downloaded the package and imported it together with playmaker 1.43 and the latest version of A* into unity 3.5 on windows . The only warning is an obsolete variable, which is not at all bad.
Could you tell me if you still get the error after importing it into an empty project? Else you can just delete the script, it's just an action and not vital.

@kolchaud
Afraid I can repro that on the nexus 10, which has a more powerful CPU than my desktop. I cannot think of a solution as of now. I'm no hardware specialist. If anyone has any ideas, I'd love to hear them. Though my bet is on Aaron's code rather than ours.

@ everyone
I tested and played around this weekend, so no updates this week. I started on node and path wrappers(Though paths can also be gotten by ID). It's making things easier, but even so I'll keep the actions backwards competible, so no worries if you've already used them in a project.
Now I'm tired =_=
Oh and I also would like to encourage everyone to extend this on their own and then post their actions here. I'll likely finish the actions I planned in the first post and then I'll focus on refining it all. Sorry for that, but I just don't have the time to spare anymore and I don't need anything more for my own projects. Hope that's somewhat understandable.
Title: Re: A* pathfinding (beta)
Post by: kolchaud on January 14, 2013, 07:21:48 AM
@Kiriri : Thanks for your feedback. I was able to move multi GameObjects in the same time with MoveToTarget Action. So I don't think Aaron's code is buggy.

In MoveToTarget action, target is set only one time whereas in FollowTarget it's updated each time. I'm going to investigate more on that. If I found something, I'll post here.
Title: Re: A* pathfinding (beta)
Post by: kolchaud on January 14, 2013, 12:42:16 PM
Considering that CalculatePath() method is called too many times, when target moves, I add a tolerance test on OnUpdate method.

On my smartphone it works very well :)

Here is my modification :

Code: [Select]
if (target.Value != null && /*target.Value.transform.position != targetPosition*/ Vector3.Distance(target.Value.transform.position,targetPosition) >= targetTolerance.Value)
{
if (LogEvents.Value)
Debug.Log ("Target was specified, getting position.");
CalculatePath();
}

where targetTolerance is defined like this :
Code: [Select]
public FsmFloat targetTolerance;
I've attached the action file. 

Hope it will help for mobile projects.
Title: Re: A* pathfinding (beta)
Post by: Ahnwee on January 16, 2013, 10:04:05 AM
Code: [Select]
Assets/PlayMaker/Actions/Addons/AStar/FollowPath.cs(96,64): error CS1061: Type `System.Collections.Generic.List<UnityEngine.Vector3>' does not contain a definition for `Length' and no extension method `Length' of type `System.Collections.Generic.List<UnityEngine.Vector3>' could be found (are you missing a using directive or an assembly reference?)
I was very excited when I found that you lovely people have made a start on some PlayMaker actions for A*, but I can't seem to get the package to work for me. Could someone tell me why I get this error?
Aaron's A* appears to be working for me, and I'm trying this on a relatively clean/new project so I don't think its a conflict with anything.

I know this is a question likely to have a very simple answer, but I'm just a very simple kid trying his hand at some Unity.

Cheers

(PlayMaker 1.4.(3?), Unity 4 Free)
Title: Re: A* pathfinding (beta)
Post by: Carwash on January 17, 2013, 05:51:42 PM
@ Carwash
This is plain weird, I define the function in the same script... It should not be unable to find it. I've just downloaded the package and imported it together with playmaker 1.43 and the latest version of A* into unity 3.5 on windows . The only warning is an obsolete variable, which is not at all bad.
Could you tell me if you still get the error after importing it into an empty project? Else you can just delete the script, it's just an action and not vital.

I'm on Unity 3.5.6
I had an old version of A*, so downloaded the latest (3.2.3).
Installed A* first, then playMaker (1.4.5), then AStar Beta 0v6. Got a different error message, something about 'length' not being defined (I'm not at home atm, so can't C&P). After deleting that script, I got the same error message in a different script, and I can't see any A*/ pathfinding actions in playMaker :(
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 18, 2013, 08:52:37 AM
 noted!

After some resarch I found out that some things were "fixed" in aaron's pathfinding, which includes lists etc. So the newer versions of his package don't work anymore. But I can fix it I think.
Let's see in an hour or so.
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 18, 2013, 09:19:27 AM
ok, to fix this, replace the line in question (l.97 in the FollowPath script) with this:
Code: [Select]
if (currentWaypoint >= (path.vectorPath as Vector3[]).Length) I have no idea what it thinks the list is, as unity says it is a vector3[] , but if we tell it explicitly that it is really a Vector3[] , it works again.
There's likely a typo somewhere in the new pathfinding package I'd guess. I'll post the script in the start post, please tell me if this fixes your problems. It did for me anyways.
Title: Re: A* pathfinding (beta)
Post by: Carwash on January 18, 2013, 03:10:16 PM
I now get
Quote
Assets/PlayMaker/Actions/Addons/AStar/FollowPath.cs(97,65): error CS0039: Cannot convert type `System.Collections.Generic.List<UnityEngine.Vector3>' to `UnityEngine.Vector3[]' via a built-in conversion

I tried editing the script myself (the line was on 96 in the script I had), and have downloaded the script in the original post to try (where I see it's on line 97). Both ways give the above error.

I restarted Unity several times whilst trying this fix.
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 18, 2013, 04:43:44 PM
weirdest thing, I emptied the project and reimported everything exactly how you described it , and I finally got the same error. The problem here is that the type of the list changed. Instead of .Length we now need .Count .
I'll be fixing up a WIP version in a moment.
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 18, 2013, 05:09:41 PM
Ok, just please tell me it works now for everyone. You will need the very newest version of aaron's pathfinding, this is not compatible with any of the older versions. There were major changes in very fundamental functions, which caused the actions to almost all be outdated. I do not understand why it only showed the one error, but after fixing that it took me on an odyssee of other bugs :S
Please only use the actions that you know from 0,6 (see first post for the list), as the rest of them is still heavily WIP.
Title: Re: A* pathfinding (beta)
Post by: Carwash on January 19, 2013, 06:06:00 AM
Excellent work, Kiriri, thanks. It all imports with no errors now, and shows up in playMaker!
Title: Re: A* pathfinding (beta)
Post by: Ahnwee on January 19, 2013, 07:49:26 PM
This has fixed it for me! Nice work :D
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 21, 2013, 04:36:51 PM
great, now that this all works, here's the next update.

There's good news and bad news.
The good news is that I've extended the system greatly. I switched to javascript, which allows us to actually use object variables in our scripts as input. The wrappers I created can be plugged into most actions now. While this has certainly become more complex, it is also exponantially more powerful. Let me know what you think of it (I think this would be the first PM plugin that uses object variables directly).

The bad news ist that this is not backwardscompatible.... You will likely have to manually reproduce your FSMs so far. For me that took about 45 minutes, which is fair considering the new features and potential I think. Even so, I'm sorry this reformation comes so late. Beta should not be so irradical.

I've never been good at documentations, and right now the code is a mess, especially since I played around to find ways to make the warnings disappear. I also implemented some fixes regarding previous problems like the followTarget action. Have a look at them and tell me what you think.

As far as the changelog goes, there you go, if incomplete :
0.7 beta
- get node info
- removed unneeded warnings and added thrice as much necessary warnings
- check area walkability individual
- wrapper variables
- createPathTo (advanced and js version)
- followPath (advanced and js version)
- translatePath
- getPathInfo
- getNodeInfo
- getNodeFromNodes
- autoMove helper script for movement even if the action is not active.
- Debug paths options
- smooth path action
- ported all the rest of those scripts to js, if they use any object variables (yes, I'm too tired to list them here :D)
- ... lots and lots of small changes and additions. I really couldn't keep track of them all but I think I addressed everything mentioned in this thread before. Hope everyone's pleased :)
Title: Re: A* pathfinding (beta)
Post by: Uttpd on January 22, 2013, 07:14:06 AM
Thanks for the great work.
Title: Re: A* pathfinding (beta)
Post by: zoeyun520 on January 23, 2013, 03:21:12 AM
Does it support  IOS?
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 23, 2013, 03:26:11 AM
Yes, though mobile devices do not support as many paths as the desktop version. But as long as you don't calculate more than 100 paths per minute, there shouldn't be any noticeable difference. At least there isn't on android.
Title: Re: A* pathfinding (beta)
Post by: PIXELCRY on January 23, 2013, 04:31:53 AM
i use last version in assets store A* pro 3.1.4, i tried restart in  unity 3.5.6 and 4.0 but both give me this error:

Assets/PlayMaker/Actions/Addons/AStar/Wrappers/FsmABPath.cs(8,24): error CS0246: The type or namespace name `ABPath' could not be found. Are you missing a using directive or an assembly reference?


 :-[
Title: Re: A* pathfinding (beta)
Post by: zoeyun520 on January 23, 2013, 04:52:06 AM
i use point graph make a scene just now, the seeker works well on mac and pc , but it does not work on ios,i don't know why. i have read the docimentation of 'Deploying for iphone' and done it like that , please help me.
My English is poor , sorry  :'(
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 23, 2013, 05:24:25 AM
A path was added in the last update, maybe the pro version isn't updated yet. In your project folder, go to playmaker/actions/addons/a star/wrapers and delete the FSMabpath script. it will likely be necessary in the next update but until then a paths should also be added to the pro version I think. Let me know if you get more errors. I'll probably update too soon, but right now I'm using the free version.
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 23, 2013, 05:26:22 AM
i use point graph make a scene just now, the seeker works well on mac and pc , but it does not work on ios,i don't know why. i have read the docimentation of 'Deploying for iphone' and done it like that , please help me.
My English is poor , sorry  :'(
The newest action package should not require you to use any seekers whatsoever. Have you tried the new actions?
Title: Re: A* pathfinding (beta)
Post by: PIXELCRY on January 23, 2013, 06:14:34 AM
thank you for the answer, i deleted the file then he tell me same error on an other file so i deleted too then he tell me same error..so finally i have no action for playmaker ! :D i wil wait an update
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 23, 2013, 10:18:41 AM
the version I'm using is 3.2.3. Are you sure there is no more recent version available for pro?
Title: Re: A* pathfinding (beta)
Post by: zoeyun520 on January 23, 2013, 11:43:21 PM
i use point graph make a scene just now, the seeker works well on mac and pc , but it does not work on ios,i don't know why. i have read the docimentation of 'Deploying for iphone' and done it like that , please help me.
My English is poor , sorry  :'(
The newest action package should not require you to use any seekers whatsoever. Have you tried the new actions?

Thanks for the help!
Show you the staff:
these are my scene ,FSM and the actions in the FSM. It worked well in unity Debug mode, but i built a .exe or a dmg file it did not work , and stopped at the "creat path" state. What's wrong with my project?
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 24, 2013, 02:35:09 AM
I'm checking those right now. I haven't tried building yet but I think I can guess the problem. I'll reply again once I've hopefully solved it
Title: Re: A* pathfinding (beta)
Post by: zoeyun520 on January 24, 2013, 04:21:43 AM
I'm checking those right now. I haven't tried building yet but I think I can guess the problem. I'll reply again once I've hopefully solved it

OK,I' m waiting for u.
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 24, 2013, 03:17:13 PM
My solution turned out to be correct: Despite of what the API says the editor folders are completely ignored when building. So luckily Aaron has implemented a way to solve this.

Upgrade instructions :

1) Create a new project.
2) Import aaron's package
3) open any test scene and select the A* gameObject.
4) Press the button to restructuate for use with javascript
5) Import PlayMaker
6) Import the new package in these attachments
7) Import everything else from your old package
8) Change the object types of your variables (eg. from FsmPathfinding/FsmNode to FsmNode)

and yes, I did try to keep the structure... but there seems to be no way whatsoever to assign namespaces to javascripts, at least not in a way for them to show up in a subcategory in PlayMaker. And I tried for hours... :S

There are also some new updates and added actions, like get and set path info and AstarPath. Likely more but I'm too tired to check them right now.

Also, this will likely not be the last time you guys will have to update the object types of the variables. I fully intend to turn them back into FsmPathfinding/XXX s , just because without a category I find it very hard to look at.

Hope this works for you too.
Title: Re: A* pathfinding (beta)
Post by: Lane on January 24, 2013, 08:17:09 PM
Im getting...

"Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/smoothPath.js(8,8): BCE0021: Namespace 'SmipleSmoothModifier' not found, maybe you forgot to add an assembly reference?"

Fiddlesticks!

Not sure what an assembly reference is, I opened the .js and don't know where the modifier would be.
Title: Re: A* pathfinding (beta)
Post by: zoeyun520 on January 24, 2013, 09:30:15 PM
Im getting...

"Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/smoothPath.js(8,8): BCE0021: Namespace 'SmipleSmoothModifier' not found, maybe you forgot to add an assembly reference?"

Fiddlesticks!

Not sure what an assembly reference is, I opened the .js and don't know where the modifier would be.
I got the same problem too.
Title: Re: A* pathfinding (beta)
Post by: zoeyun520 on January 24, 2013, 10:32:23 PM
Thanks, kiriri. It worked !
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 25, 2013, 01:06:12 AM
Great, a typo! Open the script and change the line 8 to SimpleSmoothModifier  instead of SmipleSmoothModifier. It's a mystery why I didn't get that error too ^^ I'll post another updated package this evening.
Title: Re: A* pathfinding (beta)
Post by: Lane on January 25, 2013, 01:38:27 AM
Great, a typo! Open the script and change the line 8 to SimpleSmoothModifier  instead of SmipleSmoothModifier. It's a mystery why I didn't get that error too ^^ I'll post another updated package this evening.

derp, thats my typo.

Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/smoothPath.js(8,8): BCE0021: Namespace 'SimpleSmoothModifier' not found, maybe you forgot to add an assembly reference?

Tried reimporting in a different order, didnt seem to work. Herm...
Title: Re: A* pathfinding (beta)
Post by: Lane on January 25, 2013, 02:14:52 AM
Ahh there we go.

Had to click the A* object in the scene and enable js.
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 25, 2013, 02:36:19 AM
Ahh there we go.

Had to click the A* object in the scene and enable js.

Ah, yes, I had to change the compilation order of the scripts so a star needs to go to the plugin folder (which is what the js button does).
Title: Re: A* pathfinding (beta)
Post by: Lane on January 25, 2013, 10:42:41 AM
Are there any examples for making a tile based system?

I'm not sure how to approach the graph/grid/node system as its all new to me. How would this be used to properly control placement of something like a building?
Title: Re: A* pathfinding (beta)
Post by: kiriri on January 25, 2013, 01:34:41 PM
Are there any examples for making a tile based system?

I'm not sure how to approach the graph/grid/node system as its all new to me. How would this be used to properly control placement of something like a building?

I can create an actual example for the next update. For now, maybe this video helps you :



I can't share that project because I will have to rip out plugins like PoolManager etc to not violate any licenses and stuff. But like I said, I can do that for 0v8.
Title: Re: A* pathfinding (beta 0v75)
Post by: PIXELCRY on January 26, 2013, 01:26:29 AM
some one use pro version and can make it work?
Title: Re: A* pathfinding (beta 0v75)
Post by: kiriri on January 26, 2013, 10:07:24 AM
some one use pro version and can make it work?

http://www.arongranberg.com/vanillaforums/discussion/182/next-pro-update

Official support sounds great, doesn't it? :D
Title: Re: A* pathfinding (beta 0v75)
Post by: Uttpd on January 26, 2013, 12:07:30 PM
sounds like a Win Win Win situation.
He gets exposure
You get pro
We get A* playmaker Actions.
Title: Re: A* pathfinding (beta 0v75)
Post by: PIXELCRY on January 26, 2013, 10:29:47 PM
oh didnt know i can get last version here instead of asset store! thank you
Title: Re: A* pathfinding (beta 0v75)
Post by: Threepeasoup on February 05, 2013, 01:05:11 AM
I must be a serious noob. Is there a link to your playmaker pluggin? I have read through the entire forum and tried clicking on everything but can't seem to find it. Can someone point me in the right direction?
Title: Re: A* pathfinding (beta 0v75)
Post by: escpodgames on February 05, 2013, 01:26:08 AM
It's at the bottom of the first post (attached)

What browser are you using? I cant see forum attachments on my mac :S
Title: Re: A* pathfinding (beta 0v75)
Post by: kiriri on February 05, 2013, 07:20:39 AM
@Threepeasoup
I'll be updating today, lots of new features, so you might wait until then to check it out. It is not compatible with v75 (but it should work perfectly fine with v7 and earlier) . Just thought you wanted to know that before working with it ;)

(EDIT: Sorry, I think I'll have to move this to tomorrow, I just noticed that I am working on a newer pathfinding version than which is available to public. I'll have to ask if I'm allowed to share parts of arons package to make my own package work.)
Title: Re: A* pathfinding (beta 0v75)
Post by: Threepeasoup on February 06, 2013, 02:39:48 AM
looking forward to the new update Kiriri!

Will the new update work only for the pro version of A* or still work for the free version as well?
Title: Re: A* pathfinding (beta 0v75)
Post by: kiriri on February 06, 2013, 02:54:50 PM
alright, I'm very excited at your responses. The last update took a while, but it really is a major improvement I think.
Please post any issues you have here in this thread. The video instructions on the installation stuff is currently uploading, and it takes forever :S So you can find a text based instruction in the main post.

@Threepeasoup
No worries, the only thing that non pro users have to do is install the dummy package. You'll be using the same actions as the pro guys for now. Once I have converted the scripts back to c# I can make it ignore the errors and then you won't even need to install the dummies.

Afterall, I'm doing this primarily for reputation, so it would be quite stupid of me to ignore 95% of the userbase :D
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 06, 2013, 02:59:27 PM
(I forgot to change the thread name to a newer version before posting the last post. So this is just to make people who don't check this thread but accidentally notice it in the "latest posts" list see that it is indeed stable now ... at least I hope it is.)
Title: Re: A* pathfinding (stable 0v8)
Post by: Lane on February 06, 2013, 08:40:55 PM
Assets/Plugins/FsmPathfinding.cs(1,14): error CS0519: `FsmPathfinding' clashes with a predefined namespace

Had a bunch of trouble following the instructions for a new project, it kept crashing unity 4 when I am importing the extra asset file. The above is the error I get on my existing project with everything imported.

Honestly, its notably difficult to get it working.. import PM, Aaron's stuff, your stuff, restructuating, dummies, RVO things, errors. It seems pretty cumbersome because its piggy backing on top of two other plugins and overall just doesnt feel very user friendly. I still dont have a clue how to use it and it freezes when I actually cleared the errors and tried to play one of the new example scenes.
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 07, 2013, 03:24:03 AM
I see, I could look into automatic patching soon, but right now I just don't have the time to learn more new stuff. The crashing issue is disconcerning , I'll download 4.0 today to test it too.
The error your getting when importing the package in you own project is because you then have both the old and new package imported, and some stuff exists twice.

I'll upload the package as a folder in a bit, so you can just import it manually. Maybe that'll help.
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 07, 2013, 05:32:13 AM
alright, try using the zip and put it into the plugin folder in your assets. If it still doesn't work, you can share your playmaker and astar version with me and I'll install it for you, if you want.
Are you using Mac?
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 07, 2013, 06:19:37 AM
Oh, one more thing. If you aren't sure if you've removed all of the scripts from the previous package, import the old package again and see if everything has a ''new'' label next to it. If there are items without that, you'd still need to remove that before you can import the newer package.
Title: Re: A* pathfinding (stable 0v8)
Post by: Threepeasoup on February 07, 2013, 02:28:07 PM
Hey Kiriri,

installed last night, and everything worked great! No errors on my side.
Using Windows 7 and A* free version.

I am having trouble trying to figure out how to make a* work only for the x and y axis and ignore the z axis. Is this possible?

Thanks for the awesome plugin man!
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 07, 2013, 04:19:19 PM
glad it works for you  ;D .
If possible, do try to rotate your scene to the x and z coordinates. Lots of actions expect your scene to be that way. Also, I have not encountered any practical solution to work with a grid graph in any other dimensions, though I'm by no means an expert. I'll do some research tomorrow, though I expect that many astar settings, like height checks etc may also not work properly on any other plane.

Also, right now the movement actions either require a character controller or create a new one, so you would always be affected by gravity. I'll add a checkbox to make it possible to not use a controller at all, so you can hook up your own controller to the direction value.

The next update should aim for a better point graph integration, which should allow you to do such things by placing empties all over the scene and then automatically generating connections between them. I can send you the action once it's done if you like, since the actual next update may just take some time still.
Title: Re: A* pathfinding (stable 0v8)
Post by: Lane on February 09, 2013, 06:13:30 PM
I deleted everything and reimported it a few times, I keep getting different errors, but this one is sticking.

Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/PointGraphFromChildren.js(76,42): BCE0019: 'ScanGraph' is not a member of 'AstarPath'.
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 09, 2013, 07:14:48 PM
that one means you have not added the ScanGraph function to the AstarPath script. I'm sorry, I should've mentioned that the upgrade instructions in the first post changed. Until the next Astar version everyone needs to upgrade manually. After that the function should be in Astar by default .
Title: Re: A* pathfinding (stable 0v8)
Post by: Lane on February 09, 2013, 09:21:59 PM
that one means you have not added the ScanGraph function to the AstarPath script. I'm sorry, I should've mentioned that the upgrade instructions in the first post changed. Until the next Astar version everyone needs to upgrade manually. After that the function should be in Astar by default .

doh! my mistake, I remember that.
Title: Re: A* pathfinding (stable 0v8)
Post by: Lane on February 09, 2013, 09:31:22 PM
Looks like its running.

Also do you need ArrayMaker as well to operate the tower example? There seem to be some Array actions missing that I don't have and its throwing some FSM errors.
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 10, 2013, 04:52:07 AM
nope, the examples should work without ArrayMaker... since all the variables in Astar are extensions of the object variable, and ArrayMaker does not support objects I couldn't use it, although it would have been very handy if I could. Maybe I should talk with Jean about this... though then the plugin owuld rely on 3 other plugins which would likely make it even harder to install.

Can you post a screenshot of the errors, or copy paste them ? Can they be cleared/ Do they allow you to start the game?
Title: Re: A* pathfinding (stable 0v8)
Post by: Lane on February 10, 2013, 09:35:19 AM
Heres a screenie
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 10, 2013, 10:13:52 AM
akk.... now I remember, I totally forgot about the spawner. I first used global events to update the paths of the enemies, but that was quickly becoming performance heavy so I switched to an arraylist which contains every spawned enemy and each time you would remove or add a tower, it would go through that list and tell everything to update.
I'll need to find a better way for v81 which is supposed to be a bugfix release.

.. . But seriously, that caught me mightily off guard :I .
I tested each action one after another to ensure this release to be properly stable this time, but I did not expect any problems with the examples.

Btw, I already have a working replacement, let me just test it for a bit. I'll post it here in an hour or 2 with the rest of the bugfixes as 0v805 :D
Title: Re: A* pathfinding (stable 0v8)
Post by: Lane on February 10, 2013, 10:17:03 AM
Lol, sorry to throw you off there!

So do I just need to import ArrayMaker and it should work, then? I imported it and it still throws the errors.. Maybe I need to reimport the examples..
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 10, 2013, 10:35:02 AM
yeah, I think so, you will need to reimport the examples and you also need to make sure the global variables are imported before opening the scenes. Now that I'm looking at it, it may also be possible that I somehow corrupted the monsterSpawner... just have a look at the inspector and see if the arraylist component looks proper. If it doesn't, replace it with a new one with the reference "spawns" ... or just wait another 15 min for me to finish packaging the new version (don't worry, now that you've already set up the project properly, you can just import the new package without doing anything more :D)
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 10, 2013, 10:47:08 AM
How about this one :)
I now use parent/child relations to send the events (next child action). The other 2 examples were without ArrayMaker. There are also minor changes to the MoveTo, FollowTarget and some other movement actions, which didn't work properly when repeated a lot.
Title: Re: A* pathfinding (stable 0v8)
Post by: Lane on February 10, 2013, 08:55:31 PM
Ok it's stable for me now, It's not crashing U4 with a new project and seems to open your examples without errors.

Are you sure the tower scene is working properly though? When I run it all that happens is it spawns enemies and they never move. I got into the FSM's and theres a bunch of missing variable assignments. Trying to figure out how the system is supposed to work but having a hard time making heads and tails of it. It also starts heavily bogging down the PlayMaker related GUI after I start messing with an FSM, even when its not running the scene..
Title: Re: A* pathfinding (stable 0v8)
Post by: kiriri on February 11, 2013, 02:37:57 AM
Thank you for the effort!
The missing variables are the global ones. If you imported them then there seems to bean error with playmaker. I too have problems with global vars all the time, so next target will be a global less example scene :-)
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on February 11, 2013, 12:45:13 PM
Alright, I fixes some other minor mistakes I did and replaced every global variable. Now you've got one less installation step less to worry about ;)
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on February 11, 2013, 09:30:52 PM
Hoooly cow its working. The PlayMaker tabs do not run slow anymore, either.

Thats really weird, is it normal to have global's act like that? I haven't noticed any trouble with them so far.

Either way good stuff, I'll tinker with it and figure out how the actions work. The Graph seems to be the part i don't understand the most, but I need to put a fair amount of time to it and try to figure it out. Haven't done any pathfinding yet so its all new to me.
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on February 25, 2013, 01:36:59 PM
just wanted to let anyone interested know that this is on halt for about a month, as my finals are up in just 2 weeks and I need to deprevate myself of anything fun but studies for now  :o

So if you ever thought : "Oh that stupid jerk, he approaches all of this entirely the wrong way, I can do this better!" then you have a month of time to change anything you like and submit it here and there needs to be no fear as to me working on the same script etc.

I'll still respond to new posts here though, so if you have issues then I suppose I can still offer bugfixes and support.

Well then , cya in a month or so ;)
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on February 27, 2013, 03:51:34 AM
Hi Kiriri,

First off thanks for all your hard work.

Decided to upgrade to A* Pathfinding Pro and get the latest Playmaker 1.5.3 while I'm at it. But now I'm getting 17 errors.
Also after I install the Pathfinding playmaker actions, save the project an re open, Playmaker doesn't load any more. :( 

Assets/Plugins/FsmPathfindingWrappers/FsmPointGraphs.cs(6,24): error CS0246: The type or namespace name `PointGraph' could not be found. Are you missing a using directive or an assembly reference?


Any thoughts?
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on February 27, 2013, 07:09:51 AM
thank you for pointing this out. I'm not sure what Aron's doing but he seems to be revamping a lot of the more fundamental classes. So I suppose that since you're version is quite a bit newer than the one I used the last time, some parts are outdated in the Bridge (let's just call this plugin the Bridge now, so we won't have to write "the astar integration plugin" or whatever :D).
I will update now and have a look at how much has changed, but since there are only 18 errors I don't think it should take all that long.

Give me a couple of hours, then I should be done ;)
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on February 27, 2013, 08:36:13 AM
Ok, actually it hasn't been updated. My first guess would be that you forgot to restructuate it after importing pro. This may prove a tad tricky I think.
First open any test scene (either one of Aron's or one of mine) and select the A* gameObject. Then see if under Settings/Editor Js Support is enabled. If it is, disable it , then enable it again , if it isn't supported, just enable it.

Hope that helps ;)

And I hope you didn't try this on any major project without backup, because if you closed the editor while having astar in it twice (once the normal version, once the restructuated version from before) , then this may result in data loss I think.
Title: Re: A* pathfinding (stable 0v808)
Post by: geoquav on February 27, 2013, 10:55:25 AM
I am attempting to install this but am having the same problem. I do not see the "Settings" option in the Inspector on the A* object. I have attached a screenshot to show what I am seeing. I could very well be overlooking it, please point me in the proper direction. Thanks.
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on February 27, 2013, 11:15:38 AM
this is how it looks for me. I tried with both the free and the pro version of astar. I'm using Unity 3.5 pro, but that should not matter.

Did you try it on an empty project? Did you try reimporting the package?
To me your Astar Path component looks as if it's missing, and those are only the "remnants" generated by unity so to say.

PS:
If none of that works, try searching in your project window for AstarPath. Then remove the weird AstarPath component from the A* gameObject and drag the one you found in the project onto the A* gameObject. See if it's still not working.
Title: Re: A* pathfinding (stable 0v808)
Post by: geoquav on February 27, 2013, 11:22:32 AM
The problem was my own mistake. I misunderstood Step 3 in the installation process.

3) load any test scene and restructuate for use with js (Select the A* gameObject and go to Settings/Editor in the inspector)

Just a suggestion to change to:

3)Go to A* Inspector -> Settings -> Editor -> Enable Js Support

Just for people like myself that are rule illiterate  :D.

Anyways, it is installed properly now. Also, if you go ahead and run the Playmaker files it will not allow you to place the old AStarPath.cs on the GameObject (A*).
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on February 27, 2013, 11:52:26 AM
3)Go to A* Inspector -> Settings -> Editor -> Enable Js Support
"The first post now officially features rule-illeterat-friendly language."

As for the AstarPath script, did you drag it into the inspector of the gameObject? It's supposed to be drop-in-able just like every other component. Or did I misunderstand you there?
Title: Re: A* pathfinding (stable 0v808)
Post by: geoquav on February 27, 2013, 12:37:15 PM
When I found the AStarPath.cs file in the Project folder and dragged it onto the A* object inspector it was giving me errors that I forget now, but I believe they pertained to the lack of JS capability.
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on February 27, 2013, 12:44:51 PM
Im still not sure I get you there, but as long a it's working now (it is, right?) then everything's fine I guess :)
Title: Re: A* pathfinding (stable 0v808)
Post by: geoquav on February 27, 2013, 01:21:25 PM
Yep, it's working. I just needed to be sure to enable JS before uploading the Playmaker assets for A*. If I didn't it pretty much broke it.
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on February 27, 2013, 04:55:04 PM
Ok, Got it working in a new project, had playmaker, Astar, the playmaker actions and my game all good with no errors - until i switched to iOS platform :S
Now I get these errors and when I re open Unity, playmaker menu doesn't load:( .... so close to being back up and running.

Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/helpers/FsmConverter.js(58,46): BCE0019: 'Value' is not a member of 'Object'.

Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/helpers/FsmConverter.js(51,38): BCE0019: 'Value' is not a member of 'Object'.

Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/helpers/FsmConverter.js(82,46): BCE0019: 'Value' is not a member of 'Object'.

Thoughts?
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on February 28, 2013, 05:30:55 AM
Ah that's bad, I don't have a Mac so I can't test this. I'll check the docs this evening But I'm not sure I'll find anything. Were those all the problems there are? Looks like some kind of conversion issue.
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on February 28, 2013, 03:09:23 PM
Yeah just the three errors, all complaining about the same issue.
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on February 28, 2013, 08:10:37 PM
Not being a coder, I cant help you much. I did find this forum thread which talks about - iOS requires #pragma strict for your scripts.

http://forum.unity3d.com/threads/120369-please-have-a-look-and-tell-me-what-seems-to-be-the-problem-here
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 01, 2013, 07:59:13 AM
Quote
iOS requires #pragma strict for your scripts.

good find there. However, this is what we Germans call the "Kasus-Cracktus" of the whole plugin, because not having to use a strict compiler was the one and only reason that made me move to javascript in the first place.
While I can already promise that this will be fixed asap , I'm not sure when that will actually be. It may be easily solved by removing the function and using a specific one in each and every action (which for a lack of any better ideas I just started) , but this also makes the script longer and therefore more intimidating.

Anyways, now that I use pragma strict I can see your errors so that's good.
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on March 01, 2013, 07:17:30 PM
Awesome! You're a legend Sven!!
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 02, 2013, 06:35:18 AM
Thanks that motivated me :D

So far I've prbably changed stuff in like 90% of all the scripts, and it will probably show in a lot of bugs here and there. I've learned from the past and would like to release the next version as a development beta version.

From what I've done so far there's little danger to your existing projects though. You may need to change a variable type or 2 (I'm getting rid of stuff like Nodes vs GridNodes etc) or replug some variables, but all in all it should not break any existing setups.

I may be done with the first beta release by tomorrow or so. For now I have to go back to my studies :S
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 03, 2013, 11:37:41 AM
try this one... it's missing the GeneratePointGraphFromHierarchy action I had originally planned for v81 but in exchange there no longer is ABPath vs Path or GridNode vs Node. I still need to change the actions so they only accept the matching object variable type as input, but I don't have the time today.

I also quickly checked each actions, but by now there's too much to make an indepth check.

I hope this fixes the iOS errors :) .
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on March 06, 2013, 07:51:49 PM
The iOS errors are gone but there is a new one ... but ill post it in a few weeks so you can study :)

Thx for the amazing work.
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 08, 2013, 08:50:58 PM
I finally started digging into this...

What is the RVO Controller for? I keep getting warnings about it..

I've started working in my project rather than building from your example scenes with everything from scratch so I can understand the workflow but my unit just falls through the floor when I tell him to move. I can't really figure out why. Other than that it seems like a really well put together set of actions so far. Is it possible to identify walkable and unwalkable nodes with debug colors and stuff? I'd like to get more response out of the plugin and it doesnt look like my debug path lines are working either.

Does the path finding work where you have to define a node to build paths to or does it accept any object/vector as a destination and simply use the graph to build a path as close as possible? I'm a little mixed up on what to give it and store for path information.

How do I grab a group of neaby nodes? For instance if I'm selecting a location for a large building that takes up 9 node spaces I'll grab the center one for placement, then how do I get the other 8 nearby and declare them unwalkable?
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 09, 2013, 04:20:05 AM
Excellent questions.

The RVO controller is what unity pro users use to move around with local avoidance. Every movement script (move to, follow path, etc) first checks if you've got either a character controller component or an RVO controller component on your actor(the gameobject that moves). If you don't it creates default ones according to your license.
The additional script package includes a dummy rvo component. This makes unity think it has such a component and therefore it won't give you an error. The advantage this is giving us is that we can use the same core package for both pro and free users.
The warnings should not be there though. Can you quote one? Maybe it's something that's easy to fix.

Is your actor noticably above ground? Do the examples work properly? Do you have a collider on your ground? Does your actor have a character controller (at least while the game's running it should have one, but maybe this is the same problem as the RVO controller warnings).

Select your A* gameObject in the scene. It should by default show you the graph, and unwalkable nodes should be red blocks.
Paths are only visible if you have the actor's FSM open and if you can see the action that moves it. This is a bug I've yet to crack :D

To calculate a path you always get the nearest node to your gameObject. I can implement it so the final waypoint is exactly your gameOBject , but that won't do any pathfinding from your last node in the path to your gameOBject, so it'd be asthetics only.
What do you mean by give it and store for path info? Which actions are we talking about? The path output usually is an FsmObject of the type FsmPathfinding/FsmPath.

To update many nodes at once, use the "update graph" action. To make the nodes walkable again, remove or disable the collider of your building and use another "update graph"
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 09, 2013, 02:35:47 PM
Excellent questions.

The RVO controller is what unity pro users use to move around with local avoidance. Every movement script (move to, follow path, etc) first checks if you've got either a character controller component or an RVO controller component on your actor(the gameobject that moves). If you don't it creates default ones according to your license.
The additional script package includes a dummy rvo component. This makes unity think it has such a component and therefore it won't give you an error. The advantage this is giving us is that we can use the same core package for both pro and free users.
The warnings should not be there though. Can you quote one? Maybe it's something that's easy to fix.

Code: [Select]
GetComponent requires that the requested component 'RVOController' derives from MonoBehaviour or Component or is an interface.
UnityEngine.GameObject:GetComponent(Type)
FsmMoveOnPath:Start() (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/helpers/FsmMoveOnPath.js:78)

Quote
Is your actor noticably above ground? Do the examples work properly? Do you have a collider on your ground? Does your actor have a character controller (at least while the game's running it should have one, but maybe this is the same problem as the RVO controller warnings).

Much above the ground, its fine until I order it to move, then after the move order it just goes straight down and I see the RVO warning. I've been thinking it may have something to do with me not giving the correct type of destination for the path to compute and its building a path straight down or nowhere or something.

Quote
Select your A* gameObject in the scene. It should by default show you the graph, and unwalkable nodes should be red blocks.
Paths are only visible if you have the actor's FSM open and if you can see the action that moves it. This is a bug I've yet to crack :D

I see, I'll tinker with this more.

Quote
To calculate a path you always get the nearest node to your gameObject. I can implement it so the final waypoint is exactly your gameOBject , but that won't do any pathfinding from your last node in the path to your gameOBject, so it'd be asthetics only.
What do you mean by give it and store for path info? Which actions are we talking about? The path output usually is an FsmObject of the type FsmPathfinding/FsmPath.

Hmm I don't fully understand how it works I guess. I'm getting the click location, storing it, then building a path to it, storing the path, then following that path. So..

Click (Store Vector3)
Create Path To (Vector 3) and store (Path)
Follow Path

Unit goes straight down, Path length is 1. I tried getting the nearest node and storing that but Create Path To only wants a vector 3 or gameobject. The TD example is working, but I'm having a hard time following the system and figuring out what its doing.

Quote
To update many nodes at once, use the "update graph" action. To make the nodes walkable again, remove or disable the collider of your building and use another "update graph"

Cool, I'll tinker with this more once I get the pathing working properly.

Thanks for the help!
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 09, 2013, 02:49:45 PM
"create path to" is intended for paths that do not start at the actor's position. You should be able to just use "Move To" and put in the vector3 from the screencast.

Falling down implies that you have a character controller on it, which is good. But then again, a character controller should not let you fall through the ground...

Can you send me the project so I can have a look at it? Or is it an integration into a real project? I'll also fix the annoying RVO controller warning.
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 09, 2013, 06:36:49 PM
Here is the current project, you just need to setup a project with PM/A*/A*Actions/RVODummy, bring this stuff in and open ClickMove scene.

You should be able to select the capsule by left clicking it, then right clicking where you want it to move. I changed it to Move To and it quit falling through the floor but doesn't move along any path. The right clicking location is saved as a global and there is an object following the mouse location around as well if needed.

I'll mess with it some more.
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 09, 2013, 06:37:34 PM
the attachment

also, Move To throws this error/warning:

Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
moveTo.OnDrawGizmos () (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/moveTo.js:228)
HutongGames.PlayMaker.Fsm.OnDrawGizmos ()
PlayMakerFSM.OnDrawGizmos ()
UnityEditor.DockArea:OnGUI()

And the GridGraph sc2 scene using Follow Target example throws this:
Code: [Select]
NullReferenceException: Object reference not set to an instance of an object
followTarget.OnDrawGizmos () (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/followTarget.js:240)
HutongGames.PlayMaker.Fsm.OnDrawGizmos ()
PlayMakerFSM.OnDrawGizmos ()
UnityEditor.DockArea:OnGUI()

Not sure if these are on my end or something.
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 10, 2013, 11:44:30 AM
Ok i got it to work. It doesn't seem to like the vector, using a game object as a destination seemsto work okay. Move to doesn't complete the path but follow target does it just acts weird when it gets there. Kinda choppy on the last few steps for some reason.

Inexplicably the errors are gone today. Rvo warning remains but only using move to.
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 10, 2013, 12:30:27 PM
I've done a couple of tests. Apparently the example scenes can be corrupted very easily (seems pretty hazardously to me). That can account for some of the recent confusion. @Lane I could not import your scene though since it gave me a fatal error each time.
Furthermore I was so concentrated on making everything work flawlessly with the pro version now that we have a couple of pro users here, that I totally forgot to check compatibility with the free version. Stupid bugs, It's fixed now I think.

Since everyone including me agrees that the current setup is annoying and prone to errors I got permission from Aron to share a modified version of the free astar package here. Pro users will still need to install everything the old way though.
Alex told me before that as long as the PlayMaker.dll is not included, entire projects can be shared here. But unless there are errors there too I'll leave PlayMaker to you, so you can use whichever version you like best.

So from now on it's:
1) Install PlayMaker
2) Install this package

This should solve a lot of potential issues I think :D

https://docs.google.com/file/d/0BwrgibYeepavRXdUZ1FBM3R2dlU/edit?usp=sharing

EDIT:
Forgot the vector thingy, will be in the next release, maybe this evening.
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 10, 2013, 03:17:53 PM
Ok sounds good, what version of unity are you using? Not sure why the package wouldn't import.. I'm using 4.
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 10, 2013, 04:49:05 PM
that may very well be it. I didn't muster the menu for the update yet  ::)
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 10, 2013, 08:13:16 PM
How do you get objects to orient themselves forward while moving along a path, or rather look down the path, or orient z+ to the direction of movement?
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 11, 2013, 03:41:37 AM
I use smooth look for that. Just put it right behind the movement action and use the direction value it gives you.
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 11, 2013, 04:54:26 PM
Alright, I fixed whatever I could find. The movement actions should work now, even the auto movement should work properly in any case I could think of. I edited some actions so they once again only accept very specific object types after I've changed every output so it won't return anything else. I could not detect any stuttering in the follow target action, so I don't know if that's fixed.

https://docs.google.com/file/d/0BwrgibYeepavWWRUSGlPejA1bVU/edit?usp=sharing
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 11, 2013, 04:57:52 PM
I'll check it out in a few hours when I get home.

Thanks, Sven.
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 11, 2013, 10:11:25 PM
https://dl.dropbox.com/u/38606641/Unlimited/WebBuild.html

Really can't figure out the problems Move and Follow are giving me. It's super jittery and in some cases the agent will move extremely slow for no apparent reason, often completely ignoring the speed variable. I wanted to use the pathfinding to make the dummy follow the mouse, then it would never enter an unwalkable tile and collide or be able to be placed illegally but its always just acting really strange and unpredictably. When it wasn't falling through the floor (evidently flush planes are considered intersecting so they MUST be non-planar to walk on it) then it walks weird.

The examples seem to work fine in the same project and I'm doing the exact same thing as them. I've tried placing things extra high, letting them drop onto the floor, tried new floors, reimported packages.. erg.. I can't figure out why its acting so much differently than the examples when its the same arrangement and actions.
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 13, 2013, 10:15:06 AM
my finals will be done in exactly one week from now. I'll create a tutorial for you then. Right now I'm at my limits  :o
PS: I just remembered that I had similar problems when I started using the pathfinding package. I copied an example scene and used that as my basis. In retrospect I think I didn't set up the AstarPath (the one on the A* gameObject) component right.
Title: Re: A* pathfinding (stable 0v808)
Post by: Lane on March 13, 2013, 10:53:16 AM
Ohhh nice, finals - you're almost done! ;)

Why don't you port over the scenes that come with Aaron's package next? I know the one with the spider walking around on the terrain with dynamic obstacles was really interesting but a tutorial would also be a big help. I should probably hold off until there are some docs and more annotation on things because I don't have the understanding of pathfinding to grasp all of the actions' purposes since before download your kit I havent even looked at pathfinding.

I did get a better idea of how it worked and what I needed as an end user i can mention if thats helpful. I wanted it for two things: 1. Testing the ground for legal building placement and updating the graph when structures are built and 2. Building paths for units so they avoid those buildings.

Doing #1 was the more difficult one, I couldn't figure out how to have the dummy floater building get the nearest node, then all nearby nodes (according to the structure size), and test them for walkability. It would be SUPER nice to use a collider to get any nodes it hits and store them.

Doing #2 was much simpler. I think  that what is needed for noobs like me is a choice of 3 variables: Start, Finish and Speed. Anything more should be a different action unless it is totally necessary.

So basically the actions I would hope to see would be a Move To that is simplified as much as possible, Get Nodes In Collider of some kind and Test Node(s) to see if they are walkable and send events if true/false. Maybe thats available now in some form, not sure, but I think a whole lot could be done with those 3 and Update Graph. A lot of the optimization actions that add diversity (such as a lot of the pathfinding in the TD example) are very confusing and while more economical for mobile and that particular single path environment work fine it also makes a lot of noise in the action choices when it seems like something simpler works in most cases. But there are definitely several different types of pathfinding the user may want to do which merit's having different actions in order to be efficient.
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 21, 2013, 10:25:00 AM
Alright, I can finally dedicate some time to this again. I agree on the area actions. They do exist is some form atm, but they are very buggy so I won't point them out :D .

Here's my schedule for the next release :
- iOS support (I need feedback on this, like errors etc, otherwise I can't do this because I don't own an iOS device)
- Area node actions (get nodes in area, set/get node walkability in area, all of these as cheaply as possible.)
- Point Graph from children (wanted to do this for some time, so you can finally have more complex graphs)
- fix variable types (potentially the next playmaker release offers some options to integrate the variables more deeply, saving the effort of wrapping everything. Not sure if I'll do this, because the one advantage of the wrappers is that they are all in the same category, which makes them easier to create. We'll see :) )
- A* tutorial (This will be mostly basic for now, explaining what actions do, how to create proper graphs, how to debug, etc. I was thinking of doing this along the lines of a simple towerdefense game, since that's nice and simple.)

Did I forget anything?
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on March 21, 2013, 04:26:27 PM
I'll help you with iOS support testing, sounds like a solid list :)
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 22, 2013, 03:33:16 AM
I'll help you with iOS support testing, sounds like a solid list :)
Great, can you test the latest package (the beta one from one of my previous posts) for errors? That would be a good start I think :-)
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 22, 2013, 06:08:16 PM
alright, have a look at the 2 actions in the attachments. I've put a lot of thought into them. They work the fastest on the grid graph, because the grid graph has a very good structure, but they work on any other node graph too. They only work at one graph per time though (may be changing somewhere in the future, but for now I've burnt myself out on writing a running solution that works on any graph). The set node walkability action will come tomorrow, I'm too tired right now.

Btw, this time the area actions are meant to be simple. I went through a lot of effort to make them not need any setup whatsoever. They still have optional checkboxes, but it should work either way. I'll be continuing to work on hte performance, so let's see. For now there's no every frame.
Comments are welcome :)
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on March 22, 2013, 08:53:16 PM
iOS - Pro

I get this error -
Assets/Plugins/FsmDummies/RVOControllerDummy.cs(3,14): error CS0101: The namespace `global::' already contains a definition for `RVOController'
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 23, 2013, 04:17:31 AM
Are you perhaps using astar pro? Because only the free version needs the rvo dummy. Pro users also need to fix their astar path file for themselves (you know, adding the few lines I put in the first post.). I'll ask Aron today when he'll release the next update so that bother be gone ;)
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on March 23, 2013, 04:45:46 AM
Yip, I'm using astar pro (and installed it as instructed on the first page), I'll try the free version too and let you know if there are any errors.
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 23, 2013, 02:17:33 PM
Hey, I'm done with all the actions now, hope you like them. Once the iOS support is established/confirmed, I'll release it. Tomorrow I'll also create installation and upgrade videos, as well as videos about the basics , If I've got enough time. We'll see :)
Btw. Have a look at examplescene 2, I extended it so it would reflect the new changes I've made.

pro:
https://docs.google.com/file/d/0B_ooTsYCyRtnVzJZVllkbXFMdEE/edit?usp=sharing

free:
https://docs.google.com/file/d/0B_ooTsYCyRtnLWtFQjZZeXRDNzQ/edit?usp=sharing


Changelog :
- area node actions
- various small bugfixes
- some fixes to the variable inputs, more changes internally
- partial translation to c# : 10 % (possible that I'll never complete that, js is just too useful at times :D )
- added path width to PointGraphFromChildren
- added ComplexPointGraphFromChildren ( can generate anything up to things that are as large as a gridgraph.)
- option to have node cost influence the speed of the controller.
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on March 24, 2013, 03:44:20 AM
iOS Pro works fine

iOS Free - I get a bunch of errors (installed playmaker, the free A* then the Free auctions) Did I install this correctly?
Assets/Plugins/FsmPathfindingWrappers/FsmPathfindingC/SetWalkabilityInArea.cs(126,35): error CS0246: The type or namespace name `GraphUpdateShape' could not be found. Are you missing a using directive or an assembly reference?
Title: Re: A* pathfinding (stable 0v808)
Post by: kiriri on March 24, 2013, 05:47:23 AM
thanks for even going through the trouble of testing both packages! Very appreciated.

The free version too needs a restructuated version of Astar (for use with js) , so I suppose that was what caused the errors.
To make it easier on the majority of people here I already included the modified version of astar (with everything including the additional code).
So for freebies, the steps are just

1) Install PlayMaker
2) Install the free package

nothing more :)
Good thing I've just started with the installation tutorials :D I think if the pro version works fine on iOS, the free one should too.
I'll start editing the first post now, it needs some new look I think, since this is no longer a mere extension of PlayMaker, but with all these custom actions also a kind of extension of Astar.
Thank you for your help :)
Title: Re: A* pathfinding (stable 0v808)
Post by: escpodgames on March 24, 2013, 07:10:07 AM
Ah gotcha!

iOS Free works :)
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on March 24, 2013, 04:28:31 PM
excellent!

I've started creating the tutorials, but they take forever because I'm just not good at talking about things I know so much about. i always try to explain how each thing works in detail, and then I'd probably end up with everyone loosing their patience :D

So for now, only the first 2 parts : 1) Setup and 2) basic graph info. I've also tackled the movement actions, but haven't found good ways to describe how certain things work while being both simplistic and accurate about it... I'll finish the video tomorrow, then I'll quickly go over the rest of the actions in another 2 or three 10 min videos. After that I'll start a tower defense game of roughly six 10min parts.
Part 1)
Part 2)
Title: Re: A* pathfinding (stable 0v81)
Post by: greg on March 31, 2013, 07:40:30 AM
Sven you are fucking awesome; this is so helpful, thankyou  :)

My game procedurally generates levels, should i bake the path-finding in after the geometry has been built?

How intensive are the follow and new path actions. I'll likely have quite a lot of NPC's patrolling in the level. Can we set a delay for re-calculating the follow behaviour? I imagine if an enemy is chasing the player, it only would need to recaculate the path every .5 seconds or so, would it be sensible to use "new path" every .5 seconds instead of the follow action?

Thanks for taking the time to look over my questions.
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on April 01, 2013, 09:46:58 AM
I'm glad you like it. The next tutorial video will talk a bit about setting the walkability of an area, which may be useful on procedural levels. It unfortunately does not yet support the creation of gridgraphs at runtime, which now that I think about it is quite important for games such as yours.
What you can do is go to your AstarPath component in the scene (the one I always put on the A* gameObject) and then disable the "Scan on Awake" option.

Then, once your entire level is generated, you can use "Scan Graphs" to make the nodes walkable/unwalkable depending on your settings.

The follow Path action has an additional property called "Update" . This defines how many frames it waits between each update of the path.
So unless your targets are all the way across a 1000x1000 grid and you then try to use 1000 actors every frame, there should not be many problems. If you notice any big framerate drops, that's most likely my sloppy execution so do note that as a bug ;)
Title: Re: A* pathfinding (stable 0v81)
Post by: greg on April 05, 2013, 08:47:20 AM
Thanks for answering my questions, i had a little play around: https://dl.dropbox.com/u/26630920/pathfinding/pathfinding.html
(run around with arrow keys)

If you see the attached image, i had to use two grid graphs where the bridge goes over the main level because height testing would leave a gap under there otherwise. Is there a smarter solution to this? Also, i manually joined the graphs together with a bunch of connections.. is there a way to join several grid graphs if the nodes are a certain distance apart?

I sent you a PM too, thankyou so much for all the help!
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on April 05, 2013, 01:14:09 PM
bridges are a good example of where you'd want to use point graphs. The new Create Point Graph From Children (or something like that :D ) action supports bridges of a certain width, as long as they conform to this standard: ( for a width of 3)

369...
258...
147...

The number stands for the order in which you need to create the empties you want to use as nodes in order for them to be created properly. I'll also need to add an option to automatically connect complex point graphs to any other graph.

So let's see, next update will then feature:

-Bugfixes on the movement actions (I forgot what they were about but they are important ^^) + make follow target action not halt on expensive path calculations
- Complex Point Graph connection property
- Tutorial part 4 (it's hard, I could write a book about it, but I can't explain it in 10 minutes...)
- Join Graphs action (based on distance) : That sounds like it could be useful.
- ... I think I forgot something...

So anyways, that's up for next week, this week is like super busy already  ;)
Title: Re: A* pathfinding (stable 0v81)
Post by: escpodgames on April 17, 2013, 10:24:09 PM
Got an issue with the follow action - (even if I untick debug)

NullReferenceException: Object reference not set to an instance of an object
followTarget.OnDrawGizmos () (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/followTarget.js:254)
HutongGames.PlayMaker.Fsm.OnDrawGizmos ()
PlayMakerFSM.OnDrawGizmos ()
UnityEditor.DockArea:OnGUI()
Title: Re: A* pathfinding (stable 0v81)
Post by: Saputo on April 18, 2013, 12:30:37 PM
How would I get this to work, with 2D Toolkit, I imported a Tiled Map and set up the textures with collisions and such, from the level I made with Tiled. like trees rocks ect. the player cant walk over them, but how would I make this work for the path finding to work.
Title: Null Reference Error
Post by: cyangamer on May 07, 2013, 12:40:00 AM
Hi. Great add-on. However, I'm getting an error everytime I add the MoveTo action to a state. This error keeps posting every few seconds and clogs up my console very quickly:

Quote
NullReferenceException: Object reference not set to an instance of an object
moveTo.OnDrawGizmos () (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/moveTo.js:235)
HutongGames.PlayMaker.Fsm.OnDrawGizmos ()
PlayMakerFSM.OnDrawGizmos ()
UnityEditor.DockArea:OnGUI()

I haven't touched any of the scripts, the add-on is version 0v82, and this is in Unity 3.5.6. Anyone have a solution?
Title: Re: A* pathfinding (stable 0v81)
Post by: SteveB on May 08, 2013, 06:00:08 PM
Great stuff Sven!! That said I did have a shaky start that did concern me a little bit.

First off putting the ScanGraph code snippet at line 1478 gave me a bunch of errors, and I suspect Aron changed/added something that makes that line less than ideal as it's in the middle of #if Unity_Editor, so I opted to put it at line 1505 (after that subsequent  #endif) and all seems fine...

...but now, your Tower Defense example scene doesn't work, and I get the following error continuously repeated:

Quote
NullReferenceException: Object reference not set to an instance of an object
FsmConverter.NodeListToArray (Pathfinding.Node[] go) (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/helpers/FsmConverter.js:22)
getNodeInfo.DoStuff () (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/getNodeInfo.js:101)
getNodeInfo.OnUpdate () (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/getNodeInfo.js:107)
HutongGames.PlayMaker.FsmState.OnUpdate ()
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.Update ()
PlayMakerFSM.Update ()


It's the only error I get, and perhaps not the biggest deal, that scene doesn't run 'out of the box'. The other reason I'm mentioning it is to ensure I didn't do something incorrectly when installing that will disrupt my progress in the future.

My installation was:


Should be it for now, and again I'm really hoping I have this setup correctly so I won't have to worry too much later! :D

Thanks Sven!!

-Steven

P.S. I'm Unity/iOS Pro if that's important info
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on May 09, 2013, 05:05:36 AM
thank you all for your continuing interest in the plugin . I'm sorry I didn't update it recently, I'm preparing my oral exam and it took most of my time.

But for today I'll see if I can fix all the bugs etc. The gizmo issue should be rather straight forward.

@ Saputo
You can add a box collider to any tile (static colliders aren't all that expensive) and enable/disable it depending on the walkability of the tile. Then you can use UpdateGraph to update the area of the node . I'd recommend a use of a gridgraph which you specifically set up in a way that each node is directly on the center of a tile.

@SteveB
your installation seems to be correct if you use the pro version I think. If you use the free version it should work out of the box, just install Playmaker, and then my package (which already contains Astar).
And the example should have everything setup in a way that works. So I'd guess that Aron's package changed, I'll check it out today :)
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on May 21, 2013, 12:22:08 PM
Since I obviously can't continue this thing for now, here's the path error fix for now.
I won't make any promises to anything else since right now I'm living in a hazardous environment  ;)
Title: Re: A* pathfinding (stable 0v81)
Post by: jonjojo on May 27, 2013, 05:54:10 AM
Hi thanks for the brilliant extension,  i am still getting problems on the Tower Defense example even after taking the 3 new scripts.  When i click i get ...

NullReferenceException: Object reference not set to an instance of an object
FsmConverter.NodeListToArray (Pathfinding.Node[] go) (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/helpers/FsmConverter.js:22)
getNodeInfo.DoStuff () (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/getNodeInfo.js:101)
getNodeInfo.OnUpdate () (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/getNodeInfo.js:107)
HutongGames.PlayMaker.FsmState.OnUpdate ()
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.Update ()
PlayMakerFSM.Update ()

Also there is a compile error in Mono

In getClosestPointOnPath.js  line 61

for (var i =0; < Enumerable.Count(pathNodes);i++)

it says "Ambiguous reference 'Enumerable':System.Linq.Enumerable, System.Linq.Enumerable
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 24, 2013, 05:32:31 PM
Thanks for the amazing work!

When using "Move to", gravity (some form) is applied somewhere. This is great, as the Character controller is not providing this.

But it's falling too slow for me.

Can any one tell me where the "gravity" is applied, so I can speed it up? I cannot figure it out.

Thanks a lot :)
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on June 25, 2013, 06:41:14 AM
the gravity force is 9.81m/s^2 just like in reality. If it's too slow, it means your objects are too large. 1 unit in unity equals 1 m in the physics engine.
So the best thing would be to scale it all down to what it should be like.

Alternatively you can change the gravity value too. Use the SetGravity action which should already be included with PlayMaker.
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 25, 2013, 07:11:00 AM
Wow - so simple :)

I thought the gravity was simulated.. well, erh, I know it is, but I did not think the physics engines simulation was used, since Rigidbody and Character controllers are not good friends, I figured you made some home grown math I could not find.

Thanks a bunch! Really :)
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 27, 2013, 05:39:51 PM
A lot of the Actions have an input field "Input Path", example:

Smooth Path
Game Object (That is self explaining)
Input Path: How is this supposed to work?

I do not seam to be able to create an "FsmPath" - how is that done?

Thanks.
Title: Jerky movement
Post by: FritsLyn on June 27, 2013, 05:49:29 PM
I literally spend 3 days now trying to make smoothing ghost objects to get a nice move in my objects. They work, but always come with a second problem or two, as they also cause "follow behind real action" and "smoothing what should be hard". So now I thought I'd try and ask:

When just using "Move To", on a point graph, the forward motion is sometimes smooth, but then it has random jerks every now and then.

Is there a built in functionality to make straight movement non-jerky?

Thanks.
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on June 28, 2013, 06:45:11 AM
after creating an object variable, you can select it in the PlayMaker variable tab and define its' type. You should see a category called FsmPathfinding. In there should be all the additional variable types the pathfinding actions require.

As for the jerkiness, can you create a video of it? without seeing it I can't help you I think.
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 28, 2013, 09:28:07 AM
Sure, here is a screencapture of a test maze:


I could set this up in many ways of course, and here the white box (Astar) is doing raycasting to ground and other stuff. But the same result is seen if I only take 2 completely similar objects, let one of them move by other means, and one by Astar.

In the video the camera is following the other object to show "who is stable": If I let it follow Astar, it's harder to tell what is going on, because the whole game will be "a little jerky now and then".

I have tested if this is happening at special nodes or what ever, but it appears that it's random.

In all fairness I must say that the screen capturing and Youtube transferring did not exactly help - it's not that bad in reality, but it's pretty unsmooth, and has sudden jerks every now and then.

I'm excited to hear what you think :) Thanks!
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 28, 2013, 10:19:03 AM
And for the FSMPath object - OH! Thank you very much, a new world just opened to me.

Thank you!!! Wow :)
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on June 28, 2013, 01:09:48 PM
hmmm, I haven't encountered jerkyness like that myself, so I guess it could be the pointgraph itself. How did you create it? Did you have a look at the path to see if it perhaps sometimes turns direction for 1 node or so ?
Or perhaps the jerkyness appears when you update the target location of the moveTo action (when you reenter that state) ?
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 28, 2013, 03:50:03 PM
Hmm.. I have not encountered that much jerkyness either - but I was happy to see how screen capture and YouTube exaggerated my point ;)

In reality I have often thought there was zero shake, I have been watching happily for many seconds, and then all the sudden there it is again - that sudden jump - at random spots.

I have it with any graph type that I have tested. I am pretty sure you have it as well.

I started by not noticing, because I did a standard setup of the AI moving about and maybe even the camera following it.

Then I wanted to fine tune my basic setup to be "smooth as Mario", and from there on I started to notice something was wrong.

First I thought it was somewhere else, as the character was steady, it was more the whole game that made little jumps here and there.

It is only when I make something else very smooth that I realize how unsteady the Astar Move To really is.

The planned game is for mobile devices, where the user is supposed to do little that does a lot - just swipe to change direction, tap to jump.

And in such a setup the AI is the main character, and then one start to see the problem - either the game track is jumping now and then or the character is - depending on how the camera is set up.

I am not much of a coder (thanks lord for Playmaker ;) but my humble guess is that the code keep requesting simplemove to new directions - also when not turning.

While this works most of the time, sometimes there's a set of calculations done in the wrong order, and 2 moves is happening in one frame and 0 in the next.

This is why I wondered if there's a better way - something more along the way iTween Path does things, or maybe a way to catch the calculations a little beforehand and do some smoothing over a couple of cycles.

I can do the latter in "post" but my problem is that the character controllers collider is then placed in front of what is seen as smooth.

And it's also a problem that no sudden stops are possible then (landing firmly on ground, not soft landing on a pillow of air).

This could be solved by accepting jitter on Y axis, and letting the Z&X be pre-smoothed inside the code.

unfortunately I am not a programmer :/

Cheers, and thanks for all you have done :)
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on June 28, 2013, 04:24:31 PM
hmm, this is very weird, no matter what I try, I can't replicate your bug. I sometimes get jerkyness with the local avoidance  controller, but never with the character controller. I will sleep over it and look into it tomorrow. I also need to fix the example scenes so I'll try to do both at once...
What I do know is that a "double simple movement" in one frame is not possible, and there is no way my code could do that anyways, so it must be something different. Using something like iTween for the movement would not take Physics into account, so it's a bit difficult.

Let me think about it :)
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 28, 2013, 04:35:38 PM
A single output to a (global) Vector3,

And a double input (Bool + Vector3) to say "We collided here, start here with what you are told to do" (move the other way back, or continue through because in reality I have jumped across or destroyed the obstacle) would solve all my problems!

In fact my only reason not to be able to fix things myself is that I am dependent of the character controller.

if I could get raw data (Vector3) of where the "ghost" was, I could smooth out and place anything at that vector or part of it. And if I collided, I could tell the Astar to stop and "reset" at the Vector3 I gave it to start over from.

I know this would take some documentation to understand for everyone else, and I'd be happy to write this.

it would also mean that one could chose any type of object to follow the path - fish and planes, here we come, like Mario, here he comes as well.

Another benefit would be that one could "terminate on the spot", move around and start over the Astar quite easily.

Bool: Move / Do not move
Vector In: Where to start from when Bool is set to 1
Vector Out: Where "ghost" is at

Cheers,

Frits
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 28, 2013, 05:26:38 PM
Just did some basic testing:

Any positive collision testing on an object makes it do the jitter! (not just Character controllers)

I have 2 cubes moving alongside each other.

One is constantly doing so because it has "trigger stay"
The other is just doing so by adding to value and setting position.

One is jerky, one is smooth.

So basically to get silky smooth moves, one has to have a "ghost" to do the hard work and jitter itself as much as it want, read the place it's at from the other, and smooth place it.

The good news is that there is no jitter when just "asking if there's collision", so the "follower of the ghost" can still check if it hits something, and then send this info to the jittering ghost which then can re-place itself at the masters place.

So.. it'd work :)
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on June 29, 2013, 05:26:18 AM
you can actually do that already, you are not dependent on the character controller. It's a bit more complicated than a single action though.

You could start of by using the "Create Path To" action and saving the path to a variable. Then you can use the "Get Path Info" action to get the Nodes of that path. Then you can set an int variable called "i" to 0 ("Set Int"). Then in a new state you can do something like this:
"Get Node From Nodes" with the index i and save it to Node.
"Get Node Info" on Node and get the position as NPos.
"Get Position" on Owner and save it to Pos.
"Vector3 Operator" NPos - Pos = Direction.
"Vector3 Normalize" on Direction
"Vector3 Multiply" Direction * MovementSpeed.
(continue to the next state)

"Int Add" i + 1.
"Add Force" Direction on the Owner every frame.
"Get Position" on Owner and save it to Pos  every frame.
"Vector3 Operator" NPos - Pos = DistanceVector every frame.
"Get Vector Length" DistanceVector to Distance every frame.
"Float Compare" if Distance < MinDistance go to the previous State every frame

(Don't forget to expose and fill in numbers for MinDistance and Movement Speed)

With this setup you can use a rigidbody which allows you to just add your jump movement as a force. I've used Rigidbodies myself before as character controllers, they work great if you tweak them right.
I will update the actions so you can freely choose between using a characterController, a Rigidbody, an RVO controller, nothing, or whatever is on the gameObject already. That should satisfy everyone I think.
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 29, 2013, 05:59:08 AM
Fantastic - I was starting to build my own modular Magic Boxes..

(https://lh5.googleusercontent.com/-2fRmG6QFj2Y/Uc6uJ_S3VuI/AAAAAAAAtMs/ajnGCJVVK5A/s1168/Sk%25C3%25A6rmbillede%25202013-06-29%2520kl.%252011.50.26.png)

But I'll wait and see how this thing of yours shapes up, I'd much prefer that :)

Thanks!
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on June 29, 2013, 09:55:25 AM
alright, first let's see if any of the new modes fixes things (or makes them worse).
Replace the MoveTo script in PlayMaker/Actions/Addons/AStar/FsmPathfinding/ with this new one. Then go through the controller types and check how it's working. Remember that each needs a different speed setting. If the speed is too high , they won't work (especially the transform). I'm still working on the rigidbody part. I'll try to find a solution to them sometimes looping back if they move quickly.

EDIT: Oh and if you haven't already, make sure to check whether upping the "Next Waypoint Distance" helps with the jitters.
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 29, 2013, 04:10:24 PM
You Are A Freaking Hero, Sven!!!

First I tested RigidBody, to much amusement  - It's like it keeps adding force, funny results, might come in handy, I only tested short.

THEN I tried Transform.. S-M-O-O-T-H-!-!-!

And with Direction out -> Smooth look at direction.. VOILA!!

Awesome!

I'll play around with the other controller types just to see what lies in there - but that is only for the testing and fun.

.. Just tested some more - this is absolutely awesome!!

Very nice job, thank you, thank you, thank you :)

Thank you!
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 29, 2013, 04:30:02 PM
(Thank you)
Title: Re: A* pathfinding (stable 0v81)
Post by: FritsLyn on June 30, 2013, 03:34:03 AM
Woops - Working with Transform, starting in the negative world, crossing 0.0.0 .. erh no, stuck. No crossing from negative to positive.

No problem to avoid, I moved my world - but thought I'd let you know.
Title: Re: A* pathfinding (stable 0v81)
Post by: kiriri on June 30, 2013, 05:54:00 AM
:D I'm glad you like it. The stuck issue was caused by the new finishDistanceMode "absolute" (the rest of them should work in negative space too). I fixed it and added a new mode called "absolute Endnode" which I need for my own game. As always, the tooltips should explain all the modes.

Edit: The next update will be warning-free btw. :)
Title: Re: A* pathfinding (stable, no warnings 0v82)
Post by: kiriri on June 30, 2013, 01:48:02 PM
ok changelog, I'm not sure what I did in the last months, but I do remember what I did in the last days.

Changelog 0v82
-Removed ALL warnings (yay ! :D)
-Unified the movement actions into MoveTo *
-Implemented a Custom Action Editor for the MoveTo action.
-Added Movement Modes : Rigidbody, CharacterController, RVOController, Transform, Available, None (for custom controllers)
-Added Finish Distance Modes (to control which distance the Finish Distance attribute controls) : Absolute Endnode (actor to endnode), Absolute(actor to target), relative (along path), last (only start measuring when reaching the second to last node)
-Added MoveMode : MoveTo, FollowTo(new, like Follow, but finishes when it reaches the target), Follow, FollowPath
-Fixed the example scenes (put some effort into the local avoidance and it now works decently too)

*I'm not sure you guys will be happy about that, it means you'll have to update all your Fsms that used movement actions before. However, from a developers perspective this was overdue. Due to certain reasons I can't program actions for PlayMaker like I would other scripts. Instead of inheriting certain code from one script, I had to copy paste the same code snippet into each movement action each time I made a change. By unifying the movement scripts I save myself a lot of time both when bugfixing as well as when developing new features. I hope this doesn't annoy you guys too much.

Free :
https://docs.google.com/file/d/0BwrgibYeepavZFJ5OFZFR1htRWM/edit?usp=sharing
Pro (the examples aren't working in pro so I removed them): https://docs.google.com/file/d/0BwrgibYeepavQzk3RmQ1ejZOWjQ/edit?usp=sharing
Title: Re: A* pathfinding (v821)
Post by: kiriri on June 30, 2013, 03:57:29 PM
a very small but important update : With this package I've removed the need for pro users to rig their AstarPath.cs file. There is no need for it anymore, as I've changed the function in a way that makes it work outside of AstarPath. So yeah, I'll just call it 0v821 :D
Title: Re: A* pathfinding (stable 0v82)
Post by: LoneCipher on July 26, 2013, 01:32:05 PM

Thank you for your work on this. It is hugely helpful. I am having trouble with the follow action. If I duplicate the object doing the following, it appears to stutter. When one of the objects is deleted, all objects finish the path they had last.

Am I doing something wrong?
Title: Re: A* pathfinding (stable 0v82)
Post by: Gua on July 29, 2013, 02:31:46 AM
Thx for the actions! Is there a hope for actions description and more tutorials?

Hm.. when I scan red cubs do not disappear, but it does generate nodes.

Can someone tell me what am I doing wrong when trying to install pro version?


p.s. Ive noticed that Astar Beta 0v821 pro weights only 51 kb, is it normal?
Title: Re: A* pathfinding (stable 0v82)
Post by: kiriri on July 30, 2013, 06:04:44 PM
hey guys, sorry for the late reply, I just started my 5 weeks GB tour and I didn't have any internet for the first week. Right now I'm at a youth hostel and it blocks this site as it labels it a "gaming" website, so I had to use a proxy to even see your replies :S

As for the deletion-stuttering issue, yeah that is quite an annoyance that's been bothering me as well. But I didn't notice the deletion error (I use pooling). Fixing that has very high priority for me, so I'll try to do it within the next days or so.

@ Gua
You're welcome, I'm glad you like it so far.
First of all, scanning should update all your nodes. It should not add new nodes. Red cubes only appear if the node there is unwalkable. To make sure a node becomes unwalkable on scan, check the AstarPath settings (yknow, the thing that I always put on an A* gameObject. ) You may have forgotten to include whatever should be unwalkable in the collision layer.
Right now the pro version only contains the PlayMaker actions and not the actual A* addon itself (because obviously I can't just share that freely) so it's much smaller. Also, what I forgot to mention in the update instructions is that you should make sure that your old project does not contain any of the astar-PlayMaker files because they may no longer exist in the new version. So in your case the FsmABPath.cs file no longer exists in the new astar plugin and therefore was not overriden. Now it references to a different script and expects for that script to contain the informations it needs. However , that script was updated and no longer contains the information, so it's throwing an error. So in short what you need to do is 1) create a backup of your project and 2) just import the new astar pro and the astar pro actions. Then remove all the scripts that throw up errors :D (At least I think this should work, I'll test it tomorrow myself, but I've done some changes to the package that should allow for such a simple update).

More tutorials... good point, will likely not happen within the next 4 weeks, not even in text form, It's just too difficult while being on the road. But afterwards I really plan to pick it up on a bigger scale again. That is why I really appreciate all you people who give me their feedback here on the forums. It's what keeps me motivated :)

So yeah , hope that helped. If you have more problems or if this didn't help, feel very free to post it here .
Title: Re: A* pathfinding (stable 0v82)
Post by: Swifty on July 31, 2013, 07:51:03 AM
Thank kiriri for all your hard work. The actions are really helping me set up A*.

I have been trying to output the path form MoveTo and then use GetPathInfo to get the path length. However, MoveTo does not seem to output a Path. I am trying to put the path into an FSMObject variable of type FSMPathfinding.FSMPath.

Any ideas on what is going on here?
Title: Re: A* pathfinding (stable 0v82)
Post by: kiriri on July 31, 2013, 04:24:59 PM
the problem with the paths is that they are not immediatly created . Instead they are queried to avoid frame lagging. So if you first use a move to action and then a getPathInfo, the moveTo action will likely not have created the path yet. If you use a moveTo action and wait a frame and then use the getPathInfo though, there is a good chance it'll be done.

For cases like yours I added the createPath action. Just use that first and hook up the FINISHED event. then in the next state you can use a moveTo action (in follow path mode) and also access all the path properties, because the finished events makes sure the path is finished. I can look into more immediate path creation (actually I will, it sounds useful, even if it could slow down the fps), but right now I don't have the resources to go through aron's code and figure out how it could be done properly. I put it on my listfor v84 though :)
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 06, 2013, 04:36:10 PM

Thank you for your work on this. It is hugely helpful. I am having trouble with the follow action. If I duplicate the object doing the following, it appears to stutter. When one of the objects is deleted, all objects finish the path they had last.

Am I doing something wrong?

Allright, I don't know why this bug is happening, apparently playmaker fsms continue running until the end of a frame, even if the actual gameobject they are on is being destroyed. Anyways, I fixed it in the new release by adding an additional conditional check.

0v83 changelog:

 unify speed setting in MoveTo for all controllers (so you can change the controller without having to adjust the speed setting) [done]
- make IgnoreY also work on the Finish Distance [done]
- fix rvo controller speed issues [done]
- add rigidbodyVelocity movement mode(sets rigidbody velocity to direction)[done]
- calculate ETA action (one of the benefits a unified speed setting offers) [done]
- stuttering issue if you duplicate an actor that follows [unfixable] you need to use a pooling system.
- bug if you delete one of many actors that follow [fixed]


to upgrade from 0v82 0v83 just install the pro package on top of your current project, even if you're using the free version.
Title: Re: A* pathfinding (stable 0v83)
Post by: muppetpuppet on August 08, 2013, 05:10:49 AM
hi,

I've just gotten into playmaker and especially your A* implementation. And it worked out of the box quite rapidly.. so kudos for that. 

But what I can't seem to get to work, is simply finding nodes and walkability.

Right now, I generate a level with point node objects,
I've rigged the A*star manager to greate a pointgraph based on these tagged node objects.. This works. 

After I generate, I perform a scan, to setup all the dynamically created nodes in the graph.  This also works great

now I use a moveto/follow/transform setup to get my unit to move along the graph to the mouse pointer.. This also works great..

Seeing as this is a strategy game I need 25 units to use the pointgraph..
Do keep this doable on mobile, i've decided to not have any avoidance or walkability changes when a group of units is moving,  but when they reach their destination, I would like to set a property of the node as occupied. And thus not have that node assigned as a target for other units. 

But whatever I try, I can never use get nearest node or any other node action, The output to the FSMnode gameobject var is always null.

am I forgetting a step, do I need to store the nodes somewhere? is the scangraph action not viable in the free version?  or can't you acces dynamically created nodes in the free version?

Would be great if anyone could point me in the right direction.  Seeing as the moveto is working great, I should be able to getnearest node and such.

thanks, and here's a video of what i got working so far.(only the ground unit is using a*)
I can work around it by creating a target manager, that passes only allowed target objects to the moveto, but would still like to use a little more of the a* if possible:)

cheers and kudos for the great addon again.
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 08, 2013, 07:52:36 AM
Hey muppetpuppet, your game looks awesome! I checked the get nearestNode action on Point Graphs and it should work. Can you send me a screenshot of your action setup? I used this :
MousePick (save position as pos)
GetNearestNode (pos, save node)
GetNodeInfo(node, save walkability to walk)
BoolToString(walk to walkString)
GUI Label (walk String)

with all set to every frame it correctly returns whether the node under to mouse cursor is walkable or not.
Title: Re: A* pathfinding (stable 0v83)
Post by: muppetpuppet on August 08, 2013, 12:40:05 PM
I'll send a screen when I get back to my pc.(probably tommorow sadly:(

but perhaps its because I use the target object instead of a position, will try also.

I've just made a little target manager, that assigns a unique end-node close to the target pos, per unit.  Which works quite well for now.
Title: Re: A* pathfinding (stable 0v83)
Post by: muppetpuppet on August 09, 2013, 06:23:31 AM
here's a screen of a simple picker..  (the right state isn't active when in grabbed the shot, but I can verify that it had been activated a bunch of times during the runthrough, and it passes the same target point to the actual units for following.  Which works fine..
but as you can see the node output on the inspector is none.. (or is the output bugged, but perhaps it is set internally, seems unlikely but ok)

cheers
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 09, 2013, 06:43:44 AM
Oh, yeah, that's playmaker for you :D The FsmVariables I introduced do not contain components but actual object variables. So they are not recognized by Playmaker (eg you notice that component object variables do not show the name of the component if they are assigned, but the name of the gameObject they exist on. My variables exist independently from any gameObject so they always show as null.)
To see whether it's assigned just use a get node/path/etc info action.
Hope this works now :D
Btw, next update will finally feature a smooth movement action. Not sure if you need it in your project but I saw it as overdue. :}
Title: Re: A* pathfinding (stable 0v83)
Post by: muppetpuppet on August 09, 2013, 07:43:43 AM
Aaaah that explains, I should have just explored further down the chain so to speak.

Is there code to retreive from a node the original gameobject that was used as the original reference during the scan?

That way I can code other stuff around nodes not related to the a*, but won't have to perform a find closest or anything really slow for lots of node originals (i hope this makes sense btw.)

A smooth motion would be great, I've now created my own smooth interpolator, but anyhing integrated would be good.  I don't know if i'd use it, if its a linear smooth motion probably not.  I'm a stickler for stuff having some sort of inertia and such.

cheers and thanks for the quick respons
Title: Re: A* pathfinding (stable 0v83)
Post by: muppetpuppet on August 09, 2013, 07:52:08 AM
besides a smoothpath I'm wondering how the a* tag system works.  If its similar to regular tags, perhaps the get nearest node should have a get nearest with tag sibling.

But actually, been fooling with this only for a week now, so not completely knowledgeable about the a* system.  So perhaps i'm stating something silly or noobish
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 09, 2013, 06:30:30 PM
The smoothing system Im currently developing is not a simple linear interpolation. Instead I want  a system that hides the individual node positions by introducing a turn radius at each node that will only smooth those points which are normally an abrupt change of direction. The goal would be to preserve as much accuracy as possible, while still looking smooth.

And yes, it is possible to get the root of the pointGraph. I'll include it in the next update (which I'll probably release the day after tomorrow) with some more set and get options specifically for point graphs.

Tag system is the same 32 layer system as you'd know from the rest of unity, though implementing it seemlessly into PlayMaker could take a fair bit of time I think. I'll have to take a look at it soon, but I'll finish the pointGraph and movement stuff first I think. Though if implemented well, I think tags could be very powerful .
Title: Re: A* pathfinding (stable 0v83)
Post by: LoneCipher on August 10, 2013, 02:09:40 PM
Quote
0v83 changelog:

 unify speed setting in MoveTo for all controllers (so you can change the controller without having to adjust the speed setting) [done]
- make IgnoreY also work on the Finish Distance [done]
- fix rvo controller speed issues [done]
- add rigidbodyVelocity movement mode(sets rigidbody velocity to direction)[done]
- calculate ETA action (one of the benefits a unified speed setting offers) [done]
- stuttering issue if you duplicate an actor that follows [unfixable] you need to use a pooling system.
- bug if you delete one of many actors that follow [fixed]

The deletion issue is definitely resolved in the latest version. Thanks so much!

I set up PoolManager4 to spit out some prefabs and retested the jittery follow issue. I still see jittery movement when using follow. Am I still doing something wrong? :(

Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 10, 2013, 03:20:59 PM
Glad it helped :D
Can you send me that scene? I can't see the jigger in the video. I have a license for poolmanager already.
Otherwise I could also create a test scene myself if you can tell me when exactly the jigger occurs. Does it appear as soon as you spawn a new actor? does it appear when your follow action updates the path?
Title: Re: A* pathfinding (stable 0v83)
Post by: LoneCipher on August 10, 2013, 04:30:46 PM
I can pack up the scene for you.
In the video, you can notice that the speed of the cubes slows as each new actor is spawned. If you highlight the actor as it is moving, you notice the highlighted path of the cube flashes. I imagine that each cube is sharing the same path and all cubes are updating it each frame.
This symptom does not occur when you check the 'auto' checkbox.

1 cube = full speed
2 cubes = half speed
3 cubes = 1/3 speed
4 cubes = 1/4 speed
5 cubes = 1/5 speed
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 10, 2013, 06:26:57 PM
weird issue, yeah , quick fix : set the update interval to something like 10 . The speed seems to depend on the framerate, which is weird because I am using Time.deltaTime which should effectively make the framerate irrelevant. I'll look into this tomorrow. It is a very important issue...
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 11, 2013, 03:32:10 PM
ok, yeah, everyframe follow mode really highlights the need for some good performance optimisations. I started it but it'll be a longterm project. Try using the new movement acion in the attachments, make sure to disable the log optio in the action and also disable the log option in the A* gameObject (AstarPath component). Debug log in unity can slow things down by a lot...
Please tell me if that helped, and if yes, how much.

(you'll also have to update the custom editor, but you'll find the right directory for it easily by just searching in unity's project tab)
Title: Re: A* pathfinding (stable 0v83)
Post by: LoneCipher on August 15, 2013, 04:23:55 PM
Sry for the late response.

The updated moveto actions work perfectly. I don't notice any difference in speed at all.
Nice work! :)
Title: Re: A* pathfinding (stable 0v83)
Post by: Saputo on August 22, 2013, 02:17:27 PM
Will this work using 2D Tool Kit and Using a TileMap, Iv tried to set it up, and i only get 23 spots walkable. I have over 1k nodes.

It seems FollowTarget.cs will not work fr me, were ever I put it in my actions, it just wont load up in unity, I keep getting an Error report.

Assets/PlayMaker/Actions/Addons/AStar/FollowTarget.cs(120,64): error CS1061: Type `System.Collections.Generic.List<UnityEngine.Vector3>' does not contain a definition for `Length' and no extension method `Length' of type `System.Collections.Generic.List<UnityEngine.Vector3>' could be found (are you missing a using directive or an assembly reference?)

I get the same message if I put it in the Custom Actions Folder as well.

Saputo
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 22, 2013, 04:18:25 PM
Sure it should be rather simple. Make sure that all of your sprites have a collider on them and that the graph is always under the gameobjects, so the raycasting will work propwerly. Also make sure to turn height checking off. If none of that works, try scaning your graph after the game has started (the button for that is at the bottom of the a* gameobject inspector). If none of that works, you can always send me an example project (I own a 2dtk license ;) )
Sorry for the late update btw, I needed some time to think of the best way to create an installer for both win and mac. The next release will contain a python installer script and will combine both the pro and the free version into one package, as well as doubling as an updater (so we can avoid any complicated "remove this,move this, and add that" instructions in the future)
It'll probably take some more days though...
Title: Re: A* pathfinding (stable 0v83)
Post by: Saputo on August 22, 2013, 04:39:34 PM
sounds great, what about the TargetFollow.cs prob I'm having any ideas on that?? and all that worked just there is no collisions, not even into the tree's.
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 22, 2013, 04:56:37 PM
umm, I don't have a good memory, so I can't tell when I put a TargetFollow script in there, but it should definitely not be there anymore xD Remove it and use the MoveTo action, you should be able to set the movement type at the very top. If you can't, download the newest version of it and its' custom editor on page 13 of this thread, and remove the old ones.
Title: Re: A* pathfinding (stable 0v83)
Post by: Saputo on August 22, 2013, 05:00:32 PM
the FollowTarget was a Custom Script, but I am using the MoveTo and have it set to Follow, and my AI just PUFF gone under the World, every time he moves, which is a prob I had with Tiled for a while I had to use ONLY Controller Move X Y Z, couldn't use Simple Move, b.c it has Gravity. So I was unsure if A* would work for me b.c of this.
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 22, 2013, 05:50:23 PM
I know that character controllers have issues if they contain both a normal collider AND a character controller. Please make sure that tk2d isn't adding a boxcollider OnStart. Otherwise you could try the rigidbody velocity controller type, which also offers collisions and gravity. In case you don't need any real collisions , and don't want your character to behave like a rigidbody on collisions, you can use the transform controller type. Since it's 2d you can use the graph y position to control the "depth" of your character.
Title: Re: A* pathfinding (stable 0v83)
Post by: Saputo on August 22, 2013, 06:07:55 PM
I'll test that out in a minute, I added the AStar Move Custom Editor to the AStar Folder in Playmaker in FsmPathFinding, and i got this Error


Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/AstarMoveCustomEditor.js(3,8): BCE0021: Namespace 'HutongGames.PlayMakerEditor' not found, maybe you forgot to add an assembly reference?
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 22, 2013, 06:11:25 PM
you need to upgrade PlayMaker to the newest version, sorry, I didn't mention that before.
Title: Re: A* pathfinding (stable 0v83)
Post by: Saputo on August 22, 2013, 06:16:09 PM
it is at the newest version
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 22, 2013, 06:19:32 PM
mhm, maybe putting it in PlayMaker/actions/editor/ will fix it? Sorry, I'm not at my best right now, sleeping in a 32 dorm does that to you xD
Title: Re: A* pathfinding (stable 0v83)
Post by: Saputo on August 22, 2013, 06:25:52 PM
That did the trick, and Nor Am I, Been up for 38 hours working on the Game, trying to make up for lose of time & work. I feel dumb for not thinking to put it there lol. TY
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 22, 2013, 06:28:19 PM
glad I got you a step further then. And it makes me feel good if people have problems, it at least shows that people are using this :)
Title: Re: A* pathfinding (stable 0v83)
Post by: SteveB on August 23, 2013, 11:53:15 AM
Hey guys quick question:

What is the status of using Mecanim? I saw the work that hannibalov put into it last year, but that file doesn't compile when I import it.

Is there another way to use Mecanim in the latest and greatest version of this add-on?

I have the latest installation of everything fyi.

Thank you!

-Steve
Title: Re: A* pathfinding (stable 0v83)
Post by: Alex Chouls on August 23, 2013, 03:12:50 PM
Have you tried these:
https://hutonggames.fogbugz.com/default.asp?W1031
Title: Re: A* pathfinding (stable 0v83)
Post by: SteveB on August 23, 2013, 03:31:20 PM
Yup def have that, but I'm specifically referring to using Mecanim with the A* addon here.

It was mentioned on the first page that a 'fix' was made to allow Mecanim to play nicely, but that script is DOA when I bring it in.

Has any further work been done to get these two addons to work in concert?

Thanks Alex!
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 23, 2013, 05:54:55 PM
Can you post a list of distinct features you want? I got around to buying unity 4, but so far all my characters only use the same speed value for the animator and the astar actions. This way I can set the controller to none, use smooth look at direction and set the speed variable of the animator every frame to control the mecanim movement. I understand that this isn't taking any node cost into account, and I can add that in the next update , but apart from that I don't see any major holes. But then again, perhaps I just don't use mecanim the way its' supposed to be used :D
Title: Re: A* pathfinding (stable 0v83)
Post by: SteveB on August 23, 2013, 06:04:59 PM
Haha the only feature I was hoping for was a tiny bit of direction on to use your add-on with Mecanim! :D

From what I'm gathering you're describing, you're getting the next 'waypoint' of the A* generated path, smoothLook towards it and then fire off the movement speed to mecanim, which would essentially drive the actor in the direction of the waypoint and the waypoints after that.

That about it? If there's more to it than that maybe a brief writeup or screenshot?

Thanks for the quick reply kiriri!

-Steve

PS ...and what was it that hannibalov did to the MoveToTarget.cs on the first page? Why was it necessary then for him to modify that file if it's available in your version? I think thats where my confusion came in...that things were required to tweak your add-on to work with Mecanim...
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 23, 2013, 06:13:02 PM
that's exactly what I meant :) The next waypoint direction is available as an output at the bottom of the moveTo action (in any movement mode).
Please take into account that this plugin has now been developed for about half a year, and loads of things have changed. Back then, there was no direction output available for example, and no different movement modes (you were forced to use character controllers).
But yeah, I'll add the current speed setting. Even if  you won't use it, someone else might... For the rest just use the actions Alex was referring to.
Title: Re: A* pathfinding (stable 0v83)
Post by: SteveB on August 23, 2013, 06:34:10 PM
Awesome that sounds good and I'll go and give it a shot!

BTW (to you, Jean and Alex and pretty much everyone here) I've really been impressed with both the speed of response and helpfulness of this forum. Rock on guys and thank you. :D
Title: Re: A* pathfinding (stable 0v83, 0v84 RC1)
Post by: kiriri on August 26, 2013, 07:48:37 PM
Ok here's the RC1 for 0v84.
Changelog :
- Installer/Updater/Pro Updater script [done]
- GetNodeInfo now features a graph shortcut [done]
- Get Set Graph Info : Custom Editor and custom output for PointGraphs and GridGraphs [done]
- fix jigger/slowdown issue on follow mode and then unify the speed settings again... [done? at least better now]
- smooth turns option [done, needs perfecting for follow]
- replace all regular distance calculations with sqr dist where possible, to save performance.[done]
- Added speed output variable to the movement action [done]

Requirements : This new release requires python 3.0 or newer. Download it here :
http://www.python.org/download/

Installation :
0) Install Python, Download https://docs.google.com/file/d/0B45ng4mYiP6Zb3k2RWNZZzVNY0E/edit?usp=sharing
1) Extract, then put the "AstarPlayMakerInstaller" folder inside your Assets folder of your project.
2) double click on the Setup.py file to execute it.
3) Answer the few settings that come up. The setup can setup the free version of Aron's Astar for you, or you can install the pro (or free) version prior to the setup(no need for you to make it js compatible anymore, as the installer can handle that too, though doing so manually will cause no problems). Either way, it will detect your version and install the necessary components in both cases automatically. You can even install PlayMaker after installing this, though unity will prompt some errors until you do install it.
4) done :)

Current issues :
-Test scenes are broken :( Dunno what to say... this may likely be a longterm problem, though I'm doing my best here.
-Not tested on Mac yet, might not work. If any of you use a mac and know how to use python, please help me out here, its my first ever python experience :D
-Installation directory remains due to certain access restrictions. I tried automatically moving the script outside of the folder and to then delete it, but it didn't work... Again, real python users may be able to help here :)

Please tell me what you think. Tell me if it doesn't work. Heck, tell me if it does work :D
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on August 27, 2013, 04:51:50 PM
RC2
- Updater now succesfully removes the old movement editor file and installs the new one. No warning should appear now.
- Editor now hides the rotation stuff if no smooth turns is selected.

https://docs.google.com/file/d/0B45ng4mYiP6ZQ0hJbVYzNDdhNkU/edit?usp=sharing
Title: Re: A* pathfinding (stable 0v83)
Post by: mweyna on September 01, 2013, 11:02:33 PM
So after updating to the newest Playmaker, A*, I'm getting the following error -

Assets/Plugins/FsmPathfindingWrappers/FsmPathfindingBase.cs(2,7): error CS0246: The type or namespace name `Pathfinding' could not be found. Are you missing a using directive or an assembly reference?

Looking through my project, can't find any conflicting names or anything to cause this. Any ideas?
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on September 02, 2013, 05:40:17 AM
First of all, thank you for reporting this :)

It seems that the script can't find your installation of Aron's pathfinding  package. Did you install it before the update or with the installer ?
Also, did the installer give you a finish message or did it just close without anything? Because that would mean it encountered an error somewhere (I still need to implement messages for errors).

Incase your using Astar free, I uploaded a new package which will give you the option to override your current Astar installation. It should tell you that it has detected a version of Astar, and then if you press Y + enter after the prompt it should override it. If that still doesn't work, can you send me the project?

https://docs.google.com/file/d/0B45ng4mYiP6ZaW5kZ1YtWWtZVTg/edit?usp=sharing
Title: Re: A* pathfinding (stable 0v83)
Post by: mweyna on September 02, 2013, 12:34:55 PM
That seems to have done the trick. I was using A* free, and I did have it installed before the update (just was updating my scene to the latest version of everything). Everything works now. Thanks!
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on September 02, 2013, 03:49:10 PM
perfect, btw, are you using mac? I need for a mac user to confirm that this works. I know that mac and windows use different ways of storing their paths, and although I already used absolute paths everywhere, I'm still not sure if my paths make sense to mac os, since I use strings as a representation for the actual pointers (any non coder doesn't have to understand the last part :D ).
So yeah, a thumbs up from a mac user is all that this version still needs.
Title: Re: A* pathfinding (stable 0v83)
Post by: mweyna on September 06, 2013, 02:43:48 AM
Nope, PC. Sorry. Although I did notice that the "Smooth Turns" option in the MoveTo action seems to crash my scene too.
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on September 06, 2013, 04:37:10 AM
Although I did notice that the "Smooth Turns" option in the MoveTo action seems to crash my scene too.

oh that is very interesting to hear! Can you send me your scene/ a test scene? (Or else a screenshot might help too)
Smooth turns is one of the more interesting/original concepts I integrated into this package, so I really would like for it to work out well.
Title: Re: A* pathfinding (stable 0v83)
Post by: mweyna on September 10, 2013, 04:52:22 AM
So after updating to A*Pro (Thank you Daily Deal!) the smooth path no longer seems to be causing a crash immediately upon selection. However, I'm still not having much success generating the results I want. In my scene, I have my NPC set up to create a path to a grey cube and then navigate the world to it (see scene shot) -
(http://s23.postimg.org/x2z9e0q97/Image_01.jpg)

However, at runtime, the path is created successfully, but the NPC does not move or translate across the scene in any fashion. Instead the action immediately FAILS to my confusion.
(http://s22.postimg.org/mkfcj44gx/Image_02.jpg)

Any thoughts as to why?
Title: Re: A* pathfinding (stable 0v83)
Post by: kiriri on September 10, 2013, 10:38:18 AM
Ok, let's see. Set "log events" to true to get some feedback in the console. There are several reasons to why a failed event is sent:
1) "Astar Follow Path failed. The path is null" is sent when your path variable does not exist. This is only sent if you didn't plug one in.
2) "Astar Follow Path failed. The path contains no nodes" is sent when the path doesn't contain any waypoints, eg if you have an action that calculates the path and then put your movement action right under it. In that case the path is still being calculated by the first action. In this case you should use the finish event of the Create Path action.
3) "Astar Move To failed. The actor is null" is being sent when the gameObject you want to move along the path is non-existant.
4) "Astar Move To failed. The controller was removed" is obvious :D . Do not remove the controller while the actor still moves.
5) "The final node is too far away from the target position" is supposed to be sent when the distance between the final node and the target position is larger than failureTolerance. Due to some unknown reason, this check disappeared though... I just reintegrated it :D

So yeah, seeing the debug message would help a lot to nail this problem down :)
Title: Re: A* pathfinding (stable 0v83)
Post by: mweyna on September 18, 2013, 01:59:35 AM
#2 solved that. By seperating out my Calculate Path to an action earlier it definitely works now. Those subtle delays of Playmaker have definitely been an interesting curveball many a time.
Title: Re: A* pathfinding (stable 0v84)
Post by: kiriri on September 18, 2013, 10:10:40 AM
glad it works now :) Though this is none of PlayMaker's faults ;) The astar plugin calculates all of the paths etc at the end of the frame together, that way it saves an incredible amount of performance. It really is the best way to do this I think, it's just that I haven't gotten around to finishing the tutorial I wanted to do for like forever now , so how should you have known that  :D

I'll release the 0v84 now, I did some bugfixes and it should work better than it did before, but I didn't take notes so I forgot what exactly I did :D Since there's apparently no mac users, I'll just ignore the mac support question until someone complains here :D

Please note that I updated the setup video. I also plan to update vid nr. 3 and continue the series. But don't take my word on the "continue" part :P

https://docs.google.com/file/d/0B45ng4mYiP6ZN3JlMFpNeXAxRXc/edit?usp=sharing


Release notes :
- Installer/Updater/Pro Updater script [done]
- GetNodeInfo now features a graph shortcut [done]
- Get Set Graph Info : Custom Editor and custom output for PointGraphs and GridGraphs [done]
- fix jigger/slowdown issue on follow mode and then unify the speed settings again... [done? at least better now]
- smooth turns option [done, needs perfecting for follow]
- replace all regular distance calculations with sqr dist where possible, to save performance.[done]
- Added speed output variable to the movement action [done]
- Absolute Endnode now takes IgnoreY into regard [done]
- Absolute Endnode now works without a target GameObject [done]
- fixed errors that made the action finish before even really starting (not clearing the previous path) [done]
- fixed WalkabilityInArea... this broke sometime, dunno when :S [done]
- added flee, fleeContinuously and random mode to the movement action (these are much faster than the normal movement actions if you're using pro. On free, they are the same as the normal movement, because I didn't want to undermine aron's pro package and I therefore didn't even try to create something more fancy. Still, this should be useful even for free users :) )[done]
- add "shadow" movement mode. This will be a very cheap way to follow a target. It will only calculate the path to the target once, and then add the current target position as a waypoint every frame, if it moved.
Title: Re: A* pathfinding (stable 0v83)
Post by: muppetpuppet on September 20, 2013, 06:50:18 AM
Hi i'm trying out the 84 build..  Noticed a few minor issues..

Most importantly, my pathfinder object using a moveto (or shadow when I tried it out)  Is beelining for 0,0,0  once arrived it will actually start to properly pathfind.   

As i'm spawning at different locations, I now get all my units needing to touch 0,0,0 before returning to the actual target position .  At first I.  thought I placed my pathfinding game-object wrong,  but it actually starts at its spawnlocation, smoothly straightline moves to 0,0,0 and after that does its thing correctly. (but not before starting a premature all out war between my units:)

My guess would be that the smooth motion start or target position vector3 is set to 0,0,0 and not to the current position of the game object, and its interpolating to 0,0,0 first.  Dunno just a guess, I'll look at your code a bit, see if its something i'm doing wrong, or something like that. (always mistrust yourself first;)

And minor issues:
1. You manually to remove the old version folder(install created a backup version folder I guess), or duplicate script error
2.There's some 1 and 2 debug logs in moveto.js , causing a lot of framedrops when doint a lot of moveto's  .

For the rest it seems to run smoothly enough,  but with the startup behaviour flipping out, I haven't been able to play around with the smooth turns feature (dying to try it out, its a rout to deleting a big chunk of my crappy code). 

anyways , thanks for updating and iterating, its really appreciated. 
Tomas
Title: Re: A* pathfinding (stable 0v83)
Post by: muppetpuppet on September 20, 2013, 07:04:35 AM
On a second look, I think i've scripted my units wrongly,  I looped the moveto back to itself after a failed or finished event, to create a continues follow.  But, that causes them to haywire and head for 0,0,0 at the start.

Gonna see if I can try and script a bit more properly.. and if that  fixes it..
-------------------------------

Aah yes just removed any finished or failed events, and that seems to have fixed it..  Using shadow still just causes my units to sometimes still beeline to their target, its sort of weird. 
Title: Re: A* pathfinding (stable 0v831)
Post by: kiriri on September 20, 2013, 07:26:47 AM
Thank you for your feedback, I value it a lot.
I agree that immediate looping back during the update phase of an action might potentially lead the actor to walk to the world origin. I cannot think of a fix for this though. It's generally for the best to never wire up the failed event with the same state again as right now failing really means somethings wrong with your graph or your action setup.

Well then, as for the debug logs, my bad, I'm still working on the follow mode which sometimes stutters if the next waypoint distance is less than the sqrt or the node distance * 2. I now removed the debug logs which were really only for my benefit.

I also noted that the current speed output was not available, I fixed this.

I don't quite understand your point about the setup though. I manually remove old files because I do not want to override additional scripts you might put in there. Then if you press any button at the end of the setup, it should remove the installer folder, so there shouldn't be any duplicate scripts there anymore. It's just the installation folder (with no scripts inside) that I can't delete.

The shadow beeline thingy is quite severe though... Can you have a look at the path? Does the path at least look fine or does it too go straight to the target? The shadow action should only add the current position of the target as a waypoint at the end of the path, every kind of movement along that path should work in exactly the same way moveTo of followPath does.

0v83.1
https://docs.google.com/file/d/0BwrgibYeepavZ0o0ZmNpWE9lRTg/edit?usp=sharing
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on September 20, 2013, 08:54:53 AM
Hmmm I had a FSMpathfinding subfolder in the version folder after finishing the install.  Could be just something i did wrong.. The original install folder also was still there,,  but I use dropbox , so it could have been claiming the files, forbidding deletion.

I've attached a jpg of some units with the shadow setting,, same unit-script  follow the path correctly with follow,  As you can see the path itself is straight, but somehow  all the paths only have two points.  (that could also be the problem I guess.)
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on September 20, 2013, 09:05:07 AM
If dropbox is claiming the files then there's very little I can do... I hadn't expected this, I should be able to catch that error message and print a message like "Folder deletion forbidden, please remove the installation folder manually" in the setup though, that should at least warn people ;)

Thank you for the shadow thingy, I know what's happening, I just don't know why it's that way : Your path is not getting calculated. What your seeing is just the "shadow" mechanism which always adds the target position as a new node if the last waypoint on the path is more than a certain distance away from the target position.

This is probably due to your path calculation taking more than 1 frame, I had a similar problem a while back with the follow action. I should have a solution this evenin I think.
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on September 20, 2013, 09:07:33 AM
cool,  the units targets are updated only every few seconds or so,  so a shadow so  should improve performance a bit,, (already running at 70 fps avg on nexus 7 II though, but faster is always better)
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on September 20, 2013, 09:27:34 AM
Perhaps you could also tell me what is happening with the smooth turn, if I turn it on (with the follow)  I get the following error:

Code: [Select]
ArgumentOutOfRangeException: Argument is out of range.
Parameter name: index
System.Collections.Generic.List`1[UnityEngine.Vector3].get_Item (Int32 index) (at /Applications/buildAgent/work/b59ae78cff80e584/mcs/class/corlib/System.Collections.Generic/List.cs:633)
MoveTo.OnUpdate () (at Assets/PlayMaker/Actions/Addons/AStar/FsmPathfinding/moveTo.js:564)
HutongGames.PlayMaker.FsmState.OnUpdate ()
HutongGames.PlayMaker.Fsm.UpdateState (HutongGames.PlayMaker.FsmState state)
HutongGames.PlayMaker.Fsm.Update ()
PlayMakerFSM.Update ()
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on September 20, 2013, 09:37:18 AM
Hmm, that seems to be my fault as well, it means that the waypoint your actor is walking towards does not exist (eg there are 12 waypoints in your path and you're aiming for waypoint 13 :D )

Can you tell me your next waypoint mode and movement mode ? That will make it easier to see where I forgot to clamp the currentWaypoint variable.

Oh and sorry for the abundance of errors, There's so many combinations of properties and modes that by now I find it very hard to test it properly, and since I didn't get any replies on my RCs I thought it would all work :D
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on September 20, 2013, 03:52:02 PM
Hi, took a bit..

here's a screenshot of my settings.

hope it helps..
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on September 21, 2013, 06:11:43 AM
I'm trying my best here but I can't seem to reproduce your errors. I copied your setup to the numbers and I made sure to check it on a pointgraph because I thought that might perhaps cause it (you know, if the initialisation of the point graphs could have happened after the movement actions start) , but it all seems to work just fine...

Have you tried having your actors wait before calculating their first path? Do they also beeline if you restart the FSM (disable, then reenable the fsm component) during runtime?

If none of that works, it would be nice if you could send me an example scene. Anything that creates an involuntary beeline would suffice :)
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on September 21, 2013, 06:18:01 AM
Let me try out some things, I've got some additional weirdness like units hopping to their destination, right after enabling the FSM  containing the fsm..  So i'm thinking its something in my code or A* init. (which happens a looong time before the units are spawned).. I've played around with the A* settings, maybe i've broken somethings;)
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on September 21, 2013, 12:07:48 PM
I think i've found out what i'm doing wrong, I start the state with an immediate target.  I've changed it so the pathfinding always has the same follow target, and I move that target around from only after 1 frame of pathfinding has concluded.. This stops all my startup bugs..  But still can't use shadow or smooth turns..

Could it be something in the A* heursitic settings?
Title: Re: A* pathfinding (stable 0v841)
Post by: Yanifska on September 27, 2013, 10:44:38 PM
Hi Kiriri,
I am just discovering Playmaker and A* so I wanted to give a try to your actions.
I have been through the whole thread tonight and I am amazed with the energy you invested in this projected.
I would love to implement you actions in my project but I can't nail  it properly.
First of all I regret the lack of proper documentation as I don't really understand the difference between many move modes ( follow and follow to for example) and many many great actions you have made.

My main concern is that it seems that the failed event seems to be broken, as it never fires.
Maybe my setup is not right, I don't know.
I have some kind of click and point control and if I click on an unreachable area the character will reach the closest point and start to jitter instead of failing.
There are some other time that stuter happends in the movement.

Also the smooth turns seems to crash unity when running the game.
I tried a setup with a create path state then a smooth path sate and then move to / follow to but it seemed to have a lot of bug as well.

I'd love to help but I am not so much of a coder, maybe I can help with the documentation ?
I hope you can find a fix for these or maybe it's just me who missed something.

Any way, Cheers !!

Title: Re: A* pathfinding (stable 0v841)
Post by: Yanifska on September 27, 2013, 10:59:48 PM
After playing again with the perfect finish option it seems to stop the jitter but then the pathfinding is not so good, he wont reach the other side of the obstacle for example.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on September 29, 2013, 04:30:44 AM
I'm sorry for not replying to you guys earlier, I just went apartment hunting in Munich and my camping site surprisingly didn't have any internet.

@Muppetpuppet
I think there's little I can do without a test scene. I have no idea why your actors are behaving the way they are. If it is too difficult to create a test scene from your project, you could also send me an NDA and then I could have a look directly at your project.

@Yanifska
You're the second person who says that unity crashes on smooth turn. I will need to investigate this asap.
For now the failed event is only called if you did something wrong in the action setup (eg if you follow a path that does not exist). I reimplemented the failed event as an event that is sent when the final node position is further than the failed distance away from your target position, but apparently I forgot to add this to the latest release. In such an event it would not even start to move the actor, though having an option to move the actor to the closest valid node and to then send the failed event sounds quite useful.
As for follow vs followTo : Follow will stop moving once it's within finish distance of the target, but it will continue following the target once that target has moved away again. FollowTo will send a finished event once it's within finish distance of the target.

Perfect finish will add the target position as a last waypoint to the path. This means no matter where the real calculated path ends, it will always beeline from the last node on the path directly to the target. It is useful if your target is an empty that might be "between" some nodes.
The reason why your actor is jittering without the Perfect Finish mode is because you are most likely using an Absolute Finish Distance Mode . This means, it will only finish the movement action if the distance between the center of your actor and the center of your target is less than the FinishDistance. This is never true, because the distance between the last node on your path and the target is bigger than your FinishDistance. This is why absolute should probably only be used with high FinishDistance settings, eg when you have an archer that has a long range attack, and you're making him attack something, then you first need to move to the target position, but if he's maybe on a mountain ridge he would not have to move all the way down to shoot his arrow if the target is somewhere below him. In this case an absolute finish distance check is what you need.


Ok, so let me list all the problems for the recent version up, so I can work on fixing them:
-
- Smooth Turns somehow crashes
- FailedEvent still not dependent on FailedDistance
- LateFailedDistanceCheck option (to first move to the closest node, then do the failed distance check)
- Fast actors on dense graphs cause errors (This is something that I personally need to fix, though it might take a lot of effort)
- Shadow problems (beelines)

I also think it might be for the best to implement a "simple" and "advanced" mode, where the simple mode could hide and auto-set some options to make it easier to create a working/non-stuttering action for people who just started using this.


Bugfixes I've made so far (just a list for me :D) :
- Time.frameCount <= 1 in the path creation and the OnUpdate function to produce valid paths even if the user spawns the actor before the graphs are initialized.
- added debug log message to check your real start and end path position (regarding the beeline issue, it seems that's because the target position is equal to the actor position at the time when the action first starts)
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on September 30, 2013, 03:50:46 AM
No worries,  I'll just share my project on drop-box,, Just as its my first playmaker project, it might be a bit noobish ;).

Ill PM you
Title: Re: A* pathfinding (stable 0v841)
Post by: Yanifska on September 30, 2013, 02:55:16 PM
Sven,

thank you so much for this great post !!
I need to take time to dig more in the options and I hope you can make a update soon.
I am not sure that a "noob mode" is really necessary, but it may help.
What we really need is a well written documentation...for the least
It seems that this is the only pathfinding package available for Playmaker on Unity Indie so I believe this is a really important work you have begun.

Yaniv
Title: Re: A* pathfinding (stable 0v841)
Post by: Yanifska on October 04, 2013, 06:41:50 AM
Hi Sven,

I found something else that bothers me :
it seems the MoveTo action never finishes at all even when it does reach the destination.
Is it a bug or do I need to change my setup ?
-Yaniv
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 04, 2013, 06:55:43 AM
the never stopping thing can have a number of reasons. And this is one of the things that really needs documentation :D So let's start a FAQ and save it in the second post of this thread.


1# My MoveTo action never finishes, even when the actor already reached the end of the path. What can I do?
Good question! There may be a number of reasons for this. The least obvious is the usage of the "absolute" FinishDistanceMode, combined with a low FinishDistance. In this case your actor walks towards the last node on the path, but even then the absolute distance between him and the target can still be higher than the FinishDistance (eg if you have a Gridgraph and your target is right in the centre of one of those "gridsquares".) In this case you can either :

1) Up your FinishDistance
2) Enable the ExactFinish option which adds your target's center as a last node to the path
3) Change the FinishDistanceMode to something like Last or AbsoluteLast, which  checks the distance between the actor and the last node on the path instead of the distance between the actor and the target.

You should always note that sometimes your target might be underground. In this case you should make sure to check the IgnoreY option, which will also ignore any y coordinates in the FinishDistance modes.



Hope this helps :)
Title: Re: A* pathfinding (stable 0v841)
Post by: LoneCipher on October 07, 2013, 03:42:55 PM
Loving this pathfinding solution. This works amazingly well.

I have a performance question for a click to walk setup:
I have a pointgraph set up around doors and openings
clicking the ground creates 2 nodes. one at the player's position, and one at the destination
The graph is scanned.
If the 2 new nodes are linked up, you will walk in a straight line to the destination.
If the 2 nodes cannot link up, they are already added to the pointgraph (during the scan) and the best route is taken

because of all the graph scanning each click, you can tank your fps if you spam-click.

Is there a way to see if there is a direct connection between the 2 nodes without scanning?
Title: Re: A* pathfinding (stable 0v841)
Post by: LoneCipher on October 07, 2013, 03:57:06 PM
Also, is there a way to create a path from a spesific graph?
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 07, 2013, 04:30:46 PM
To see if there is a direct path between 2 nodes you would require something along the lines of a "planecast" (2D raycast) , which Unity unfortunately does not provide. You could emulate such a behaviour with a box collider rigidbody though. I think there is a function called rigidbody sweep that should make it possible to get whether the rigidbody collides with something (without having to wait for the next frame).

As for restricting path calculation to one graph only, it is possible via node tags, but I have yet to implement this into the action.
If you wan to do it, then make sure you set the Path.walkabilityMask of the path right after the path is created and before it is being calculated. I don't know when I'll be able to implement it myself, it may take me as long as the weekend to finally find some time to spend on this project again, sorry.

Anyways, I'm really glad about your positive feedback :)
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 09, 2013, 04:06:56 AM
Since I know that this will be a big issue once Unity 4.3 is released, let me clarify some things. Right now, neither my plugin nor Aron Granberg's is ready for the 2D mode. Unity always had this oddity in that the y axis defined height (all other game engines use the z axis for height) . So it was a real surprise for me that they now chose to use the x and y axis for their 2D mode. This means ignore y won't work and I'll likely have to add another ignore z mode. I think they did it this way to allow people to reuse physics plugins , but still it's annoying :D. On top of that a GridGraph behaves weirdly when rotated.

So what you could do to make this work already is use pointGraphs and use a calculate path coupled with a translate path and a move to. On the pointGraph you would have to calculate the walkability of each node yourself, which you can easily do with a raycast on each node.

And yes, I know this is horrible :D Perhaps I'll find some time on the weekend to ask Aron on his plans and to write that ignoreZ option.
Title: Re: A* pathfinding (stable 0v841)
Post by: LoneCipher on October 11, 2013, 05:31:50 PM
Is there a way to have an ai use a specific graph?
Lets say i want one to use a point graph and the other to use a grid graph.
i see that there is an action for "get graph in graphs" but i have no idea how to use it. :(
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 17, 2013, 06:14:18 AM
Not that I know of. I might be wrong though. However, you can specify certain Tags for the path. So you can just tag your one graph as "big" and the other as "small". At least in theory you can. In practice, I still didn't get around to write a custom editor to handle tag masks, so it's not yet possible to do with my actions. It's a tad tricky so I won't promise anything, but I might find the time for it this weekend.

I just started university now so the pace of updates will unfortunately decrease a lot from now on. Sorry if this causes any inconveniences.
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on October 17, 2013, 11:08:01 AM
What is the easiest way to have my object face forward while navigating a path? I've tried using all the look at variations however they all basically fail to rotate the object to face it's current target on the node.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 17, 2013, 11:23:30 AM
Is smooth look at direction not working for you? You can use the direction value the moveTo action returns.
Title: Re: A* pathfinding (stable 0v841)
Post by: LoneCipher on October 17, 2013, 12:16:56 PM
Quote
I just started university now so the pace of updates will unfortunately decrease a lot from now on. Sorry if this causes any inconveniences.

This is all charity work so you don't need to apologize.
Thank you for all the hard work you have done so far :)
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on October 17, 2013, 12:27:47 PM
Smooth Look At Direction doesn't seem to be working for me, unless I've set this up wrong. Here is my setup -

(http://s8.postimg.org/j2ugpu0yt/Wander.jpg)

What basically happens currently is the unit (those little guys on the far left of the screen stay in that orientation you currently see, regardless of where they are moving to. The path is being created successfully, however the guys just aren't using their X forward to face it.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 17, 2013, 12:38:37 PM
ok, so what you need to do is you first of all need to move the Look at action below the move to action. Otherwise the direction is set to 0 on the first frame because it has not yet been calculated by the move to action at that point.

Then you need to create a new Vector3 variable. Let's call it Direction. Now have a look at the MoveTo action. At the bottom of that action, under Outputs, there should be a direction value. Click on the small icon right next to it to plug in your Direction variable. Now it will save the value of your current direction to that Variable, every frame, for as long as the moveTo action runs.

Now plug the direction variable in the Target Direction slot on the SmoothLookAtDirection action (again, press the small icon that looks like three horizontal bars to make it possible to choose a variable for this field).
In this case your Direction variable is used as an input.

Does it work now?

@LoneCypher
Thanks for understanding :)
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on October 18, 2013, 02:28:40 AM
That works perfectly now. I feel like an idiot, i've been trying to solve this for weeks!
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 24, 2013, 11:51:23 AM
Hey,

I am just looking at making a quick prototype with playmaker and the A* pathfinder. I have the pro version of the A* pathfinder and have imported it, and the latest version of playmaker, yet when I run the setup python file it tells me that the A* files are not there and asks if I want to install them, if I say no and go through the rest then everything seems to work ok, but then if I try to create a Recast Graph the path finder blows up when trying to draw the materials and setting passes for the shaders.

On the site (http://arongranberg.com/vanillaforums/discussion/381/error-cannot-build-recast-graph) it seems that the solution is to remove it and add it back in, but as this script moves it all around I am not sure if this is going to stop me from using the recast bit.

Is there no way of just manually installing the actions for the pathfinder as all Playmaker looks for is the classes with attributes indicating they are actions right? or is there some reason that the A* project has to get moved around etc?
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 24, 2013, 12:28:38 PM
there is a way to install it manually, but it is rather complex. Since it didn't recognize the A* plugin it means that this check :

Code: [Select]
if not(os.path.exists(papath + "/AstarPathfindingEditor") or os.path.exists(papath + "/Plugins/AstarPathfindingProject")(papath is the assets folder path)

...does not work on any of the newer versions anymore. I can't test it because my internet connection breaks down every few seconds and it cancels the download :S
Now, if the rest still works, then what you can do is delete the A* folder, reinstall the astar package, then run the installer again. It will move your stuff and even override if needed.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 24, 2013, 12:53:25 PM
No worries, you have done enough by making the plugin :)

Is there any technical reason why the folder structures have to move around?

As if I just bung in the actions and the wrappers manually to a folder like "AStarPlaymakerActions" (as that's all I can see that you *need*) it complains that it cannot find some namespaces, but I presume there is a way to locate the dependency?
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 24, 2013, 01:11:33 PM
When I started writing the plugin (which was quite some time ago), I was still in the process of learning .NET and Unity in general. While trying to make paths etc work inside PlayMaker I stumbled across a problem that was automatically fixed by using javascript instead of c#. So I switched to js. However, unity compiles the scripts in a very particular order.  Since this plugin needs many features from the original A* package, those scripts that contain these features need to be compiled before the scripts in this plugin are compiled, otherwise the compiler will not understand what for example a Path is.
For this reason the Astar package needs to be in the Plugin Folder, which will force-compile it before anything else. And that's what the installer does. The only fix for this is to convert the js scripts to c#, which considering how many scripts there are can take quite a bit of time. That is the reason why I never got motivated to doing it :|
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 24, 2013, 02:22:45 PM
Is it just the FsmPathfinding folder that would need converting?
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 24, 2013, 03:22:49 PM
I believe so. I don't remember whether the dummy scripts for the free version were in js or cs, but they're so simple, it's only a matter of seconds to convert them anyways.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 24, 2013, 03:38:47 PM
I wouldn't say seconds... but shouldn't be a difficult task just mundane.

If I convert them over would you be able to test them? as I haven't got it working my side so although it may compile I wouldn't know if it was working as desired.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 24, 2013, 04:05:53 PM
sure, but please don't underestimate the task ;) It would definitely be an important step forwards though :)
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 24, 2013, 04:31:43 PM
I am about half way through, but I dislike monodevelop, my resharper licence ran out for VS2013 so will try to port over first then maybe refactor if it works, as there are a load of variable names which are not descriptive and static methods which could just be ported to extension methods to clean up the code base.

Would you be open to putting the project on github or something? then that way other people can contribute to it save you having to be the sole updater.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 26, 2013, 04:56:43 AM
Got a few issues with ComplexPointGraphFromChildren, but I think all files are converted, just need to work through the issues, but wont be online much this weekend so hopefully have it done soon.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 27, 2013, 01:30:25 PM
Right I have mapped it all over, its very dirty but compiles. There were a few bits of logic which seemed redundant... like it was setting a node and returning void, however in the JS version that was being captured as if it was returning the grid, so just made subsequent calls to get the grid. There were some other changes too but if you can give it a whirl and make sure it works or possibly fix the bits which are not 100%, then I will refactor and clean it up as ideally the enums and namespaces and variable names need tidying up.

I have attached an export to the post.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 27, 2013, 01:36:04 PM
awesome, I'll test it asap, sorry for not replying on the weekend, I tried to find some time to get the git repo working, but it just wouldn't work and I couldn't really delve into the matter.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 27, 2013, 01:40:57 PM
If you have set up github/bitbucket etc account then let me know the URL and I will branch and push up the latest version so you can merge it in if that helps.

If you haven't had time to set that bit up I can always set it up on my github account and then transfer ownership to you once you have time to sort it out?
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 27, 2013, 02:03:15 PM
That sounds excellent. You're bringing new Energy into this project :)
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 27, 2013, 02:38:46 PM
No worries, glad I can help.

Have set up a project here:
https://github.com/grofit/playmaker-astar-actions

I would like to be able to make the project have some working examples etc, however as playmaker does not have a free version I have just put in the raw files, so the project will complain as its dependencies are not there, but the export should work in any project that has playmaker and a* pathfinder in.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on October 28, 2013, 05:07:59 AM
examples don't work because the AstarPath component and therefore all graph settings are lost on export. My idea for the future was to put both the Assets/... data and the Library/... data as they are into the installer. Then the installer could put everything in its' right place and no data should be lost. I never got around to testing this though.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 28, 2013, 11:44:52 AM
The c# conversion is just the raw actions and wrappers, it doesn't have any of the other dependencies, as its assumed you already have these in your project like the other playmaker actions.

So it shouldn't really matter where you put them as its no longer file system specific, they are just extracted via the attributes.

So you *should* be able to get a fresh project with playmaker and a* pathfinder, then import the unity package, and then should work. Well when I say work, it should at least compile.

Let me know once you (or anyone who knows the functionality of the actions) have managed to give it a test as I am keen to continue with my project (the one which spawned me looking here) and ideally want the A* playmaker logic, but cannot move the A* pathfinding folder or the pro features stop working.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on October 29, 2013, 05:03:38 PM
I have updated the project (on github) so it now contains your example projects as well as the A* Pathfinder project, although you would have to import playmaker as we cannot package that.

It all compiles but certain scripts were missing from your example objects, like moveTo could not be found in its old place, so I have tried remapping them but dont have a clue what settings each script should have etc. So if you can clone the github repo, import playmaker and run the examples (I was just using the tower defense) and make sure the playmaker scripts are all set correctly etc, then let me know if you get any errors?

At least this way all you need to do is check out the code, and just match up missing scripts in your examples and see if it works.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 01, 2013, 10:16:49 AM
Any progress?

As much as I would love to continue to make changes and optimise certain parts I don't want to do any more on it until I know it is as functional as the previous one was (as far as examples go anyway).

As I would say in my day job, this is a blocker for me :(
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on November 01, 2013, 01:23:51 PM
I couldn't start it before (unity just wouldn't load the project, the Unity.exe process just stopped without any kind of warning or error message :S ) So now I created an empty project and pasted the stuff inside, and now it works. So far I've only noticed that you had dismissed the default values for the moveTo action. However, those for the finishDistance etc are very important for newcomers. A year ago when this started I also just used 0 for all settings as a default and people complained :D Apart from that it seems to work fine though. I'll try to push my changes this evening, never really worked with git though, so it might not work :D

Edit: It won't move, but I might just have made some mistakes myself, I'm looking into it :)
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on November 01, 2013, 01:34:05 PM
ok, I'll just put my changelogs here :
- Added default values for moveTo properties;{moveTo}
- Added the override keyword to the actions, without it they won't start;{moveTo,addNodeConnection,ComplexPointGraphFromChildren,createNodes,createPathTo,duplicatePath,getAStarPathInfo,getClosestPointOnPath,getGraphInfo,getGraphInGraphs,getNearestNode,getNodeFromNodes,getNodeInfo,getPathInfo,nodeContainsConnection,PointGraphFromChildren,recyclePath,setAStarPathInfo,setGraphInfo,setNodeInfo,setPathInfo,smoothPath,translatePath}
- Changed the name of the Path-Parameter in OnPathComplete to path1 so it won't locally replace the private variable "path", and cause it to be inaccessible anywhere outside of the OnPathComplete function; {moveTo}

With these changes the moveTo action now works.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on November 01, 2013, 02:44:34 PM
ok, I commited it, and I think I pushed it but I'm not sure. If I didn't send a push request then I don't understand how you would do it with the github program...
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 01, 2013, 04:47:52 PM
No worries will go take a look, thanks for helping out will come back if I have any queries.

Just for future reference (and apologise if you already know this) but with git you have 2 levels of commital, local and remote. So you can commit locally (known as committing) as much as you want without the remote/origin knowing of your changes, then once you are ready to put your changes up you do a push which takes all the changes you have done since your last pull and sends them up to the server. I tend to use TortoiseGit as the command line git commands annoy the hell out of me. As for Github it just is a fancy web front end on the git repository.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 01, 2013, 04:57:32 PM
Cannot see any commits or anything. You have 2 options available.

1) This is the one to do if you want to do a bit of learning.

Then it should notify me that there is a change to be merged in, so I can merge it into the main project.

You can find out more here:
https://help.github.com/articles/using-pull-requests

2) This one is if you dont really want to learn git. Just zip up the project and put it on here or email it to me (grofit1@yahoo.com)
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on November 01, 2013, 07:50:49 PM
this is the reason why I never used git before... I just can't make it work. I got as far as committing it succesfully and seeing my commited changes etc, but when I want to push it it either can't find the server (in https) or it says I have insufficient permissions (ssh). It's enfuriating how I never seem to get the hang of it :S . Well anyways, I put the changes in the zip file. Just extract it in the FsmPathfinding folder and override the scripts there.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 02, 2013, 03:37:30 AM
Thanks, have updated it.

In github (and most other project git hosts, but not git itself) you cannot push directly to the main project, you can only push to your fork of it, then request it be merged into mine. Otherwise anyone could just come along and push all manner of broken guff into it. That being said I can see your fork of it, just no pushes into it, with github even if you dont have your SSH set up correctly you can normally still push but it will request your username and password when you do it, anyway if you do want to try to diagnose the issue you have with git send me a pm and we can discuss in there. (I am only pushing for your git access so if you want to take ownership of the project ideally you would need to be able to manage its commits etc).
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 03, 2013, 07:23:33 AM
Hey,

Just tried pulling all changes and running them but none of the examples work for me, still got lots of missing mono scripts on components etc. I am going through and doing a load of refactoring now that I have resharper installed again.

I applied your fixes from your upload but they were only for the actions part not for the examples. Also I just remembered when you said the project wouldnt run for you when you checked it out, did you import playmaker to the default locations etc? as playmaker isnt packaged and wont run without it.

Do you want me to raise future issues as an issue on the github project or continue to put it in here?
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on November 03, 2013, 07:35:51 AM
I prefer working via the forums. The examples were always broken, it's some weird library thing, I'm not sure if it'll work if I fix them, but I'll try it tomorrow anyways, it shouldn't be too much work.

Btw, would it be possible to give me full git rights while still retaining yours? Like, I would like to push to the real repo directly without having to go through all this fuss about pull requests etc, but I imagine it would be for the better if you could still manage it because I don't really have any clue whatsoever about what I would have to do as owner of the repo :D

EDIT : Oh and changing the classnames is a very good idea, it always enfuriated me when I tried to reference a type and only later when I compiled the script I find out that for some reason it didn't start with a capital letter :( As for the Mohogony() and DoStuff() functions... yeah that's me alright :D
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 03, 2013, 08:25:11 AM
lol I am going through renaming Mohogany/DoStuff to things like CalculateNearestNode etc so it will be a bit easier for others to pick up and run with.

If you want me to retain the general management of the general git stuff for the moment I can see if I can add you as a collaborator so you should be able to push directly without forking.

If we could get the examples working it would be a great step forward or even making some new simple examples, as thats one of the first things I look at when I get a new library so I know that im using it right. Also once thats done it only takes a few moments to run the examples to know for sure we haven't broken anything with our code changes.


=== Minor Edit ===
Just added you as a collaborator so try cloning from the main project url and editing your test file and pushing it back up.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 05, 2013, 04:57:22 PM
Thanks for the commit, have been busy on another project so far this week and can see it dragging on until early next week, but will get back to this as soon as I can. You have my email so just drop me a message if you need me for anything.
Title: Re: A* pathfinding (stable 0v841)
Post by: LoneCipher on November 05, 2013, 05:24:42 PM
Just wanted to say; Go Team! :D
We all appreciate your work.
Title: Re: A* pathfinding (stable 0v841)
Post by: DanielSnd on November 06, 2013, 02:57:49 AM
Just register to say: THANK YOU BOTH SO MUCH!!!!

I'm quite new at unit and the only way I found to get a decent navmesh working at run time was by using A* (Random level generation ;x). And since I'm quite the newbie at programming I decided the best/easiest way for me to make Enemy AI would be using PlayMaker.

And now that I found this, thanks to you I can use both together :D THANKS!
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 17, 2013, 01:20:02 PM
Hey,

I have updated the project in git, ignored a load of stuff which apparently is not needed and also began adding some simple examples, however I got an issue when using MoveTo and a destination point where it cannot seem to find the destination waypoint, as that method is huge thought I would try to see if you had time to take a look ;)
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on November 26, 2013, 05:48:56 PM
Hi, it's me again.  I've build a teleporter system, but the issue where you re-init a state with the moveto action and it's already at destination issue flares up again.

At least that's what I think is happening.. the moveto stops responding to changes in the target position. I if I leave the state and then re-enter the moveto state things start working again.  Is there a possibility that the failure event could be expanded to include such a situation?
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on November 26, 2013, 05:58:31 PM
Slight footnote, figured out was happening, when teleporting to a new unconnected island of the graph,  any unit listening to a new target object on the disconnected bit of the graph, stopped responding.   Any way around this, or i'm gonna have to turn of these units to stop them listening to targets they can't reach?
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 27, 2013, 04:47:57 AM
You using the javascript version with installer or the github versions with the unitypackage?

Not that I can help much but I can raise a bug on the github project if there is an issue with this.
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on November 27, 2013, 06:49:24 PM
Hmm i'm using the package with the python installation script.  Is there still someone developing \updating by the way.?
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on November 28, 2013, 03:40:44 AM
Not exactly, I was having issues with the installer and the reason that the installer exists is to get around some issue with the astar project needing to do something before the JS can access it, so the installer moves things around which seemed to create trouble on the project I was working on, so Kiriri and I started porting the project over from Javascript to C# so you dont need the installer (although it will still be provided).

I am not sure what direction Kiriri wants to go with it but as github allows you to raise and track issues as well as let other developers fix and push changes up I am hoping that he will start to push that as the *main* version.

You can access it here:
https://github.com/grofit/playmaker-astar-actions

Should be functional as all code has been ported over but we are still ironing out some small bugs and adding more examples.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on November 28, 2013, 08:49:07 AM
If the newer version does not fix it (which tbh I don't think it will), please send me an example scene. Everything you send to my mail address will be seen as confidential material, I won't share any kind of info about your project with anyone else, so no worries there.
From the sound of it , it  might be a bug or it might be a bad setup. I can't judge it without an example.
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on November 28, 2013, 04:54:11 PM
Hi no problem,.

I think its a variation on the previous issue, where I init the moveto when its already at its destination,  if you move the follow target object the moveto stays stuck..   I think it just needs this situation as a fail condition, or perhaps a simple, if object is not moving, and target is at distance then fail.
If that's possible.

I'm gonna try and update to the github version tommorow.. (been putting it off, as it took some manual reshuffling last time..
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on December 04, 2013, 03:32:03 AM
You make any progress on this issue MuppetPuppet?
Title: Re: A* pathfinding (stable 0v841)
Post by: dasbin on December 11, 2013, 03:49:39 PM
Seems to be some incompatibilities with the latest version of AStar (3.4).

I get the following errors just from trying to import the Git Hub package into a blank new project (other than Playmaker and AStar Pro are imported already):

Quote
Assets/AStarPlaymakerActions/FsmVariables/FsmGridNode.cs(5,51): error CS0246: The type or namespace name `GridNode' could not be found. Are you missing a using directive or an assembly reference?

Assets/AStarPlaymakerActions/FsmVariables/FsmGridNodes.cs(5,52): error CS0246: The type or namespace name `GridNode' could not be found. Are you missing a using directive or an assembly reference?

Assets/AStarPlaymakerActions/FsmVariables/FsmNode.cs(5,47): error CS0619: `Pathfinding.Node' is obsolete: `This class has been replaced with GraphNode, it may be removed in future versions'

Assets/AStarPlaymakerActions/FsmVariables/FsmNodeRunData.cs(5,54): error CS0246: The type or namespace name `NodeRunData' could not be found. Are you missing a using directive or an assembly reference?

Assets/AStarPlaymakerActions/FsmVariables/FsmNodes.cs(6,53): error CS0619: `Pathfinding.Node' is obsolete: `This class has been replaced with GraphNode, it may be removed in future versions'

And the old Python version is even worse of course.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on December 12, 2013, 05:52:54 AM
Hey,

If you are just cloning the repo and trying to build it then it should work (again assuming you have imported your own version of playmaker). I will take a look shortly and update if needed.

Thanks for reporting.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on December 12, 2013, 06:51:24 AM
Yeah they have removed some classes and moved to use new ones. I will refactor the actions to work with the new components as best I can but could do with someone testing it once I am done... I am still not 100% sure that the github project is actually stable, but will let you know once its done and let me know if it works :)

There are some underlying changes which I am not really sure how to map over in the new version...  I have put a post here:

http://arongranberg.com/vanillaforums/discussion/1005/changes-in-version-3-4

So hopefully once I get some steer on what to use instead of these old methods I should be good. For now I would say stick with the older version of the pathfinder unless you NEED something in the new one.

We have made a 3.4 branch in git however it is not compiling currently.
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on December 12, 2013, 11:08:33 PM
So just to be clear, the new version is non-functional and we should avoid updating until this is all resolved?
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on December 13, 2013, 06:42:21 AM
Yes.

Version 3.4 of the A* pathfinding system does not currently work with the playmaker bindings. This goes for the github version (still not fully tested) and the installer version on he first post in this thread.

The github version is currently being updated to the latest version, however there are some outstanding questions for the creator of the pathfinding library before we can update.

We will post on here when the update has been done.
Title: Re: A* pathfinding (stable 0v841)
Post by: dasbin on December 13, 2013, 09:33:23 PM
Grofit,

Just want to mention that your really generous selfless contributions are going very appreciated here. The most detailed intricacies of AStar are a bit beyond me, personally, but I'm aware enough of the scope of the work to recognize all the time and effort required to do what you've been doing. Thank you.
And of course many thanks to kiriri as well for all the original work.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on December 15, 2013, 04:18:12 AM
No worries, I don't have a clue about most of the internal logic of this thing, however I don't really need to know the domain to re-work it, Reshaper helps lots in doing this :)

To be honest the only reason I started this github versions was because the installer version broke my A* pathfinding bindings in unity so this seemed to be a way to get around it without too much effort.

We have fixed some more issues, but still need some confirmation on other bits and I need Kiriri to take a look over some of the remaining issues as it will effect the logic and don't want to mess with that.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on December 20, 2013, 05:36:13 AM
Just to keep you all in the loop we are still working with Aron (the creator of A* Pathfinder) to solve the current issues and should hopefully have a release soon.
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on December 20, 2013, 10:59:36 AM
Sorry for the late update on my issues.

They still persist, but i've coded a simple script that checks if the pathfollower is moving or not.. and if it isn't it triggers a seperate state that re-triggers the entire move to state..   Which works quite well actually. (but is a really dirty hack IMHO ;)

so its solved for now, via workaround..
Title: Re: A* pathfinding (stable 0v841)
Post by: kathode on December 28, 2013, 04:46:53 PM
Just wanted to register and post my support :)  I am working on a project with a click-to-move mechanic and this support would be invaluable.  Keep us updated and let us know if you need testers.
Title: Re: A* pathfinding (stable 0v841)
Post by: hwilliams on January 01, 2014, 01:28:17 PM
I know that an update for these actions is in the works, but I was just wondering if there was a way to download an older version of A* so that I could work with it until then. Or if anyone had a copy they'd be willing to share. Thanks!!
Title: Re: A* pathfinding (stable 0v841)
Post by: darrkbeast on January 02, 2014, 04:20:56 PM
Hey I know you can download from the link on the first page, when you run it without A*star and click add when the installer ask and it will install a working version it did for me. Also you can download a older version of a* from that website, but I cant rememeber what you change at the end of the download link to do that. If you only have free just run the installer from here it will get you going.
Title: Re: A* pathfinding (stable 0v841)
Post by: hwilliams on January 03, 2014, 02:50:24 PM
Thanks darrkbeast! Unfortunately when I try to use the link on the front page I get a string of errors, and python telling me it can't install A*, but it's probably because I'm doing something wrong. I appreciate the help though! If I can't get an older copy of A* I can wait until the playmaker actions update.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on January 03, 2014, 04:54:04 PM
The bulk of the work has been done on the refactor for the new version (to support the latest A* version) its just waiting on Kiriri or the creator of the A* project to advise on one or two points, as I don't have the domain context of the A* library to know what to do with the current errors.

If it helps here is the outstanding issue on github to finish it, once those guys tell me (or do the change themselves) we should be good to go.

https://github.com/grofit/playmaker-astar-actions/issues/5

I am using this for point and click controls as well :)
Title: Re: A* pathfinding (stable 0v841)
Post by: redmotion on January 08, 2014, 08:32:41 AM
Hi, I'm using a mac.

How do I install this extension?

(Sorry for not reading 21 pages of forum posts, if this has already been answered, it's not on the opening post)
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on January 14, 2014, 10:00:09 AM
If you are using the installer off the first page you will need to install python and run the py file from the command line and press yes or no to the questions asked.

If you are using the github version just take the unity package from the dist folder and install it as you would any other package.

Neither are compatible with the latest version of the Astar package, but work is underway on this.
Title: Re: A* pathfinding (stable 0v841)
Post by: mykonata on January 15, 2014, 10:31:25 AM
Hello, thanks for your great addon!

Can someone tell me how get fsmNavGraph variable from my graph(grid) ?
And how i can put all nodes(from 1 graph) to array ?
Title: Re: A* pathfinding (stable 0v841)
Post by: Sly on January 24, 2014, 03:58:30 PM
Hello,

I try to install this but I've got an error in the CMD prompt: NameError: name 'Y' is not defined
Code: [Select]
Playmaker exists in the project
Aron's Astar package is not installed. Would you like to install the free version?
Y/N
YN
invalid Input
Y/N
YN
invalid Input
Y/N
Y
Traceback (most recent call last):
  File "C:\Users\DansTonUc\Documents\Test4000\Assets\AstarPlayMakerInstaller\Setup.py", line 76, in <module>
    aronInstalled = YN()
  File "C:\Users\DansTonUc\Documents\Test4000\Assets\AstarPlayMakerInstaller\Setup.py", line 19, in YN
    free = YN()
  File "C:\Users\DansTonUc\Documents\Test4000\Assets\AstarPlayMakerInstaller\Setup.py", line 19, in YN
    free = YN()
  File "C:\Users\DansTonUc\Documents\Test4000\Assets\AstarPlayMakerInstaller\Setup.py", line 10, in YN
    inp = input()
  File "<string>", line 1, in <module>
NameError: name 'Y' is not defined

What am I supposed to do to fixe that?

Note: Python version is 3.0 - I'm doing this on Windows 7, using python v x86 I guess
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on January 24, 2014, 04:54:22 PM
Cant advise on that verison, I know when I have had to work with python stuff before I have had to use the versions before 3, then stuff tends to work. So give that a try...
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on January 24, 2014, 05:09:37 PM
Any update on when the 100% clear working version for the newest A* will come online?
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on January 24, 2014, 05:43:00 PM
Still awaiting on input from the creator of the original actions, or the guy who makes the pathfinding lib to take a look. I have notified them on Github of the requests to get this done but they seem to be away or something at the moment so cannot give a timeline.

I have bumped the thread in Github again just to make sure they are notified of it.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on January 26, 2014, 08:36:06 AM
The owner of this project said he will be unable to do any work for about 2 months because of some other work he has on, so if anyone knows this library well enough feel free to help out on the outstanding issues on github, also the library still needs some form of testing (for previous version as well as the latest one when tis done)
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on January 26, 2014, 04:34:02 PM
Such a shame kiriri is busy.  I've still having one singular issue with the old version. 

Groffit, perhaps you could spare a thought on my issue. 

I'm pooling my AI units.  so once they've died, i'm de-activating them and placing them in a pool for future use..

However If I re-activate the game-object  no matter what I do, it still tries to follow some perverted remnat of his last known path. 

either I reset the script, and the unit,will teleport to his last known location and proceed from there.  If i don't reset the unit will spawn at his correct new location but start to move not to his new target, but to his old target. (or a node with similar ID in the new graph, guessing here)..

Well I've tried every possible work around, including recycling his last path. But this feature in the recycle path code seems not-working. 

Also in the moveto code I find a comment in the move() this one: // previous path is not cleared on reload. That's why it's finishing and why there's no error !!!!!!
it seems kiriri was working this and it's either not working, or not usable with re-activating obejcts (that's how I read it)

So now i'm completely stumped.  I can't find a work around, that doesn't cause some other issue.. and I'm stuck with units occasionaly going completely awol on spawn.   

Well, what could help is just a boolean in the moveto I could set on spawn, that completely wipes the current moveto state and paths..  is something like that possible?   how would i go about this..

It could be that the new version solves this, but like you advice its unwise to try.

So if you could help, it would be super super super appreciated.  honestly I'd be willing to pay. anything to get my game back on track.

Cheers
tomas
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on January 26, 2014, 04:44:23 PM
I have similar problems, only reason I was helping out was because I wanted to use this plugin on my project but the installer borked my A* plugin so the C# re-write was so I could use it in my game, but even with the C# re-write it still feels a bit off. Like I tell a game object to MoveTo another one with a given grid and it just wanders off in the opposite direction, which seems completely wrong.

I wish I could help but I know nothing about the A* library, I just know how to refactor code so I just re-jigged and optimised sections, as far as the actual context of the code in the plugin, I have little idea... I will go take a quick look just incase I can see anything which would fix your problem but it would only be done on the git version of this library not the installer version.
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on January 26, 2014, 04:52:53 PM
I feared as much,  if you find anything that would be great. I'd happily switch to the github version if i'd fix something.. ;)  cuz at the moment, it's either ditch it or go without pooling, which is a very bad idea on mobile..

thanks anyway
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on February 05, 2014, 08:35:11 AM
I had some feedback from arnon..  And he's said that you should never call path.reset.   

but rather set the path to null and call path.release()..

He also stated that somewhere in the moveto or follow() code there should already be a release() to handle pooling.  This is not the case as far as I can see.

I've also had a look at the void reset()  and there kirikire only sets the OutputPath to null.  So i've added a path=null to the reset to see if that fixes it. 

as I assume the outputpath is not the internal actual path but just an output.  And I'm assuming that the void reset is also called on deactivate gameobject .   
At least I'm assumig this is what the reset() does in all the playmaker code does.  Or it only resets the editor, in which case it doesn't change a thing.,

well just an update. i'll let you know what happens..
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on February 06, 2014, 05:39:34 AM
yeah good to know, If reset should not ever be called it should be marked as such as to me reset makes more sense than release as you just want to blank the path, but if anyone knows what you should do it would be Arron.
Title: Re: A* pathfinding (stable 0v841)
Post by: Skermunkel on March 06, 2014, 03:18:51 PM
Hi,

I seem to be getting a bunch of compiler errors when importing Astar Pro 3.4.0.5 stating that a bunch of parameters are being defined multiple times. Once I install the Playmaker actions it reduces the errors to 2:

Assets/Plugins/AstarPathfindingProject/Core/Nodes/GraphNode.cs(20,22): error CS0101: The namespace `Pathfinding' already contains a definition for `Node'

Assets/Plugins/AstarPathfindingProject/Generators/NodeClasses/MeshNode.cs(6,22): error CS0101: The namespace `Pathfinding' already contains a definition for `MeshNode'

Is there something that I might be doing wrong?
Title: Re: A* pathfinding (stable 0v841)
Post by: Skermunkel on March 06, 2014, 03:27:08 PM
Nevermind, I fixed it, I just rei-mported everything and it seems to be fine now.
Title: Re: A* pathfinding (stable 0v841)
Post by: Skermunkel on March 06, 2014, 04:30:24 PM
Scratch that I still seem to be getting the same errors. :-\
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on March 06, 2014, 04:50:46 PM
Thank you Grofit for all your wonderful work!

I'm sorry to keep you guys waiting. I feel bad for it, but I'm still in my exam phase for about a month. I do not know if I can get back to this any sooner. I may be able to go over the more tricky bugs over the next days though. If it's not too much, that is.

Cheers,
Sven

EDIT: (reading backwards here) Yes, there is no pooling integrated. I had problems with memory leaks the last time I tried to integrate it. But that was a long time ago and I'm not sure I did it correctly :D

@ Skibbejak
your errors most likely indicate that you have some scripts twice. Do you perhaps have both the js and cs version installed at the same time?
Title: Re: A* pathfinding (stable 0v841)
Post by: Skermunkel on March 07, 2014, 05:32:55 AM
Where can I find the js versions and delete them? As that is most likely the case, I will probably only be using the c# version.

I searched for GraphNode.js and MeshNode.js but I could only find the c# versions.
Title: Re: A* pathfinding (stable 0v841)
Post by: Skermunkel on March 07, 2014, 09:37:07 AM
It seems the Node class in GraphNode.cs is Obsolete and has been replaced with GraphNode, so I fixed that error by just commenting out the empty Node class.

Im still having a problem with the last one though:

Assets/Plugins/AstarPathfindingProject/Generators/NodeClasses/MeshNode.cs(6,22): error CS0101: The namespace `Pathfinding' already contains a definition for `MeshNode'
Title: Re: A* pathfinding (stable 0v841)
Post by: RowdyMrB on March 09, 2014, 06:35:19 PM
I read through the forum and and installed the GitHub package and had a number of namespace errors. I believe I have gotten everything fixed with the exception of a namespace error in FsmNodeRunData.cs.  As listed below:

using Pathfinding;
namespace HutongGames.PlayMaker.Pathfinding
{
    public class FsmNodeRunData : FsmVariableWrapper<NodeRunData>{}
}

Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on March 13, 2014, 03:50:18 PM
So I'm still running the older version before this upgrade nonsense, but whenever i build my client, I get the following error -

"NullReferenceException: No AstarPath object found in the scene. Make sure there is one or do not create paths in Awake"

Any idea how to fix it?
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on March 17, 2014, 04:20:14 PM
So I fixed it by just copying and using the A* setup object from the pathfinding scene, seemed to resolve all my problems. Not sure why, but solved.
Title: Re: A* pathfinding (stable 0v841)
Post by: GrandAlchemist on May 10, 2014, 08:29:00 PM
Just out of curiosity, how hard is it to get a* pathfinding to work with playmaker?? IS it possible for someone like me (with not much programming experience) to get the most out of a* pathfinding with playmaker???
Title: Re: A* pathfinding (stable 0v841)
Post by: daplunk on May 10, 2014, 09:10:15 PM
I'm also super keen to find a way to work with A* Pathfinding Project in Playmaker. I've had a look at the Unity Pro pathfinding features and it's not robust enough as it can't handle re-baking at run-time.

I've read through this entire post and it looks like all functionality is broken due to a number of run-time errors.
Title: Re: A* pathfinding (stable 0v841)
Post by: TrentSterling on May 11, 2014, 12:35:03 AM
I don't think I can make as robust of a library- however, I have a few pathfinding actions that depend on the Seeker.cs from the A* library. It's pretty generic.

Essentially it handles getting a list of nodes. You'd have to use PlayMaker magic to LookAt the next node, and either Force or MoveTo the target.

I might do a character controller and rigidbody implementation with speed/velocities and whatnot, but I prefer my actions to be super generic.  :(
Title: Re: A* pathfinding (stable 0v841)
Post by: daplunk on May 12, 2014, 06:14:19 AM
Actually I stumbled upon your blog / videos during the many hours spent searching for a working set of actions. I like the sound of the simplified approach. All I've been trying to do is feed a game object variable into the AIPath script that's attached to a seeker object but alas, apparently not as simple as it looks in my head.
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on June 04, 2014, 12:37:14 PM
Hey all,

I was hoping that Kiriri would be back on by now but he must still be busy with other stuff.

If it helps anyone I wrote my own set of actions, but they are no where near as complete as these ones and they are also used slightly differently. One of the main differences is the way the actions are broken up, so rather than having a MoveTo action which encompasses the whole "Create a Path", "Get the next node", "Move to that position" it now forces you to do each step explicitly, as in the real world movement is not just movement. It is mecanim animations and AI updating and physics checking etc.

It was only written as a prototype, so it may not be as performant as this one nor as easy to use, however if people are stuck (as I was) then I am happy to open the repository up to the public, however it currently only supports the pro version. It is not a massive job to create a free version from it, but was never planning to make it public.

If there is no need then hold out for this to get updated, but if you are really in need of something to get the latest playmaker and A* working together then this can at least tide you over. Let me know if anyone wants to test etc and I will put in links and remove some custom assets I was using.
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on June 05, 2014, 08:09:25 PM
I had hoped Kiriri back faster too, I've basically just stopped updating to keep my existing legacy version running. Any chance you can add this to your to-do list super programmer Jean?
Title: Re: A* pathfinding (stable 0v841)
Post by: Grofit on June 07, 2014, 07:35:06 AM
If anyone does want to try an alternative in the meantime then here is the other one I was working on. Although like mentioned before it has slightly different use-cases than these current actions. Look at the examples if you want to see how it has been done but should be self explanatory.

Like the github one I ported just take the release in the dist folder, it has been tested with the latest A* (3.4.0.6) and all the simple stuff works.

https://bitbucket.org/grofit/astar-playmaker-actions
Title: Re: A* pathfinding (stable 0v841)
Post by: terri on June 17, 2014, 10:25:44 AM
Any tips on upgrading from Unity 4.3 to 4.51?
Everything seems to work at first (I can run the game in editor just fine), but when I try to build things fall apart.

After following this: http://hutonggames.com/playmakerforum/index.php?topic=7454.0

I now have all these errors:
https://dl.dropboxusercontent.com/u/226993/pm_error.png (https://dl.dropboxusercontent.com/u/226993/pm_error.png)

I should note that everything runs and builds fine on 4.3
Any ideas on how to fix this?

edit: seems I was using a c fix for a js action
Title: Re: A* pathfinding (stable 0v841)
Post by: IceMaker on June 25, 2014, 05:16:15 AM
It's unfortunate that the playmaker commands are obsolete, is this the only decent pathfinding solution available at the moment?

The Unity Navmesh seems to not have the efficiency to recalculate paths on the fly (looping through possible targets to run away from a player whom may be blocking certain hallways for instance, that requires the distance of player and character to be figured.)

Title: Re: A* pathfinding (stable 0v841)
Post by: Sly on July 04, 2014, 09:20:36 AM
Yep, it could be cool to have feedback from the dev, because now we can't use it anymore.

It could be great to have some news about that.
Title: Re: A* pathfinding (stable 0v841)
Post by: gozda on October 29, 2014, 08:08:27 PM
Can't add component 'AstarPath' because it doesn't exist.

How to fix that?
Title: Re: A* pathfinding (stable 0v841)
Post by: nighty9 on November 25, 2014, 05:50:57 AM
Does someone has an updated version of the Actions that is working with new unity versions ? Unity 5, 4.6 etc, would be greatly appreciated :)
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on December 11, 2014, 02:30:52 PM
As far as I know, this is still a non functional package with the new unity until the author updates it.
Title: Re: A* pathfinding (stable 0v841)
Post by: TheWarRoom on December 14, 2014, 04:50:23 PM
Oh my someone please help me. I added this to my project not realizing it is outdated! I need help removing as my project is broken with it !!
Title: Re: A* pathfinding (stable 0v841)
Post by: TheWarRoom on December 14, 2014, 05:36:52 PM
I Figured it out :)  Sorry for the false alarm.
Title: Re: A* pathfinding (stable 0v841)
Post by: laik2002 on January 02, 2015, 03:36:02 AM
I m using a mac .I can't finish to installation.Plz help~,thx
Title: Re: A* pathfinding (stable 0v841)
Post by: Lane on January 02, 2015, 10:40:29 AM
I m using a mac .I can't finish to installation.Plz help~,thx

The A* Pathfinding Project has a fairly volatile API from what I can tell, it seems that the package isn't maintained any longer and doesn't work with the latest versions of the asset.

Perhaps contact the author of the actions and see if he is able to update them? I took a glance at them, but its a pretty robust set of actions and would take a long time to get into and update.
Title: Re: A* pathfinding (stable 0v841)
Post by: laik2002 on January 15, 2015, 04:08:47 AM
Oo~it s a really bad news....
thx for sugguestion.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on January 29, 2015, 01:44:50 PM
Color me surprised! How did this thread stay alive for so long?! I had disabled all updates on this post when I started studying what I found an incredibly hard uni course (Molecular Biotechnology). Then I realized a year later that I just can't go without programming, so I switched to CS, which means I have quite some spare time on my hand. Without PaulH's PM this would never have come to my attention again.

 I will update this project again to work with Unity 4.6 and 5 as requested. I'll also clean up the code base as it's quite horrendous (this was my first Unity plugin and my first experience with js/c# for that matter). I won't add functionality though, I might even remove WIP parts that don't make much sense on their own.

My last exam for this semester will be mid next month. Afterwards I will tackle this project.
Do answer me one thing though : Why are you guys still interested in this plugin? Doesn't Unity's own pathfinding work just as well in most situations? I have never used it but looks powerful.
Title: Re: A* pathfinding (stable 0v841)
Post by: Sly on January 29, 2015, 01:51:17 PM
Wow that's a good news pal!

Your pathfinding system is just very simple to understand, easy to plugg, and it's easy to modify! And for sure, it was (and so it will be) compatible with playmaker!
:)

Thanks for the update!
Title: Re: A* pathfinding (stable 0v841)
Post by: Lane on January 29, 2015, 01:51:27 PM
Cool news kiriri! Hope things are going well for you =)

I think most people are interested in this because NavMesh in Unity is a Pro only feature while Aaron's project is the most recommended alternative.
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on January 29, 2015, 02:43:13 PM
Yah! I've been holding on to a barely functional version for months now. Compared to Unity Pathfinding, I found that A* worked more efficiently for me, given my constantly changing at run-time world environment. I look forward to the working update!
Title: Re: A* pathfinding (stable 0v841)
Post by: Rbanninga on February 16, 2015, 12:29:30 AM
Speed and realtime updates that outdo the pro version from Unity itself. This one is just a million times better and we would love to have it supported again with playmaker! Some official addon coop with the devs would be extra amazing... hint hint Jean!? :)

Cheers and good luck with your exams!
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on March 01, 2015, 05:28:50 PM
Ok, on second glance, my code seems even worse than I had previously thought. Here's a barebone-version containing a move-to action (which is like half the code of this entire project :D ) which features everything but the auto option which I think stopped working in v0.2 or so anyway :D UpdateGraph, UpdateGraphArea, GetNearestNodeWalkability, IsPathPossible, WillPathBePossible should also work again. The rest is not included for now. I want to focus on each script, comment each section , refactor it for the sake of readability and generally make it faster and better first. Also, I'm only working on v4.6 free for now, pro will come right after, then I'll make it work on v5 which should be released publicly anytime soon.

If you're upgrading your project please make sure to backup. I've made some structural changes so you'll have to remove all FSM actions before loading the new ones into your assetfolder. You will also need to install the newest A* package.
If you have a project and require certain other actions before you can upgrade please post them here and I'll prioritize them.

EDIT : Also, please tell me the graph types you're using. I'm using GridGraphs all the time and especially navmeshgraphs and quadgraphs may cause issues since they now save their nodes in a different format (no more arrays for them)
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on March 01, 2015, 09:25:42 PM
Just wanted to confirm the following actions worked before updating:

Create Path To
Scan Graphs
Update Graph Area
Scan Graph
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on March 01, 2015, 11:40:47 PM
which graphs are you using?
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on March 01, 2015, 11:47:07 PM
Basic grid graphs.
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on March 02, 2015, 12:10:58 AM
UpdateGraph and CreatePathTo were missing, quickly wrote them. I ported CreatePathTo to cs and renamed it to capital letters so Playmaker may or may not update your references.
Edit : and they do work in Unity 4.6
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on March 02, 2015, 01:31:58 AM
Trying to Incorporate to the latest Astar and my scene I get the following errors:

Assets/AStarPlaymakerActions/FsmPathfinding/MoveTo.cs(310,41): error CS0104: `FleePath' is an ambiguous reference between `HutongGames.PlayMaker.Dummies.FleePath' and `Pathfinding.FleePath'
Assets/AStarPlaymakerActions/FsmPathfinding/MoveTo.cs(310,41): error CS0103: The name `FleePath' does not exist in the current context
Assets/AStarPlaymakerActions/FsmPathfinding/MoveTo.cs(316,41): error CS0104: `RandomPath' is an ambiguous reference between `HutongGames.PlayMaker.Dummies.RandomPath' and `Pathfinding.RandomPath'
Assets/AStarPlaymakerActions/FsmPathfinding/MoveTo.cs(316,41): error CS0103: The name `RandomPath' does not exist in the current context

Any thoughts on the proper resolution?
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on March 02, 2015, 02:52:09 AM
You're using pro?
If so remove the AStarPlaymakerActions/FsmDummy folder. This is the version for free users. As a pro user you don't need the "dummy pro scripts"
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on March 02, 2015, 03:22:57 AM
So when I trash that folder I get,

Assets/AStarPlaymakerActions/FsmPathfinding/MoveTo.cs(112,25): error CS0246: The type or namespace name `RVOController' could not be found. Are you missing a using directive or an assembly reference?
Assets/AStarPlaymakerActions/FsmPathfinding/MoveTo.cs(2,29): error CS0234: The type or namespace name `Dummies' does not exist in the namespace `HutongGames.PlayMaker'. Are you missing an assembly reference?
Assets/AStarPlaymakerActions/FsmPathfinding/helpers/FsmConverter.cs(8,19): error CS0234: The type or namespace name `Nodes' does not exist in the namespace `Pathfinding'. Are you missing an assembly reference?
Assets/AStarPlaymakerActions/FsmPathfindingWrappers/FsmPathfindingC/GetWalkabilityInArea.cs(8,19): error CS0234: The type or namespace name `Nodes' does not exist in the namespace `Pathfinding'. Are you missing an assembly reference?
Assets/AStarPlaymakerActions/FsmPathfinding/MoveTo.cs(2,29): error CS0234: The type or namespace name `Dummies' does not exist in the namespace `HutongGames.PlayMaker'. Are you missing an assembly reference?
Assets/AStarPlaymakerActions/FsmPathfinding/helpers/FsmConverter.cs(8,19): error CS0234: The type or namespace name `Nodes' does not exist in the namespace `Pathfinding'. Are you missing an assembly reference?
Assets/AStarPlaymakerActions/FsmPathfindingWrappers/FsmPathfindingC/GetWalkabilityInArea.cs(8,19): error CS0234: The type or namespace name `Nodes' does not exist in the namespace `Pathfinding'. Are you missing an assembly reference?
Title: Re: A* pathfinding (stable 0v841)
Post by: kiriri on March 02, 2015, 03:35:46 AM
I don't have access to my desktop right now, I'm sorry for the false hopes, I was sure it'd work for pro as well, but apparently the rvo controller has been replaced. I will have to look into it this evening.  :-\
Title: Re: A* pathfinding (stable 0v841)
Post by: Anflo on March 02, 2015, 08:00:55 AM
"Can Search" "Can Move" bool. for seeker AIPath.
Pleaaaaaaaaase.
Title: Re: A* pathfinding (stable 0v841)
Post by: Anflo on March 05, 2015, 05:29:39 PM
Is there any Playmaker action to change the target in the AIPath script while the game is running. I would love to if possible that so I can change the gameobjects.

Thanks in advance
Title: Re: A* pathfinding (stable 0v841)
Post by: hensoup on March 09, 2015, 03:50:08 AM
cannot intall with 0v841 package I tried to get it intsall but I keep getting a huge list of compile errors.
Title: Re: A* pathfinding (stable 0v841)
Post by: Sly on March 09, 2015, 08:13:44 AM
cannot intall with 0v841 package I tried to get it intsall but I keep getting a huge list of compile errors.

If you give to the author more infos probably he can help you.
Title: Re: A* pathfinding (stable 0v841)
Post by: hensoup on March 09, 2015, 11:49:06 AM
I got it sorted for now .
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on March 18, 2015, 04:03:53 PM
Just checking in for any updates, how's it all going?
Title: Re: A* pathfinding (stable 0v841)
Post by: HalfVoxel on March 21, 2015, 04:47:08 PM
Author of the A* Pathfinding Project here.

Just wanted to let you know that if you have any problems writing this library, I will be happy to help. I am not watching this forum thread, but you can send me a PM on forum.arongranberg.com.

A big thumbs up for working on this extension! : )

Also, when you feel it is stable enough, I will be happy to add it to the extensions page on the website.
Title: Re: A* pathfinding (stable 0v841)
Post by: bizilux on March 27, 2015, 04:30:16 PM
is it possible to use these actions in 2D top down environment?
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on March 29, 2015, 07:02:04 PM
Hey HalfVoxel, any ability to include Playmaker integration into a future expansion as either part of the official pack or some standalone expansion code for sale? I suspect without any financial benefit Playmaker integration will always lag beyond your latest and greatest.
Title: Re: A* pathfinding (stable 0v841)
Post by: rik on April 09, 2015, 08:41:23 AM
Hi i try to import a star actions and try to install using py code but it was having errors
Assets/Plugins/FsmPathfindingWrappers/FsmPathfindingC/CalculateETA.cs(10,2): error CS0246: The type or namespace name `Tooltip' could not be found. Are you missing a using directive or an assembly reference?
Title: Re: A* pathfinding (stable 0v841)
Post by: rik on April 09, 2015, 08:49:58 AM
can some one make actions for latest update
Title: Re: A* pathfinding (stable 0v841)
Post by: Scrawny on April 13, 2015, 08:40:42 AM
Just throwing this out there, I made the mistake of running the installer not in the installer folder, but just casually in the assets folder. It ended up deleting ALL my assets. So yeah, that happened.
I know I should've followed the instructions to a T, but sheesh... might want to do something about that, or at least put up a warning or something
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on April 23, 2015, 05:07:03 AM
Any updates on making this work again?
Title: Re: A* pathfinding (stable 0v841)
Post by: rik on May 03, 2015, 08:07:42 PM
It was listed on wiki if it does not work no one was ready to make actions for this then it should be removed on wiki.
Title: Re: A* pathfinding (stable 0v841)
Post by: mweyna on May 18, 2015, 12:14:15 PM
Bump.
Title: Re: A* pathfinding (stable 0v841)
Post by: rik on May 18, 2015, 01:31:25 PM
i have found that it was waste of time bumping the thread try to use navmesh
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on June 27, 2015, 04:58:39 AM
I'm still using one of the old versions, lol.   It works for me.. but In hindsight should've used navmesh instead.

Still the setWalkablein Area has a offbyone error causing the first node to not have its walkability set. (the one in the centre of your area offcourse ;)

Anyway for that one person out there banging his head on this. (p.s i've had this working since 2013 I guess, so don't take this as a notice anyone sane is still working on this ;)
Title: Re: A* pathfinding (stable 0v841)
Post by: Phuzz on September 12, 2015, 07:03:07 AM
HEllo,

Smooth Turns option on the Movto Action seems to crash unity, its a very important option in A*, I know this thread seems a bit abandoned but if any one knows how to solve this problem would be great.

I am able to use Moveto action successfully except smooth turns.
Title: Re: A* pathfinding (stable 0v841)
Post by: rik on September 12, 2015, 01:47:36 PM
Hi
better use unity navmesh it was also working good
Title: Re: A* pathfinding (stable 0v841)
Post by: hensoup on September 14, 2015, 04:23:39 AM
bingo!

these two scripts work great with it.
just use set properties

(https://i.gyazo.com/ff5872ee7b4a678648601fc6bfdbcb89.png)
(https://i.gyazo.com/35e431b27e06b1c720b9fb07674ac35e.png)

using the latest version
Title: Re: A* pathfinding (stable 0v841)
Post by: Phuzz on September 29, 2015, 05:46:59 AM
Hello,

That sounds like a good idea, my main issue is smooth turns, is it working in this method?
Title: Re: A* pathfinding (stable 0v841)
Post by: hensoup on October 21, 2015, 10:58:23 PM
seems like it's working it's how you tweak the seaker script varibles
Title: Re: A* pathfinding (stable 0v841)
Post by: bizilux on April 29, 2016, 01:15:06 PM
can this be resurrected? thread has like 65,000 views... a lot of interest in a really good pathfinding solution... too bad... too bad
Title: Re: A* pathfinding (stable 0v841)
Post by: muppetpuppet on May 02, 2016, 04:56:05 AM
I've update to the latest version.  If you remove the .nodes namespace and replace node with graphnode, you can get it to work with the latest A* and unity 5.3+

However i'm desperatly trying to reconstuct the set walkable in area, but with little luck.  ;(

but the moveto.cs  is working properly ;) i can confirm.
Title: Re: A* pathfinding (stable 0v841)
Post by: 3d_Artist1987 on July 01, 2016, 05:58:00 AM
Any update?
Title: Re: A* pathfinding (stable 0v841)
Post by: rik on July 17, 2016, 03:15:18 PM
hey send me what actions list you need i will help you.
Title: Re: A* pathfinding (stable 0v841)
Post by: jess84 on August 14, 2016, 07:22:16 AM
Are these actions going to be updated?

I just bought the pro version without realise playmaker support for it was dead  :'(
Title: Re: A* pathfinding (stable 0v841)
Post by: joepalos on August 15, 2016, 03:02:23 PM
A* is still usable with Playmaker with a little trickery. Get Property and Set Property are your friends. You can set the destination of an agent, read if it has arrived, send commands, etc.

I can (kind of) help you out if you need me to.
Title: Re: A* pathfinding (stable 0v841)
Post by: jess84 on August 29, 2016, 10:17:40 AM
Cool, thanks.

I'll have a play around with it, see if I can get what I need from Get/Set properties.

Shame such a cool 3rd party pack hasn't gone for full/official PM support :/
Title: Re: A* pathfinding (stable 0v841)
Post by: BDFgames on December 09, 2016, 06:13:40 PM
Hi guys. What's the latest on A* pathfinding support in Playmaker? This seems to be the latest info, but I note it's from back in August. Has there been any progress since then?

I'm currently experimenting with A* (Unity's navmesh, it turns out, is "limited" in certain areas) and it'd make things MUCH easier if I can use Playmaker's visual interface.  :)
Title: Re: A* pathfinding (stable 0v841)
Post by: tcmeric on March 14, 2017, 05:27:48 AM
I am going to Necro this thread. Is there still interest in custom playmakeractions for A* Pathfinding? I am just trying to gauge the desire for this, as I am considering doing it.

I might make some for my next project. Havent decide yet if I want to use A* or not yet.
Title: Re: A* pathfinding (stable 0v841)
Post by: BDFgames on March 14, 2017, 04:51:38 PM
Yes, I would be very interested.  :)
Title: Re: A* pathfinding (stable 0v841)
Post by: tcmeric on March 15, 2017, 05:05:47 AM
Are you using it right now? Any specific actions you need?
Title: Re: A* pathfinding (stable 0v841)
Post by: BDFgames on March 15, 2017, 05:24:27 AM
I'm not currently, no, as I went back to Unity's navmesh agent, but definitely open to revisiting A* as it would enable proper random level generation.

Where would you propose to start?
Title: Re: A* pathfinding (stable 0v841)
Post by: tcmeric on March 16, 2017, 10:03:17 AM
Honestly, I am still trying to figure out why I would use A* over unitys built in pathfinding actually.  :o
Title: Re: A* pathfinding (stable 0v841)
Post by: BDFgames on March 19, 2017, 05:10:08 AM
The reason I'm interested is that you can't build the standard Unity navmesh at runtime, which A* can. Realistically, that's the only reason I'm interested in it, as vanilla navmesh does everything else I need at present. Others will doubtless have other needs, of course.  :)
Title: Re: A* pathfinding (stable 0v841)
Post by: terri on March 20, 2017, 06:23:50 AM
Unity is close to pushing out Navmesh runtime baking! There is some experimental stuff out already:
https://github.com/Unity-Technologies/NavMeshComponents

https://unity3d.com/unity/roadmap (look under beta 5.6)
Title: Re: A* pathfinding (stable 0v841)
Post by: tcmeric on March 20, 2017, 06:54:38 AM
Thanks. I just want to make sure that I am using my time wisely when making custom actions. I may not move forward on this project, as it seems unity is more and more able to handle things itself.  :o
Title: Re: A* pathfinding (stable 0v841)
Post by: Silicon Power on June 28, 2018, 09:51:00 PM
Is there any update for this? I mean does it work with last version of A* Pathfinding.
Title: Re: A* pathfinding (stable 0v841)
Post by: tcmeric on June 29, 2018, 11:58:36 AM
I have partial version that I believe still works with the current. However, A* is a big package that contains all kinds of things. My actions only cover a very small part. If you want a copy, join me over at https://invite-playmaker-slack.herokuapp.com . My handle is tcmeric.

Is there something specific you want in A* that you think/know that unity navmesh doesnt cover?
Title: Re: A* pathfinding (stable 0v841)
Post by: Silicon Power on June 30, 2018, 03:15:21 PM
I have partial version that I believe still works with the current. However, A* is a big package that contains all kinds of things. My actions only cover a very small part. If you want a copy, join me over at https://invite-playmaker-slack.herokuapp.com . My handle is tcmeric.

Is there something specific you want in A* that you think/know that unity navmesh doesnt cover?

I believe A* pathfinding is a lot better than unity default. I've created a procedural pathfinding easily for an open world game. I doubt if unity can be used for large maps.

Anyway I tried to register on that site and it's told me " It looks like you're in an embargoed country.This means you can't create a new team or an account on Slack. " (Suck a fool racist website)
Title: Re: A* pathfinding (stable 0v841)
Post by: miguelfanclub on November 28, 2018, 11:05:18 AM
Any update here?
Playmaker still doesnt have any a* solution, neither in the asset sore.

The slack invitation also doesnt work.
Title: Re: A* pathfinding (stable 0v841)
Post by: tcmeric on November 28, 2018, 07:54:45 PM
The slack invitation should work. We have new people joining regularly.

PM me your email address and I will send you an invite manually. Also make sure the invite is not getting blocked by your spam filter.

Title: Re: A* pathfinding (stable 0v841)
Post by: MattyWS on May 29, 2019, 07:30:44 PM
I'd hate to be that guy but I'm also very curious about playmaker and Aron Granberg's A* pathfinding project. I anticipate my next project will have thousands of units running around. and want the very best system for it. :)

Is there any update on playmaker actions for this package?

Title: Re: A* pathfinding (stable 0v841)
Post by: Christoph on March 07, 2021, 09:00:38 AM
Hello! Looking for actions as well.
Title: Re: A* pathfinding (stable 0v841)
Post by: Silicon Power on June 02, 2023, 12:42:59 AM
Still no action for this asset?
Title: Re: A* pathfinding (stable 0v841)
Post by: Zenfish on June 19, 2023, 01:45:41 PM
Here is the only action i need with A*. That allows you to change the target destination (works with the “destination setter” component) It can also be done with the “set property” action. Hope it can help.

Code: [Select]
using UnityEngine;
using HutongGames.PlayMaker;
using Pathfinding;

namespace HutongGames.PlayMaker.Actions
{
    [ActionCategory(ActionCategory.ScriptControl)]
    [Tooltip("Change the target of an A* AI agent.")]
    public class AstarDestination : FsmStateAction
    {

        [RequiredField]
        [Tooltip("The GameObject containing the AIDestinationSetter component.")]
        public FsmGameObject MovingObject;
        [RequiredField]
        [Tooltip("The new target to set for the A* AI agent.")]
        public FsmGameObject DestinationObject;

       

        private AIDestinationSetter aiDestinationSetter;

        public override void OnEnter()
        {
            aiDestinationSetter = MovingObject.Value?.GetComponent<AIDestinationSetter>();

            if (aiDestinationSetter != null)
            {
                aiDestinationSetter.target = DestinationObject.Value?.transform;
            }

            Finish();
        }
    }
}