- Home /
VR Multiplayer Mirror LAN?
It is terribly hard to find information on how to do VR networking. With UNet in depreciation (HLAPI and LLAPI not shipped in 2019.4) and Netcode being unclear about LAN in its current state, I am trying to use Mirror and I am working with SteamVR for its excellent player hand controls. I have tried to figure out stackexchange information, WireWhiz demos, and countless other bits and bobbles of networking info on the web and I just can't get any of these scripts or ideas to work. So I ask, plead even, does anyone have any information on how to network VR with SteamVR 2.2+ preferably using Mirror for a LAN only set up?
Photon PUN (third party plugin) has good documentation on LAN setups and matchmaking, as well as a list of platforms they support. Check their website and see if they have docs for VR.
Thanks I am currently avoiding Photon as it is not approved for use on this project. Hence the need for $$anonymous$$irror.
Answer by GetLitGames · Jul 27, 2020 at 09:04 PM
Start with one of Mirror's simple examples and build from there by adding the SteamVR rig into the scene and figure out how to network it. VR is not that special, you need to learn the basics first. There may be a few things particular to VR but nothing that prevents you from implementing basic network functionality.
Thanks. I know I am diving into the deep end here without making other multiplayer projects first. I have Looked at Dapper Dino tutorials for $$anonymous$$irror and I am looking at the example files again based on your suggestion. I have however heard in multiple posts that VR is a different beast as the SteamVR player rig moves its location in the hierarchy on start and each player requires multiple network transforms to track the H$$anonymous$$D and two controllers. I have a networking player script to spawn heads and hands on the LAN but they wont follow the players position.
Some progress has been made here: https://forum.unity.com/threads/multiplayer-with-steamvr.535321/#post-6144678
To me, Photon Bolt is superior to most networking packages and I don't know much about mirror but all you want to do in the beginning is get some objects position and rotation syncing. This is no different regardless of VR or anything else. To help isolate you from this confusion, you can create your own gameobjects that represent the player's body and hands. Those should only contain the visible meshes and not be part of the rig. Next, write a component that gets the position and rotation of the rig objects you need and simply keep their position and rotation updated to be the same as the rig objects. That will keep you from worrying about the rig and what it does with the objects and show you that you just need to duplicate the positions and rotations. As far as complexity, if you mean that a rig will need more than one object to be synced then yes, of course. Normally a "player" in a game is simply one object that need to be synced but for a VR rig you will sync multiple objects. I still don't see any more complexity though, its just more objects to be synced. You are just repeating the same task multiple times.
Thanks. I think its more then isolating confusion when making the game objects for networked representations of the head and hands in VR; at least when Using SteamVR hands as you don't want to duplicate the entire VR rig as you said. The trick is not the syncing of these parts over the network but the proper movement of these parts locally. Where the issue arises is that the proxy parts are spawned in when the network is launched but the links I have made to my rig for translation or rotation and position break because the Player Prefab has moved when SteamVR initialized at the start of the game. I'm trying to work through this on the linked forum post and at this point I am probably missing something super simple by overthinking things. So yes its no more complex then repeating the same task multiple times once it works however the task isn't working once with my VR tests even though it works fine in my non-VR testing with $$anonymous$$irror examples and tutorials.
Answer by ReverendDanyul · Jan 12, 2021 at 09:11 PM
Wondering if you had any success with Mirror, as I am looking at this exact situation. (Project MUST be local network only).
Answer by Giantbean · Jan 13, 2021 at 02:13 AM
Yes I used Mirror for a LAN only VR game. One key thing in VR is that the network player is not a single object but a networked head and two hands. This requires a little bit if a different set up then standard networking but the essentials of things like rpc's and authority are fairly standard. For me I had to use a plug-in from First Gear Games patreon called Flex Network Transform or FNT as the standard network transform in Mirror is not very good.
Ultimately all networking libraries are about sending data. They also usually have some sense of ownership, so that only one machine can make changes to an object. It's nice they give you helper components that do things for you but not necessary once you get more familiar with whats going on. The little bit of code they do to send/receive and update the transform and rotation you could write yourself easily. You don't really need a component to attach to 3 objects, you could handle it yourself and send/recv data to update the positions and rotations but it's nice they give you components that do that. So it's really just a matter of learning the library and following a tutorial. Photon Bolt is probably the easiest to use I think. VR is no different from anything else, you just feel that way (and others trying to start multiplayer networking) because most examples show one gameobject as the player's body. For the position and rotation, which are floats and change rapidly, they should be in state and not RPCs/Events. Bolt also has smoothing/interpolation, it's just a setting to turn on. Bolt also has compression but it's optional. Photon Bolt already has some easily understandable concepts and UI similar to what I saw in the Flex Network video I found, but better, and is probably more performant/efficient than what I saw described too. But again, its nice that someone made a component thats easier to use/understand rather than doing $$anonymous$$irror tutorials. I also tried to look at $$anonymous$$irror but Photon Bolt already has all the features and is easy to understand but it's not free.
Thanks. Learning a lot more about networking and now doing a non VR networked game they are very similar. I still feel VR has some significant differences that need to be addressed and using discord to discuses this with others I have found many times where non VR developers failed to understand this, (even giving wrong information and misleading direction that luckily other VR developers helped me correct) however there is enough in common that your point stands. As for Photon, its paid and was not approved for use in my project. Also not the best at offline LAN only connections needed for my project so $$anonymous$$irror was still a better option for me. @ReverendDanyul Check my link in the accepted answerer, study networking generals as SubtleTechnology suggests and join the mirror discord. Good luck.
If you are doing VR, try the HumanoidControl asset - they already support most libraries and they stream the positions/rotations ignoring the friendly components. Definitely more efficient than using RPCs/Events but less efficient than if they used Photon Bolt States instead. I was asked to implement Photon Bolt for a client using HumanoidControl but then I saw they already had it and we used that instead. So if you're doing VR, checkout Humanoid Control and see if that works for what you want to do for a player body because it's network-ready via multiple libraries and you can focus on your game instead of how to network the player's body.
Answer by ryanology · May 25 at 06:33 PM
I'm in the same boat now that you were in a couple years ago. Need to get Mirror working for a multiplayer VR LAN project. Only thing is, for the life of me I can't get it working properly. Any way you could share your code or contact me to help me work through my issue @Giantbean ?
For others who view this post, ryanology and I chated and he worked out the issue with https://forum.unity.com/threads/multiplayer-with-steamvr.535321/#post-6144678 and made sure the childNetworkTransform was set up on a parent networked objects with the child objects set in the inspectors target field.
Your answer
![](https://koobas.hobune.stream/wayback/20220613004208im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
NetworkAnimator.SetParameterAutoSend, no sync.... 1 Answer
Setup Custom Multiplayer Joining 0 Answers
What technology should I use to play through Radmin or Hamachi? 1 Answer
Oculus Quest Photon Network bugs connecting players 2 Answers
Remove players and close server in Unity Multiplayer Game 0 Answers