mGBA Forums
Is mGBA link cable emulation deterministic? - Printable Version

+- mGBA Forums (https://forums.mgba.io)
+-- Forum: mGBA (https://forums.mgba.io/forumdisplay.php?fid=1)
+--- Forum: Development (https://forums.mgba.io/forumdisplay.php?fid=11)
+--- Thread: Is mGBA link cable emulation deterministic? (/showthread.php?tid=4906)



Is mGBA link cable emulation deterministic? - kakashidinho - 12-14-2018

Hi,
I'm new to mGBA, currently just playing around with code and experimenting ways to implement netplay feature.
What I noticed is that sometimes 2 local gba emulations when connected through link cable will result in different states (even when they started from same states and received same input sequences).

What I tried:
- open 2 gbas on PC A, then open 2 gbas on PC B. 
- 2 gbas on the same machine were executed on the same thread (to avoid randomness of multithreading). 2 gbas in 2 machines started from same save states.
- Apply the same input sequences to the 2 gbas in 2 machines, at first the states keep being identical for a while. However at some point, they started behave differently.
- For example: on PC A, lockstep.useCycles(1, 499) was called, while on the other one, useCycles(1, 495) was called. 

I'm not sure why the cycles value were called differently at that time. After that point, obviously the states of 2 gbas on 2 PCs were diverse.


RE: Is mGBA link cable emulation deterministic? - endrift - 12-15-2018

Currently, no. It's buggy at the moment. I have a redesign in early progress that will hopefully fix that though.


RE: Is mGBA link cable emulation deterministic? - kakashidinho - 12-17-2018

(12-15-2018, 12:22 AM)endrift Wrote: Currently, no. It's buggy at the moment. I have a redesign in early progress that will hopefully fix that though.

Thanks for the reply. Do you have any documents on how GBA link cable work? I would love to understand it better. 
Haven't managed to find anything useful on the net.

I experimented some multiplayer scenarios lately and found out the timing & sync (fps target for example) affected the stability of link cable, some fps targets caused too many communication errors. Why does fps target affect the link cable?
I understand that you are rewriting the link cable module. However, would really appreciate to understand what are the problems currently.

Thanks,


RE: Is mGBA link cable emulation deterministic? - kakashidinho - 01-13-2019

Ok, I saw your gbatek repo. It's quite useful. I have made a pull request for link cable fix for pokemon/kirby games here: https://github.com/mgba-emu/mgba/pull/1263
Hopefully, it could be useful.