Commit Graph

2 Commits

Author SHA1 Message Date
828ebf089a feat(game): Stellaris-style single-ship control with real flight physics
Some checks failed
CI / TypeScript Check (docs) (push) Has been cancelled
CI / TypeScript Check (site) (push) Has been cancelled
CI / Rust Check (push) Has been cancelled
CI / Security Audit (push) Has been cancelled
The player ship was never wired to its own movement systems — it lacked
MaxSpeed/TurnRate (so steer_to_target skipped it) and the Player marker
(so click-to-move skipped it). Only integrate_velocity matched, leaving
the ship drifting on a hardcoded undock vector and ignoring all input.
Left-click was also bound to camera drag, selection, and move at once,
and "Approach" started a cosmetic timer that moved nothing.

New control scheme (single ship, like Stellaris minus fleet selection):
- Right-click issues a move order (was left-click, which conflicted
  with selection + camera drag).
- Left-click cursor-selects the target under the cursor (was
  nearest-to-camera) and deselects on empty space.
- "Approach" now actually flies to the selected target, homing onto it
  via ApproachTarget even as it orbits.
- Smooth acceleration + stopping-distance arrival deceleration +
  turn-rate-limited banking replace instant velocity snapping.
- A pulsing destination waypoint ring gives on-world move-order feedback.
- Undock holds position (zero velocity + at-ship MoveTarget) instead of
  drifting off on a stale vector.
- Follow-cam now allows free-look rotate/zoom so the player can find
  and click targets while the camera tracks the ship.

Steering is shared: the player ship and AI ships use one physics model.
AI spawn bundle gets the new required components (Acceleration,
ArrivalRadius).

Also fixes a B0001 panic in the destination-marker system: the marker
query now carries Without<PlayerShip> so it is provably disjoint from
the player Transform read.

Includes the in-system action-panel rebuild-on-change optimization
(buttons and their Interaction state persist between frames so clicks
register), which the Approach/Dock flow depends on.

Flight tuning lives in in_system/scene.rs (PLAYER_MAX_SPEED,
PLAYER_ACCELERATION, PLAYER_TURN_RATE, PLAYER_ARRIVAL_RADIUS).
2026-06-18 17:57:03 -04:00
c14f684b09 Add galaxy parameter UI, star selection, and movement/physics scaffolding
Galaxy creation scene (Bevy 0.16):
- Split into module folder: params.rs, mod.rs (generation + spawn), ui.rs,
  selection.rs
- GalaxyParams resource (seed, count, arms, vertical_arms, size, twist,
  vertical_twist) with generation counter for change detection
- Control panel: 7 +/- slider rows + Regenerate button, no native Bevy slider
  widget so uses label + icon buttons
- Info panel: live-refreshes on selection change via despawn_related::<Children>
- Click-to-select: screen-space picking (project each star to viewport, closest
  within 18px threshold wins); selected star lerps scale to 2.2x
- Generation faithfully ports the docs TS reference including vertical arms
- Regeneration system: despawns GalaxyScene root only, preserves UI panels

Camera:
- Camera2d -> Camera3d + OrbitCamera (left-drag yaw/pitch, scroll zoom,
  pitch/distance clamped to avoid gimbal)
- Orbit drag suppressed when cursor over UI

New plugins (scaffolding):
- movement/: Velocity, MaxSpeed, TurnRate, Drag, MoveTarget, Player components
  + click-to-move (no player spawned yet)
- physics/: pure-data geometry (ray_vs_sphere, overlaps, separate,
  segment_vs_sphere) with 7 passing unit tests; no systems wired yet
- star_map/: plugin skeleton gated on AppState::InGame

Shared:
- ui/util.rs: cursor_over_ui helper for UI-hover detection
- docs: ARCH-9 decision record (custom movement & collision, no physics engine)
2026-06-04 12:29:33 -04:00