News Forums RAIN General Discussion and Troubleshooting Random Navigation Target

This topic contains 9 replies, has 2 voices, and was last updated by  binary 1 month ago.

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #34985

    binary
    Participant

    Hi,

    for a rouge i’d like to have my monsters wander between random placed points ( Navigation Targets ).
    Basically i try to do what the sample ChooseWanderPosition does but with defined POI’s.
    I found NavigationManager.Instance.GetNavigationTarget(name) so far but i need a list of all random generated NavTargets, which is not exposed by NavigationManager, so i could pick one randomly.

    How do i get all NavigationTarget’s?

    • This topic was modified 1 month, 2 weeks ago by  binary.
    #34996

    prime
    Keymaster

    Unfortunately, the accessor you need is missing from the Navigation Manager. That’s an oversight on our part and I just added it. A Property that returns a readonly list of all registered NavigationTargets will be available in the next release.

    Until then you might just keep your own global list of nav targets as you randomly generate them.

    #35012

    binary
    Participant

    Thank you!

    In general, how do i get such a reference into an Action?
    Atm i have an extra GamObject say, POI_Collector that does a FindObjectsOfType<NavigationTargetRig>() and copy’s the targets from the rigs into a List. In the Actions Start() (how often is this called anyway?) i do then a Find(“POI_Collector”) to get to my List …
    I know that’s not good practice, how is it intended to be done? How can i feed data by value/reference into the AI?

    • This reply was modified 1 month, 2 weeks ago by  binary.
    #35020

    prime
    Keymaster

    The Start action is called every time a behavior node is run, except when that node is already running. The nodes themselves can keep history - they aren’t destroyed and recreated as the tree is run, so often you will do a check like:

    if (tCollectorObject == null)
    {
      tCollectorObject = Find("POI_Collector");
    }

    This means the expensive call will only ever happen once, even if Start is called multiple times.

    Since your POI_Collector is already in the scene, you could just add an entry to the AI Memory in the inspector. GameObject is one of the valid types, so you could set it up in advance and avoid the Find(“”) call at runtime.

    #35031

    binary
    Participant

    Nice, got it now. Thanks for your patience and not RTFM’ing me. :)

    #35046

    binary
    Participant

    Sooner or later my AI’s get stuck when this kind of graph gets generated:
    Look here pls
    (Allow off graph move is off)

    The AI could have walked that same way several times before, without any problems but sooner or later this happens by chance.
    Any idea why this happens and how to avoid it?

    • This reply was modified 1 month, 2 weeks ago by  binary.
    • This reply was modified 1 month, 2 weeks ago by  binary.
    • This reply was modified 1 month, 2 weeks ago by  binary.
    #35051

    prime
    Keymaster

    Not sure - it’s a little hard to tell from that screen shot. Is the destination target moving or stationary?

    #35055

    binary
    Participant

    Stationary NavigationTarget. From where the graph hits the mesh, everything is calculated correct on the nav mesh.
    You can grab my test runtime here:
    MutantWatch
    ‘G’ generates a new level and ‘C’ cycles through cams.

    The error happens by chance in the bigger hall down at the green lit door. Maybe you can spot something.

    • This reply was modified 1 month, 1 week ago by  binary.
    • This reply was modified 1 month, 1 week ago by  binary.
    #35067

    prime
    Keymaster

    First off - your game looks really great so far. Those are randomly generated levels? Awesome.

    As far as the pathing issue - we think we know what that is, and we think it is fixed in the new version of RAIN we’ll be releasing this week. If you need the fix sooner, email jester (@rivaltheory.com)

    Thanks

    #35244

    binary
    Participant

    Thanks!
    The recent release (2.1.8.0) fixed the problem. :)

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in to reply to this topic.