playMaker

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

kiriri

  • Hero Member
  • *****
  • Posts: 506
    • View Profile
Re: A* pathfinding (stable 0v808)
« Reply #105 on: February 28, 2013, 03: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.
Best,
Sven

escpodgames

  • Hero Member
  • *****
  • Posts: 686
    • View Profile
    • Assets
Re: A* pathfinding (stable 0v808)
« Reply #106 on: February 28, 2013, 01:09:23 PM »
Yeah just the three errors, all complaining about the same issue.

escpodgames

  • Hero Member
  • *****
  • Posts: 686
    • View Profile
    • Assets
Re: A* pathfinding (stable 0v808)
« Reply #107 on: February 28, 2013, 06: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

kiriri

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

escpodgames

  • Hero Member
  • *****
  • Posts: 686
    • View Profile
    • Assets
Re: A* pathfinding (stable 0v808)
« Reply #109 on: March 01, 2013, 05:17:30 PM »
Awesome! You're a legend Sven!!

kiriri

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

kiriri

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

escpodgames

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

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: A* pathfinding (stable 0v808)
« Reply #113 on: March 08, 2013, 06: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?
« Last Edit: March 08, 2013, 07:12:57 PM by Lane »

kiriri

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

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: A* pathfinding (stable 0v808)
« Reply #115 on: March 09, 2013, 12: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!

kiriri

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

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: A* pathfinding (stable 0v808)
« Reply #117 on: March 09, 2013, 04: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.
« Last Edit: March 09, 2013, 04:39:17 PM by Lane »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: A* pathfinding (stable 0v808)
« Reply #118 on: March 09, 2013, 04: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.
« Last Edit: March 09, 2013, 05:28:09 PM by Lane »

Lane

  • Administrator
  • Hero Member
  • *****
  • Posts: 2488
  • Yup.
    • View Profile
    • Cleverous
Re: A* pathfinding (stable 0v808)
« Reply #119 on: March 10, 2013, 08: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.