Commit Graph

8 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
2330044ec3 Merge agent branch agent/u1-8a3c7cf2 into main (U1: Basic UI Shell) 2026-06-18 00:57:19 -04:00
7b9b892bfb feat(game): restore in-system HUD with reactive station↔flight panel swap (U1)
Basic UI Shell: bring back the in-game flight HUD and station info panel,
and implement the missing "station mode panel swap."

Implementation:
- New `in_system/hud.rs` with a reactive, idempotent `sync_hud_panels`
  system: it shows the station info panel while the player is `Docked` and
  the flight HUD while in `FlightState`, spawning/despawning only when the
  on-screen panel disagrees with the player's state. This replaces the old
  fragile event-driven spawn/despawn scattered through the transition systems.
- Re-enabled the docked info panel (`ui.rs`) and flight HUD (`flight_ui.rs`),
  restructured both as small corner-anchored overlays with NO full-screen
  root so they only block camera orbit input when the cursor is directly
  over a panel (orbit_camera_control suppresses input over any UI node).
- Made the docked panel info-only (actions live in the contextual action
  panel, which adapts to docked/flight modes).
- Fixed the broken undock chain: `start_undocking`/`start_travel` now take a
  real `now_ms` (was hardcoded `0.0`, completing instantly) and a new
  `complete_operations` bridge maps `OperationCompletedEvent::Undocking`
  back to `UndockEvent` so `handle_undock` actually runs.
- Wired `ActionType::Dock` to fire a `DockEvent` for a targeted station /
  habitable planet so the flight→docked swap is reachable too.
- `handle_docking` now also clears Velocity/MoveTarget/SelectedTarget so the
  docked ship stops cleanly.
- Fixed deprecated Bevy 0.16 APIs (single_mut, EventWriter::write,
  despawn) and removed now-dead code, dropping total warnings 183→137.

Compiles clean (`cargo check`); no new warnings in touched files.
2026-06-17 19:43:24 -04:00
b8e8f934d3 feat(physics): collision resolution + proximity queries (P2)
Implement the kinematic physics & collision layer per ARCH-7 (no physics
engine; distance-based collision + spatial queries).

physics/
- components.rs (new): BodyMass, ProximitySensor, CollisionEvent, ProximityEvent
- geometry.rs: add sphere_overlap() + split_by_inverse_mass() with unit tests
- systems.rs: collision pipeline (detect_collisions -> resolve_collisions)
  with mass-weighted separation and inbound-velocity cancel, plus
  update_proximity_sensors spatial query and a log_physics_events observer.
  Core math factored into pure plan_collisions() with unit tests.
- mod.rs: PhysicsPlugin registers events, FrameCollisions resource, and the
  InGame systems ordered after kinematic integration.

in_system/scene.rs: give the player ship a BoundingVolume collider, BodyMass,
and a ProximitySensor so it participates in collision and spatial queries.

Bodies with a Velocity are movable; scenery is immovable. 19 unit tests pass;
no new compiler/clippy warnings introduced.
2026-06-16 21:30:27 -04:00
30b6678569 feat(camera): comprehensive camera system (C1)
Rebuild the camera around a single persistent MainCamera and the
Camera System design-doc model: two framing modes (Orbit = inspection/
docked tactical, Follow = track the ship) plus Cinematic as a boolean
overlay (free rotation + HUD hide + live gameplay), not a third mode.

Critical fixes (gap analysis A1-A3):
- A1: scenes now *reconfigure* the one startup camera instead of spawning
  a second one; despawn_in_system_scene no longer destroys MainCamera, so
  the session never loses its camera. .single_mut() on MainCamera now
  succeeds during flight.
- A2: Cinematic is a real overlay — toggle (KeyC), free-look rotation in
  any framing, HUD hidden while active, gameplay keeps running.
- A3: removed dead FollowCamera component + setup_follow_camera; tracking
  is unified in track_camera_target.

Gaps B1-B6:
- B1: adopted doc model (Cinematic overlay, not exclusive mode).
- B2: canonical isometric tactical_rotation() baseline.
- B3: smooth reframing via OrbitFocusGoal exponential-damp tween.
- B4: non-zero CameraState defaults.
- B5: consolidated the three orbit-control impls into one (dropped the
  starting_base local control + its Euler variant).
- B6: track_camera_target keeps OrbitCamera.target synced to the focus
  entity every frame.

Docked view now frames the actual station at a tactical iso distance.
cargo check + clippy clean for all newly-authored code; net -10 lines
(more dead code removed than added). 42 tests pass.
2026-06-16 20:05:31 -04:00
57633addfe chore: sync codebase remediation, gameplay systems, and docs
Security & infrastructure:
- Remove unused services/ (auth, spacetimedb) and auth.db
- Add .env.example template, expand .gitignore for env/db files
- Add GitHub Actions CI + commitlint config and workflows
- Add manual vendor chunking and source maps to docs/site vite configs

Shared UI & docs app:
- Add ARIA props and focus-visible rings to Button/Panel
- Add ButtonAsLink primitive; use shared Button in NotFound
- Wire @void-nav/ui into docs app; refresh content pages
- Replace Todo page with Kanban board

Gameplay (Bevy):
- Add ai module (behavior, faction, navigation, perception, spawning, states)
- Add narrative module (events, history, synthesis, ui)
- Refine galaxy contents and in-system flight/scene systems
2026-06-16 11:49:13 -04:00
98c2ba59df feat(gameplay): implement in-system gameplay with camera modes and flight controls
Add comprehensive in-system gameplay features including:

Camera System:
- Orbit mode for galaxy/inspection views
- Follow mode for tracking player ship during flight
- Cinematic mode for docked/cutscene views
- Smooth interpolation and orbit controls

In-System Gameplay:
- Docked state at stations with undock functionality
- Flight mode with velocity and target-based navigation
- Point-and-click movement via ground plane projection
- Target selection system for POIs

Flight Controls:
- Flight state tracking with speed monitoring
- Automatic camera transitions between modes
- Flight HUD with speed indicator and status panel
- Contextual action system for approach/dock/mining

UI Updates:
- Docked station panel with system information
- Flight mode controls and hints
- Dynamic population display

This implementation provides the foundation for tactical
space gameplay with smooth camera transitions and
intuitive point-and-click navigation.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-15 20:02:19 -04:00
07316dbcd7 feat(gameplay): implement in-system onboarding with docked station view
Implement the final onboarding step where the player loads into their
selected starting system docked at a station.

New features:
- Create in_system module for system-scale gameplay
- Spawn player ship docked at highest-population station
- Display station info panel with undock button
- Position camera for cinematic docked view with orbit controls

Implementation details:
- in_system/mod.rs: Plugin setup with DockedState and ActiveSystem resources
- in_system/scene.rs: System/POI spawning and player ship docked positioning
- in_system/docked.rs: Docked state management and UndockEvent
- in_system/ui.rs: Docked UI with station details and undock button
- Reuse existing POI spawning patterns from galaxy/contents.rs
- Select docking station by highest population (better for new players)

Modified files:
- Add in_system module exports to gameplay/mod.rs
- Register InSystemPlugin in main.rs
- Update orbit camera control for InGame state
- Re-export GeneratedStation and STARTING_SHIPS for use by in_system

The player now completes onboarding by loading into a system view with
their ship docked at a station, ready for gameplay.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-14 15:19:18 -04:00