lucaspoffo / renet

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

draft: Switch from using raw `u64` to `NetworkId` wrapper type #100

Closed roboteng closed 1 year ago

roboteng commented 1 year ago

fixes: #41

The main change is in renetcode/src/server.rs.

NetworkId is just a wrapper around u64, so there isn't much of a functionality change here, just a refactor. Two dependency changes are present:

  1. renetcode now has a serde feature, which adds Serialization and Deserialization impls for NetworkId when enabled.
  2. bev_renet now directly depends on renetcode. This is only to enable the serde feature

I noticed that in the code, ClientId was used, while the issue mentioned NetworkId/NetId. I thought NetworkId was a better name, in case clients would need it to refer to the server, but I'm totally open to changing the name.

I also didn't write any docs for NetworkId, I wasn't sure what to put other than "Wraps u64"