Multicast not called in replays

Hi,

I’m facing an issue with the replay system. In our game we use Multicast functions to propagate events from server to all clients, but when replaying my recorded replays, the multicast functions are never called. As the replay recorder almost behaves like a network client, I thought this wouldn’t have been a problem at all.

Does the demo recorder only records replicated data, and not replicated function calls ?

Thanks.

Hi JB,

Mutlicast function calls should get recorded - UDemoNetDriver::ProcessRemoteFunction handles saving them out. Can you set a breakpoint there and see if that function is getting called?

Thanks for your tip !

ProcessRemoteFunction wasn’t called at all, because GetNetDriver is, I think, not correctly implemented, at least in the 4.12 branch.

Previous code:

UNetDriver* AActor::GetNetDriver() const
{
	UWorld *World = GetWorld();
	if (NetDriverName == NAME_GameNetDriver)
	{
		return (World ? World->GetNetDriver() : nullptr);
	}

	return GEngine->FindNamedNetDriver(World, NetDriverName);
}

I changed it to:

UNetDriver* AActor::GetNetDriver() const
{
	UWorld *World = GetWorld();
	if (NetDriverName == NAME_GameNetDriver)
	{
		return (World ? World->DemoNetDriver : nullptr); //<<-this
	}

	return GEngine->FindNamedNetDriver(World, NetDriverName);
}

And now it works fine.

Thanks a lot.

Hi JB,

It seems like something else is going on here if that is fixing this problem - I think you’ll see some problems during gameplay, because when CallRemoteFunction is called on the actor (among other places), it will get the demo net driver instead of the game net driver, which is wrong.

UDemoNetDriver::ProcessRemoteFunction gets called from UIpNetDriver::ProcessRemoteFunction in this block of code:

			// Replicate any RPCs to the replay net driver so that they can get saved in network replays
			UNetDriver* NetDriver = GEngine->FindNamedNetDriver(GetWorld(), NAME_DemoNetDriver);
			if (NetDriver)
			{
				NetDriver->ProcessRemoteFunction(Actor, Function, Parameters, OutParms, Stack, SubObject);
			}

Yeah I saw that yesterday and already fixed it in almost the same way as you, I was about to post the right fix here but you outguessed me :slight_smile: