naia-lib / naia

a cross-platform (including Wasm!) networking library built in Rust. Intended to make multiplayer game development dead-simple & lightning-fast
Apache License 2.0
911 stars 58 forks source link

Release 0.22.0 [WIP] #188

Closed connorcarpenter closed 10 months ago

connorcarpenter commented 1 year ago

This release is mainly focused on a powerful new tool for World Sync.

Previously, Entities and their Components were either Client-authoritative, or Server-authoritative. This made things simple to understand, but also made making more complicated ownership models require a bit of boilerplate.

It has always been the intention of Naia to be useful beyond the scope of games. When we consider apps where multiple users are capable of modifying a shared state, we run into problems of having to resolve conflicts and guard access. This update will introduce, via a slim API that you never need to look at, the possibility of setting alternative replication configurations on a per-entity basis that allows for more complicated ownership/visibility management.

  1. Public vs Private Client-owned Entities. Currently, Client-owned Entities are replicated to the Server, and no other Clients. In 0.22, you will be able to configure a Client-owned Entity to be "Public", which means that it will automatically be replicated out to other Clients as well, once it reaches the Server (scopes & rooms will be able to be used to filter which Users get those updates)

  2. Delegated Authority Entities will be able to be configured to have a "Delegated Authority Model" where a User can request write-authority over a specific Entity, and be able to mutate the Entity's data immediately, which will be replicated out to the Server and in-scope Clients. The User or Server can release authority, opening up an Entity to be claimed by another Client for write-access in the future. This will prevent any type of mutation conflicts.

This release will also have some other useability and quality of life improvements / bugfixes.