I am looking for a way to replicate a function only to certain players. My game is team based, and somethings, such as in game chat messages should only be replicated to the player’s team, so that they can communicate without giving away information to the enemy.
I’ve found a couple of solutions to this online, however they all assume that it is in the players interest to not replicate the function if they are not the intended recipient, for example this post, where it is not in the interest of the player to show the effects on his screen, so it is safe to ask that player kindly to not show the effects.
The problem with implementing this for me, is I cannot trust the player to make that decision for himself. So that you can understand it, an implementation of that person’s solution for me would be something like this:
The problem with this is that the enemy’s computer would receive the chat message, and it would be up to them to not show it if they’re on the wrong team. This means, if the enemy uses cheats they could bypass the branch so it instanly shows the chat message, not matter what team it was meant to be sent to. They could even just monitor their network packets and sniff out the message.
What I am asking is if their is a secure method of replicating a function only to specific players. If it needs to be programmed in C++, I am happy to do that.
Thanks in advance!