Search Unity

Question best options for multiplayer VR

Discussion in 'VR' started by gon_cl, Mar 6, 2023.

  1. gon_cl

    gon_cl

    Joined:
    Oct 1, 2022
    Posts:
    3
    Hi, I'm planning to make a cooperative game in VR for 2 people, I've searched a lot on the internet, but I have more and more doubts, so I wanted to ask your opinion about which tools I should use.

    On one hand I think I should use a software like VRIF or AutoHand, so I don't reinvent the wheel and focus on the game. On the other hand, I would like to use Unity Multiplayer Networking or Photon, but I have not been able to find much information on how to integrate it into a VR game.

    Please if someone has already gone through this, could you recommend me what to use?
    Thanks!
     
  2. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    1. Using a package is good, unless you have very new VR intearactions. I personally have a good experience with VRIF, havent used autohands yet. A free alternative is UltimateXR
    2. VRIF has a photon demo if I recall correctly. Networking a VR game is almost exactly the same as a flat screen game, you just need to send the hands and hmd instead of 1 player object
     
    gon_cl likes this.
  3. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
    Using Photon along with a few tutorials is a very good way to get your feet wet in the multiplayer world and learning to grasp different concepts about how things work. There is a few videos on how to integrate it onto VR if you want to get some prototype up very quickly. But their services are paid if you want it fullscale.
     
    gon_cl and DevDunk like this.
  4. jeffries7

    jeffries7

    Joined:
    Jun 25, 2014
    Posts:
    59
    Networking in a VR game is no different to networking in any other game, you have more parts of the player that you need to sync.

    If you've never worked on networking I'd recommend starting on a non-VR project as it'll be faster to test and iterate.
     
    gon_cl likes this.
  5. gon_cl

    gon_cl

    Joined:
    Oct 1, 2022
    Posts:
    3
    Thanks for the answers, I've done projects with XR Interaction Toolkit and Netcode for Gameobject separately, I haven't found any guide to help me put them together. So I will try with VRIF + Photon which seems the simplest way, thanks for the help!
     
    DevDunk likes this.
  6. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    If you know netcode, you can just use that
     
    nilagard likes this.
  7. vrjoydev

    vrjoydev

    Joined:
    Nov 7, 2018
    Posts:
    5
    Netcode works fine for multiplayer in VR, you just need to take care to disable some features of the player when it is Spawned in the scene, if it is not your player you should disable components like Canera, XRDirectInteractor, XRRayInteractor and so on.
    in my case I created a script that tests if I am the owner of the player, if not I disable the following components.

    upload_2023-3-7_8-18-53.png
     
    gon_cl likes this.
  8. gon_cl

    gon_cl

    Joined:
    Oct 1, 2022
    Posts:
    3
    Ohh that would be great, I think in the image you did it directly with XR interactor or not? have you tried it with VRIF?
     
    vrjoydev likes this.
  9. vrjoydev

    vrjoydev

    Joined:
    Nov 7, 2018
    Posts:
    5
    I'm only using OpenXR, as I'm creating a relatively simple game, there's no need to use a better FrameWork.
    Surely VRIF should have better ways to turn Player features on or off.
     
    gon_cl likes this.
  10. Yann_de_Couessin

    Yann_de_Couessin

    Joined:
    Jan 2, 2015
    Posts:
    40
    Hey friends,
    I join the conservation since I have a small related question :

    I'd like to make a local coop OpenXR based training module. I already validated the "colocation assistant" where the users can align their virtual scene to the real world. 3 points calibration based on realworld works like a charm to make an average origin.

    But not I have to choose between Unity NGO and Photon.

    I have to constraints :
    • Keep it local and avoid paid solution : no internet connection since we'll deploy in vocationnal schools so I guess I won't use Photon ?

    • Avoid third party frameworks (I love VRIF but the project needs to be modified by others establishements) so I guess I'll stick to XR Interaction Toolkit.

    Regarding my constraints, you'd choose NGO and XR Interaction Toolkit too right ?

    Regards
     
  11. nilagard

    nilagard

    Joined:
    Jan 13, 2017
    Posts:
    77
    You can use photon if you can share wifi from your phone. But remember, you can only have 1 instance active. If you choose to deploy this to several schools and use it all at once then that room would reach it's max population real fast.
     
  12. Yann_de_Couessin

    Yann_de_Couessin

    Joined:
    Jan 2, 2015
    Posts:
    40
  13. jeffries7

    jeffries7

    Joined:
    Jun 25, 2014
    Posts:
    59

    I worked on something like this years ago. It was a VR driving activity (in UE) and the same PC was running another application (also UE) that displayed the vehicle diagnostics.
    It was completely offline and if I remember correctly we had to write some custom client/server code to send the data locally.
    We also looked into sockets and Python but I don't think we went down that path.

    Sorry I can't be of more help but I wanted to let you know it's certainly possible.
     
    DevDunk likes this.
  14. DevDunk

    DevDunk

    Joined:
    Feb 13, 2020
    Posts:
    5,060
    Yeah, most networking solutions support to route localhost :p