Replication for certain Players

Hello everyone!

Everyone knows conditional replication and thus I am wondering why I seem to be the only person having this issue / this question.
I have an Alliance class, where Players can join and do some funny stuff together enemys should not know about. For example, the name of the alliance should be replicated to every player, but the list of members only to the members itself.

So, how can I replicate stuff to certain players only? The reason is mainly cheat-security, and thats why I can’t just send it to all and then locally dismiss the information on clients that should not know about it, because they could just modify their client programm to get access to gameplay-important information, beside the fact that this would lead in some unnessecary network-usage.

The alliance class is spawned in the alliance-manager, which itself is spawned in the GameState (one instance only, player indipendent).

Idea 1
One “idea” I had was to manually call client functions from the Alliance-class to the member-players and send them the new data to proceed. E.G, I have a function called “addNewMember” and when HasAuthority() foreach(member) ClientFunction to execute playerController->playerState->GamePlayer->Alliance->addNewMember locally.
But this seems a bit of an overheat, since I would have first to retrace from playerController to the alliance-class, and secondly I would need to implement special Client functions for everything in the playerController class…

Idea 2
Another idea I just had was client-requests from the replicated version to the server-version passing a player-controller and just sending the data when the player-controller is valid for receiving this information. But still this would require client-functions from the playerController.

Idea 3 (seems okay, so far?!)
Or what about don’t replicating mainly about the “mother-alliance instance” but just create alliance-instances for every player, who then can replicate everything with COND_OwnerOnly, and just connecting this instances to the “mother-instance”, which itself could still replicate the public stuff to non-member players, like the name.

|-> New Alliance was formed with three members. Spawn the alliance in the alliance manager and set it to replicate public-data to everyone, and spawn also three alliance instances for the three players in their GamePlayer (More persistent, gameplay-wise brother of the temporary playerState) class. Connect this instances to the mother instance and everytime something important is changed in the mother-instance, tell the child-instanced about it. When an “enemy” accesses this GamePlayer instance and want’s the alliance-instance, redirect to the mother-instance. When every important information is still noticed as COND_OwnerOnly in the alliance class, this should lead to no replication on ther mother-instance, and to-owner-only replication on the “child-alliance”, or don’t it? But that would lead to having enemys the same public-data multiple times replicated, no? Uff, heavy topic…

Does this lead in furious actor-overload?

Do you have any better ideas? :slight_smile:

I’m not sure exactly what it is you are trying to do, but replication is usually between the server version of an actor, and the equivalent version of that actor in different worlds. From what I think you want, I would perhaps create the alliance-manager class on the server, and have it replicate it’s info to the other worlds. For an individual player/pawn I would put a reference to the alliance-manager, as well as having an int/bool/enum that specifies what alliance they belong to.

For the player I would then let them call something like AllianceManager->GetData(MyAllianceType).

If you wanted to change something in the AllianceManager, rather than just read it, you would have no choice but to call a server function. They can’t return values, but they can make changes on the server which get replicated to the clients. You can specify a function to be called when the new replicated data arrives so you could notify players if needed.

You probably knew all this, and I may have missed your point. Sorry if that is the case :slight_smile:

The alliance is spawned in the manager, itself spawned in the gameState, and thus every player has access to the gameState, that means the alliance is replicated to them all, or am I still misunderstanding some concepts of replication? I thought the gameState has no “real” owner (a player) but replicated to everyone :o

You should have a Manager which holds each alliance’s information, without the client being able to access it. The manager decides which instance - which alliance members - get to see what. If you have the info available on all the clients, you’re gonna have a bad time :slight_smile:

Yes, of course, but how do I solve that without creating too much bandwith? The game is desired to become a MMO, so sending all the necessary data to clients everytime they smash a button seems a bit of an overload. Thats why I am looking for a bandwork-cheap solution.

I thought about a “Alliance-Agent” class for every player, which takes a alliance-identifyer (maybe a unique integer) and sends a request to a server-side Manager class, if its the first time with this identifier. Then the Alliance-Manager decides what the requesting player should be able to see and fills out a AllianceDisplayStruct Structure in the AllianceManager that is replicated back to the specific player, and hook up the server-version of this struct to the alliance, so that changes in the visible parts are automatically replicated and the client doesn’t have to send a new request every time he clicks a button. So, now the player has a local struct of the data he is allowed to see, and when he comes to a point in the game where he should see the informations of an alliance, the Agent looks through the local AllianceDisplayStructs if they already exist locally, and shows them to the client, if not, send a request.

Is this a proper solution or do you see any disadvantages? In that way I would only need to replicate a single identifyer ID for each alliance to each player.

The funny thing is I came up with the idea just while writing it down, but until now I didn’t see any disadvantages yet. I hope that remains so :smiley:

But then I have another question: Can I replicate an Actor to 100% just to one player? So, that the actor doesn’t exist on other clients at all? As far as I understood so far, I can set every variable to COND_OwnerOnly, but the Class itself still gets replicated to everybody. They are all “logically” actors, with no mesh, and every player has about 50-100 of them. Concidering 500 players, this makes up to 5000 actors replicated to every client. I heared something about IsNetRelevantFor. Any ideas how I could use that to my benefit?