Initial work on rollback and refactor

This commit is contained in:
2026-08-12 12:27:35 +02:00
parent ad6c1e17ac
commit a21f24b2d9
45 changed files with 1451 additions and 717 deletions
+31
View File
@@ -0,0 +1,31 @@
//! Rollback networking: session setup and the engine-level rollback
//! registrations. Gameplay components are registered by the plugin that owns
//! them, not here.
use bevy::prelude::*;
use bevy_egui::EguiPrimaryContextPass;
use bevy_ggrs::prelude::*;
pub mod debug;
pub mod session;
/// The GGRS configuration for this game — notably, what a frame of input is.
pub type GGRSCfg = GgrsConfig<crate::input::FighterInputFrame>;
#[derive(Default)]
pub struct FighterNetcodePlugin;
impl Plugin for FighterNetcodePlugin {
fn build(&self, app: &mut App) {
let plugin = GgrsPlugin::<GGRSCfg>::default();
app.add_plugins(plugin)
.add_systems(Startup, session::netcode_setup)
// Engine-level components that every rolled-back entity may carry.
// Gameplay components are registered by the plugin that owns them.
.rollback_component_with_clone::<Transform>()
.rollback_component_with_clone::<Name>()
.add_systems(EguiPrimaryContextPass, debug::network_debug)
.add_systems(Update, session::print_events_system)
.insert_resource(RollbackFrameRate(60));
}
}