x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Object visibility in Multiplayer

Hi,

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.

Product Version: UE 4.10
Tags:
more ▼

asked Dec 15 '15 at 06:50 PM in Rendering

avatar image

HAF-Blade
16 2 4 8

(comments are locked)
10|2000 characters needed characters left

3 answers: sort voted first

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.

more ▼

answered Dec 16 '15 at 09:47 AM

avatar image

HAF-Blade
16 2 4 8

avatar image streusu May 17 '16 at 08:08 PM

hi..i am interested at your work for my multiplayer game. Can you explain well what do you mean for " i add the owner to the player controller?? do you mean set owner only see? Sorry for my bad english and sorry for my question, but i am stopped in this point. thank you so much. if possible you can posted a screen with this specific function.. :)

avatar image HAF-Blade May 17 '16 at 09:10 PM

Oo. Didn't answer directly to your question. Don't know if you get some notification. So I add this message, too. :)

(comments are locked)
10|2000 characters needed characters left

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.

alt text

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.

alt text

blueprint.png (349.5 kB)
marker.png (2.7 MB)
more ▼

answered May 17 '16 at 09:08 PM

avatar image

HAF-Blade
16 2 4 8

avatar image streusu May 17 '16 at 09:41 PM

Wow. you are a genius. you have find a nice solution.. my case is different but is analog problem, because i want that the player name on head of single player is visible only the same team but no see for other team players. i am searching of adapt your solution for my case. thank you your very helpful, i hope help to you soon.

My question: https://answers.unrealengine.com/questions/420990/player-name-see-only-owner-team.html

(comments are locked)
10|2000 characters needed characters left

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.

  • Create a 3d widget

  • Add a text element to the 3d widget

  • Under details, bind the text element to a function in which you retriev the name of the player

  • Bind the visibility to a function. This function returns "hidden" when the current player (get player pawn) is not in the same team like the player of the widget, and "visible" if they are in the same team

  • Go to the character blueprint and add the 3d widget to it (in UE4.10 this feature is experimental, don't know how it is in 4.11)

  • Set the widgets space attribute in the character blueprint to "screen" so that it is always faced towards the player

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: alt text

widget3d.png (263.4 kB)
more ▼

answered May 18 '16 at 07:47 PM

avatar image

HAF-Blade
16 2 4 8

avatar image streusu May 23 '16 at 08:03 PM

Hello HAF-Blade . i want trying this solution but i think that is very good. i don t know can i thank you for your help...my player name is set like a player info( text render component), maybe this is the problem. thank you so much, if i can help you , you can asking me when do you want. See you soon :)

(comments are locked)
10|2000 characters needed characters left
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question