CategoriesC++Unreal Engine

Syncing random (animation) between clients.

In multiplayer projects there are cases when you need sync random (not only for animations) between clients; The first and the obvious idea is to use Random Stream and seed; But there’s a question how to sync the seed between clients and also make it unique for all actors that will be in use of it. The solution is simple and elegant.

Firstly we need to uniquly identify Actors between the clients and server.

C++
int32 UPB_BlueprintFunctionLibrary::GetNetGIUD(UObject* WorldContextObject, AActor * InActor)
{
	UWorld* World = WorldContextObject->GetWorld();
	
	if(!World->IsGameWorld())
	{
		return 0;
	}
	
	FNetworkGUID NetId = World->GetNetDriver()->GuidCache->GetOrAssignNetGUID(InActor);
	int32 Seed = NetId.ObjectId;
	int32 Default = FNetworkGUID::GetDefault().ObjectId;
	
	// can't find NetGUID in NetGUIDLookup, default was assigned
	ensureAlways(Seed != Default);
	
	return Seed;
}

CategoriesC++Unreal Engine

Unknown structure in BPs during cooking after updating the engine

After updating engine from 5.4 to 5.5 there were a lot of errors in BP_PB_MainMenuGameMode with log “unknown structure“ in PlayFab async nodes.

LOG
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_3EA289BF44DE58647EEDBE94DBFBAFD2:response'. Unknown structure.
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_0B1C352942D5F143C8B4D8A25DA80CEF:response'. Unknown structure.
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_1A0EB2EA43AFF9FF4ACD61B5B2066B5C:response'. Unknown structure.
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_DCC86BA4449C14B1ACDFE0814C55A2F3:response'. Unknown structure.
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_21231BFD4BE61A95E8D611AC2FB07AF8:response'. Unknown structure.
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_B1421B304D52951825D766BDA0EC6AA0:response'. Unknown structure.
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_A405560142B55F6A1A0094901137665F:response'. Unknown structure.
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_9FA6414944FCA3602E478EA88220A34F:response'. Unknown structure.
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_3E8E60F04A8D6D8BBA6A8282BFB43CFA:response'. Unknown structure.
UATHelper: Packaging (Windows): LogProperty: Error: FStructProperty::Serialize Loading: Property 'StructProperty /Game/Core/GameModes/BP_PB_MainMenugameMode.BP_PB_MainMenuGameMode_C:OnPlayFabResponse_7A2E03454653A83351BF839F8612993A:response'. Unknown structure.

The error points to response structure of type FPlayFabBaseMode.