Compare commits

..
Author SHA1 Message Date
EIREXE c463dd76db Remove UI multi cam setup
CI / build-and-test (pull_request) Successful in 1m15s
CI / production-build (pull_request) Successful in 9m3s
2026-09-20 18:23:01 +02:00
EIREXE 85236c4e0f Optimize rollback hot paths (#53)
CI / build-and-test (push) Successful in 1m16s
CI / production-build (push) Successful in 9m36s
## Summary

Fixes #20.

- Reuse fighter animation scratch and output buffers across rollback frames.
- Select air-collision hits in one pass without candidate allocations or sorting.
- Index contiguous replay input frames directly and binary-search checksums.
- Add regression tests for buffer reuse and replay lookup/validation.

Reviewed-on: #53
Co-authored-by: Álex Román Núñez <eirexe@eirteam.moe>
2026-09-20 12:41:13 +00:00
3 changed files with 16 additions and 16 deletions
+1 -1
View File
@@ -241,7 +241,7 @@ pub fn copy_cursor_transform_to_token(
character_boxes: Query<(&CharacterBox, &ComputedNode, &UiGlobalTransform)>, character_boxes: Query<(&CharacterBox, &ComputedNode, &UiGlobalTransform)>,
match_config: Res<MenuMatchConfig>, match_config: Res<MenuMatchConfig>,
cursors: Query<&UiGlobalTransform, With<FGMenuCursor>>, cursors: Query<&UiGlobalTransform, With<FGMenuCursor>>,
cam: Single<&Camera, With<IsDefaultUiCamera>>, cam: Single<&Camera>,
ui_scale: Res<UiScale>, ui_scale: Res<UiScale>,
) -> Result { ) -> Result {
let camera = cam.into_inner(); let camera = cam.into_inner();
+1 -1
View File
@@ -181,7 +181,7 @@ pub fn cursor_input(
} }
pub fn update_cursor_transform( pub fn update_cursor_transform(
camera: Single<&Camera, With<IsDefaultUiCamera>>, camera: Single<&Camera>,
query: Query<(&mut Node, &PointerLocation), With<FGMenuCursor>>, query: Query<(&mut Node, &PointerLocation), With<FGMenuCursor>>,
ui_scale: Res<UiScale>, ui_scale: Res<UiScale>,
) { ) {
+14 -14
View File
@@ -25,6 +25,8 @@ pub mod style;
#[derive(Component, Clone, Default)] #[derive(Component, Clone, Default)]
pub struct MenuMarker {} pub struct MenuMarker {}
#[derive(Component, Clone, Default)]
pub struct MenuCameraMarker {}
pub struct MenuPlugin; pub struct MenuPlugin;
@@ -38,6 +40,7 @@ pub fn wrap_menu(menu: impl Scene) -> impl Scene {
bsn! { bsn! {
#MenuRoot #MenuRoot
MenuMarker MenuMarker
Transform
Node { Node {
width: percent(100), width: percent(100),
height: percent(100), height: percent(100),
@@ -46,6 +49,11 @@ pub fn wrap_menu(menu: impl Scene) -> impl Scene {
flex_direction: FlexDirection::Column, flex_direction: FlexDirection::Column,
} }
Children [ Children [
(
#MenuCamera
Camera
Camera2d
),
( (
#MenuContainer #MenuContainer
Node { Node {
@@ -65,15 +73,18 @@ pub fn wrap_menu(menu: impl Scene) -> impl Scene {
pub fn despawn_menu( pub fn despawn_menu(
existing_menu: Option<Single<Entity, With<MenuMarker>>>, existing_menu: Option<Single<Entity, With<MenuMarker>>>,
existing_menu_camera: Option<Single<Entity, With<MenuCameraMarker>>>,
mut commands: Commands, mut commands: Commands,
) { ) {
if let Some(entity) = existing_menu { if let Some(entity) = existing_menu {
commands commands
.entity(entity.into_inner()) .entity(entity.into_inner())
.remove::<Camera2d>()
.remove::<Camera>()
.despawn(); .despawn();
} }
if let Some(menu_cam) = existing_menu_camera {
commands.entity(*menu_cam).despawn();
}
} }
pub fn spawn_menu( pub fn spawn_menu(
@@ -84,8 +95,6 @@ pub fn spawn_menu(
if let Some(entity) = existing_menu { if let Some(entity) = existing_menu {
commands commands
.entity(entity.into_inner()) .entity(entity.into_inner())
.remove::<Camera2d>()
.remove::<Camera>()
.despawn(); .despawn();
} }
commands.queue_spawn_scene(wrap_menu(menu)); commands.queue_spawn_scene(wrap_menu(menu));
@@ -113,16 +122,7 @@ impl Plugin for MenuPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_systems( app.add_systems(
OnEnter(AppState::MainMenu), OnEnter(AppState::MainMenu),
(build_menu::<MainMenu>, |mut commands: Commands| { build_menu::<MainMenu>,
commands.spawn((Camera2d, IsDefaultUiCamera));
commands.spawn((
Camera2d,
Camera {
order: 1,
..default()
},
));
}),
) )
.add_message::<character_select::PlayerSlotAssigned>() .add_message::<character_select::PlayerSlotAssigned>()
.init_resource::<navigation::UINavigationActionState>() .init_resource::<navigation::UINavigationActionState>()