Small Bugs in Multiplayer Tutorial

Hi, I found two small issues in the C++ Multiplayer tutorial:

  1. In the code, you’re referring to AActor::Role., which used to be public up until 4.24. However, in 4.25 it has become private, so this should be changed to GetLocalRole(). (This is mentioned in the Source code for 4.24, but not in 4.25. So, when trying to run the tutorial with 4.25, the user get’s an error with no hint what to do about it.)

  2. In paragraph 5, it says: “In ThirdPersonMPProjectile.h, add the <…>”
    This needs to be"In ThirdPersonMPProjectile.cpp, add the <…>". Also, the headline in the code-box below refers to the header file instead of the cpp file.

Found more issues:

  1. In the last sentence of paragraph 5 also uses Role directly.
    I think it would be better to use this instead:


if (HasAuthority()) {
 <...>
}


  1. In section 6.4, there’s this code:


UWorld* World = GetWorld();
World->GetTimerManager().SetTimer(FiringTimer, this, &AThirdPersonMP424Character::StopFire, FireRate, false);
HandleFire();


I guess the “AThirdPersonMP424Character” is a typo?

Hey hwacookie! Thanks for pointing these out to us. Just to be sure, are you talking about: https://docs.unrealengine.com/en-US/…art/index.html?

Hey @echo_four ! Yes he is talking about that post. I was looking for a solution and found this post. In the Testing Multiplayer

https://docs.unrealengine.com/en-US/Gameplay/HowTo/Networking/TestMultiplayer/index.html

these pictures are outdated too, in 4.25 there are no Dedicated server option, only Nr of Players and Net Mode, which is a bit confusing for beginners like me to follow and set it up correctly for testing, because all Net modes provide different results. Thanks!

Also, in section 4. Creating a Projectile with Replication, the setting of relative location and scale in step 8:




if (DefaultMesh.Succeeded())
{
    StaticMesh->SetStaticMesh(DefaultMesh.Object);
    StaticMesh->RelativeLocation = FVector(0.0f, 0.0f, -37.5f);
    StaticMesh->RelativeScale3D = FVector(0.75f, 0.75f, 0.75f);
}



is assumable outdated and needs to be:



    StaticMesh->SetRelativeLocation(FVector(0.0f, 0.0f, -37.5f));
    StaticMesh->SetRelativeScale3D(FVector(0.75f, 0.75f, 0.75f));


Further, though the code compiles, I get this error (using Rider for Unreal):

I use forward declaration in the ThirdPersonMPProjectile.h-file and have included the component header in ThirdPersonMPProjectile.cpp:


#include "GameFramework/ProjectileMovementComponent.h"

And in section 5. Making the Projectile Cause Damage, step 4:

This line:


UGameplayStatics::ApplyPointDamage(OtherActor, Damage, NormalImpulse, Hit, Instigator->Controller, this, DamageType);

assumably should be:


UGameplayStatics::ApplyPointDamage(OtherActor, Damage, NormalImpulse, Hit, GetInstigator()->Controller, this, DamageType);

Thanks everyone for chiming in and submitting all this great feedback! I’ve put all of this into a ticket and passed it along to the rest of the Docs team. I’ll update this thread once I have an update on the ticket.