Does Oculus Quest support Photon Unity Networking? — Oculus
IMPORTANT:

All Oculus Quest developers MUST PASS the concept review prior to gaining publishing access to the Quest Store and additional resources. Submit a concept document for review as early in your Quest application development cycle as possible: https://developer.oculus.com/quest-pitch/

For additional information and context, please see "Submitting Your App to the Oculus Quest Store".
Welcome to the Oculus Developer Forums!

Your participation on the forum is subject to the Oculus Code of Conduct.

In general, please be respectful and kind. If you violate the Oculus Code of Conduct, your access to the developer forums may be revoked at the discretion of Oculus staff.

Does Oculus Quest support Photon Unity Networking?

mofvrmofvr Posts: 3
NerveGear
I am researching about possibilities to make multi user experiences for the Quest and have been wondering if Photon would help?

Answers

  • MikeFMikeF Posts: 676
    Neo
    yes
  • VJ76VJ76 Posts: 31
    Brain Burst
    edited June 18
    @MikeF Where can I find a tutorial on this subject?
  • MikeFMikeF Posts: 676
    Neo
    networking is networking, there's nothing special about it for vr development other than what gameobject information you're sending and receiving. Any photon tutorial will work just fine
  • cloud_canvascloud_canvas Posts: 67
    Hiro Protagonist
    re: idiosyncrasies of local vs remote players using Oculus Avatars SDK and PUN 2:

    Samsung Galaxy S8 (Snapdragon 835), Gear VR (2017), Oculus Go (64GB), Unity 2018.3.14f1
  • VJ76VJ76 Posts: 31
    Brain Burst
    re: idiosyncrasies of local vs remote players using Oculus Avatars SDK and PUN 2:

    Thx! @cloud_canvas, did you use it yourself? i have experience in developing vr, but i'm new to networking.

  • NuttyLordNuttyLord Posts: 3
    NerveGear
    if you are new to networking, it can help to have something "working" to learn with. https://github.com/quintesse/PlayoVR this repo is something using vrtk 3.3 with PUN if you are interested. Its a good starting point to learn without sifting through a crazy amount of documentation.
  • VJ76VJ76 Posts: 31
    Brain Burst
    @NuttyLord i will get into it! Thx! Apparently there are many ways to achieve thisI my goal is to develop a kind of template for simple networking, with oculus intergration and pun2.
  • VJ76VJ76 Posts: 31
    Brain Burst
    edited June 19
    I found this youtube tutorial, i tought it comes close to what i want to achieve. but i'm getting stuck on how to change the player script so i can instantiate a OVRplayercontroller.

    https://www.youtube.com/watch?v=Er0eqEbbQqg&t=1s
  • VJ76VJ76 Posts: 31
    Brain Burst
    NuttyLord said:
    if you are new to networking, it can help to have something "working" to learn with. https://github.com/quintesse/PlayoVR this repo is something using vrtk 3.3 with PUN if you are interested. Its a good starting point to learn without sifting through a crazy amount of documentation.
    @NuttyLord ; I think it is time to upgrade the project to Unity 2019, i'm getting 66 errors on text mesh pro :)

    https://forum.unity.com/threads/text-mesh-pro-dozens-of-errors-with-unity-2019-1.662575/#post-4436926
     
    PlayoVR master/Library/PackageCache/com.unity.textmeshpro@2.0.1/Scripts/Runtime/TMPro_UGUI_Private.cs(1865,73): error CS1644: Feature `out variable declaration' cannot be used because it is not part of the C# 4.0 language specification

  • cloud_canvascloud_canvas Posts: 67
    Hiro Protagonist
    VJ76 said:
    re: idiosyncrasies of local vs remote players using Oculus Avatars SDK and PUN 2:

    Thx! @cloud_canvas, did you use it yourself? i have experience in developing vr, but i'm new to networking.

    Yep, if you look at the bottom of the page there's an addendum crediting me, lol. I've had a lot of back and forth with Tobias and Jean from Photon specifically about Oculus Avatar serialization. Please search for "Oculus Avatars" and "PUN" or "Photon" and you will see loads about this on this forum.
    Samsung Galaxy S8 (Snapdragon 835), Gear VR (2017), Oculus Go (64GB), Unity 2018.3.14f1
  • cloud_canvascloud_canvas Posts: 67
    Hiro Protagonist
    My company's Oculus Go app has extensive integration with PUN 2 and Oculus Avatars. I am also totally new to networking. I'd recommend simply following Photon's basic tutorials and then applying the concepts (PhotonView, RPC, RaiseEvent etc.) to your own project.
    Samsung Galaxy S8 (Snapdragon 835), Gear VR (2017), Oculus Go (64GB), Unity 2018.3.14f1
  • paulodgnpaulodgn Posts: 10
    NerveGear
    @cloud_canvas First thanks for all the research and to share the fix with photon and Avatars. I did what it says in the Photon tutorial for the avatars but im having a problem. The avatar never gets Initialized for some reason and i dont get any errors. Any idea in what can be the cause of this?
  • justin.oheirjustin.oheir Posts: 35 Oculus Start Member
    Hey I'm currently in the process of working with pun2 and avatars as well.

    I realized the OnJoinedRoom() function wasn't being called when instantiating the avatars so I changed it to a LoadAvatar() function and called it just after I created the player. 

    This is my NetworkManager.cs script:
    
    
    private void Start()
        {
            CreatePlayer();
            LoadAvatar();
        }
    
     //here's my create player script
    
     public byte InstantiateVrAvatarEventCode = 123;
    
        public void LoadAvatar()
        {
            GameObject localAvatar = Instantiate(Resources.Load("PUN_LocalAvatar")) as GameObject;
            PhotonView photonView = localAvatar.GetComponent<PhotonView>();
    
            //Make avatar child of PUNPlayer
            localAvatar.transform.parent = player.transform;
    
            //Center avatar on PUNPlayer
            localAvatar.transform.localPosition = Vector3.zero;
            localAvatar.transform.localRotation = Quaternion.identity;
    
    
            if (PhotonNetwork.AllocateViewID(photonView))
            {
                RaiseEventOptions raiseEventOptions = new RaiseEventOptions
                {
                    CachingOption = EventCaching.AddToRoomCache,
                    Receivers = ReceiverGroup.Others
                };
    
                SendOptions sendOptions = new SendOptions
                {
                    Reliability = true
                };
    
                PhotonNetwork.RaiseEvent(InstantiateVrAvatarEventCode, photonView.ViewID, raiseEventOptions, sendOptions);
                Debug.Log("Raised Event Set: " + photonView.ViewID + " | " + raiseEventOptions + " | " + sendOptions);
            }
            else
            {
                Debug.LogError("Failed to allocate a ViewId.");
    
                Destroy(localAvatar);
            }
        }
    But now it seems like my event data for RemoteAvatar not being sent, here's my CallBack.cs script:
    public class EventCallbacks : MonoBehaviourPunCallbacks, IOnEventCallback
    {
    
        public byte InstantiateVrAvatarEventCode = 123;
    
        public override void OnEnable()
        {
            PhotonNetwork.AddCallbackTarget(this);
        }
    
        public override void OnDisable()
        {
            PhotonNetwork.RemoveCallbackTarget(this);
        }
    
        public void OnEvent(EventData photonEvent)
        {
            if (photonEvent.Code == InstantiateVrAvatarEventCode)
            {
                GameObject remoteAvatar = Instantiate(Resources.Load("PUN_RemoteAvatar")) as GameObject;
                PhotonView photonView = remoteAvatar.GetComponent<PhotonView>();
                photonView.ViewID = (int)photonEvent.CustomData;
    
                Debug.Log("Remote Avatar Instantiated");
            }
        }
    }
    Maybe I have it on the wrong GameObject or I'm putting everything in the wrong places (I have no clue). It would be helpful if the photon documentation specified "Create a script for ______ and attach it to ______". I did implement @cloud_canvas's OVRAvatar.cs hack but I'm not even getting the callback error. 

    @paulodgn I feel we can put our heads together and figure it out, maybe @cloud_canvas can help us  ;)
  • paulodgnpaulodgn Posts: 10
    NerveGear
    @justin.oheir i fixed my issue. The problem was cloud OVRAvatar fix. The avatar was never initialiazed, so i removed that part of the code and it works good now. For the rest of it i followed the tutorial from Photon and everything works.
    Did you follow that guide? https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/oculusavatarsdk
  • paulodgnpaulodgn Posts: 10
    NerveGear
    @justin.oheir Regarding the gameobjects you should have something like this for the LocalAvatar:



    Make sure that the object in the Observed Component is the Photon Avatar View (marked in red). Hope it helps, im no expert, just starting with Photon also.
  • justin.oheirjustin.oheir Posts: 35 Oculus Start Member
    edited August 22
    @justin.oheir i fixed my issue. The problem was cloud OVRAvatar fix. The avatar was never initialiazed, so i removed that part of the code and it works good now. For the rest of it i followed the tutorial from Photon and everything works.
    Did you follow that guide? https://doc.photonengine.com/en-us/pun/current/demos-and-tutorials/oculusavatarsdk
    Yea I'm following that tutorial. Thanks a bunch! 

    So I have achieved a grey avatar with no hands that doesn't move with the headset, I just removed TransformView from the PhotonView based on your set-up. I have a feeling that will fix my movement problem, come on hands! (also do you have the same scripts on the RemoteAvatar?@paulodgn

  • paulodgnpaulodgn Posts: 10
    NerveGear
    @justin.oheir Yes the remote avatar has the same setup

    For the hands to work i believe you have to set an app ID on the Avatar settings:


  • justin.oheirjustin.oheir Posts: 35 Oculus Start Member
    Yea I have those set. hmm
  • pyrusspyruss Posts: 3
    NerveGear
    Would any kind soul, share  very simplistic / basic scripts on what currently work with oculus quest 7.0 + Pun2? modeler & animator with very basic scripting knowledge and 2 days of networking survey.
    I am following the photon tutorials , got it to work with regular networking but as soon as i try to add the avatar portion, all hell breaks lose and nothing works, it doesnt even let me add "IOneventCallback" to the network manager script (that uses in regular tutorial) 
  • pyrusspyruss Posts: 3
    NerveGear
    Justin were do you apply your "EventCallback" scripts? What about OVR camera? how do you call it?
  • justin.oheirjustin.oheir Posts: 35 Oculus Start Member
    Event callback I put on my remote avatar, and I have an OVRPlayerController Prefab already in the scene I make the instantiated avatar a child of it
  • justin.oheirjustin.oheir Posts: 35 Oculus Start Member
    edited August 23
    @pyruss
     to answer your IOneventCallback problem:
    using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    using Photon.Pun;
    using Photon.Realtime;
    using ExitGames.Client.Photon;
    
    public class EventCallbacks : MonoBehaviourPunCallbacks, IOnEventCallback
    {
    Just a tip, click on items with a red underline and press alt+enter and it will usually show if a namespace is missing.
  • justin.oheirjustin.oheir Posts: 35 Oculus Start Member
    I think my issue currently is due to a conflict between the Oculus Platform P2P and Photon, trying to figure out how to disable that (I use the p2p before lauching photon so I can't remove it completely).
  • pyrusspyruss Posts: 3
    NerveGear
    Justin thanks for all the tips, Do you use a "dont destroy on load" on that OVRPlayer controller?or call it via script when you upload a room?
  • justin.oheirjustin.oheir Posts: 35 Oculus Start Member
    When I load my photon scene I have a new OVRPlayerController. I haven't quite dug into how I will use it when changing scenes in my photon scenes yet. 
  • justin.oheirjustin.oheir Posts: 35 Oculus Start Member
    Just a note, I ended up creating my own avatars as nothing was working..
Sign In or Register to comment.