Object visibility in Multiplayer
While creating some working multiplayer shooter game I came up with a problem where I don't know where to start.
I wanted to provide some specific meshes which should only be visible to a group of players in the game. The other players in the multiplayer game should not see theses meshes. Instead they have their own meshes which are only visible to them..
I thought about hiding meshes by the use of post processing, but post processing blendables only have some emissive input and no possibility to make something completly translucent. Or am I wrong? If yes I would use the custom stencil and some blendables per player type to hide/show the objects.
Further more there could be the possibility to use "Only owner see" but then I have to create the meshes for every single player and set these as the owner of the specific object. This would be some overhead.
Is there some easy solution to achieve this? I'm using ue4 now for almost 1,5 years but I can't remember if I have ever seen some similar functionality.
Thanks for your help.
asked Dec 15 '15 at 06:50 PM in Rendering
It is me again :) I found a solution by spawning the suiting meshes only on the owning client. I call some custom event with "owning client" replication (blueprint) from the server (the one which has the authority). When spawning the actor on the client I add the owner to the PlayerController.
For every trying around with this solution: I wasn't sure when to call the "owning client" custom event. First I called it on the BeginPlay node but this seemed to be to early (because of owner relationships). In the tick event it worked because there the owners are set already.
answered Dec 16 '15 at 09:47 AM
Hi streusu. Ok. I'll try to explain these things.
I've created a team based shooter with starting areas for every single team. When you step into the starting zone of the enemy, you will die. This is done with damage volumes.
To mark these areas in the level I created some translucent meshes (double sided textures) with some kind of "stopping signs". These should only be shown to the enemy team and not to the team which owns this specific base.
The level designer now has some "marker templates". These templates can be placed in a level and they can be assigned to some specific team. At the location of these marker templates, the templates will be created dynamically during the game.
In the screenshot you can see the creation process. This is perhaps not the best solution but it is mine. :)
The most important thing is that the event is running on the owning client and that the markers themselves are NOT replicated. When I now create them on the owning client they only exist there!
The first step is now to check if the markers have been already created. If no the process starts. Because of initialization issues (and the possibility to switch the teams during game) all existing markers for this player are destroyed.
After that, all marker templates (the objects which can be set in the level by the level designer) are searched with GetAllActorsOfClass.
For each marker template it is checked if the owning client has the correct team and if he should see this specific marker (marker at the base of team 1 have the variable "TeamWhichSeesMarker" set to 2).
If the player should see the marker, it is spawned and the owner is set to the PlayerController actor/class of the owning client. Furthermore the marker is appended to the list of markers for this player.
At the end the flag that the markers have been created, is set to true. If the player now switches the team this flag is deleted and the process starts again.
Here you can see some screenshot of a marker from my game prototype.
answered May 17 '16 at 09:08 PM
I think you should use some other approach for HUD elements floating over the head. My approach shows real objects in the 3d world but what you want is more a HUD element.
I created something similar to show healthbar above the heads of the team members.
I hope I haven't forgotten something. :) Have fun with it!
You can see some example of my hud above a team member in the following screenshot:
answered May 18 '16 at 07:47 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here