• Login
  • Register
  • Dolphin Forums
  • Home
  • FAQ
  • Download
  • Wiki
  • Code


Dolphin, the GameCube and Wii emulator - Forums › Dolphin Emulator Discussion and Support › Development Discussion v
« Previous 1 ... 15 16 17 18 19 ... 117 Next »

[Question] What is the mechanism behind Dolphin Netplay?
View New Posts | View Today's Posts

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Thread Modes
[Question] What is the mechanism behind Dolphin Netplay?
11-18-2018, 05:58 AM
#1
kakashidinho
Unregistered
 
Hi,
I heard that Dolphin has a quite robust netplay implementation. I'm curious about how is it implemented? A lot of other console emulators (including Retroarch) have problems with state desync but seems like Dolphin doesn't (asides from rom & emu version mismatch)?

How does it cope with network input delay/loss, out of order arrivals for example? If the simple solution is just resending and making sure the order of input is correct, then isn't it make the delay even worse?
Reply
11-18-2018, 06:16 AM
#2
mimimi Offline
Senior Member
****
Posts: 720
Threads: 1
Joined: May 2014
Disclaimer: I'm not a good coder and i'm just stating the things i noticed in the code and Dolphin's behavior.

I don't think there's any code to cope with out of order arrivals. If that was an actual problem, you'd just add a number to the packets, so Dolphin knows when one is skipped.

Netplay works by getting both machines in the same starting state and then it just sends the controller inputs via network. The delay is handled by storing a few inputs in a buffer and playing the inputs from that buffer, so all inputs are delayed by a certain number of inputs.

Also, it only works properly in single core mode, since there it is 100% deterministic when Dolphin does what and when the inputs are processed. I guess one major part of the robustness comes from not getting the system time after starting the game and calculating the time by processed frames and cpu cycles. Because of that, one client can lag behind and catch up later, without a single bit difference in the game's memory.
Find
Reply
11-18-2018, 06:41 AM
#3
kakashidinho
Unregistered
 
(11-18-2018, 06:16 AM)mimimi Wrote: I don't think there's any code to cope with out of order arrivals. If that was an actual problem, you'd just add a number to the packets, so Dolphin knows when one is skipped.

Thanks for the reply.

If receiver side just skips out of order input, then doesn't that mean the state will be different between 2 players? Since the sender actually didn't skip that input.
Or is it because of long enough buffer, the chance of out of order input arrivals is practically zero?
Reply
11-18-2018, 11:00 AM
#4
mimimi Offline
Senior Member
****
Posts: 720
Threads: 1
Joined: May 2014
(11-18-2018, 06:41 AM)kakashidinho Wrote: Thanks for the reply.

If receiver side just skips out of order input, then doesn't that mean the state will be different between 2 players? Since the sender actually didn't skip that input.
Or is it because of long enough buffer, the chance of out of order input arrivals is practically zero?

I don't think this is happening, or least it's not a big problem. Right now, Dolphin should desync on packet loss, at least as far as i have seen it the last time i looked at the code. Like i said, it shouldn't be too hard to catch this by adding an index to the packets. Then, if there's a skipped packet, it would just need to request resending the missing packet, wait until it's reveived and then process all inputs properly in order.
Find
Reply
11-18-2018, 02:45 PM
#5
delroth Offline
Making the world a better place through reverse engineered DSP firmwares
**********
Developers (Some Administrators and Super Moderators)
Posts: 1,354
Threads: 63
Joined: Aug 2011
We use enet as a transport layer, which takes care of packet reordering and retransmissions.
Pierre "delroth" Bourdon - @delroth_ - Blog

<@neobrain> that looks sophisticated enough to not be a totally dumb thing to do
Website Find
Reply
« Next Oldest | Next Newest »


  • View a Printable Version
  • Subscribe to this thread
Forum Jump:


Users browsing this thread: 2 Guest(s)



Powered By MyBB | Theme by Fragma

Linear Mode
Threaded Mode