I am currently trying to replicate the Camera and Motion Controllers of my Oculus Quest to the Server on a local network. I read a lot about Replication but still can’t wrap my head around the whole concept. As far as understood, the the Character Pawn has a built-in replication movement replication component but it doesn’t not work for with motion controllers out of the box - or maybe I didn’t set it up correctly.
What I am basically looking for is this:
Computer = Server
Oculus = Client
The Client should send the Oculus motion controller positions to the server, so the actual positions could be monitored in real-time. (Guess the other way around would be easier but I am planing to use this with multiple HMD devices later on… - The Server could also ask for the clients position, I think for setup either way is fine as long as the position gets updated which also does not have to hapen every tick - every 0.1 seconds would be enough…
I suppose the PlayerController on the Client/Oculus side somehow has to call a RPC on the server side, letting the server know where he is…?
I already looked into the Collab Viewer Template which I think does exactly this, but I got lost because there was too much going on.
It would be great if someone could give a little bit of help on to set this up.
Another thing I tried was using the “set render target with blend” function to jump on the server side into the VR-View. This kind of worked pretty nice, but only for orientations - the positions did not update and the cameras position was locked…
Ok I finally got the server picking up the Clients (VR HMD) movement, but i am still trying to figure out how to replicate the movement from there to the other connected clients.
I suppose this has to be done via multicast and I followed this tutorial: - YouTube but no matter what I try, I end up jittery oder crazy movement or no movement at all.
I would recommend checking out the VR Expansion plugin. It has proper replication implemented.
@Eanir, oh I did not know about that, thanks I will try this!
If this works, I definitely will go with this, but still if anybody could help me out on the general concept here would be great
I guess every client needs to call a “run on server” event to move his actor on the server - and also calling an action which replicates this information to every other client except the client who called it… …or also?
Ok the VR Expansion Plugin works out box which is pretty amazing. But network performance is kind of laggy.
My own replication setup (which for nox is only client to server) is complelety lag-free. With plugin I am having some real performance issues. is there anything essential I need to consider?
The VR Expansion is still very laggy so continued with my own trial and error setup.
I followed this tutorialhttps://youtube.com/watch?v=WFAy5nYWCRE
I think the main with problem this approach are the “run on server” and “multicast” functions,w replicate the data back to the client - which has already moved the pawn through its own input - before calling the ROS. So it’s kind of being moved twice, creating the crazy behavior.
I suppose the right way is to communicate just the input data to the server which then multicasts the actual movement. But I didn’t figure out how just grab the motion controllers transforms, since they seem to apply all the transforms automatically by default.
So I just multicasted the transform data to a static mesh component of the pawn which is just a visual representation of the players location. Guess that’s a cheap workaround but maybe it helps anybody with a similar issue…
You say being moved twice - as in twice on the client? I stored the transform as a replicated variable, updated this from the client to the server. Then in the onRep for the transform I set the hand transform based on the variable - unless it’s locally controlled and then it’s ignored.
If I’ve totally misunderstood my apologies - but this is how I got my clientside hands more controlled. I’ll eventually lerp the hand transform instead of just updating.
Edit: This came at the top of my view, so I didn’t realise how old it was!
@Boruki thanks anyway.
In the end the vr expansion plugin worked just fine for all the movement replication and in the meantime I also learned a lot about replication/RPC in general. For sure it wasn’t the best idea to develop a networking app after spending only two months in UE, but somehow I made it work.
Having a good understanding of networking in UE is always worth having.