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

Add rollback systems with app.add_system(system.in_schedule(GGRSSchedule)) #51

Merged
merged 8 commits into from
Mar 30, 2023

Conversation

johanhelsing
Copy link
Collaborator

Builds on #50

This moves the schedule building functions over to App instead.

This means regular Bevy Plugins can now easily add systems GGRS schedule in their build function.

I'm wondering: would you consider changing your naming scheme so it could be GgrsSchedule? My brain is kind of struggling a bit with GGRSSchedule.

@johanhelsing
Copy link
Collaborator Author

johanhelsing commented Mar 10, 2023

More example usage:

#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
#[system_set(base)]
pub enum RollbackSet {
    Pre,
    Update,
}

        app.get_schedule_mut(GGRSSchedule)
            .expect("no ggrs schedule, add ggrs plugin first")
            .configure_set(RollbackSet::Pre.before(RollbackSet::Update))
            .set_default_base_set(RollbackSet::Update)
            // "core" rollback systems
            .add_systems(
                (tick_frame_count, update_action_state_from_ggrs_input)
                    .in_base_set(RollbackSet::Pre),
            );

in another plugin:

        let rollback = app
            .get_schedule_mut(GGRSSchedule)
            .expect("No ggrs schedule added");

        rollback.add_systems((
            update_character_state,
            update_character_facing_dir,
            // todo: remove?
            set_torque,
        ));

        // after update_character_state
        rollback.add_systems(
            (
                character_jetpack_movement,
                activate_terminals.before(propagate_actuation),
                character_run
                    // mutually exclusive since characters can't run while flying
                    .ambiguous_with(character_jetpack_movement),
                character_jump
                    // arbitrary ordering for determinism
                    .after(character_run)
                    // mutually exclusive since characters can't jump while flying
                    .ambiguous_with(character_jetpack_movement),
            )
                .after(update_character_state),
        );

@donedgardo
Copy link
Contributor

donedgardo commented Mar 12, 2023

I've been testing johns bevy-0.10-refactor branch and created some integration test in it.

Here is the branch with integration test and the GitHub actions checks passing.
PR: johanhelsing#2
CI Action: https://github.com/donedgardo/bevy_ggrs/actions/runs/4396368805

@gschup
Copy link
Owner

gschup commented Mar 12, 2023

Thats super cool, thank you! I am currently in the process of rewriting the whole plugin on this branch, but I would be glad to have the integration tests in that new version. I'll let you know once I arrived at a satisfactory state of my rewriting attempt :)

* Add .idea to IDE gitignore
* Add integration test
@johanhelsing
Copy link
Collaborator Author

I'll probably be using this branch for my game until #52 is ready, so I guess it could serve as the "final" reflect-style bevy 0.10 compatible branch for anyone else wanting to use bevy 0.10 immediately?

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