lucaspoffo / renet

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

Add TransportSocket trait for injecting the socket into netcode transports #145

Closed UkoeHB closed 7 months ago

UkoeHB commented 9 months ago

This way the existing netcode transports can be reused for the in-memory transport and WebTransport, which should reduce diffs/complexity for both of them, and allows WebTransport to use netcode ConnectTokens which are an essential part of the architecture.

This abstraction would also make it very easy to insert custom TransportSockets that artificially add packet loss and latency for testing purposes. Other performance characteristics of the architecture would remain the same with that approach (compared to writing entirely new transports with injected packet loss/latency), which is important for high-quality testing.

The main disadvantage of this approach is WebTransport would end up double-encrypting all packets. It may be possible to configure renet not to encrypt packets if the user can promise they were already encrypted. Needs careful thought.

UkoeHB commented 7 months ago

Closing this as implemented in renet2.