Multicast Executed On Server Not Executing On All Clients

I am currently developing a multiplayer prototype, via a listen-server.
In the game, the player is able to enter/exit vehicles, and this is where it goes wrong:

After interacting with the vehicle (client-side) a function gets called on the player controller, that executes on the server (ServerEnterCar), which on its turn calls a function on the clients via multicast (ClientEnterCar).

This logic works completely fine when it is called from a client (so not the server client)
but when it is called from the server client itself, it is not being executed on the other clients.

Controller.h

	void TryEnterCar(AMyWheeledVehiclePawn* InPawn);
	UFUNCTION(Server, Reliable, BlueprintCallable)
	void ServerEnterCar(AFreeroamPlayerController* controller, AMyWheeledVehiclePawn* InPawn, APlayerCharacter* InPlayerCharacter);
	UFUNCTION(NetMulticast, Reliable, BlueprintCallable)
	void ClientEnterCar(AFreeroamPlayerController* controller, AMyWheeledVehiclePawn* InPawn, APlayerCharacter* InPlayerCharacter, bool setAsDriver);

	UFUNCTION(BlueprintImplementableEvent)
	void ServerEnterCarBP(AFreeroamPlayerController* controller, AMyWheeledVehiclePawn* InPawn, APlayerCharacter* InPlayerCharacter);
	UFUNCTION(BlueprintImplementableEvent)
	void ClientEnterCarBP(AFreeroamPlayerController* controller, AMyWheeledVehiclePawn* InPawn, APlayerCharacter* InPlayerCharacter, bool setAsDriver);

Controller.cpp

void AFreeroamPlayerController::TryEnterCar(AMyWheeledVehiclePawn* InPawn)
{
	if (!PlayerCharacter)
	{
		PlayerCharacter = GetPawn<APlayerCharacter>();
	}

	if (PlayerCharacter)
	{
		ServerEnterCar(this, InPawn, PlayerCharacter);
	}
}


void AFreeroamPlayerController::ClientEnterCar_Implementation(AFreeroamPlayerController* controller, AMyWheeledVehiclePawn* InPawn, APlayerCharacter* InPlayerCharacter, bool setAsDriver)
{
	GEngine->AddOnScreenDebugMessage(-1, 15.0f, FColor::Yellow, TEXT("CLIENT: ENTER CAR"));

	ClientEnterCarBP(controller, InPawn, PlayerCharacter, setAsDriver);
}

void AFreeroamPlayerController::ServerEnterCar_Implementation(AFreeroamPlayerController* controller, AMyWheeledVehiclePawn* InPawn, APlayerCharacter* InPlayerCharacter)
{
	ServerEnterCarBP(this, InPawn, PlayerCharacter);
}

Thanks in advance for the help!

well the multicast is working then so maybe the server just isnt calling it, have you got something blocking that, for instance a switchisremote.

id throw a breakpoint/printstring back and see where the server is losing the call.

Multicasts along with all other replication is dependent on “Relevance”.

Check your Network Cull Distance value. If a player is not in the NCD hemisphere then replication will not apply.

For clarity when a multicast or any other replication task is called the engine checks relevance and priority. If X player does not meet the requirements then the data is not sent to them.

Quick update on this, I still don’t really know what was happening in my specific case.
I checked my Cull Distance, Relevance as RevOverDrive suggested, but nothing seemed to be off there.
I was indeed using some switchisremote nodes in the blueprint section of this actor, but at this point the BP was too much spaghetti to handle.
So I ended up completely starting from scratch, and now it seems to be working properly.

TLDR; I ended up rewriting it from scratch, more CPP based than BP, and it seems to be working now.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.