Search Unity

Question How to influence other player's view?

Discussion in 'Game Design' started by SonOfLich, Jul 20, 2022.

  1. SonOfLich

    SonOfLich

    Joined:
    Jul 10, 2022
    Posts:
    4
    Hi all,

    I'm new to Unity and posting. Apologies if I've posted in the wrong place.

    I'm just working on a PC online multiplayer mini golf game where I'm wanting the following (it sounds dumb without context but here it goes!)...
    • Player 1 controls the ball (direction & power) but can't see anything during the actual gameplay (see Host)
    • Player 2 can see everything that Player 1 should see but can't influence/control anything. They can only communicate via voice/written chat.
    • Host has the ability to turn off Player 1's view.
    I've got good guidance on almost everything including chat features but I'm unsure how to approach the host disabling Player 1's view.

    Any suggestions are greatly appreciated! Thanks all.
     
  2. _BlenMiner_

    _BlenMiner_

    Joined:
    Jun 10, 2015
    Posts:
    87
    You can can probably go to the camera settings and disable all the layers so it doesn't render anything.
    Or you can fake it by simply placing a UI element that takes the whole screen.
    Or a mix of both, a UI element to do some fade effect, then when its done simply don't render anything except the UI layer.
     
  3. SonOfLich

    SonOfLich

    Joined:
    Jul 10, 2022
    Posts:
    4
    Nice! I thought something like that would do the trick. I'm completely new to Unity and am unsure how to functionally achieve that... how would I map a Host control to disable Player 1's layers only OR to introduce a UI element visible to Player 1 only?

    The UI element sounds preferable because Player 1's golf course, direction and powerbar need to be fully visible to Player 2.
     
  4. _BlenMiner_

    _BlenMiner_

    Joined:
    Jun 10, 2015
    Posts:
    87
    Every player has their own client. If you change something for one player, it won't change for the others unless you replicate/share that over the network.
    You can simply let the host send some sort of message to the player1 that tells them to hide or show their screen. And then display or not a UI element on top locally (just activate a gameobject or something).
     
    SonOfLich likes this.
  5. SonOfLich

    SonOfLich

    Joined:
    Jul 10, 2022
    Posts:
    4
    Oh cool! Sorry for the noob question, does that work in the same way with Photon PUN?
     
  6. _BlenMiner_

    _BlenMiner_

    Joined:
    Jun 10, 2015
    Posts:
    87
    Yeah, all network solutions use the same base idea.
     
    SonOfLich likes this.
  7. SonOfLich

    SonOfLich

    Joined:
    Jul 10, 2022
    Posts:
    4
    Legend! I'll give it a go