Netplay for the PC version. Let's discuss it

Hi guys :slight_smile:

I’d like to expand upon a topic SquarePusher and I touched on over at the FBA forums a couple weeks ago…netplay in RetroArch. Before I continue, I would like to preface this by making you aware that the following questions are about the PC version of RetroArch only, not any other version.

SquarePusher…, you told me in that Wolf Unit thread that RA supports netplay for the PC. I would like to know more information on how it works, and therefore would like to ask a few follow up questions:

1)Why isn’t netplay talked about more in this forum? I see no topics from anyone either asking about it or making any suggestions. A bit strange don’t you think, for something so significant in a wonderful emulator such as this one?

2)How exactly does netplay work in RA and how do you set it up? Is it difficult? Is there a FAQ or something I can go to to read more in-depth instructions?

3)How does the netplay feature compare to say, Kaillera, MAMEHUB or GGPO? Does it have a lobby function where multiple users can go in to play a game?

4)Is the netcode contained in these RA cores taken directly from their respective emulator counterparts? In other words? We know that snes9x emulator by itself natively supports netplay, but does the Snes9x core in RA use the identical netplay code from the REAL Snes9x EMULATOR? Or does RetroArch use it’s OWN netcode built from scratch, and apply it to each core in RA(like one blanket netcode program covering all the cores)?

5)Most importantly, which out of the several cores in RA supports netplay? All of them? Playstation? MAME? Snes? NES? Sega Genesis? Amiga? Master System? PC Engine? Very curious about this…

Again, keep in mind I am only asking about the PC version of RA, not any of the portable versions.

I can field some of these questions.

1.) Dunno why it isn’t talked about more because it’s fucking awesome. I think the main thing holding it back is that PC is only one part of the userbase, so console and mobile users are out in the cold.

2.) For setup, you can see this document I made a loooong time ago (back when RetroArch was called SSNES):

The netplay part is all the way at the end.

3.) It’s a homegrown, rollback-based “lagless” implementation from maister that works similar to GGPO in that it exchanges savestate deltas between the players and compares them for divergence. When it sees a divergence, it rolls back to the last known same state, resolves the differences and then emulates the intervening frames (known as ‘lag frames’) all at once to catch both players back up. This can be a big strain on resources, depending on the number of lag frames required due to ping/latency, but on a powerful machine, you can do cross-continental play and it feels lagless. [When it was first being implemented, maister and I played a few games with him in Norway and me in the USA and it felt completely snappy, despite some odd rollback situations due to excessive lag frames; snappy enough to reliably parry in Third Strike, even]

There’s no lobby system. We had discussed the possibility of an IRC client plugin that would allow anyone to setup an IRC channel for lobbying, but that never materialized. If people want to meet up in #retroarch or start a new #retroarch-netplay (or whatever) channel for matchmaking, they’re welcome to do it :slight_smile:

4.) Nothing taken from the cores, it’s all RetroArch’s own GGPO-style version. The cores aren’t really “aware” of the netplay aspect at all.

5.) Only a few cores work with netplay, as it requires savestate support (so no Mednafen-PSX) and consistent internal sync, which means that if you rewind and replay the same part X times, the result will always be exactly the same. The second one is the really tricky one, as inadequate internal sync will cause the players to desync and lose connection. Cores that I’ve personally tested as working are FBA and SNES9x/Next. I know bsnes doesn’t work because its internal sync isn’t sufficiently predictable (ilari had to fix this for his lsnes TAS fork), and the aforementioned Mednafen-PSX, since it doesn’t do savestates.

Anything that doesn’t support rewind is obviously out, so that’s the best first test. After that, it’s a matter of trying it out to see if it desyncs or not.

For consoles/mobile (and the many cores that don’t support the existing netplay implementation), there’s been some talk about implementing a “laggy” netplay similar to something like Kaillera that would work across platforms and cores.

Thank you very much HunterK. That’s helpful :slight_smile:

If you get a chance to do testing on any more cores with successful results on the PC version of RA, please post them here. FBA and Snes9x netplay support sounds awesome. I wonder if the NES and Master System cores work with it?

Also, since you brought up the mobile version, can you setup a direct netplay connection on mobile devices like the Shield? Can two Shields link to each other and play? Which cores are supported for Nvidia Shield netplay?

There will be a big performance test happening later next month that will determine whether netplay on two Shields is good.

If it is, then we can at least start to include Netplay for the Android port under the guise of ‘your mileage may vary on your device’.

Sounds good thanks SP.