Open DrewRidley opened 9 months ago
One possible API involves traits:
pub trait NetDecision {
type Updater: IntoSystem
fn process<T: NetMessage>(msg: T);
}
trait NetMessage {
fn send();
}
The underlying data structure would process the messages, which contain a .send()
method. NetDecision could be extended with associated types with IntoSystem
trait bounds. The primary unknowns with this approach are the performance characteristics (fragmenting and copying messages might become a bottleneck), and network order ambiguity. With this approach, there is zero guarantees or consistency in how/when messages are sent, which might affect network order. Given the current archetypal design, it would also not be possible to defer archetype moves (component insertions, removals).
Another unknown with this approach is how to guarantee eventual consistency. If a message is permanently dropped, there needs to be some marker indicating that the entities state is NOT up to date. This design also does not address streaming an entities existence. There should also be a way to predicate if/when entities are streamed, separate from the event system. If an entity does not exist on the client, no associated changes or events should be delivered.
In Nevy, it will be essential that developers are able to specify custom logic to determine how, when and if a given component change should be synchronized. This tracking issue will contain discussions, possible designs, and the implications of such designs.
Requirements: