I think I want to hear other opinions before making a decision on the further technical design of our game.
The players in the game can build amazing courses using physical objects, whereby the objects can trigger each other and so on. In multiplayer mode the players shall work together to build even more complicated courses. So the game distinguishes between build state and simulation state.
We want to have the ability to simulate the course on one client but let the other clients continue building the course in this time.
I see two possible solutions at the moment:
- Use one Actor per modifiable object in the course and turn off the replication for this actor when switching into Simulation Mode.
- Spawn a local Actor for every modifiable Actor in the scene. Then hide the replicated Actors on the simulating clients and start the simulation using the newly spawned actors.
I see a big advantage for 1. from a performance/memory perspective (we only need half as many Actors) but it feels a bit hacky to me. I’m not entirely sure if solution 1. can be achieved easily. I think I also have to switch the Role / RemoteRole of the Actor and there might be problems when the server has two clients whereby both start their simulation and want to have Authority on the Actor.
Solution 2. is conceptually simpler but I’m not sure how many Actors this solution can manage? 1000, 10000 or even more? We have the advantage that we would only spawn physically simulated Actors on the client that would not replicate and therefore have not to adapt the default replication policies of the transformation of actors. We can hide the shared actors but they will remain in memory so that might become a problem at a specific number. Does someone know the memory size of an Actor instance?
At the moment of writing I prefer solution 2. because I have a clearer understanding how to implement it. My biggest problem with solution 1. is that I think I have to change a lot of the default behaviors in UE net-code but maybe I’m wrong on this point!?
Maybe someone can think of a solution I did not come up with yet? I’m not very experienced with UE yet, is there a unreal way to achieve this? I’m not sure if solution 1. is possible somehow as I described it, perhaps it can be adapted somehow? I’m really looking forward your opinions!