• Visit Rebornbuddy
  • Visit Panda Profiles
  • Visit LLamamMagic
  • What Navigator provider should I use?

    Discussion in 'Community Developer Forum' started by Neverdyne, Dec 4, 2014.

    1. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      So I've been testing some things with a bot base recently, and am currently stuck on understanding navigator providers. How do I make my bot base to accept Navigator.MoveTo(position)? Furthermore, is there a way to ignore the Z coordinate and simply try to move based on the XY coordinate?
       
    2. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      Something must set navigator before you can use Navigator.MoveTo(somecoords). Typically the botbase does this. Navigator.NavigationProvider = new GaiaNavigator();

      I think Navigator is just a wrapper for a navigation provider, either AStar or Gaia. It appears that way but I never got a response on my thread. I also have no idea what the differences are between AStar and Gaia.

      To move while ignoring the mesh and z axis, you want SlideMover.
      Navigator.PlayerMover = new SlideMover();

      When you use SlideMover to move, it just sets your rotation to face the point and starts moving you forward.

      btw, I would kill for strafing control.
       
    3. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      Uh, this is getting frustrating. So I made a quick botbase to test avoidance of telegraphed attacks, it's just a quick test. The point is to make the player move in a perpendicular line whenever a cone attack is cast. However, I cannnot seem to make the movement perpendicular. I believe my vectors are correct, but for whatever reason it just won't move in a 90 degree direction. Here's the bot if you want to test it, it works with any class, it just avoids the cones. You can test it on the buffalo mobs near Costa del Sol, their attack is on the database. Just start the bot, go to one buffalo and stay there smacking it with auto attack until he does the cone, the player moves but not perpendicular :(
       

      Attached Files:

    4. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      I don't think you're calculating the vectors right, but that type of math has always confused me :S
      You should just use MathEx
      Code:
      MathEx.GetPointAt(Core.Me.Location, someDistance, MathEx.NormalizeRadian(Core.Me.Heading+ (float)Math.PI/2));
      something like that
       
    5. kagamihiiragi17

      kagamihiiragi17 Community Developer

      Joined:
      Jun 24, 2014
      Messages:
      873
      Likes Received:
      25
      Trophy Points:
      0
      GaiaNavigator uses the navmesh, AStar uses a local mesh/waypoint profile.

      I personally wouldn't recommend omitting an axis while moving. If you want to move to a flank to avoid an AOE, I'd recommend checking:

      Clio.Common.MathEx.CalculatePointAtSide(Clio.Utilities.Vector3 target, float targetFacingInRadians, float distanceToTarget, bool rightSide)

      That will return a Vector3, and then move to that point to avoid an AoE.
       
    6. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      Omitting z axis while moving doesn't matter in this case. If you're using slidemover size it will ignore it anyways...

      If you want to use a mesh move then you can't just straight send a point you generate because it will frequently not be on the mesh and there's no way to get a nearest mesh point from a point. You would have to use move to random spot within, which can cause it's own problems. Besides, nav calls have a bit of lag.
       
    7. kagamihiiragi17

      kagamihiiragi17 Community Developer

      Joined:
      Jun 24, 2014
      Messages:
      873
      Likes Received:
      25
      Trophy Points:
      0
      If you're getting a Vector3 at the flank of an enemy, it should be on the mesh or close enough to being on the mesh that it really shouldn't be a problem. The navigator should be able to figure it out. Yes there is a tiny bit of lag, but not much at all. Otherwise, call a SlideMover and move yourself to the flank that way with no lag. Either way it doesn't really matter.
       
    8. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      True it's only a split second lag, unless the spot your calculating is moving and then it causes nav call spam.

      But it is not close enough, if you're on a slant/hill and the point is off by ~1f, the nav will not work. I have tested heavily.
       
    9. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      I'll try this out, thanks guys. By they way, how do you "read" the mesh? Where's the mesh data at?
       
    10. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      It looks like Managers.MeshProfile is only to load local mesh files. And even if you have local files, I don't think there's any api for interactions/information besides basic Navigator calls.

      I wish that I'm wrong and someone will correct me.

      btw, the normal nav files are on a server and we never see/interact with them directly.
       
    11. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      Ah I see, alright. Well for now it works with CalculatePointAtSide, made a combat routine that uses it. However I don't know how we could make it so other combat routines uses it. I'll post something tomorrow.
       
    12. kaihaider

      kaihaider Community Developer

      Joined:
      May 18, 2010
      Messages:
      1,325
      Likes Received:
      5
      Trophy Points:
      38
      I had always hoped that once the database required to make this work was created, the cr devs would make their own implementations since there are so many ways to scan adds/calculate safety/move point/use interrupts and whatever other idea they come up with along the way.

      Could use a plugin, edit crs/check for compatibility and just freeze combat if it's not.

      Not what I would like but w/e works

      edit:
      plugin would let people use kupo
      guess it would be a good thing to do
       
      Last edited: Dec 5, 2014
    13. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      Yeah I see your point, especially in regards to interrupts. As a plugin, if we hook as a pre-combat behavior, CRs won't be give the chance to interrupt. I've just finished the plugin, I'll post it tomorrow once I test it. But you can also just use the SpellShapeDatabase.cs class in it on your CR and not use the plugin. I've also combined the spell logger with the new plugin, so that it only logs spells that are not in the database already. That way people don't send unnecessary screenshots.
       
    14. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      Botbases set the navigaitonprovider and playermover on startup and clear them on stop.
      Code:
                  Navigator.PlayerMover = new SlideMover();
                  Navigator.NavigationProvider = new GaiaNavigator();
      
      
      NavigationProviders role is to figure out how to get from point A to B. PlayerMovers role is to interface with the game to move the character.


      Gaia nav is the remote navigation service we provide, astar is for the orginal profile system and will be eventually phased out.


      Don't create separate instances of gaianav, this is a very fast way to get your self banned from the nav server. If you want to test avoidance logic Id recommend modifying the raidbot botbase to use the above code and insert the following into its behavior code.

      Code:
      new HookExecutor("PreCombatLogic"),
      
      that way you can easily test your logic.

      As for the delay....absolute worst case scenario would be like 500ms thats still tons faster then any human could react.
       
    15. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      Thanks Mastahg, I'm trying to do what you told me about the PreCombatLogic hook, but it doesn't seem to be called testing it with FateBot. This is what I'm doing when the plugin is enabled:

      Code:
      var avoidanceBehavior = new Action(r => AvoidTelegraph());
      TreeHooks.Instance.AddHook("PreCombatLogic", avoidanceBehavior);
      The logger shows:

      Code:
      Added new hook [PreCombatLogic] b67c1549-206e-48a3-8276-e284e03579ac
      I added a Logging call as the first thing to the AvoidTelegraph method as a test, and it is never called. Do you know what it might be?
       
    16. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      Post full log
       
    17. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      After further testing it seems the hook works if I hook it on a Pulse(). I could make an IfUnhooked bool check on the first Pulse(), but then is there a way for a plugin to know when the bot is stopped so I can clear the flag?
       
    18. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      I have a feeling the hook might be getting cleared. Post a full log.
       
    19. Neverdyne

      Neverdyne Community Developer

      Joined:
      Sep 12, 2014
      Messages:
      649
      Likes Received:
      18
      Trophy Points:
      18
      Here's the logs with and without the Pulse() hook.
       

      Attached Files:

    20. mastahg

      mastahg Administrator Staff Member

      Joined:
      Feb 27, 2011
      Messages:
      5,343
      Likes Received:
      383
      Trophy Points:
      83
      Inside onenabled

      Code:
      TreeHooks.Instance.OnHooksCleared += OnInstanceOnOnHooksCleared;
      
      put the treehook code there
       

    Share This Page