What i want:
A map dynamically spawned via construction script by the server based on his inputs that gets replicated to the clients. I tried everyone to spawn his own map but the actor interaction and random rolls are messed up that way.
Map is only spawned on server, not on clients. While the server thinks players are fine, on the client they start freefalling (tested via listen server / positioning errors).
How the map generator works:
The generator itself is an componentless actor with everything done in construction script. After an authority switch i have 2 mandatory inputs, TileCount x and y. The script loops through each and based on simple math and randoms spawns blueprint child actors as well as static meshes.
What i tried so far:
I set replication on the generator itself as well as every bp it is using to spawn actors. I tried different variations including setting all except OnlyRelevantToOwner to true.
This log message get logged for roughly every actor i create in my generator, i have the feeling this has something to do with the problem:
LogNetPackageMap:Warning: FNetGUIDCache::SupportsObject: ChildActorComponent /Game/Maps/UEDPIE_1_Test.Test:PersistentLevel.MapGenerator_C_1.ChildActorComponent_1463 NOT Supported. LogNet:Warning: Received invalid actor class on channel 10 LogNet: Server connection received: ActorChannelFailure
EDIT: I forgot telling that i just dragged the MapGenerator object in my level. I got a babystep further now by instead of dragging it into the level,i spawn it through the level blueprint on EventBeginPlay. It actually spawn everything now…i still get those warnings (the others vanished):
LogNetPackageMap:Warning: FNetGUIDCache::SupportsObject: ChildActorComponent /Game/Maps/UEDPIE_1_Test.Test:PersistentLevel.MapGenerator_C_124.ChildActorComponent_6269 NOT Supported.
Problem is, after everything spawns (in what seems like the right location) they all get teleported on top of each other. I did replicate all transforms/locations within the map generator.
I changed all objects to be static instead of movable. Now they all stay in place and are working fine, i get tons of
LogPhysics:Warning: MoveFixedBody: Trying to move component % with a non-Movable Mobility. warnings though which revealed the actual problem…every spawned object gets moved to 0/0/0 after a short delay.
Also the lighting is now fubar. All static objects have no lighning build at spawn and i didn’t figure out how to do that yet.
Had to replace AddStaticMeshComponent with AddChildActor because even though static meshes had collision they did not render at clients.
But i just played my first local game with my mate and all (gamelogic and stuff, destroying spawned objects) seemed to work perfectly fine in multiplayer which is nice.