libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.28k stars 1.83k forks source link

(Emscripten) Networking support #10851

Open enten opened 4 years ago

enten commented 4 years ago

Is networking support possible for emscripten?

I know that networking support isn't implement yet for emscripten (and that explains why netplay doesn't work). But I'm only asking if is it possible.

I see in emscripten docs that we can deal with networking.

I tried to read network sources but as I don't know lot of things about retroarch codebase and its building process (despite observations across libretro ressources and understanding of how everything works): I can't say that networking support is surely possible for emscripten (but I'm thinking it isn't impossible).

I would like to see libretro for emscripten have networking support to be able to use netplay and RetroAchievements.

I think libretro is a wonderful piece of software and our browsers are ready to offer a great experience of gaming which can start in one click. And I think that networking support for emscripten can make this experience even better.

Thanks for reading.

inactive123 commented 4 years ago

@ToadKing Any ideas?

ToadKing commented 4 years ago

I'm not familiar with RetroArch's netplay or know if it's TCP or UDP-based, but either way has issues due to emscripten only having support to web technologies like Websockets or WebRTC. There would either have to be a lot of work in RetroArch to handle TCP packets enclosed in Websocket messages and UDP packets in WebRTC messages, or involve proxy servers that handle the conversion.

enten commented 4 years ago

I understand that rewrite all network logic to enclose TCP/UDP packets in Websocket/WebRTC messages is a lot of work. And it will be useful for emscripten build only. So this solution is possible but requires too many changes.

The second solution which involve proxy servers to handle the conversion sounds better because it doesn't require lot of big changes in RetroArch code base.

But, do you see any changes require in RetroArch to try this solution base on proxy server?

Also, can you give some thoughts on how that proxy server should works?

dpxcc commented 3 years ago

+1 for networking support with emscripten

the doc (https://emscripten.org/docs/porting/networking.html) indicates that emscripten supports:

  1. emulated posix tcp socket
  2. full posix socket over websocket proxy server

so it seems that the work is already done on the emscripten side. any idea?

enten commented 3 years ago

The blog post Multiplayer Doom on Cloudflare Workers gives interesting information about how they make multiplayer works through websocket. The state of libretro to make multiplayer works isn't the same, but I think that can be a source of inspiration.

LibretroAdmin commented 2 years ago

@Cthulhu-throwaway Do you think some kind of networking support in Emscripten is do-able at this point, or is it a complete nonstarter?

GavriloviciEduard commented 7 months ago

Any updates on this? I'm really looking forward to retroachievements support.