I’m doing a fog-of-war kind of thing, in a networked game.
On the server, when a detector actor for a particular player gets close enough to some other actor, that other actor updates a set of “seen by players” PlayerController Set, and broadcasts a (reliable) event saying “add this playercontroller to the set of players that have seen the actor.”
In the actor, I then want to make it invisible, unless the local player controller is in the set of player controllers who have seen it.
Actors are spawned by some particular player, who is the Owner for the actor, and that player initially goes in the set.
I have two problems getting this to work:
Inside the possibly-invisible Actor, I need to get “the local player controller” to check whether it’s in the set. I think that just “get player controller at index 0” will always do this, because I never support splitscreen – is this correct?
I seem to recall that player controllers aren’t really replicated – so, what will happen to the player controller value as it gets broadcast to other players? Does it turn into a dummy empty controller of some other class? Does it get ignored? Turned to NULL? E g, if I’m client X, and my instance of the invisible-actor A gets the message “seen by player Y,” what will the value of Y be in the event handler?
Yes, if invisibility was important, I would arrange for the actor to not even get replicated to players that haven’t “seen” it, so that there could be no maphacks. This is not a use case where this is important. (That being said, if doing so is actually the easiest way to get this done, sure, point me in that direction instead!)