mGBA Forums
[New Feature] Add network multiplayer - 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: [New Feature] Add network multiplayer (/showthread.php?tid=421)



[New Feature] Add network multiplayer - n1zzo - 07-11-2016

I'd like to implement multiplayer communication over IP,
could this be feasible?

Should it be server based with a central server that broadcasts the frames to every client,
or just point to point?

The current local SIO emulation is somehow limited with respect to the possibilities of multiplayer over internet.


RE: [New Feature] Add network multiplayer - endrift - 07-11-2016

I'm already planning to implement this, but trust me, it's way harder than it seems due to the tight timing constraints of SIO communication.

The plan involved serializing inputs and savestates across the network instead of individual SIO packets, and running the emulation loop in full on each computer. However, this will require a bunch of internal knowledge to get up and running so it's not a great newbie project. I can try to help, but...it's difficult, which is why I haven't done it yet myself.


RE: [New Feature] Add network multiplayer - n1zzo - 07-11-2016

Ok, directly porting the protocol on internet is a no-go,
but maybe we can do something to avoid the problem of the strict time window.
We could replace the original GBA protocol and instead of exchanging frames in the same window,
just exchange them in an asynchronous way and send the correct interrupts every time we receive a new
message from one of the clients.

Your idea of replicating the multiplayer is very interesting but seems very hard to implement to me,
but maybe because I have very little knowledge of the gba emulation internals.

I've looked a bit into the source code of VBA Link which actually implements the LAN multiplayer,
and they seem to use a server-client architecture, every client, instead of waiting for their turn, directly send
their 16bit word to the server, which once enough frames are collected, sends them as a whole packet to the clients.

Is this manageable in your opinion?


RE: [New Feature] Add network multiplayer - JSON - 01-06-2017

As cool as that sounds, it doesn't sound realistic. All you should need to do is emulate whatever serial protocol that was used by the original GBA over the wire (but send over wifi or Bluetooth). Did Gameboy Advance send video frames and full gamestate over its basic serial interface? Or just basic commands and user state? Your idea sounds awesome but wouldn't emulate the original interface that the games were designed for.

The VBA approach is close to dead on, it just needs to utilise a network stack designed for peer to peer because the TCP route is not the way to go. Multiplayer is my main interest when comparing emulators. Its specifically what i was investigation[ when I found mGBA. mGBA's approach is very low level. It just needs a network interface designed to emulate 'link'.