I don't understand how to replicate my pawn's movement

I just got into networking and i figured some things out but some others not.
I have this pawn that moves. It has a UFloatingPawnMovementComponent. I want to replicate the movement (position basically) on all clients.
This is not working and i don’t know why. I’ll show you my code.
In the header file:

UPROPERTY(EditAnywhere, Replicated)
		UStaticMeshComponent* birdMesh;

	UPROPERTY(EditAnywhere, Category = Movement, Replicated)
		UFloatingPawnMovement* movementComp;

UFUNCTION(Server, Reliable, WithValidation)
		void serverChangePawnPosition(float deltaTime);

	void changePawnPosition(float deltaTime);
	virtual void serverChangePawnPosition_Implementation(float deltaTime);
	virtual bool serverChangePawnPosition_Validate(float deltaTime);

Now i have 2 ways to change the pawns position. By doing

movementComp->Velocity.Y = movementSpeed;

Or by using the change position function (which i probably understand wrong)

void ABird::changePawnPosition(float deltaTime)
{
	FVector newBirdLoc = GetActorLocation();
	newBirdLoc.Y += movementSpeed * deltaTime;
	SetActorLocation(newBirdLoc, true);

	if (Role < ROLE_Authority)
	{
		serverChangePawnPosition(deltaTime);
	}
}

bool ABird::serverChangePawnPosition_Validate(float deltaTime)
{
	return true;
}

void ABird::serverChangePawnPosition_Implementation(float deltaTime)
{
	changePawnPosition(deltaTime);
}

But both are not replicating the pawn, and also not it’s movement. Maybe the problem starts with the fact that i dont see the other client’s mesh at all.
The way i spawn the mesh, in the pawn’s controller :
In header:

   UFUNCTION(Server, Reliable, WithValidation)
    		void serverSpawnPawn();
    	void serverSpawnPawn_Implementation();
    	bool serverSpawnPawn_Validate();

In source file:

void ABirdController::serverSpawnPawn_Implementation()
{
	FActorSpawnParameters spawnParams;
	ABird* pawn = GetWorld()->SpawnActor<ABird>(ABird::staticclass(), FVector(0, 0, 0), FRotator(0, 0, 0), spawnParams);
	Possess(Cast<APawn>(pawn));
}
bool ABirdController::serverSpawnPawn_Validate()
{
	return true;
}

Then i call the serverSpawnPawn in the begin play function of the controller.
I also notices that Role == ROLE_Authority is true in my pawn so i must not be spawning it right

Depends on how you setup and spawn the pawns.

I am more experienced working with BP but maybe I can still help.

Every actor has a flag (something like “bReplicates”) that needs to be set for actor movement to be replicated. Make sure it’s set to true.

If you don’t see the mesh of other client’s pawns, it sounds like you spawned them from the client (?) Make sure things are spawned on the server only and replicated to the clients. If you spawn things on the client it might be only local and the server doesn’t event know about it hence not replicating it to other clients. Does the server see all the client meshes?

UPDATE:

Many forum posts point to the fact that CharacterMovement has built in replication support that does most of the work for you that other MovementComponents don’t do. If you don’t have a reason not to use it, I’d advise you to just stick with a character instead of only a pawn.

If not, I haven’t found a way to get FloatingPawnMovement to replicate correctly so far. Applying changes directly to your pawns location in a Server function would be the easiest here, and I don’t think the MovementComponent does anything apart from things like MaxSpeed you couldn’t do yourself.

Still find it weird, setting the velocity or adding input vectors of client side FPMs from the server doesn’t change anything, so I really struggle replicating this myself…

Thanks for helping. I just tried adding a pawn spawn on the server but it’s not working. I’m using

UFUNCTION(Server, Reliable, WithValidation)
void serverSpawnPawn();
void serverSpawnPawn_Implementation();
bool serverSpawnPawn_Validate();

Then i call serverSpawnPawn() from begin play of controller, which spawns the pawn. But every client is still only seeing its own pawn. Also the server.

I added a lot of info to the question

Today, I have been working for hours, trying to get this to work myself. But if you downvote me for no reason while I’m only trying to help, I will stop right away… How very unthankful.

I updated my answer with what I found out.

lol i’m sorry i didn’t mean to. I just thought if i change this from an upvote to a downvote, maybe it will appear as unresolved again in the feed. It has nothing to do with you. I definitely appreciate the help bro !