RetroFed Forum
Your home away from modern life.
🧬 Bevy Replicon 0.35.0 is out!
Post Reply
AuthorMessage
Shatur lemmy.ml Shatur@lemmy.ml
Joined: 2021-11-18
Quote

It’s a crate for server-authoritative networking. We use it for Simgine, but it's general-purpose.

Highlights

  • Priority system inspired by Unreal Engine's Iris. This lets you control how often mutations are sent.
  • Replication filters. When registering component(s) for replication, you can now attach Query filters using *_filtered functions:
app.replicate_filtered::<Transform, Or<(With<Player>, With<Enemy>)>>()

We had to add *_filtered because functions can't 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 Signature component 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's a new video where they can properly see each other.

This release targets Bevy 0.16. I'm starting work on the 0.17 RC now.

πŸ“œFull changelog
πŸ“¦bevy_replicon

1   Original
Post Reply
Back to top