Download

Server function not running on Server...

I can’t get my head around this… is there any glaring reason why this Server function doesn’t actually run on the Server? If I place the code in a Role == Authority check, I get no messages on-screen from it, which must mean it’s not actually being sent to the Server at all… I can’t make sense of it :confused:



void ANTPawn::Tick(float DeltaSeconds)
{
	Super::Tick(DeltaSeconds);

	if (IsLocallyControlled())
	{
		// If Client, tell server what input is
		if (Role < ROLE_Authority)
		{
			Server_SimulateInput_Implementation(InputStates);
		}
	}

	if (Role == ROLE_Authority && !IsLocallyControlled())
	{
		GEngine->AddOnScreenDebugMessage(-1, 0.5f, FColor::Green, FString::Printf(TEXT("Input %i %i %i %i"), InputStates.Forward, InputStates.Backward, InputStates.Right, InputStates.Left));
	}

	CalculateAccel(DeltaSeconds, InputStates);
}

void ANTPawn::Server_SimulateInput_Implementation(const FCubeInput FromInput)
{
	InputStates = FromInput;
	GEngine->AddOnScreenDebugMessage(-1, 0.5f, FColor::Red, FString::Printf(TEXT("Input %i %i %i %i"), InputStates.Forward, InputStates.Backward, InputStates.Right, InputStates.Left));
}


EDIT: Figured it out like 2 seconds later… you don’t add _Implementation when you call it… duh. Been sitting with this for like an hour :@