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"

TopDownProject network navsys : character client is as slow as possible

Hello,

I saw that I couldn't use the NavSys on the client so I made a SetNewMoveDestinationServer function. The SetNewMoveDestinationServer_Implementation will call SetNewMoveDestination to move the character, SUCCESS !

But... now the client character is as slow as possible. I don't understand how and why. I mean it moves on the client and the server perfectly and it has all the animations but it moves at minspeed.

How can I fix that ?

rXp

Product Version: Not Selected
Tags:
more ▼

asked Jan 29 '15 at 10:59 PM in C++ Programming

avatar image

rXp
311 21 16 39

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

Hard to tell. This should not be happening so it's either a bug in movement code that we haven't encountered yet, or it's related to your SetNewMoveDestinationServer_Implementation. If you could share a stripped-down version of your project we could have a look and be more helpful.

Cheers,

--mieszko

more ▼

answered Jan 30 '15 at 09:23 AM

avatar image

MieszkoZ STAFF
7.3k 223 56 408

avatar image rXp Jan 30 '15 at 10:08 AM

Thanks :) it's below

avatar image MieszkoZ STAFF Feb 02 '15 at 05:44 PM

I've used up some time trying to build a repro-project from what you posted just to find out it's not all that's required. If you want us to look at it please share a complete (even though if a stripped-down) version of your project.

Cheers,

--mieszko

avatar image rXp Feb 02 '15 at 07:17 PM

This is a stripped down old version of my project. You will see the Pawn->GetMovementComponent()->Velocity = Pawn->GetMovementComponent()->Velocity * 10; to "fix temporarily" the issue in the charactercontroller.

I had to remove the map file to be able upload it. The map/level file is only a square with some rocks that have collision. link text

(comments are locked)
10|2000 characters needed characters left

As you can see I picked the TopDown project and build on it. For now I don't have much because I need multiplayer from the beginning.

Player controller class :
void AMyTopDownProjectPlayerController::PlayerTick(float DeltaTime) { Super::PlayerTick(DeltaTime);

     // keep updating the destination every tick while desired
     if (bMoveToMouseCursor)
     {
         MoveToMouseCursor();
     }
 
     if (bLaunchSelectedAction)
     {
         APawn* const pawn = GetPawn();
         AMyTopDownProjectCharacter* const character = Cast<AMyTopDownProjectCharacter>(pawn);
         character->LaunchAction();
         bLaunchSelectedAction = false;
     }
 }
 
 void AMyTopDownProjectPlayerController::MoveToMouseCursor()
 {
     // Trace to see what is under the mouse cursor
     FHitResult Hit;
     GetHitResultUnderCursor(ECC_Visibility, false, Hit);
 
     if (Hit.bBlockingHit)
     {
         // We hit something, move there
         SetNewMoveDestination(Hit.ImpactPoint);
     }
 }
 
 void AMyTopDownProjectPlayerController::MoveToTouchLocation(const ETouchIndex::Type FingerIndex, const FVector Location)
 {
     FVector2D ScreenSpaceLocation(Location);
 
     // Trace to see what is under the touch location
     FHitResult HitResult;
     GetHitResultAtScreenPosition(ScreenSpaceLocation, CurrentClickTraceChannel, true, HitResult);
     if (HitResult.bBlockingHit)
     {
         // We hit something, move there
         SetNewMoveDestination(HitResult.ImpactPoint);
     }
 }
 
 void AMyTopDownProjectPlayerController::SetNewMoveDestination(const FVector DestLocation)
 {
     if (Role >= ROLE_Authority)
     {
         APawn* const Pawn = GetPawn();
         if (Pawn)
         {
             UNavigationSystem* const NavSys = UNavigationSystem::GetCurrent(this);
             float const Distance = FVector::Dist(DestLocation, Pawn->GetActorLocation());
             if (NavSys && (Distance > 120.0f))
             {
                 NavSys->SimpleMoveToLocation(this, DestLocation);
             }
         }
         //test force update call event
         ((AMyTopDownProjectCharacter* const)Pawn)->RepChar();
     }
     else{
         SetNewMoveDestinationServer(DestLocation);
     }
 }
 
 void AMyTopDownProjectPlayerController::SetNewMoveDestinationServer_Implementation(const FVector DestLocation)
 {
     SetNewMoveDestination(DestLocation);
 }
 
 bool AMyTopDownProjectPlayerController::SetNewMoveDestinationServer_Validate(const FVector DestLocation)
 {
     return true;
 }
 
more ▼

answered Jan 30 '15 at 09:37 AM

avatar image

rXp
311 21 16 39

(comments are locked)
10|2000 characters needed characters left

Anyone ? For now I update the velocity each time the pawn is moved by the navsys : Pawn->GetMovementComponent()->Velocity = Pawn->GetMovementComponent()->Velocity * 10;

But... it is ugly and can lead to issues in MP.

Can anyone help me ?

rXp

more ▼

answered Feb 02 '15 at 02:44 PM

avatar image

rXp
311 21 16 39

(comments are locked)
10|2000 characters needed characters left
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