In my game, I keep a list of all clients currently connected to the server and a list of all actors in the game. Each actor is "relevant" ( currently replicating ) to 0 or many clients, and each client has has 0 or many actors that are relevant to it.
In some situations, I want to do something like this:
NetworkSystem.AddMulticastRPC( rpcCall, actor.AllRelevantClients );
This would send an RPC to all clients who have this actor as relevant.
Sometimes I need to do things like this:
foreach( var actor in client.RelevantActors )
{
...
}
Looping through all relevant actors.
Storing a collection on both the client and actor objects would be a duplication of data. Storing a collection on only one of these leads to some complex searches.
Is there an approach to dealing with data like this that avoids both of those problems?