-
Notifications
You must be signed in to change notification settings - Fork 658
Feat: disable alliances after 40 mins #2417
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
base: main
Are you sure you want to change the base?
Conversation
WalkthroughAdds a 40-minute (24,000 ticks) time gate that blocks new alliance requests and renewals by short-circuiting AllianceExtensionExecution.init and PlayerImpl.canSendAllianceRequest; corresponding constant and tests added. Changes
Sequence Diagram(s)sequenceDiagram
participant Player as Player
participant MG as Game (mg)
participant Ext as AllianceExtensionExecution
rect `#E8F5E9`
note left of Ext: New/changed path
Player->>Ext: requestAlliance() / renewAlliance()
Ext->>MG: mg.ticks()
alt ticks < ALLIANCE_BLOCK_TICKS
Ext->>Ext: continue processing (existing validations/workflow)
Ext->>Player: proceed (request created / renewal displayed)
else ticks >= ALLIANCE_BLOCK_TICKS
Ext-->>Player: early return (no request / no renewal)
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 (6)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used🧠 Learnings (12)📓 Common learnings📚 Learning: 2025-10-20T20:15:28.858ZApplied to files:
📚 Learning: 2025-10-18T17:54:01.311ZApplied to files:
📚 Learning: 2025-10-20T11:02:16.969ZApplied to files:
📚 Learning: 2025-10-08T17:14:49.369ZApplied to files:
📚 Learning: 2025-10-08T17:14:49.369ZApplied to files:
📚 Learning: 2025-10-27T09:47:26.395ZApplied to files:
📚 Learning: 2025-08-12T00:31:50.144ZApplied to files:
📚 Learning: 2025-08-23T07:48:19.060ZApplied to files:
📚 Learning: 2025-10-26T15:37:07.732ZApplied to files:
📚 Learning: 2025-10-21T20:06:04.823ZApplied to files:
📚 Learning: 2025-06-22T05:48:19.241ZApplied to files:
🧬 Code graph analysis (4)tests/AllianceRequestExecution.test.ts (2)
src/core/execution/alliance/AllianceExtensionExecution.ts (1)
tests/PlayerImpl.test.ts (1)
tests/AllianceExtensionExecution.test.ts (4)
🔇 Additional comments (5)
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: 4
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/core/execution/alliance/AllianceExtensionExecution.ts(1 hunks)src/core/game/PlayerImpl.ts(1 hunks)tests/AllianceExtensionExecution.test.ts(1 hunks)tests/AllianceRequestExecution.test.ts(1 hunks)tests/PlayerImpl.test.ts(1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📚 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/AllianceRequestExecution.test.tstests/AllianceExtensionExecution.test.tssrc/core/execution/alliance/AllianceExtensionExecution.tssrc/core/game/PlayerImpl.ts
📚 Learning: 2025-10-20T11:02:16.969Z
Learnt from: sambokai
Repo: openfrontio/OpenFrontIO PR: 2225
File: src/core/execution/FakeHumanExecution.ts:57-57
Timestamp: 2025-10-20T11:02:16.969Z
Learning: In src/core/execution/FakeHumanExecution.ts, the correct MIRV victory denial thresholds are VICTORY_DENIAL_TEAM_THRESHOLD = 0.8 (80% for team games) and VICTORY_DENIAL_INDIVIDUAL_THRESHOLD = 0.65 (65% for individual players), not 0.85 and 0.7 as might be mentioned in some documentation.
Applied to files:
src/core/execution/alliance/AllianceExtensionExecution.ts
📚 Learning: 2025-10-08T17:14:49.369Z
Learnt from: Foorack
Repo: openfrontio/OpenFrontIO PR: 2141
File: src/client/ClientGameRunner.ts:228-234
Timestamp: 2025-10-08T17:14:49.369Z
Learning: For the window close confirmation feature in `ClientGameRunner.ts`, the troop count requirement (>10,000 troops) from issue #2137 was intentionally removed because it was arbitrary and troop count can be reported as low despite having significant land. The confirmation now triggers for any alive player regardless of troop count.
Applied to files:
src/core/game/PlayerImpl.ts
🧬 Code graph analysis (2)
tests/AllianceRequestExecution.test.ts (1)
src/core/execution/alliance/AllianceRequestExecution.ts (1)
AllianceRequestExecution(9-72)
tests/AllianceExtensionExecution.test.ts (3)
src/core/execution/alliance/AllianceRequestExecution.ts (1)
AllianceRequestExecution(9-72)src/core/execution/alliance/AllianceRequestReplyExecution.ts (1)
AllianceRequestReplyExecution(3-56)src/core/execution/alliance/AllianceExtensionExecution.ts (1)
AllianceExtensionExecution(9-93)
🔇 Additional comments (1)
src/core/execution/alliance/AllianceExtensionExecution.ts (1)
16-21: Extract the duplicated constant to a shared configuration.The
ALLIANCE_BLOCK_TICKSconstant is defined in multiple files (this file,src/core/game/PlayerImpl.ts, and three test files). This code duplication violates the DRY principle and creates maintenance risk, especially since game balance constants may change frequently during testing.Consider extracting this to a shared location such as
Game.tsor a dedicated constants/config file:// In a shared config file or Game.ts export const ALLIANCE_BLOCK_TICKS = 40 * 60 * 10; // 24,000 ticks (40 minutes)Then import and use it across all files:
+import { ALLIANCE_BLOCK_TICKS } from "../../game/Game"; + export class AllianceExtensionExecution implements Execution { constructor( private readonly from: Player, private readonly toID: PlayerID, ) {} init(mg: Game, ticks: number): void { // Block alliance renewals after 40 minutes of game time - // 40 minutes = 2400 seconds = 24,000 ticks (10 ticks per second) - const ALLIANCE_BLOCK_TICKS = 40 * 60 * 10; // 24,000 ticks if (mg.ticks() >= ALLIANCE_BLOCK_TICKS) { return; }⛔ Skipped due to learnings
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.
|
I dont mind if this is denied due to it being a game meta change, but i talked to people, some hate it, some like it, so it took 5 mins to make, so i thought ill offer it as a idea |
Description:
Describe the PR.
To help with game balancing and to help with ensuring their isn't a "stalement" and to help prevent games to go for hour + sometimes when theirs a situlation when its a 1v1v1 and everyone has mrivs, this PR suggestions to block new alliances after 40 mins to help encourge activity.
Please complete the following:
Please put your Discord username so you can be contacted if a bug or regression is found:
DISCORD_USERNAME
notifxy (1379678982676676639)