Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better history API #359

Merged
merged 9 commits into from
Dec 1, 2024
Merged

Better history API #359

merged 9 commits into from
Dec 1, 2024

Conversation

Shatur
Copy link
Contributor

@Shatur Shatur commented Nov 21, 2024

Implements the proposal from #338:

  • HistoryConfirmed event for ConfirmHistory.
  • ServerMutateTicks resource that provides an API similar to HistoryConfirmed, but for received mutate messages. To activate it, third-party crate needs to call TrackAppExt::track_mutate_messages. I decided on an app extension method to avoid require user to set it in the plugin. And not via resource since it's something that should be configured before the app starts.
  • MutateTickConfirmed for the added ServerMutateTicks.

Requires #356, I will retarget to the master after the merge.

Copy link

codecov bot commented Nov 21, 2024

Codecov Report

Attention: Patch coverage is 97.39130% with 3 lines in your changes missing coverage. Please review.

Project coverage is 90.12%. Comparing base (9c0e1ed) to head (ad840f1).
Report is 2 commits behind head on master.

Files with missing lines Patch % Lines
src/client/server_mutate_ticks.rs 94.33% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #359      +/-   ##
==========================================
+ Coverage   89.93%   90.12%   +0.19%     
==========================================
  Files          44       46       +2     
  Lines        2484     2563      +79     
==========================================
+ Hits         2234     2310      +76     
- Misses        250      253       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Shatur Shatur force-pushed the deferred-entity-refactor branch from 8799e20 to 941f97b Compare November 26, 2024 23:05
Base automatically changed from deferred-entity-refactor to master November 27, 2024 09:05
@Shatur
Copy link
Contributor Author

Shatur commented Nov 27, 2024

Marking as ready for review. Most added lines are just tests.

@Shatur Shatur marked this pull request as ready for review November 27, 2024 23:06
@Shatur Shatur requested a review from UkoeHB November 27, 2024 23:06
@Shatur Shatur mentioned this pull request Nov 29, 2024
src/client.rs Outdated Show resolved Hide resolved
Comment on lines 132 to 136
/// Triggered for an entity when it receives changes for a tick.
///
/// See also [`ConfirmHistory`].
#[derive(Debug, Event, Clone, Copy)]
pub struct HistoryConfirmed {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe rename to EntityChanged? The name HistoryConfirmed is confusing to me since you haven't necessarily confirmed anything - there could be more mutation messages for this tick or previous ticks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about EntityReplicated? 🤔 EntityChanged sounds like something from Bevy.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about MutateTickConfirmed -> MutateTickReceived as well?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like that

src/client/server_mutate_ticks.rs Outdated Show resolved Hide resolved
src/client/server_mutate_ticks.rs Outdated Show resolved Hide resolved
@@ -366,14 +370,15 @@ fn send_messages(
trace!("no changes to send for {:?}", client.id());
}

if !mutate_message.is_empty() {
if !mutate_message.is_empty() || track_mutate_messages {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do you want to send empty messages? Just to confirm they are empty?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, necessary to differentiate between missed ticks and ticks without changes.

@Shatur Shatur linked an issue Dec 1, 2024 that may be closed by this pull request
@Shatur Shatur requested a review from UkoeHB December 1, 2024 11:24
@Shatur Shatur merged commit c99bfca into master Dec 1, 2024
5 checks passed
@Shatur Shatur deleted the history-rework branch December 1, 2024 22:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide more information about history
2 participants