TGC VR #2 | Networking for VR | PUN2 and Photon Voice Setup for Oculus Quest multiplayer

Поділитися
Вставка
  • Опубліковано 14 лип 2024
  • Today we go through setting up Photon for having a shared VR experience, where players can connect to the same default room and add support for avatars live movement, hands synchronization, and voice chat using Photon Voice.
    Code Samples: github.com/silidragos/TCG
    Photon Website: www.photonengine.com/pun
    Photon Asset: assetstore.unity.com/packages...
    Photon Voice: assetstore.unity.com/packages...
  • Наука та технологія

КОМЕНТАРІ • 78

  • @ColorfulCodingARVR
    @ColorfulCodingARVR  4 роки тому +9

    Ok, so here is the working sample project in Unity 2019. Just download it, make sure you put your own IDs in Photon App ID and Photon Voice ID and everything should work under NetworkSampleScene scene. Sorry for talking so long ! github.com/silidragos/TCG

    • @anasraza3885
      @anasraza3885 4 роки тому

      oh got it , thanks

    • @NaguWhiteout
      @NaguWhiteout 3 роки тому

      hm - not working! the mainscene looks different from what you show in the video. a lot is missing. I only got: ovrcamerarig, handsmanager, cards, sceneassets, MinMaxHandCards

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому

      @@NaguWhiteout The work in this video is inside NetworkingSampleScene in the same Scenes folder.

  • @chithmalaikarthikp2866
    @chithmalaikarthikp2866 3 роки тому

    I understood about the parenting of local players after seeing the video 5 times. Thanks

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому +1

      Oh, sorry man :)) I'll be more careful so things I assume are clear, actually are clear in the future. Thanks for having the patience and I'm glad you made it, tho.

  • @dhruv9332
    @dhruv9332 2 роки тому

    A good tutorial for start photon voice.

  • @cengkunet8293
    @cengkunet8293 4 роки тому

    Thanks

  • @ryandobby67
    @ryandobby67 4 роки тому

    Where are the Action methods that are in the NetworkManager? I keep getting null references for OnPlayersChanged, RoomPropsChanged, OnRoomCreated... The Actions are declared but there are no methods associated with them.

  • @attackonquest
    @attackonquest 4 роки тому

    Hi, thanks for posting. You mention part 1 Photon video but unable to find on UA-cam. I'm also missing several coding references using the linked Github code such as "GeneralSettings" "GameState" "GeneralSoundSystemBehavior".

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому

      Hello! It's not a part 1 photon video, but a part 1 video where we set up Oculus and hand tracking - ua-cam.com/video/fSDejIg2emU/v-deo.html . As for those scripts, there are just some custom behaviour scripts I made for the project I was working on, specific for that usecase. On those lines, you can do whatever you need for your project to work.

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому +1

      I've uploaded the GeneralSoundSystemBehavior right now: github.com/silidragos/colorfulcoding-projects/blob/master/TCG%20VR/Networking/GeneralSoundSystemBehavior.cs The other two classes are only places I keep some variables.

    • @attackonquest
      @attackonquest 4 роки тому +1

      @@ColorfulCodingARVR thank you very much.

  • @pushthebutton4602
    @pushthebutton4602 4 роки тому

    Hi again! Is missing the GeneralSoundSystemBehavior, GeneralSettings. ? In the NetworkVoiceManager?

    • @attackonquest
      @attackonquest 4 роки тому

      Did you get the NetworkManager script to work? I had some missing references there too.

  • @akumaa8488
    @akumaa8488 3 роки тому

    Thanks for the help! But when i tried to combine this with movement it kinda launched me away when i moved my head to the left, do you have any idea why is that so? Thanks in advance!

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому

      Glad it helped! Why is your character movement affected? Your character should only send out information, not receive any input on its position :-? Do you Photon Instantiate each character prefab from each owner's instance? Is there a chance your character had been instantiated by somewhere else, so now you are not the owner of your own character?

  • @andriyfedorchuk3098
    @andriyfedorchuk3098 3 роки тому

    Hi, and many thanks for the tutorial, great stuff. I would love to ask how do you deal with spatial audio currently in Network Voice Manager. You are parenting RemoteSpeakerPrefab to the "OtherVoices" Parent, so if the Avatar Clone moves the "Speaker for Player 1Voice#1 -#2 - #3" is not following the clones so you can not have the spatial effect for players when they are far apart.
    Many thanks in advance.

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому +1

      Hi Andriy! Glad I could help! Yes, right now everyone is heard the same. If you want to make it spatial simply parent the Speaker to it's owner's 3D character and make sure the Audio is 3D and not 2D. One easy way to match them is by using the player's nickname.

    • @andriyfedorchuk3098
      @andriyfedorchuk3098 3 роки тому

      @@ColorfulCodingARVR Many thanks for the swift reply. I will give it a try. Do you create a nickname for each new player that could not see it in your code?
      Many thanks in advance appreciate your taking your time to respond.

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому

      @@andriyfedorchuk3098 Photon itself has a nickname per player, and also a unique id. I do create the nickname in a simple one-input form usually, but here it's simply random.

  • @pushthebutton4602
    @pushthebutton4602 4 роки тому

    Thank you for this, can you please put up an working unity example to explore? Thanks in advance! this is great!

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому

      I'm glad you like it! I'll try and put everything together soon, and upload it on Git.

    • @pushthebutton4602
      @pushthebutton4602 4 роки тому +1

      ​@@ColorfulCodingARVR Great , Thank you for your Time!

  • @yazeedmohi
    @yazeedmohi 4 роки тому

    Thank you very much, you are a good person.
    One question though, how do I get the players to join a specific room in PhotonVoice according to the room they chose to join earlier in PUN?

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому +1

      Thanks! I'm really glad you enjoyed my upload.
      I haven't yet implemented that part but PUN documentation says: Auto Connect And Join - If PUN joins a room, the Voice client can connect and join a corresponding voice room as well. So, Photon Voice is actually observing what PUN room you are in, and manages it automatically for the voice too.
      I think. Gotta test that, though.
      (doc.photonengine.com/en-US/voice/current/getting-started/voice-for-pun#auto_connect_and_join)

    • @yazeedmohi
      @yazeedmohi 4 роки тому +1

      @@ColorfulCodingARVR Thanks brother, I really appreciate your help.
      If you have the time please check out my new mobile game and give me feedback. Here's the google play link: play.google.com/store/apps/details?id=com.DavidDesigns.CUBIC

    • @josh_ram101
      @josh_ram101 3 роки тому

      @@ColorfulCodingARVR does this mean that players in room one won't hear players in room two? and player in room two won't hear players in room one?

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому +1

      @@josh_ram101 Yes. Exactly. But you have to be careful, although you have rooms A and B in PUN2, photon voice connects using his own logic, so you can, mistakenly, connect the player from room B to room A for voice (I actually had that bug in one of my apps).

    • @josh_ram101
      @josh_ram101 3 роки тому

      @@ColorfulCodingARVR do you have code for it? or it does not need code?

  • @ryandobby67
    @ryandobby67 4 роки тому +1

    Any idea how to get the LocalAvatar to work instead of the HeadPrefab? Can't beat the oculus avatar sdk

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому +1

      I kind of avoided oculus platform until now, because I found it difficult to test on Quest. However, my guess is that one way would be to PhotonView.Instantiate just the empty transforms that would control the movement and have a PhotonView on them. When you connect, you could send your user ID with an RPC call to all other players. Each player would use that ID to get the information needed - models, avatars etc and parent them accordingly, to the already connected gameobjects. I hope this makes sense.

    • @MrVJ76
      @MrVJ76 4 роки тому

      ColorfulCoding I also want to make use the Oculus avatars, Could you please make a tutorial of how to do that?

  • @momskiller
    @momskiller 4 роки тому

    Hi, thanks for your tuorial ! Can you please show us how to let a player use the Quest and the other player can use the computer to play ! For asymetric game .
    Regards.

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому +1

      Sure thing. It's a matter of checking if which PlayerPrefab is yours (using photonview.ismine) and, afterwards, dynamically putting the control logic on it. On VR you'll change its parents to OVRCameraRig elements - hands + head, while on PC depends very much on how you created the controls. Either add CharacterController component, or your own scripts, etc. I hope it's clear enough. I can also think about putting it on a video, but it would be lower in the queue as I already have a few ideas on the roll.

  • @chithmalaikarthikp2866
    @chithmalaikarthikp2866 3 роки тому

    Hey @ColourfulCoding. As you said I did practising the demos. I used your scene as demo.
    I have done with the voice now.
    I have one issue now. The character is not moving over the network, if I walk.
    If I move the avatar(which is cloned under centre camera) manually in the editor, then it is updating over the network.
    Can you please help with this?

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому +1

      Can we talk over Discord, so I can get a better view over what the problem is? Here's my id: silidragos#1340

    • @chithmalaikarthikp2866
      @chithmalaikarthikp2866 3 роки тому

      ColorfulCoding yeah sure. I will ping you on morning tomorrow

    • @chithmalaikarthikp2866
      @chithmalaikarthikp2866 3 роки тому

      @@ColorfulCodingARVR I have sent a request in discord. Please check

  • @johnr.7764
    @johnr.7764 3 роки тому

    Hello, I like your Videos so much! but i have a issue on the TGC VR #2 | Networking for VR | PUN2 and Photon Voice Setup for Oculus Quest multiplayer, the NetworkManager in your Video an the NetworkManager script in the Download Folder are not the Same. I watch also the Videos from Valem but i have only 1 Problem. My Virtual Hands are stucked on the Floor, i can make a Fist but i can't move my Hands. over the network i have the same case. I use the XR Rig, can you please help me shortly. Thank you in advance

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому +1

      Thanks for watching! I think the problem comes from Photon not synchronizing the global position, but the local one. I can swear it synced the global one when testing, but now indeed I also had a similar problem. Here's a custom script I used for sync-ing the global transform position: gist.github.com/silidragos/060ea562dc32967970c5502eb8fde5d5 . Hope this helps!

  • @anasraza3885
    @anasraza3885 4 роки тому

    Hi, Thank you for this tutorial, The Github link is broken and takes me to 404. Can you please share the project folder again , I have also send you a Discord request.

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому +1

      The good link was in the pinned comment. Fixed it also in the description. Thanks for pointing out.

  • @ryandobby67
    @ryandobby67 4 роки тому

    The NetworkManager.CreatePlayer() doesn't add the Hands or Head to the hierarchy. If you manually add the prefabs to the correct locations, ie. CenterEyeAnchor, RightHandAchor, LeftHandAnchor, it simply moves them to the OtherCharacters upon starting the game. Anyone having any luck?

    • @ryandobby67
      @ryandobby67 4 роки тому

      I managed to get it working by moving the CreatePlayer() method to the beginning of the OnJoinedRoom(). It wasn't working because NetworkManager.OnRoomCreated & NetworkManager.OnExistingRoomJoined Actions are null, since they are only declared and have no associated methods in the provided code.

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому +2

      ​@@ryandobby67 You seem to be right There should also have been some null checks etc. Putting just the scripts is not so intuitive, and it's indeed error-prone. I'll upload over the weekend a working project with everything working (except the API Key)

  • @denismp9963
    @denismp9963 3 роки тому

    Hi,your voice chat work at distance? like player it s not near you ,him don t hear you

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому +1

      What I did here is just tossing all the AudioSources in a random parent GameObject. What you can do instead is parenting the instantiated AudioSource to the respective player's GameObject and everything should work as you said.

    • @denismp9963
      @denismp9963 3 роки тому

      @@ColorfulCodingARVR Thx for reply .

  • @diher57
    @diher57 3 роки тому

    Does anyone has a good solution Steam VR and Photon 2 work together ?

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому

      It shouldn't really matter what you use Photon with. As you could see in the video, you just tell photon what objects to sync. So once you set up Steam VR you simply add Photon Views on whatever moving objects you want to synchronize, like the avatar head, body...whatever. Maybe the more different step is identifying what gives the animation to Steam VR hands prefab.

  • @chithmalaikarthikp2866
    @chithmalaikarthikp2866 3 роки тому

    Hi. Can you post the step by step tutorial for the unity VR photon voice? @ColorfulCoding

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому +1

      Hi! Sure, I think I'll make a blog post about it. Meanwhile, if following this video is unclear, the easiest way it would be to just take the objects in the example scene and simply copy the configurations / components from there. Afterwards, delete what seems useless.

    • @chithmalaikarthikp2866
      @chithmalaikarthikp2866 3 роки тому

      ColorfulCoding actually we can’t access github from office laptop. If you post the tutorial, then I will create it by following the tutorial

  • @VictorGamer98
    @VictorGamer98 3 роки тому

    Why you instantiate the hands and not de OVRPlayerController with the hands?

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому

      Good question. I do this because I don't want all the logic on OVRPlayerController to be re-instantiated for each new player (and the scripts on it too) since this might create some problems/bugs, such as OVR trying to control all of them in the same time, and not only my OVRPlayerController.
      I always try to instantiate over the network only what I really need, and I try to keep things as clean as possible. But it could work to have both hands under the same parent and instantiate that. Hope this helped.

    • @VictorGamer98
      @VictorGamer98 3 роки тому

      @@ColorfulCodingARVR Yes thx, I have this problem im doing a project in VR with photon2 and I have to check if it works with only 1 VR and 1 PC. And when I start 1 game it works great, but when I play with 2 players the controls breaks and I don't know how to do it. The player can control the other and the cameras of the players change....

    • @VictorGamer98
      @VictorGamer98 3 роки тому

      @@ColorfulCodingARVR I have sent you a friend request in discord to see if u can help me with this.

  • @rodrigo.cs.machado
    @rodrigo.cs.machado Рік тому

    In a multiplayer game for VR where the player has the possibility to use the teleport, the floor needs to have the "teleportation area" script, but it looks for a "teleportation provider" that is in the player that will be instantiated in the scene.
    First doubt: how to make this script find the player's script after the "void start"?
    Second doubt: how to make this script on the ground accept the teleportation of several players?

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  Рік тому

      Try keeping all the teleportation logic only for the local player. So I can teleport wherever I want and I just tell everybody else where my position is using a PhotonTransformView. Similarly I only care where other people are, but I do not want to the teleportation logic to be made on my machine.
      Therefore, at least in my usecases, I only needed the Teleportation areas to check for my own teleportation provider. The other players are simple GameObjects with a synced position and rotation but no other logic.
      I hope I understood well your problem 🤔

    • @rodrigo.cs.machado
      @rodrigo.cs.machado Рік тому

      @@ColorfulCodingARVR I understood your explanation and yes, it makes perfect sense, my inexperience with online and multiplayer systems did not let me see this solution. But I still don't know how to make the teleportation area find the player's teleportation provider after it is instantiated, it only finds it automatically if the player is in the scene when starting the game

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  Рік тому

      @@rodrigo.cs.machado Hmm, wanna discuss more on discord so I can understand the problem better? Here's my id: silidragos#1340

    • @rodrigo.cs.machado
      @rodrigo.cs.machado Рік тому

      @@ColorfulCodingARVR Very thoughtful of you, I will definitely add it. Although I have already found a satisfactory solution to the problem, a more experienced view would be of great help.
      Just forgive me for not knowing english fluently

  • @VictorGamer98
    @VictorGamer98 3 роки тому

    I have some problems with my project and I need some help, if u can I send u a firend request in discord, I have the same name that here. It would be a great help.

  • @pushthebutton4602
    @pushthebutton4602 4 роки тому

    Please update the script with GeneralSettings and GeneralSoundSystemBehavior. Otherwise I can't get to work. Thank in advance.

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому

      General Settings is just a class where I keep the nickname (and other settings in the future). I've uploaded the GeneralSoundSystemBehavior right now: github.com/silidragos/colorfulcoding-projects/blob/master/TCG%20VR/Networking/GeneralSoundSystemBehavior.cs

  • @pushthebutton4602
    @pushthebutton4602 4 роки тому

    I still haven't got it to work. Does anybody got it to work?

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  4 роки тому

      You can DM me on discord and I can have a look next days if it helps. Here's my username: silidragos#1340

    • @MarioRuizSincope
      @MarioRuizSincope 4 роки тому

      Wow you really DO push the button a lot.

  • @madhawacperera
    @madhawacperera 3 роки тому

    Hi, thank you for your tutorial. It is very helpful. Can you please show how we can use Oculus hand tracking also in a networked setup? That is to see other player's hand movements (not controllers). I tried using OVRHandPrefab to sync through the network but so far not successful. Any thoughts on this? Thanks.

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому +1

      What part of the OVRHandPrefab did your PhotonView sync? Just reinstantianting it wouldn't work, as you need to see where the animation is happening and also serialize that through the Network, with an Photon Animator View I think.

    • @matiasbrunacci
      @matiasbrunacci 3 роки тому

      Did you solve the hand tracking problem? I have the same issue :/

    • @matiasbrunacci
      @matiasbrunacci 3 роки тому

      @@ColorfulCodingARVR same problem here! Any clue?

    • @ColorfulCodingARVR
      @ColorfulCodingARVR  3 роки тому +1

      @@matiasbrunacci Can you please tell me how did you setup the PhotonViews over your OVRHandPrefab?

  • @Valorant_player_collector
    @Valorant_player_collector 11 місяців тому

    can i have your discord please