x

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"

Why is NavData not replicated to clients?

I tried playing Top Down template with a (listen) server and 2 clients but clients cannot move. Then i executed Show Navigation console command and clients didnt had any nav data (green area). Is this intentional or a bug?

I used a workaround like this (Big Thanks to Omberone. Check his answer here)

TopDownNetworkTestCPPlayerController.h

 UFUNCTION( reliable, server, WithValidation )
 void MoveToDestination( const FVector Destination );
 bool MoveToDestination_Validate( const FVector Destination );
 void MoveToDestination_Implementation( const FVector Destination );

TopDownNetworkTestCPPlayerController.cpp:

 bool ATopDownNetworkTestCPPlayerController::MoveToDestination_Validate( const FVector Destination )
 {
     return true;
 }
 
 void ATopDownNetworkTestCPPlayerController::MoveToDestination_Implementation( const FVector Destination )
 {
     APawn* const Pawn = GetPawn();
     if (Pawn)
     {
         UNavigationSystem* const NavSys = UNavigationSystem::GetCurrent( this );
         if (NavSys && (FVector::Dist( Destination, Pawn->GetActorLocation() ) > MIN_CLICK_DISTANCE))
         {
             NavSys->SimpleMoveToLocation( this, Destination );
         }
     }
 }

Product Version: Not Selected
Tags:
more ▼

asked Feb 24 '15 at 09:41 AM in Using UE4

avatar image

ryanjon2040
1.6k 55 43 92

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

1 answer: sort voted first

This is intentional. By default only AI is using navmesh and AI lives only on the server. Also, replicating navigation data would saturate your connection really fast. The only option would be to have static navmesh loaded on clients, but that requires changes to C++ code (meaning it's not an exposed feature you can enable).

Cheers,

--mieszko

more ▼

answered Feb 24 '15 at 10:27 AM

avatar image

MieszkoZ STAFF
7.3k 223 57 412

avatar image ryanjon2040 Feb 24 '15 at 10:59 AM

Thanks for the info MieszkoZ! :)

So if i want to make an RTS multiplayer game, how should i proceed? I mean if NavMesh is only on server then how can clients place their buildings and move around them?

Plus what changes should i make to load static navmesh on clients?

avatar image MieszkoZ STAFF Mar 04 '15 at 10:00 AM

Regarding loading navmesh on clients you should start by enabling navigation system creation on clients - look for CreateNavigationSystem and cases when it's not being called.

Regarding new buildings and navmesh, regardless of where the navmesh is, replicating building actor creation should be enough to trigger navmesh update (provided you have navmesh set up for runtime generation).

(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