Multiplayer quick start tutorial illogical behavior

Hello, I have finished the [multiplayer quick start tutorial][1] just now. But I am confused because the OnHealthUpdate() method doesn’t work as it suppose to work.

I extended the behavior of the ThirdPerson character as per the tutorial says. It has a method called OnHealthUpdate(). When CurrentHealth variable is updated, this method is called as to notify the whole actor. According to the method’s logic, it should print a different text on the screen depending on whether the game is client or server.

void AThirdPersonMPCharacter::OnHealthUpdate()
{	
	const float MessageDuration = 60.0f;
	// Client specific functionality
	if (IsLocallyControlled()) {
		FString healthMessage = FString::Printf(TEXT("You now have %f health remaining."), CurrentHealth);
		GEngine->AddOnScreenDebugMessage(-1, MessageDuration, FColor::Green, healthMessage);

		if (CurrentHealth <= 0)
		{
			FString deathMessage = FString::Printf(TEXT("You have been killed."));
			GEngine->AddOnScreenDebugMessage(-1, MessageDuration, FColor::Red, deathMessage);
		}
	}

	// Server specific functionality
	if (GetLocalRole() == ROLE_Authority) {
		FString healthMessage = FString::Printf(TEXT("%s now has %f health remaining."), *GetFName().ToString(), CurrentHealth);
		GEngine->AddOnScreenDebugMessage(-1, MessageDuration, FColor::Green, healthMessage);
	}
}

However, when I test the game, this logic doesn’t execute correctly. I ran the game in the editor with 2 players and one being as listening server and other is client. I can see the both messages in both client and server. Could someone explain me this? Should I see client-specific message in client and server-specific message in server?

Hi! I just had this exact problem - it’s because the two (or more) instances are running under one process. If you go into Editor Preferences → Play → Multiplayer Options, and untick “Run Under One Process”, it should work just fine :slight_smile:

I went under the same bug, it would be nice to notify the reader on the tutorial

I experienced this issue also, and thank you for offering a solution, however, with it running under separate processes its incredibly laggy. Its far from the experience when running under the same process and I can imagine this making it very difficult to play test a game.

Any thoughts?