lucaspoffo / renet

Server/Client network library for multiplayer games with authentication and connection management made with Rust
Apache License 2.0
621 stars 63 forks source link

Any intention of WebRTC Support? #10

Open ValorZard opened 2 years ago

ValorZard commented 2 years ago

You could also have it be cross platform with native apps by using something like webrtc-rs

lucaspoffo commented 2 years ago

Yes,

My goal for a future version would be to decouple the UdpSocket from the server/client. I'm not sure about the approach yet. Maybe I'll do something similar to what I did with the renetcode crate, where we have functions to process/generate packets that can be sent/received from any transport layer. Or, something like a Transport trait so I can use a dyn Trait and a simple send/receive API.

But independent of the approach, a UDP implementation would be provided. But the user could swap for other transport implementations: Async IO, WebRTC... could even do another UDP implementation that spawns another thread to do the message pooling.

Some changes and experimentation are required to do this, so I'll probably do it after the initial release.

AceBunny commented 1 year ago

Sorry to bother, but do you have any updates on this or if it will happen in the foreseeable future? I'm interested on using your lib but support for UDP WebRTC is a requirement.

erlend-sh commented 1 year ago

I also asked about this today on behalf of @fishfolks, and received the following answer from Lucas on Discord:

It's something I will look into after 0.1 release: I do an old draft with some idea on how I would do: #14 Then with the channel (or a Trait) , you could impl whatever transport for it Someone would need to impl the trait for Web, since I don't really know wasm. Using naia-socket could be another way

Cheers! We might be able to help implement the trait for web if it seems feasible to do for our game.

lucaspoffo commented 1 year ago

I made #36 to move this discussion forward. What would be necessary to make a WASM compatible transport layer for renet? I made a simple Trait and impl it for Udp, now it's necessary to check what might need - if anything - for the wasm/webrtc implementation or any other desired backend.

lucaspoffo commented 1 year ago

With the release of https://github.com/lucaspoffo/renet/releases/tag/0.0.12, now it's possible to implement other backends for the transport layer.