Individually controlled visibility for actors/components?

Hi there, I’m trying to work on making actors/components only visible to specific players, and only under specific conditions.

I’m trying to make it work in a way that -

  • The actor/component does not need to be owned by a specific client, or spawned only for a specific client.
  • The actor/component has visibility control specific to a client and/or its data.

Some examples would be

  • A character has a stealth mechanic which makes them invisible to everyone but themselves/party members.
  • An NPC has a quest available marker that displays if there’s an available quest for a specific player, but the NPC is also owned by the server… So another player could kill it and prevent other players from accessing its quests.

I’m rather new to UE4, and my knowledge of network replication is limited. What I’m doing is trying to create a basic template for a game, that can be single player or multiplayer, and not be locked into designed features which only work in one project.

Is something like this possible?

Short answer, yes this is all possible. The long version is that its complex and will require a bit of trial and error to learn how the replication works. My recommendation is to start with this live training tutorial from epic that goes over one of the challenges your discussing: having the local player see something different than the server or other clients. It tackles this with handling how the first person character perceives (or rather doesn’t perceive) themselves, vs how the other player will see a full character model. I would start here and begin growing your understanding of replication from there.

https://www.youtube.com/watch?v=hlDWovBcu7E

Thanks for the answer… I tried searching for a solution using different wording a bunch of times and came across a thread with the answer I needed. Unfortunately I can’t find it again, but I’ll just lay it out here in case anyone has similar issues.

If you want something to exist regardless, but want to hide it from a specific camera, you can use the HiddenActors list on the player controller class (The controller you want to hide it from). It’s only available through C++ as far as I know… But it will prevent a player controller from seeing actors on the list.

Keep in mind, this does not remove the actor. If it has collision and you walk into it, you will hit an invisible wall. If you set up interactions, you can still interact with it. All it does is remove the mesh and shadows from being rendered by the player controller that has said actor listed in it’s HiddenActors list.

My simple solution was too create a player controller c++ blueprint as a parent, put in the functions to add and remove from the list, and then make the functions blueprint callable so you can pass references through blueprint variables.