Skip to content

Allow configuring replication schedule #712

Description

@Shatur

Right now we expose tick_schedule, which allows configuring the schedule on which the server tick is incremented. By default, it's FixedPostUpdate.

Incrementing the tick triggers replication in PostUpdate:

bevy_replicon/src/server.rs

Lines 158 to 166 in 60e3c5e

PostUpdate,
(
prepare_messages,
collect_mappings,
collect_despawns,
collect_removals,
collect_changes,
send_messages,
)

However, if the fixed schedule runs multiple times, the tick will also be incremented multiple times (assuming it's incremented in the fixed schedule, which is the default). Replication, however, will happen only once. This could be problematic for prediction/interpolation because it's impossible to tell on which tick a value was changed.

We could allow configuring the replication schedule as well.

But maybe we shouldn't even separate replication it from the tick increment? I.e instead of running replication when the tick is incremented, we could include the tick increment inside the replication schedule itself. So it will be a single plugin setting that determines both when the tick is incremented and when replication is sent.

Thoughts?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions