Commit Graph

31 Commits

Author SHA1 Message Date
CosmicClash Training Bot 052b47c04f chore(training): generation 5 progress after 20260811-2216-gen5-s4-handling-retry1 2026-08-12 04:24:21 +01:00
CosmicClash Training Bot 6a34eefceb chore(training): generation 5 progress after 20260811-1606-gen5-s4-handling 2026-08-11 22:16:10 +01:00
CosmicClash Training Bot f5b0a79cea chore(training): generation 5 progress after 20260811-0858-gen5-s4-handling-retry4 2026-08-11 15:12:24 +01:00
CosmicClash Training Bot be1429e99e chore(training): generation 5 progress after 20260810-1338-gen5-s4-handling-retry3 2026-08-10 19:52:02 +01:00
CosmicClash Training Bot d1ccf4dbc7 chore(training): generation 5 progress after 20260810-0211-gen5-s4-handling-retry2 2026-08-10 08:22:52 +01:00
CosmicClash Training Bot dd1165c805 chore(training): generation 5 progress after 20260809-1955-gen5-s4-handling-retry1 2026-08-10 02:11:41 +01:00
CosmicClash Training Bot 7174ff7cf9 chore(training): generation 5 progress after 20260809-1340-gen5-s4-handling 2026-08-09 19:55:13 +01:00
CosmicClash Training Bot 005cd0c66e chore(training): generation 5 progress after 20260809-0328-gen5-s4-handling-retry2 2026-08-09 09:36:44 +01:00
CosmicClash Training Bot 837deedc08 chore(training): generation 5 progress after 20260808-2120-gen5-s4-handling-retry1 2026-08-09 03:28:48 +01:00
CosmicClash Training Bot d617c8032c chore(training): generation 5 progress after 20260808-1508-gen5-s4-handling 2026-08-08 21:20:09 +01:00
CosmicClash Training Bot 9fd1764522 chore(training): curriculum progress after 20260805-1926-curric-s2-selfplay 2026-08-06 19:39:02 +01:00
Josh Creek 1811e9333e feat(training): curriculum generation 4 — MultiDiscrete action space redesign
Three curriculum generations (2026-07-21 through 2026-08-04) all tried
gating *when* the policy could use vertical thrust/pitch-roll on top of a
continuous Gaussian action space, and all three failed the same way: PPO's
action-distribution std collapsed within ~10% of steps and never recovered,
landing at a 15-32% win rate vs the grounded reference regardless of
mechanism (hard mask, then a gradual ramp). Generation 3's final attempt
just landed at 24% — the worst of the three.

Root cause, verified against this project's own physics: hovering this ship
requires *holding* thrust.y ~= 0.408 continuously (mass 5.0, vertical_thrust
120, gravity 9.8). A collapsed near-zero-mean Gaussian can brush that value
but never sustain it long enough to earn the reward gradient that would
move the mean — no amount of gating *when* the axis acts fixes a problem in
*how* the policy represents a decision on it. This also independently found
and fixes a real bug: godot_rl never marks an episode timeout as a
truncation, so PPO was bootstrapping V(s)=0 on every 30s draw in every
generation to date.

- Game/scripts/ship_action_codec.gd (new): single source of truth for a
  per-axis MultiDiscrete action space (7 heads, nvec [5,5,5,5,5,5,2]) shared
  by training and in-game inference, replacing the continuous Gaussian.
  thrust_y's bins are deliberately asymmetric so a random policy drifts
  through the volume instead of floor-pinning. Legacy continuous decode
  (ai_ship_controller.gd's old logic) preserved verbatim so every
  pre-generation-4 export (e.g. Game/bots/promoted/easy.json) keeps working
  unchanged via an optional "action_space" JSON field.
- ship_observations.gd: append own contact state (SIZE 31 -> 35, append-only)
  so the value function can see what wall_contact_penalty fires on.
- ship_ai_controller.gd: action space/decode via the codec; drop the
  vertical_ramp/pitch_roll_ramp mechanism entirely; tilt_penalty default
  lowered 4x (aerial approaches require pitching); flight telemetry
  (airborne_fraction, mean_altitude, air_touch_fraction, vertical_thrust_mean)
  and truncation-snapshot fields on get_info().
- training_mode.gd: new air_drill_chance state-setter branch (ball spawned
  high, ships low, kept clear of walls) so aerial practice is forced by the
  environment instead of relying on reward-driven exploration alone; snapshot
  terminal observations before a timeout reset for the truncation fix.
- cosmic_env.py: remap ShipAIController's truncated/terminal_obs info into
  SB3's TimeLimit.truncated/terminal_observation keys.
- train.py: --reset-logits (+ --reset-logits-heads) replaces the
  now-meaningless --reset-std; new EntropyFloorCallback (a persistent
  per-rollout ent_coef controller replacing the one-shot std-reset shock)
  and per-head entropy logging; FlightTelemetryCallback; --air-drill-chance/
  --tilt-penalty flags; optional AbortIfCallback kill-criterion.
- export_policy.py: writes the action_space block for MultiDiscrete models;
  index-level parity check (argmax per head) instead of comparing floats.
- curriculum.py: full rewrite — 3 stages (bootstrap/selfplay/gauntlet), no
  grounded stage, full action space live from step 1; deletes generation
  1-3's checkpoint-lineage machinery (nothing to resume from); final report
  evaluates against both promoted/easy.json and the new
  promoted/reference-grounded.json (a copy of curric-s5-aggression, the
  strongest grounded-era artifact, kept as a fixed yardstick).
- run_training.sh/.gitignore: commit only final.zip, not the ~2400
  intermediate checkpoint files a single stage was writing (~500MB ->
  ~0.2MB per run); requirements.txt pinned (behaviour here now depends on
  specific library internals, not just public APIs).
- test_action_space.py (new): offline rung-0 check catching a head-order
  mismatch before it silently corrupts 24h of training.

Validated: GDScript compiles clean (Godot --headless --import + script
validation), free_play.tscn and training.tscn both boot headless without
errors, offline action-space assertions pass. Not yet run: the actual
smoke-training/A-B validation ladder steps in TRAINING.md's "Generation 4"
section, before committing to the full ~32h curriculum.

See TRAINING.md's "Generation 4" section for the full design writeup.
2026-08-04 23:27:57 +01:00
CosmicClash Training Bot 20f6be7e28 chore(training): curriculum progress after 20260802-1458-curric-s4-unmask-retry1 2026-08-03 18:29:13 +01:00
CosmicClash Training Bot 62dc0a2981 chore(training): curriculum progress after 20260801-1131-curric-s4-unmask 2026-08-02 14:58:25 +01:00
CosmicClash Training Bot 0759e1514b chore(training): curriculum progress after 20260730-1224-curric-s1-unmask-retry2 2026-07-31 16:07:16 +01:00
CosmicClash Training Bot 6084991f1c chore(training): curriculum progress after 20260729-0837-curric-s1-unmask-retry1 2026-07-30 12:24:45 +01:00
Josh Creek efda6c1a05 chore(training): Resume stage 1 unmask from its own checkpoint, not foundation
Generation 2's first two real stage-1 attempts both independently restarted
from curric-s5-aggression (reset_retry_checkpoint) with identical flags and
landed at 32% and 27% win rate vs the reference -- a real regression either
way, but too much spread between "identical" runs for repeat fresh restarts
to be a controlled test of anything. The first attempt's own trajectory
(ep_rew_mean climbing from -10.86 toward ~0 by the 240M-step cutoff,
briefly touching positive) looked closer to convergence than the second's,
so retries now continue that attempt's own checkpoint for another full
timesteps budget instead of resetting to foundation again.

Drops retry1 and retry2 (checkpoints, logs, exported bots, eval_history
entries) -- retry2 never trained meaningfully before crashing on the
GoalRateCallback bug just fixed, and retry1 was the inferior of the two
real samples. curriculum_state.json rewinds to attempt 1, in_progress, so
the next run resumes 20260726-1904-curric-s1-unmask/final.zip directly.
2026-07-29 08:35:34 +01:00
CosmicClash Training Bot 8bc16ee048 chore(training): curriculum progress after 20260729-0607-curric-s1-unmask-retry2 2026-07-29 06:09:25 +01:00
CosmicClash Training Bot 0d29fc44e0 chore(training): curriculum progress after 20260728-0031-curric-s1-unmask-retry1 2026-07-29 06:07:26 +01:00
CosmicClash Training Bot 2533827cf8 chore(training): curriculum progress after 20260726-1904-curric-s1-unmask 2026-07-28 00:30:59 +01:00
CosmicClash Training Bot 33b2c23f13 chore(training): curriculum progress after curric-s6-unmask-retry2 2026-07-26 13:08:35 +01:00
CosmicClash Training Bot 28109756dd chore(training): curriculum progress after curric-s6-unmask-retry1 2026-07-25 07:41:43 +01:00
CosmicClash Training Bot 407a916b40 chore(training): curriculum progress after curric-s6-unmask 2026-07-24 02:25:37 +01:00
CosmicClash Training Bot 2de3085f13 chore(training): curriculum progress after curric-s5-aggression 2026-07-22 20:33:07 +01:00
Josh Creek fca6a46200 fix(training): correct stage-3 eval (locomotion-mask bugfix) and add grounded aggression stage
Re-ran stage-3 (curric-s3-no_draws vs curric-s2-defend) and the missing
stage-4 gate now that the locomotion-mask inference bugfix is in. Both
reverse or contradict the pre-fix bookkeeping: curric-s2-defend (grounded)
beats curric-s3-no_draws 60-26 and curric-s4-mechanics 57-24 when fairly
evaluated, so lifting the locomotion mask in stage 3 was a real regression
in floor play, not the improvement the buggy eval reported.

Adds a stage-5 "aggression" curriculum entry that resumes from stage 2
directly (via new resume_from_experiment/reference_experiment stage-dict
overrides in curriculum.py) instead of compounding the regression through
stages 3-4, keeps the locomotion mask on, and retunes ball-pursuit reward
weights for much more aggressive floor play. Extends train.py with the
three new --velocity-to-ball-weight/--ball-distance-penalty/--ball-touch-reward
flags needed to forward that retune to Godot's existing SHIP_AI_OVERRIDES.

curriculum_state.json and TRAINING.md are corrected/annotated in place
rather than silently rewritten, so the regression stays visible in history.
2026-07-22 12:48:45 +01:00
CosmicClash Training Bot dd2b3c570b chore(training): curriculum progress after curric-s3-no_draws 2026-07-21 21:46:34 +01:00
CosmicClash Training Bot 44b1384a97 chore(training): curriculum progress after curric-s2-defend 2026-07-21 19:19:44 +01:00
CosmicClash Training Bot 7e67998a23 chore(training): curriculum progress after curric-s1-score 2026-07-21 16:52:20 +01:00
Josh Creek 7d69ac4a01 feat(*): retune scoring incentives and add finishing reps 2026-07-20 20:06:11 +01:00
Josh Creek 772f98b7fe feat(*): Fix exported-policy action order to gymnasium's sorted-key layout, add wall-contact penalty and stronger ball-touch reward, and wire Spectate to run01 vs run02 2026-07-19 13:21:14 +01:00
Josh Creek 85f96eb15e feat(*): Add self-play RL training pipeline with PPO trainer, in-game GDScript policy inference, and bot opponent support in Match mode 2026-07-18 19:32:51 +01:00