Repository navigation
fix: wire Rhizome methods into smart_hard AI gameplay loop - #60
Merged
Merged
Conversation
Three Rhizome methods were computed but never read by the AI: 1. meetsSpacingRule — now checked in findBuildingPlacement() and findDefensePlacement() so smart_hard buildings obey the Rule-of-3 tile spacing, preventing AoE bombardment from wiping clusters of the same building type. 2. getPotentialFieldBias — now applied in issueFormationApproach() via a cachedState field. Each unit's attack waypoint is nudged by the field gradient (avoid turrets, escort harvesters, chase fog) at a 2-tile strength so routing is influenced without overriding tactics. 3. pressure density state — getDensityState() already handled 'isolated' (retreat), but 'pressure' was silently ignored. Now pressured units skip the HP-based retreat check and flood forward (overspill). All other Rhizome hooks (update, getOrganPriority, isOverdriveActive, notifyEnemySwCooldown) were already wired and remain unchanged. tsc: clean | vitest: 62/62 pass Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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
Three
Rhizomemethods were computed every frame but their results were never read byAI.ts, making them dead code despite the 30-unit test suite passing.meetsSpacingRule— now checked infindBuildingPlacement()andfindDefensePlacement()so smart_hard buildings obey the Rule-of-3 tile spacing. Prevents AoE bombardment from wiping a cluster of same-type buildings/turrets.getPotentialFieldBias— now applied inissueFormationApproach(). Each unit's attack waypoint is nudged by the potential field gradient (avoid turrets, escort harvesters, explore fog) at 2-tile strength. AcachedStatefield threadsGameStateinto the helper without changing call-site signatures.pressuredensity state —getDensityState()was already handling'isolated'(retreat), but'pressure'(outnumbered-by-enemies cluster) was silently ignored. Pressured units now skip the HP-based retreat check and flood forward (overspill behavior).All previously-wired hooks remain unchanged:
rhizome.update()— every frame ✅rhizome.getOrganPriority()—followTechTree()✅rhizome.isOverdriveActive()—retreatDamagedUnits()+considerAttacking()✅rhizome.notifyEnemySwCooldown()—tickSuperweapons()✅Test plan
npx tsc --noEmit— cleannpx vitest run— 62/62 tests pass (29 Rhizome, 5 AIGoals, 21 spawn validation, 4 ore recovery, 3 map balance)smart_hardand verify buildings spread out, units avoid turrets during approach, low-HP units in large groups keep fighting🤖 Generated with Claude Code