mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-15 03:12:03 +00:00
fix(training): correct non-forward penalty math and add a grounding incentive
Adversarial review of the previous stage-4 retune found two problems: non_forward_speed used planar_speed - forward_component, which under-charges diagonal motion relative to true lateral speed (e.g. ~29% penalty at 45 degrees off the nose instead of the correct ~71%); fixed to the Pythagorean magnitude for forward-facing angles, full speed for backward-facing ones. Also, ground_tilt_penalty and non_forward_penalty only ever cost reward near the floor with nothing offsetting them above it, which could teach a policy that's still bad at ground handling to just avoid the floor rather than get better at it. Added grounded_upright_reward (ship_ai_controller.gd) plus a new ShipObservations.is_floor_contact helper for genuine belly-on-floor contact detection, so grounding well while upright is the locally profitable choice, not just the least-punished one.
This commit is contained in:
@@ -51,7 +51,13 @@ STANDING_ARGS = ["--ent-coef", "0.01", "--entropy-floor"]
|
||||
# full sideways episode now costs ~45, comparable to a goal) and
|
||||
# non_forward_penalty is a new term (ship_ai_controller.gd) directly costing
|
||||
# sideways/reverse planar velocity near the floor, independent of the ball,
|
||||
# since nothing previously penalized that at all.
|
||||
# since nothing previously penalized that at all. Both are floor-proximity
|
||||
# penalties only, with nothing equivalent above GROUND_HANDLING_HEIGHT — on
|
||||
# its own that risks teaching "avoid the floor" instead of "handle well on
|
||||
# it", worsening Stage 3's already-airborne-heavy baseline. grounded_upright_
|
||||
# reward is the positive counterpart: a bonus for genuine floor contact
|
||||
# (not just low altitude) while upright, so grounding well is the locally
|
||||
# profitable choice rather than merely the least-punished one.
|
||||
HANDLING_REWARD_FLAGS = [
|
||||
"--velocity-to-ball-weight", "0.04",
|
||||
"--forward-velocity-to-ball-weight", "0.06",
|
||||
@@ -63,6 +69,7 @@ HANDLING_REWARD_FLAGS = [
|
||||
"--tilt-penalty", "0.0002",
|
||||
"--ground-tilt-penalty", "0.05",
|
||||
"--non-forward-penalty", "0.04",
|
||||
"--grounded-upright-reward", "0.015",
|
||||
]
|
||||
|
||||
STAGES = [
|
||||
|
||||
Reference in New Issue
Block a user