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

Configurable systems/event clearing #34

Merged
merged 6 commits into from
Aug 28, 2022

Conversation

Aceeri
Copy link
Contributor

@Aceeri Aceeri commented Aug 3, 2022

Related issue: #31

Somewhat follows bevy_rapier's example although I don't make entire stages since that seems a bit wasteful here. But this should also make it easier to add more systems without breakage in the future if needed.

Copy link
Contributor

@Shatur Shatur left a comment

Choose a reason for hiding this comment

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

Looks reasonable, similar to Rapier but with systems instead of stages (makes sense).

@@ -70,11 +121,32 @@ impl RenetClientPlugin {
}
}

pub fn send_packets_system(mut client: ResMut<RenetClient>, mut renet_error: EventWriter<RenetError>) {
pub fn send_packets(mut client: ResMut<RenetClient>, mut renet_error: EventWriter<RenetError>) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Using _system is a convention suggested by @cart. Also other systems still have _system suffix, so I would keep it.

Comment on lines 99 to 115
pub fn get_systems(label: RenetSystems) -> SystemSet {
match label {
RenetSystems::ClearEvents => SystemSet::new()
.with_system(Events::<ServerEvent>::update_system)
.with_system(Events::<RenetError>::update_system)
.label(RenetSystems::ClearEvents),
RenetSystems::Update => SystemSet::new()
.with_system(Self::update_system.with_run_criteria(has_resource::<RenetServer>))
.label(RenetSystems::Update),
RenetSystems::SendPackets => SystemSet::new().with_system(
Self::send_packets
.with_run_criteria(has_resource::<RenetServer>)
.label(RenetSystems::SendPackets),
),
}
}
}
Copy link
Owner

Choose a reason for hiding this comment

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

I feel that adding systems like this adds too much noise to the code without gains, we have very few system, the labels almost map 1 to 1. I think we still could use the old way, WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ya I was just thinking it might be useful if more systems are added in the future.

Copy link
Owner

@lucaspoffo lucaspoffo Aug 6, 2022

Choose a reason for hiding this comment

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

When the time comes, we can use this approach if necessary 👍
For now, I would just use after/before the system names and remove the get_system.
But I can see why rapier is using it, they have a way more complex system structure and ordering.

@lucaspoffo lucaspoffo merged commit 4c24eed into lucaspoffo:master Aug 28, 2022
@lucaspoffo
Copy link
Owner

Thanks! Sorry for the delay

@Shatur
Copy link
Contributor

Shatur commented Aug 28, 2022

@lucaspoffo variable default_system_setup is used only do setup event clearing? Maybe rename into something related to events then?

@lucaspoffo
Copy link
Owner

@Shatur yeah, I've already done this on 5ac53f7, when documenting it I noticed also this.

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.

3 participants