playMaker

Author Topic: A* pathfinding (stable 0v841)  (Read 146209 times)

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: A* pathfinding (stable 0v808)
« Reply #135 on: March 23, 2013, 01: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 ;)
Best,
Sven

escpodgames

  • Hero Member
  • *****
  • Posts: 686
    • View Profile
    • Assets
Re: A* pathfinding (stable 0v808)
« Reply #136 on: March 23, 2013, 01: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.

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: A* pathfinding (stable 0v808)
« Reply #137 on: March 23, 2013, 11:17:33 AM »
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.
Best,
Sven

escpodgames

  • Hero Member
  • *****
  • Posts: 686
    • View Profile
    • Assets
Re: A* pathfinding (stable 0v808)
« Reply #138 on: March 24, 2013, 12: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?

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: A* pathfinding (stable 0v808)
« Reply #139 on: March 24, 2013, 02: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 :)
« Last Edit: March 24, 2013, 02:51:35 AM by kiriri »
Best,
Sven

escpodgames

  • Hero Member
  • *****
  • Posts: 686
    • View Profile
    • Assets
Re: A* pathfinding (stable 0v808)
« Reply #140 on: March 24, 2013, 04:10:07 AM »
Ah gotcha!

iOS Free works :)

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: A* pathfinding (stable 0v81)
« Reply #141 on: March 24, 2013, 01: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)
Best,
Sven

greg

  • Junior Playmaker
  • **
  • Posts: 68
    • View Profile
Re: A* pathfinding (stable 0v81)
« Reply #142 on: March 31, 2013, 04: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.

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: A* pathfinding (stable 0v81)
« Reply #143 on: April 01, 2013, 06: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 ;)
Best,
Sven

greg

  • Junior Playmaker
  • **
  • Posts: 68
    • View Profile
Re: A* pathfinding (stable 0v81)
« Reply #144 on: April 05, 2013, 05: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!

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: A* pathfinding (stable 0v81)
« Reply #145 on: April 05, 2013, 10:14:09 AM »
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  ;)
« Last Edit: April 05, 2013, 10:16:32 AM by kiriri »
Best,
Sven

escpodgames

  • Hero Member
  • *****
  • Posts: 686
    • View Profile
    • Assets
Re: A* pathfinding (stable 0v81)
« Reply #146 on: April 17, 2013, 07: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()

Saputo

  • Full Member
  • ***
  • Posts: 107
    • View Profile
Re: A* pathfinding (stable 0v81)
« Reply #147 on: April 18, 2013, 09:30:37 AM »
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.

cyangamer

  • Playmaker Newbie
  • *
  • Posts: 1
    • View Profile
Null Reference Error
« Reply #148 on: May 06, 2013, 09:40:00 PM »
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?

SteveB

  • Playmaker Newbie
  • *
  • Posts: 29
    • View Profile
Re: A* pathfinding (stable 0v81)
« Reply #149 on: May 08, 2013, 03: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:

  • Imported Playmaker
  • Imported AStar
  • Enabled JS
  • Added ScanGraph code at line 1505
  • Imported these Astar Actions

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