Task #28: thirty-night soak, pool sizes, and a balance report
docs/thirty-night-soak.md: the whole vacation for 3 seeds with the scripted scarecrow (per-night arrivals planned / arrived / waited / dropped, peak alive per type, losses, HP at dawn, levels, materials banked, sim tick), character pools measured on nights 20 and 30 (48/20, 64/28, 48/40), density experiments, and three things to tune next. Nothing in the game broke; no numbers changed. soak_night.gd (cycle mode): per-night report as a table and ROW json lines; the carry-over check counts the Workbench granted after night 1; a lost night is retried, then (--shield=after) carried on with the scarecrow shielded; the scripted player buys the corn shooter first, repairs, rebuilds broken build-plan pieces, and patches at half its real max health; measuring options --start, --load, --save-at/--save-dir, --stock, --gather=0, --pool, --frame, --count-scale, --plan-scale. test_nights _back_to_back: planned-vs-arrived becomes an accounting check (arrived, or dropped at sunrise with every character of the type in use; drops match WaveDirector.dropped; spawn_skipped unchanged), still reporting the planned / arrived / dropped numbers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
3f32596034
commit
e26e343436
3 changed files with 1022 additions and 65 deletions
|
|
@ -6,8 +6,9 @@ extends RefCounted
|
|||
## the upgrades apply to the systems they change and persist (next morning, JSON, retry), the plans
|
||||
## load by count with each night's enemy speed and HP scales, the debug F3 jump moves the morning,
|
||||
## and a sample of the nights (1-5, a siege, the last) plays back to back to the farmers' return,
|
||||
## the rest skipped by the F3 morning path, each with its own plan and morning snapshot,
|
||||
## everything carrying over.
|
||||
## the rest skipped by the F3 morning path, each with its own plan and morning snapshot, every
|
||||
## planned arrival accounted for (arrived, or dropped at sunrise with its pool full), everything
|
||||
## carrying over.
|
||||
|
||||
const P := CampaignController.Phase
|
||||
const T := ThiefBehavior.State
|
||||
|
|
@ -420,9 +421,11 @@ func _night_jump(r: GameTestRunner, farm: Node3D, sim: FarmSim) -> void:
|
|||
|
||||
|
||||
## The vacation back to back to the farmers' return: the PLAYED nights (1-5, a siege, the last),
|
||||
## each with its own plan and morning snapshot and its arrivals as planned; the nights between are
|
||||
## skipped on F3's morning path (CampaignDebug.jump_morning: the next morning, the farm as it is).
|
||||
## The farm is defended, and the scarecrow kept out of harm.
|
||||
## each with its own plan and morning snapshot; the nights between are skipped on F3's morning path
|
||||
## (CampaignDebug.jump_morning: the next morning, the farm as it is). The farm is defended, and the
|
||||
## scarecrow kept out of harm. Every planned arrival arrives, or waits for a free character and is
|
||||
## dropped at sunrise (#25), and nothing vanishes: here no scarecrow fights and few breakers die or
|
||||
## leave, so the breakers past their pool's 20 wait all night.
|
||||
func _back_to_back(r: GameTestRunner, farm: Node3D, sim: FarmSim, player: PlayerCharacter) -> void:
|
||||
var c := sim.campaign
|
||||
var hud := farm.get_node("Hud/PhaseHud") as PhaseHud
|
||||
|
|
@ -439,6 +442,19 @@ func _back_to_back(r: GameTestRunner, farm: Node3D, sim: FarmSim, player: Player
|
|||
sim.waves.arrived.connect(func(h: int, _at: Vector2) -> void:
|
||||
var t: int = sim.enemies.type[sim.enemies.resolve_handle(h)]
|
||||
arrivals[t] = int(arrivals.get(t, 0)) + 1)
|
||||
# Each ground type's character pool as the night ends (#25: arrivals still waiting for a free
|
||||
# character are dropped then): full, or full at the end of the night's last tick before it
|
||||
# (a character can come free in the very tick the night ends, after the arrivals were looked at).
|
||||
var full_at_end := {}
|
||||
var full_last_tick := {}
|
||||
var ground: Array[int] = []
|
||||
for t in EnemySystem.TYPE_NAMES.size():
|
||||
if sim.enemies.t_flying[t] == 0:
|
||||
ground.append(t)
|
||||
sim.campaign.phase_changed.connect(func(phase: CampaignController.Phase, previous: CampaignController.Phase) -> void:
|
||||
if previous == P.NIGHT and phase != P.NIGHT:
|
||||
for t in ground:
|
||||
full_at_end[t] = not sim.characters.has_free(t))
|
||||
var broken: Array[int] = []
|
||||
sim.structures.destroyed.connect(func(id: int, _t: String, _at: Vector3) -> void: broken.append(id))
|
||||
var all_good := true
|
||||
|
|
@ -465,16 +481,44 @@ func _back_to_back(r: GameTestRunner, farm: Node3D, sim: FarmSim, player: Player
|
|||
var plan := sim.waves.plan_for(night)
|
||||
var title_ok := hud._banner.text == "Night %d: %s" % [night, plan.title]
|
||||
arrivals.clear()
|
||||
full_at_end.clear()
|
||||
full_last_tick.clear()
|
||||
var skipped0 := sim.enemies.spawn_skipped
|
||||
var structures_at_night := c.state.structures.size()
|
||||
broken.clear()
|
||||
var t_night := Time.get_ticks_msec()
|
||||
while c.state.phase != P.MORNING and not c.is_over():
|
||||
sim.scarecrow.invulnerable_left = 1.0
|
||||
sim.step(DT)
|
||||
if c.state.phase == P.NIGHT and c.state.phase_time_left <= 2.0 * DT: # the night's last ticks
|
||||
for t in ground:
|
||||
full_last_tick[t] = not sim.characters.has_free(t)
|
||||
# Every planned arrival arrived or, its type's characters all in use when the night ended,
|
||||
# was still waiting for one and dropped at sunrise (#25); none vanished (spawn_skipped).
|
||||
var expect := plan.type_counts(plan.count_scale_in(c.config))
|
||||
r.check(arrivals == expect and title_ok, "night %d, '%s': the plan's %s arrived %s" % [night, plan.title, expect, arrivals])
|
||||
var dropped := {}
|
||||
var accounted := sim.enemies.spawn_skipped == skipped0
|
||||
for t in expect:
|
||||
var gone := int(expect[t]) - int(arrivals.get(t, 0))
|
||||
accounted = accounted and gone >= 0
|
||||
if gone > 0:
|
||||
dropped[t] = gone
|
||||
accounted = accounted and ground.has(t) and (bool(full_at_end.get(t, false)) or bool(full_last_tick.get(t, false)))
|
||||
for t in arrivals:
|
||||
accounted = accounted and expect.has(t)
|
||||
var dropped_total := 0
|
||||
for t in dropped:
|
||||
dropped_total += int(dropped[t])
|
||||
accounted = accounted and dropped_total == sim.waves.dropped
|
||||
r.check(accounted and title_ok, "night %d, '%s': the plan's %s arrived %s, %s dropped at sunrise with every character of the type in use (%d skipped)" % [
|
||||
night, plan.title, expect, arrivals, dropped, sim.enemies.spawn_skipped - skipped0])
|
||||
var e: Dictionary = c.state.night_log[c.state.night_log.size() - 1]
|
||||
r.info("night %d: %d crops, %d animals, %d supplies lost; %d structures broken (%.1f s)" % [night, e["crops_lost"],
|
||||
var dropped_names := PackedStringArray()
|
||||
for t in dropped:
|
||||
dropped_names.append("%d %s" % [dropped[t], EnemySystem.TYPE_NAMES[t]])
|
||||
r.info("night %d: %d of %d arrived, %d dropped%s; %d crops, %d animals, %d supplies lost; %d structures broken (%.1f s)" % [
|
||||
night, sim.waves.spawned, plan.total(plan.count_scale_in(c.config)), dropped_total,
|
||||
" (%s)" % ", ".join(dropped_names) if not dropped_names.is_empty() else "", e["crops_lost"],
|
||||
e["animals_lost"], e["supplies_lost"], broken.size(), (Time.get_ticks_msec() - t_night) / 1000.0])
|
||||
if night < nights:
|
||||
all_good = all_good and c.state.structures.size() == structures_at_night - broken.size() and c.state.supplies_in_transit == 0
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue