Repository navigation
feat(farming-analyzer): charge the approach maps to a spot's safety - #34
Merged
Merged
Conversation
A circuit could rate safety 0.69-0.99 while the only way in crossed a far deadlier map: Sera (level 36, no fire/acid/poison protection) died five times on the Underground City entrance, whose level-32 puddings and jellies the analyzer never scored because it looked only at the circuit's own maps. Build a map graph from authored exits, tile_path_N headers and walkable coordinate-map seams, and run a bounded, deterministic bottleneck search from the nearest origin (surface world tile, savebed map or the new --approach-origin) to each spot. Each crossed map is charged for its worst aggressive encounter with the existing monster, damage and protection model, cached per map. safety_score becomes the lower of the spot and approach safeties; the spot-only value stays in spot_safety_score, and new approach_* fields expose the path, origin, worst map, danger and flags. --ignore-approach restores the spot-only score and --max-approach-maps bounds the search. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Dependency Review✅ No vulnerabilities or license issues found.Scanned FilesNone |
Address review of the approach-danger change: - Charge an approach pack by sequential exposure: every engaged monster keeps attacking until it dies, killed in Smith's-rule order. The Underground City entrance slime cluster rises from ~127 to ~288 expected damage for a Sera-like level 36 profile. - Re-expand a map reached with fewer hops so a long zero-danger path can no longer block a shorter, more dangerous one inside the hop limit. - Flag unreachable spots with approach_unknown and add the opt-in --unreachable-approach-safety cap. - Derive tiling as the server's derive_map_filename_tiles() does: any basename with two or three short numeric words, eight same-depth directions including diagonal corners. - Charge surface entrance tiles when crossed; savebed and explicit origins stay free. Add --approach-origins-only, normalize and validate --approach-origin, and ignore savebeds carried in containers. - Test the reviewer's hop-limit repro, disconnected maps, tile paths, savebeds, relative/absolute slaying, nested exits, missing targets, depth-only and diagonal seams, plus a content-gated Underground City regression. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Linking whole maps credited exits a character cannot stand next to. The world_2_69 exit_green sits on a two-tile pocket reachable only from inside the Underground City, so 81 city results took that phantom entrance and stayed at safety 1.0 for a Sera-like profile at 244 HP. - Search over (map, 8-neighbour walkable component) nodes, computed lazily and cached. Exits leave from their tile or an adjacent walkable tile and land at hp/sp, enter_x/enter_y when out of range, or an adjacent free tile; stairs without slaying follow last_heal through the tile table; same-map exits move between components. - Seams join only the edge and corner tiles they connect, using the server's tile table (header tile_path_N first, then derived names). - Origins are components: placed savebeds and every part of an explicit origin are free; surface components are charged origins only when their surface-seam group touches a savebed or an exit to or from a savebed map, so islets and pockets entered from below are not origins. - Charge a spawn that is aggressive with probability p by p, not p², in sequential exposure; document why crossing a pack costs about (n+1)/2 times farming it. - Replace the approach_unknown flag with a boolean field, and document path results with no approach maps. - Test islets, surface pockets, dungeon dead ends, enter_x/enter_y arrival and seam components, plus a content-gated check that the city circuits now approach through 0_0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Record exit sub_type and follow auto-linked exits (no path, hp/sp -1, non-zero sub_type) to every same-sub_type exit within five tiles, across tiled neighbours, as exit_find() does. - Charge an approach node only for the spawns standing in its walkable component, cached per (map, component); a spawn with no walkable tile nearby stays charged everywhere. - Group surface components once with union-find over seams in either direction, so town connectivity no longer depends on visit order. - Document that the content-gated Underground City test is skipped without a content checkout and so does not run in CI. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…mponent Filtering an approach component's threat to spawns standing in it dropped casters, archers, flyers and swimmers behind rock, tree or water lines that block walking but not engagement. Charge every spawn whose own detection radius reaches a tile of the component by Chebyshev distance, alongside spawns standing in it, so only genuinely distant components stay separate. Test a caster behind a walk-blocking line and a pocket beyond its radius. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
Self-reviewScope: the full diff 073ed62..450bf75. A fresh-context reviewer read 2ed790a in full, then did delta reviews of b65349d, 4512a52, 50fd6fb and 450bf75. It probed real content with independent tile walks, using the scripts in rev34/. Validation: farming_analyzer 53 OK, tests 12 OK, map-checker-qt 28 OK, Round 1 (2ed790a), fixed in b65349d
Round 2 (b65349d), fixed in 4512a52
Round 3 (4512a52), fixed in 50fd6fb
Round 4 (50fd6fb), fixed in 450bf75
Round 5 (450bf75)No P0–P2. Two items declined:
Known limits, documented: poisoning pulses, keys and locks, scripts and fight variance. At 322 HP the UC circuits still score 1.0 (0_0 pack 288 < 322); at Sera's current 244 HP they score 0.85. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
A farm spot's
safety_scorenow includes the maps the character has to cross to reach it, not only the spot's own monsters. It becomes the lower of the spot's own safety and the safety of the least dangerous approach.The motivating case: on 2026-11-14 the playtester character Sera, level 36 with no fire, acid or poison protection, died five times on the Underground City entrance map (
underground_city_0_0). Its level-32 puddings and jellies were not part of any circuit's score, so the analyzer rated those circuits at 0.69–0.99 safety.Changes
Connectivity graph. It is built in the same pass as terrain, at about the same scan time. Edges come from:
slaying);tile_path_Nheaders;Approach origins. These are surface
world_X_Ytiles, savebed maps, and the new--approach-origin MAPoption.Approach search. A bounded bottleneck search (
--max-approach-maps, default 16) finds the path whose most dangerous map is least dangerous. Each map's danger reuses the existing monster and damage model, including the character's protections.New output fields. These are added to every result:
spot_safety_score,approach_status,approach_origin,approach_maps,approach_danger,approach_safety_score,approach_worst_mapandapproach_danger_flags. Existing fields keep their names.safety_scorecan now only go down.--ignore-approachturns the feature off.Not modelled: scripted teleports, keys and locked doors, and running past monsters.
Validation
python3 -m unittest discover -s farming_analyzer/tests -t .: 34 OK. That's the 26 existing tests plus 8 new ones intest_approach.py.tests: 12 OK.map-checker-qt/tests: 28 OK.compileall -W errorandgit diff --checkare clean.underground_city_0_0with fire, acid and poison flags.Follow-up
The playtester locks analyzer v3.8.0. Once this is released, the playtester needs a lock bump, and its
farm_analyzer.pyfield whitelist has to pass the new fields through.🤖 Generated with Claude Code