-
Notifications
You must be signed in to change notification settings - Fork 686
Remove deprecated package.json dependency and Align SAM launcher tests with adjusted costs #2438
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
WalkthroughReplaces SAMLauncher cost wrapper with a dynamic, tiered cost function that considers player type, infiniteGold, unitsOwned and unitsConstructed; changes samRange(level) to linear values 70/85/100; adds tests validating pricing tiers, unit tracking, and range values. Changes
Sequence Diagram(s)sequenceDiagram
participant Player
participant DefaultConfig
participant GameState
Note over Player,DefaultConfig: Request cost for SAMLauncher
Player->>DefaultConfig: get SAMLauncher cost(player)
DefaultConfig->>GameState: read unitsOwned / unitsConstructed / units info
alt player.human && player.infiniteGold
DefaultConfig-->>Player: cost = 0
else
alt totalLevels == 0
DefaultConfig-->>Player: cost = 1_500_000
else
alt upgrading level2 -> 3 and condition met
DefaultConfig-->>Player: cost = 6_000_000
else
DefaultConfig-->>Player: cost = 3_000_000
end
end
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks✅ Passed checks (3 passed)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
package-lock.jsonis excluded by!**/package-lock.json
📒 Files selected for processing (2)
src/core/configuration/DefaultConfig.ts(2 hunks)tests/core/configuration/SAMLauncherConfig.test.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 Learning: 2025-08-24T11:13:08.495Z
Learnt from: DevelopingTom
Repo: openfrontio/OpenFrontIO PR: 1900
File: src/core/execution/SAMLauncherExecution.ts:103-111
Timestamp: 2025-08-24T11:13:08.495Z
Learning: In SAMLauncherExecution.ts, the cached target bug can only occur if: 1) SAM is not on cooldown when nuke is in range, 2) SAM goes on cooldown right after computing trajectory, 3) SAM becomes available again before nuke explodes. This is not possible with current cooldown values but the fix is still valuable for robustness.
Applied to files:
tests/core/configuration/SAMLauncherConfig.test.tssrc/core/configuration/DefaultConfig.ts
📚 Learning: 2025-10-20T20:15:28.858Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:51-51
Timestamp: 2025-10-20T20:15:28.858Z
Learning: In src/core/execution/FakeHumanExecution.ts, game balance constants like MIRV_COOLDOWN_TICKS, MIRV_HESITATION_ODDS, VICTORY_DENIAL_TEAM_THRESHOLD, VICTORY_DENIAL_INDIVIDUAL_THRESHOLD, and STEAMROLL_CITY_GAP_MULTIPLIER are experimental tuning parameters subject to frequent change during balance testing. Do not flag changes to these values as issues or compare them against previous values.
Applied to files:
tests/core/configuration/SAMLauncherConfig.test.tssrc/core/configuration/DefaultConfig.ts
📚 Learning: 2025-08-18T03:11:18.617Z
Learnt from: scottanderson
Repo: openfrontio/OpenFrontIO PR: 1851
File: src/core/execution/FakeHumanExecution.ts:433-441
Timestamp: 2025-08-18T03:11:18.617Z
Learning: In FakeHumanExecution.maybeSpawnStructure, the perceived cost multiplier (owned + 1, capped at 5) applied to structure costs is intentional. This makes AI nations build fewer structures than players could, saving gold for bombs/nukes rather than maxing out structures.
Applied to files:
src/core/configuration/DefaultConfig.ts
🧬 Code graph analysis (2)
tests/core/configuration/SAMLauncherConfig.test.ts (4)
src/core/configuration/DefaultConfig.ts (1)
DefaultConfig(227-1013)tests/util/Setup.ts (1)
setup(23-81)tests/util/TestConfig.ts (1)
TestConfig(12-87)src/core/game/PlayerImpl.ts (2)
unitsOwned(251-263)unitsConstructed(227-237)
src/core/configuration/DefaultConfig.ts (3)
src/core/game/Game.ts (1)
Player(526-662)src/core/game/UnitImpl.ts (1)
level(415-417)src/core/game/GameView.ts (1)
level(167-169)
If this PR fixes an issue, link it below. If not, delete these two lines.
Resolves #(issue number)
Description:
Testing
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
Orion Nebula
orion_nebula22