- Home /
Using Unity for master-slave tele-robotics
Hello
I am programming a multiplayer game in unity that would be in the form of a Master-Slave tele-operation system. Essentially, I have a multi-threaded system, with two threads -
Unity update loop - 60-100Hz
Robot update loop - 1000 Hz
So, in the single player setting, when I move the robotic arm, the cursor moves on the screen (Imagine that the robot is very expensive joystick that controls player motions). Now, I want to transfer this motion over the internet to another computer running the same game. So if I move my master robot, the slave robot should move in the same way and the slave player (on screen cursor) should move as well.
Now as far as the player motions are considered, Unity Multiplayer is enough to transfer that data. However, I cannot transfer the robot data as I need to maintain the sampling rate of 1000 Hz across both robots. Please note that it is vital that the robot data is transferred at 1000 Hz.
Any clue as to how to achieve this?
Thanks in advance
Answer by TheSOULDev · Sep 01, 2017 at 06:53 PM
You can transfer the data at 1000 Hz, but Unity won't be able to receive the data. There is absolutely no reason that you transfer data at 1000 Hz when firstly, it is completely unnecessary to have ANYTHING running that quickly, and secondly, if you can't read 1000 Hz, you don't send 1000 Hz.
The solution is to send at 60-100 Hz, which you regulate with the master, otherwise you're just going to be permanently stuck syncing without actual output for the slave. But then again, the slave will have to ask for data and then receive, otherwise you're going to have a laggy stack structure which probably doesn't even work that well. All solutions that don't have the same refresh rate are going to be inefficient, though.
Your answer
Follow this Question
Related Questions
how to display photon private rooms on rooms list? 0 Answers
Online Mulitplayer options in Free Unity 1 Answer
Photon network won't join random room with a custom property 0 Answers
instantiate spawning meany objects in multiplayer 0 Answers
What to do when user clicks back on google play games realtime multiplayer auto-match ui ? 0 Answers