Replication: input and animation.

Hello.
I’m trying to set up the replication of the input. On listen-server’s side all fine, but the client does not perceive the input and does not play the animation, but sees the character move from the server. I’ve set up a breakpoint on the server application and the client move function is triggered and gets the correct values during the keys pressed on the client, but the client character does not move.



"PlayerCharacter.h"
UFUNCTION( Server, Reliable, WithValidation )
void Server_MoveRight( float Value );

UFUNCTION( NetMulticast, Reliable )
void Client_MoveRight( float Value );

void MoveRight( float Value );




"PlayerCharacter.cpp"

void APlayerCharacter::MoveRight( float Value )
{
	Server_MoveRight( Value );
}

void APlayerCharacter::Server_MoveRight_Implementation( float Value )
{
	if ( HasAuthority() )
	{
		Client_MoveRight( Value );
	}
}

bool APlayerCharacter::Server_MoveRight_Validate( float Value )
{
	return true;
}

void APlayerCharacter::Client_MoveRight_Implementation( float Value )
{
	AddMovementInput( FVector( 1.0f, 0.0f, 0.0f ), Value );
}


Help please.

Dont think you need custom UFUNCTIONs for simple movement input, it’s already built in with replication. Think as long as you call AddMovementInput() on both client and server (which is only happening on the client in your example) it’ll “just work”. Take a look at CharacterMovementComponent to see what exactly is going on

It was a mistake in my code. My GameState class was inherited from AGameStateBase but not from AGameState. This violated the work. As a result, the variant “from box” and the code I wrote above work.