lucaspoffo / renet

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

Allow application code to be transport agnostic #119

Closed OleStrohm closed 8 months ago

OleStrohm commented 8 months ago

This PR aims to provide ways of interacting with renet that are transport layer agnostic. The basic additions in this PR are two bevy System Sets: RenetReceive and RenetSend. These are the system sets where all transport layers should place their receive and send systems, allowing users to easily ensure that their systems run before/after Renet's transport layer systems run, rather than having to individually ensure that for each transport layer they care about.

The other addition in this PR is to move the Bevy run conditions from being implemented in each transport layer to making one single definition that uses RenetClient. This also means that each transport layer now has to update the RenetClient with the current state.

I also made quite a few methods private, specifically the methods that expose the internal connection status of the transport layers and the systems that previously marked when a transport layer would receive/send data. This was primarily done to help users migrating from previous versions notice that these shouldn't be used anymore, as well as not confuse new users. If this change isn't desired (especially the one about the transport layer connection status), then I'm happy to revert this change.

Fixes #115

OleStrohm commented 8 months ago

Also as an aside, I'm not entirely sure how you do the changelog, i.e. whether I should write the changelog here, or if you go through all the PRs with breaking changes when you draft a new release.