Season 15 and Demonbuddy, working as of 21th September 2018!
  • Visit Rebornbuddy
  • Visit Demonbuddy

How to use AStarNavigator

Discussion in 'Community Developer Forum' started by cljnnn, Jan 30, 2018.

Tags:
  1. cljnnn

    cljnnn New Member

    Joined:
    Feb 15, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hi, I am working on building my own navigator.this is my first C# program. I am sorry if there is stupid code.
    I found AStarNavigator and GaiaNavigator in documentation. GaiaNavigator is running on the server(I read the threads and know that), so the option is AStarNavigator. am I right?

    here is piece of code of demo. it doesn't work, I want to know how to fix it or any suggestion for the own navigator. Thanks.
    Code:
    var g = new Pathfinding.Graph ();
    var myLocation = Core.Player.Location;
    var node1= new Pathfinding.Node (myLocation.X, myLocation.Y, myLocation.Z);
    node1.Id = 1;
    g.AddNode(node1);
    var node2= new Pathfinding.Node (myLocation.X-5, myLocation.Y-5, myLocation.Z);
    node2.Id = 2;
    g.AddNode(node2);
    g.AddArc (new Pathfinding.Arc (node1, node2));
    Navigator.PlayerMover = new SlideMover ();
    Navigator.NavigationProvider = new AStarNavigator(g);
    Navigator.MoveTo(g.NodeById(2).Position);
    
    I got this exception. I fixed it by creating a new class StarNav : AStarNavigator, and implement an empty OnPulse.
    Code:
    System.NotImplementedException:
        ff14bot.Navigation.AStarNavigator.OnPulse()
        ff14bot.Behavior.Pulsator.Pulse(PulseFlags CurrentPulseFlags)
    
    then another exception was thrown. I have no idea about this.
    Code:
    [23:55:07.597 D]
    System.NullReferenceException: 
       Pathfinding.AStar.SearchPath(Node StartNode, Node endNode)
       ff14bot.Navigation.AStarNavigator..(CloseNode )
       System.Linq.Enumerable.WhereSelectListIterator`2.MoveNext()
       System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
       ff14bot.Navigation.AStarNavigator.MoveTo(MoveToParameters parameters)
       ff14bot.Navigation.Navigator.MoveTo(Vector3 location, String destination)
    
     
  2. zzi

    zzi Active Member

    Joined:
    Mar 10, 2016
    Messages:
    276
    Likes Received:
    39
    Trophy Points:
    28
    GaiaNavigator is depreciated, if you want to use the server based navigation you are looking for the

    ff14bot.Pathing.Service_Navigation.ServiceNavigationProvider


    The AStarNavigator is a pain to use, you have to feed the constructor a graph that already has all the nodes and everything that you want in it.

    The profile tools can help you make a graph that you can load in, but loading it is something like:

    Code:
    
    using (StreamReader streamReader = new StreamReader(File.OpenRead(path), Encoding.UTF8))
                {
                    XElement xelement = XElement.Load(streamReader, LoadOptions.SetLineInfo);
                    var graph = new Graph();
                        result = new XmlEngine(null, false).Load(graph, xelement);
                }
    
    iirc

    For the
    NotImplementedException just implement your own onpulse event

    Code:
    public override void OnPulse()
    {
    }
    
    second exception just looks like your graph isn't setup correctly.



    Not sure why you are trying to use the AStarNavigator, I don't know how long it will stick around for.

    The ServiceNavigator & Flightor let you do like 99% of everything. granted there are a few hickups now and then, but those can mostly be worked around, or fixed.
     
  3. cljnnn

    cljnnn New Member

    Joined:
    Feb 15, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    Hi zzi, Thanks for your help. Here is my situation, I want to level my character up quickly in PODD(Palace of the Dead deep).
    I tried the bot DeepDive which is from you, it's great and awesome, thanks.
    The only problem for me is that I can't use it within human team because it always intends to get all of the treasure, that makes my team member crazy.
    It seems that it's not designed for human team.

    I try to make my own bot, now it can target members' enemy with movement. but I have to navigate it by myself.
    The ServiceNavigator isn't available in PODD due to the random map.
    Here is my initial idea to build the navigation for team job. we build a graph based on the waypoints from all team members dynamically , those waypoints are safe(like edge of the wall) and walkable.
    Is this reasonable?is there a way to approach this?

    Thanks in advance.
     
  4. zzi

    zzi Active Member

    Joined:
    Mar 10, 2016
    Messages:
    276
    Likes Received:
    39
    Trophy Points:
    28
    Service navigator would work fine if you are just following along and killing mobs that your team starts to attack. And yes, how you are describing using AStarNavigator is how one of the verry first versions of DeepDive worked ;)

    Potd isn't "Random" in the sense of games like Path of Exile or Diablo. The levels all have mostly fixed layouts with walls that are enabled / disabled to create the randomness.


    Yea, I know POTD lacks any sort of party logic. we had some for a while but it was removed during a rewrite because I didn't like it. One of these days when DeepDive is opensourced you'll be able to just edit it how you want :)
     
    cljnnn likes this.
  5. cljnnn

    cljnnn New Member

    Joined:
    Feb 15, 2015
    Messages:
    5
    Likes Received:
    0
    Trophy Points:
    1
    That is great, Can't wait for the coming day!!! Cheers!!!
     
  6. zzi

    zzi Active Member

    Joined:
    Mar 10, 2016
    Messages:
    276
    Likes Received:
    39
    Trophy Points:
    28
    ^^

    it might be a little while yet. still working on fixing everything from 4.2 T_T
     
  7. Steven_Drake

    Steven_Drake New Member

    Joined:
    Jun 26, 2018
    Messages:
    3
    Likes Received:
    0
    Trophy Points:
    1
    Its really helpful discussion Thanks for the knowladge.
     

Share This Page