Skip to content

docs: balancing-tools overview; fix harness replay + turn cost - #206

Merged
nnunley merged 1 commit into
mainfrom
docs/balancing-tools
Sep 22, 2026
Merged

nnunley merged 1 commit into
mainfrom
docs/balancing-tools

Conversation

@nnunley

@nnunley nnunley commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator

Adds docs/balancing-tools.md, a one-page guide to the dev tools for balance and tuning work:

  • Balance harness (xsofy/balance.lg), by @nnunley
  • Scenario test, map viewer + audit, lighting testbed, native bench, and dev console, by @mparrett

Each tool was run on current main (let-go 1.13):

  • scenariotest --check on both scenarios; web-trample also played through in tmux
  • mapgen for a single seed and a multi-seed run (audit floating=0 unreach=0)
  • bench/native.lg (all four fixtures, about 9 ms/turn)
  • balance_explore.lg and the doc's REPL snippet
  • lighttest (move, radius, render-mode cycle, quit)
  • Dev console with XSOFY_DEV=1: (help), (player), (location), (seed), (replay), (bench)

Two fixes to docs/balance-harness.md, found during verification:

  • Replay was wrong. dispatch/replay builds from the default starting kit rather than the loadout, so replaying a harness run crashed. Replay from make-loadout-world instead; that matched the live run's turn, depth, and HP in 3 of 3 runs I tried.
  • Turn cost was stale. It is now about 9–10 ms/turn natively, not 20–25 ms.

Docs only; no code changes.

🤖 Generated with Claude Code

Comment thread docs/balancing-tools.md

Backtick opens a dev console in the running game (native and browser). It
only appears in dev mode: set `XSOFY_DEV=1` natively
(`XSOFY_DEV=1 lg main.lg`) or add `?mode=dev` to the web URL. It is

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember offhand, does ?mode=admin also permit the console?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked - disconfirmed. admin mode does NOT permit the console. (I wonder why?)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Leaving as written, per your check: only ?mode=dev and XSOFY_DEV gate the console.

Comment thread docs/balancing-tools.md Outdated
Comment thread docs/balancing-tools.md
| `(player)` | HP, max HP, position, depth |
| `(location)` | Position, depth, turn |
| `(bench)` | Quick micro-benchmark (3 seeds × 20 turns) |
| `(help)` | Command list |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another comment just for awareness. If I recall, there's a sugar/convenience path that allows bare commands with no args, like help to be treated as (help).

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Confirmed, see comment.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added in 0795542: "Commands that take no arguments also work bare: seed is the same as (seed)." under the console table.

@mparrett

mparrett commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

@nnunley - Much needed, and nicely done. Thanks for picking it up.

@mparrett mparrett left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drafted by Claude for @mparrett; follows the three inline comments above.

Approving. I checked the claims about the tools against current main and they hold: the console whitelist and dev gate, the scenario keys and defaults, mapgen/mapaudit, the lighttest e cycle, and the bench fixtures. The replay fix is right: dispatch/replay builds from a bare world/make-world, so a loadout run has to start from make-loadout-world.

On two of the inline notes, from main:

  • ?mode=admin doesn't open the console. xsofy.input/dev? only checks ?mode=dev and XSOFY_DEV, so the doc is right as written.
  • Bare commands work for every whitelisted command, not only help: run-command accepts a bare symbol as well as a list, so seed behaves like (seed). The console section could mention it in half a sentence.

One nit, not blocking: in balance-harness.md, the section under the new ~13-minute figure still uses the old 20 ms/turn numbers. The heading says "Silent 30-Minute Hang", step 2 estimates "~27 minutes", and "3 runs × 60 turns = 3.6 seconds" would be about 1.8 s at 10 ms/turn. Updating those three would make the section agree with its own figure.

New docs/balancing-tools.md: one-page guide to the balance harness
(@nnunley) and the scenario test, map viewer/audit, lighting testbed,
native bench, and dev console (@mparrett), each verified on current main.

docs/balance-harness.md fixes found while verifying:
- Replay must start from make-loadout-world; plain dispatch/replay uses
  the default starting kit and diverges from the harness run.
- Per-turn cost is now ~9-10 ms natively (was documented as 20-25 ms);
  every derived estimate (smoke-run seconds, the 13-minute default sweep,
  the scaling example, the sample sweep, balance_explore.lg's banner and
  docstring) is recomputed from that and re-measured on current main.

balancing-tools.md also notes console (bench) reports microseconds while
bench/native.lg prints milliseconds, and that console commands work bare.
@nnunley
nnunley force-pushed the docs/balancing-tools branch from 0734ad2 to 0795542 Compare September 22, 2026 19:33
@nnunley

nnunley commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

Timing nit addressed in 0795542. Every figure derived from per-turn cost is recomputed from the measured ~9–10 ms/turn and re-timed on current main:

  • Heading: "Silent 30-Minute Hang" → "Silent Multi-Minute Run"
  • Scaling example: 3 × 60 ≈ 1.8 s of turns (~2 s with startup), 40 × 2000 ≈ 444× that → ~13 min
  • 3 × 60 snippet: ~2 s (measured 2.2 s); 4 × 200 smoke run: ~5 s (measured 4.8 s)
  • Sample sweep: ~20 s when recorded, ~37 s on current main (findings kept as the original run)
  • balance_explore.lg docstring and banner: ~5 s / up to ~13 min (was ~30 s / ~30 min)

The estimate is now framed as a worst case (n-runs × max-turns × 0.01 s + ~1 s startup), since runs that end early finish sooner. Also fixed while there: the script docstring said max-turns=200 (the code uses 400) and "6 runs per policy". n-runs is the total across combos rounded down to a multiple of the combo count, so the script runs 4 simulations.

@nnunley
nnunley merged commit 0c38395 into main Sep 22, 2026
4 checks passed
@github-actions

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-09-22 19:36 UTC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants