TLDR: When an actor goes outside of NetCullDistance is it possible to stop it being deleted on the clients?
Design:
Base building multiplayer game. Many of the same actor types (Foundations, floors, walls etc). I would like to utilize UHierarchicalInstancedStaticMeshComponent (HISM) for each type to allow for optimized rendering. To achieve this I have an actor (Base) which contains many HISM for each type. The syncing of the HISM across the server would be handled through FFastArray (FFastArraySerializer and FFastArraySerializerItem) to contain data representing each element contained for a single HISM for say “floors”. All of this works great.
The Issue:
When I go outside of the NetCullDistance all of the information contained in Base that is not replicated would be lost meaning a lot of recalculating things. I could decouple some of this but it still leaves the problem with the implementation of a FFastArray being redundant. As it does not just send changes across - it sends the entire array which will become costly in a complete system.
Further Research:
- Using bAlwaysRelevant is kind of the behaviour I am after but I don’t want it to keep receiving updates from the server constantly as there will be many of these bases (potentially hundreds) in the game.
- I read that if an object is in the world and not spawned it is not deleted. So I could create a base pool and utilize this approach but it would have draw backs with the base pool reaching its limit. Also the wasted resources on objects in the pool that are not used.
- Currently I am researching the Replication Graph and the system to replace it Iris. I have yet to find an exact solution as these are new to me.
- I am currently looking into the mechanism that deletes actors when they are no longer relevant but going through the source code is tough as Actor, ActorReplication etc are complex.
- Using AI it suggests or maybe hallucinates that this is possible using IsNetRelevantFor. But most things it suggests seem to be just a custom way of implementing a bAlwaysRelevant. I have yet to to implement any of what it suggests as it seems wrong.
- I am open to changing the unreal source code to not delete the actor but I feel that a lot of the code needs to stay the consistent and that it wouldn’t be as simple as - if the class is of type ABase don’t destroy it.
Of course I understand many people might say your design approach is wrong - unreal does not work this way etc. But I’m wondering if anyone has done anything about keeping an object alive outside the NetCullDistance. My approach seems optimal if only the server/client relationship did not delete the object when outside of the NetCullDistance.
Thank you to anyone who takes the time to read this or comment. I never ask for help but I feel out of options on this one and really wanted this to work.
NOW SOLVED SEE MY LAST POST