Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

A* Custom pathing

I am creating a custom path node system to use as the default unreal isn't for flying things

I have created a component that i am using as a path node to use in the A* algorithm. i have collected these components in an array in a separate navigation class that is used to search the array and return a rout.

The system works when only 1 pawn is using the system. I am assuming that it doesn't work with multiple pawns as each pawn can be accessing the nodes at the same time if they are in different threads.

is there a better way to deal with this issue other than creating a struct for each path node in each pawn and copying the components relevant details e.g. g,h,location, etc <- i don't want to do this for performance reasons if i can do it a better way.

with your responses bear in mind that i am a novice coder and will probably need very basic / step by step explanations.

Product Version: UE 4.13
more ▼

asked Oct 18 '16 at 02:44 AM in C++ Programming

avatar image

3 1 4 4

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

I'm not doing to give you step by step instructions, because that would take a lot of time to write it down (actually it would be quicker to just implement it! :D ) but I've figured it's better to give you a answer than to give you nothing.

I'd suggest you created a new navigation data type. You do that by implementing a class inheriting from ANavigationData. This will allow you to add custom FindPath implementations (see how RecastNavMesh does it). Once you have the new navigation data type you'll need to add a supported agent information, this one's trivial, just go to Project Settings -> Navigation System and add an entry to SupportedAgents array and have the new entry point at your navigation type. If you don't use any other navigation type in your project this will make your navigation type be the main navigation type for the game, and that means you don't need any additional setup, all the PathFollowingComponents and generic FindPath calls will take advantage of your code.

One note, unless you manually make sure your code runs on multiple threads the gameplay code in UE4 is always run in a single thread. It's a strong assumption and unless you really have to go wide I would strongly advice to stay on the game thread (especially if you're a novice coder).

Regarding A* implementation that can be used by multiple agents at "the same" time see if you can figure out how to use FGraphAStar. We're successfully using it both in Paragon and Fortnite, but there's not example of usage in the engine/AIModule code just yet (sorry!).



more ▼

answered Oct 18 '16 at 03:19 PM

avatar image

MieszkoZ STAFF
7.3k 223 57 412

avatar image Dantissimo Oct 19 '16 at 06:04 AM

TY for your time. What you said made me realise that what i thought the issue was (threading) was not the problem. the issue was that the logic had a flaw that made the process take 2 ticks not 1 so the pawns messed with each others result

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question