- cross-posted to:
- bevy
- cross-posted to:
- bevy
It鈥檚 a crate for server-authoritative networking. We use it for Simgine, but it鈥檚 general-purpose.
Highlights
- Priority system inspired by Unreal Engine鈥檚 Iris. This lets you control how often mutations are sent.
- Replication filters. When registering component(s) for replication, you can now attach
Queryfilters usingfunctions:
app.replicate_filtered::<Transform, Or<(With<Player>, With<Enemy>)>>()
We had to add because functions can鈥檛 have default generic parameters like structs (which is how it works with Query).
- Replication as another struct. This lets you define a struct, implement conversions via
From, add serde derives, and register it like this:
app.replicate_as::<Transform, TransformWithoutScale>();
Using replicate_with with custom ser/de functions is still possible and useful, but for simple cases replicate_as is nicer.
- Ergonomic mapping for entities spawned on the client. When an entity is spawned on the server, clients automatically spawn a new entity and map IDs.
But sometimes you may need to predict spawning on the client or load a level independently on both client and server.
This is where the newly added
Signaturecomponent comes in. It calculates a hash for the entity to uniquely identify it based on component(s) and/or a seed. This way, when the server replicates a new entity to a client and its hash matches an already existing entity, they will be mapped.
commands.spawn(Cell { x, y }, Signature::of::<Cell>());
- Migration to Bevy states from custom run conditions. This feels more natural and allows the use of things like
StateScoped(ClientState::Connected).
We also revamped the examples! I already showcased a boids example (https://lemmy.ml/post/35170308) for deterministic replication, but later realized that a silly mistake in the code left the boids half-blind 馃槄 So here鈥檚 a new video where they can properly see each other.
This release targets Bevy 0.16. I鈥檓 starting work on the 0.17 RC now.
You must log in or # to comment.

