Commit Graph

564 Commits

Author SHA1 Message Date
evanpelle f1b70ea26d Merge branch 'v26' 2025-10-23 15:02:46 -07:00
Vivacious Box dddf54be0b Add deletion duration and indicators (#2216)
## Description:

Adds a timer before self deleting units
Adds a loading bar under deleting units
Adds a timer in radial menu for clarity purposes


![deletecd](https://github.com/user-attachments/assets/613bf742-ef90-42b5-a258-b928daae6aaa)

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Mr.Box

---------

Co-authored-by: Evan <evanpelle@gmail.com>
2025-10-21 10:07:14 -07:00
VariableVince 4673808dc0 Fix annex surrounded main cluster disconnected player (#2241)
## Description:

When a main cluster is fully surrounded, the surrounding player is able
to attack them (based on AttackLogic in DefaultConfig). But so far
wasn't able to annex them.

Fix: turned around an isFriendly check in PlayerExecution. This way if
this.player is disconnected, they can get annexed, allied/team mate or
not.

This also means that in the edge case of surrounding player going AFK,
the enclosed main cluster can attack the disconnected surrounding player
and maybe fight it's way out of being enclosed.

Meant as hotfix for v26.

Reported here:
https://discord.com/channels/1284581928254701718/1429252618995105923/1429252618995105923

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

tryout33
2025-10-21 10:06:23 -07:00
Abdallah Bahrawi 373e3ef44a fix Request icon stuck for nations (#2234)
## Description:

fixes https://github.com/openfrontio/OpenFrontIO/issues/1955

Describe the PR.

Bots previously created requests directly, skipping timeout cleanup and
causing
a stuck “request sent” icon when unhandled. Using
AllianceRequestExecution makes
bots follow the same lifecycle as humans, so requests expire correctly.
## Please complete the following:

- [ ] I have added screenshots for all UI updates
- [ ] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [ ] I have added relevant tests to the test directory
- [ ] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

abodcraft1

---------

Co-authored-by: Evan <evanpelle@gmail.com>
2025-10-21 09:55:54 -07:00
Vivacious Box f161c94ff4 Max timer (#1289)
## Description:

Adds a max timer setting
The timer starts at max timer and goes down, becoming red if reaching <
1 min
The player with the biggest territory wins at the end of the timer


![image](https://github.com/user-attachments/assets/888099fc-95ae-4303-8c80-c850e58d36e2)

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Vivacious Box

---------

Co-authored-by: Loymdayddaud <145969603+TheGiraffe3@users.noreply.github.com>
2025-10-17 17:09:10 -07:00
evanpelle eea8db7a06 delete warship when player is afk 2025-10-14 19:51:58 -07:00
evanpelle 9ab35a0436 bugfix: don't use bigint for zod schema as it causes json parsing issues 2025-10-14 19:05:53 -07:00
Michal Martínek 522413678a Enabled the @typescript-eslint/no-unused-expressions eslint rule (#2014)
## Description:

- Fixes #1790
- Fixed the codebase:
- expressions short-circuiting with `&&` changed to proper `if`
statements
  - `A instanceof B;` expressions now emit warnings

## Please complete the following:
- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:
michal7952

---------

Co-authored-by: Evan <evanpelle@gmail.com>
2025-10-14 11:10:52 -07:00
Evan b58d140f94 fix encirclement issues (#2191)
## Description:

Players with no ongoing attacks were ignored during cluster calculations
in
https://github.com/openfrontio/OpenFrontIO/commit/3680d9cc1663a22f0e174d2c2de806c0ee78b923

This PR has it fallback to neighbor with largest border if no ongoing
attacks

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-10-13 19:54:05 -07:00
evanpelle 136cfa1316 improve nation ai (#2172)
## Description:

1. Create forceSendAttack function so nations expand faster at the start
(their reserve troop ratio was too low, causing them to skip the first
attack
2. modify the perceived cost modifier to reduce the number of defense
posts built.
3. Updated how random land is selected to avoid player.tiles() since
that can be millions of entries.
4. Improve performance of valueFunction by using closestTile and
reducing the number of tiles checked.
5. Nations now launch hydros if they have enough gold.
6. used boundBox instead of bfs because doing a large bfs for h-bombs
can get expensive.
7. Modified perceived multiplayer to remove cap and scale super-linearly
to discourage nations from spamming too many building. Instead they are
more likely to spend that money on nukes.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-10-11 19:35:11 -07:00
Jeff 649e4d2ed7 fix(PlayerExecution): remove alarming DefensePost destruction messages on capture (#2163)
## Description:

Patches issue flagged from
https://github.com/openfrontio/OpenFrontIO/pull/1957#issuecomment-3386398998.

Right now for every single defense post capture, attackers receive two
messages:
- "Your Defense Post was destroyed" and "Captured Defense Post from ..."

By downgrading before captures, behavior will now be:
- defender receives "Your Defense Post was destroyed"
- attacker receives no message unless capturing a lv2+ defense post
(downgraded to lv 1), in which case they receive "Captured Defense Post
from ..."

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

`seekerreturns`

---------

Co-authored-by: evanpelle <evanpelle@gmail.com>
2025-10-10 02:21:05 +00:00
Britton Fischer 3680d9cc16 fix: allies cannot annex your clusters (#2158)
## Description:

Fixes #1685
Continuation from #1924, which was auto-closed after the upstream repo
force-pushed main and I synced my fork.

This change ensures that allies are excluded from the `getMode()` call
made by `getCapturingPlayer()` inside `removeCluster()`.

- Previously, friendly neighbors were treated as candidates for
capturing, leading to incorrect annexations in certain edge cases.
- Added a small efficiency improvement by filtering out non-player and
friendly neighbors up front to reduce total computations down-the-line.
- Important: we can’t simply check if the `getMode(neighborsIDs)` result
is a friendly. Doing so would cause the territory to go to nobody until
the user is attacked. I believe the expected behavior is the largest
neighboring enemy should take it automatically.

Here's an example of the new behavior in an extreme edge case:
<img width="622" height="422" alt="Screenshot 2025-08-24 at 4 56 46 PM"
src="https://github.com/user-attachments/assets/c5dd9c0d-0a3c-4657-8154-e114fa920689"
/>

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

nottirb
2025-10-08 18:28:26 -07:00
Jeff 187ef1f2dd feat(PlayerExecution): downgrade defense posts on capture (#1957)
## Description:

Closes https://github.com/openfrontio/OpenFrontIO/issues/1619.

On capture, defense posts will be downgraded.

On the live version this means defense posts will be destroyed, as
defense posts can only be level 1.

Misc. changes:
- added `decreaserLevel` helper
- cleaned up if/else in tick unit loop for clarity to avoid yet another
nested layer

Continuation of the stale PR,
https://github.com/openfrontio/OpenFrontIO/pull/1622.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Discord username: `seekerreturns`
2025-10-08 17:31:56 -07:00
Abdallah Bahrawi b03f9778db Fix nations break alliance too ealry bug (#2123)
Betrayal was being considered too early (inside shouldAttack), causing
alliances to break before calling attackChance.

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
regression is found:

abodcraft1
2025-10-07 16:04:00 -07:00
Scott Anderson e216b8a22b cleanup: Nations rarely launch nukes (#1948)
## Description:

In #1860, some unused code was left behind. Remove the unused code.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
2025-10-06 15:37:04 -07:00
Scott Anderson d83a66196a bugfix: Nations rarely launch nukes (#1860)
## Description:

Simplify nation enemy selection to make nations more likely to launch
nukes.

Partially fixes #1855 by addressing a v24 regression in nation behavior.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
2025-10-06 15:37:04 -07:00
Scott Anderson 8308d7f1e7 Nations send emoji when declining assistance requests (#1911)
## Description:

Nations will now send emoji when declining assistance requests.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
2025-10-06 15:37:04 -07:00
Scott Anderson 81bd98c8d6 Nations send emoji when declining assistance requests (#1911)
Nations will now send emoji when declining assistance requests.

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

Cancel alliance requests if the recipient attacks (#1733)

Problem: attacking a player right before accepting an alliance request
is very effective since the requester can't fight back or reclaim his
territory without canceling the alliance and being penalized with the
traitor debuff.

Change:
- Attacking a player after he requested an alliance automatically
rejects the request
- No changes to existing attacks in both directions, only new attacks
affect the request

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA agreement (only required once).

regression is found:

IngloriousTom
2025-10-06 15:37:00 -07:00
Scott Anderson f0f9318852 Nations build defense posts (#1935)
## Description:

Nations build defense posts. Fixes #1854.

<img width="259" height="383" alt="image"
src="https://github.com/user-attachments/assets/aee75fd3-f52e-47d8-b47f-b192b8aaa69b"
/>

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
2025-10-06 14:40:46 -07:00
Scott Anderson 47edfe3e40 Nations build SAM launchers (#1931)
## Description:

Fixes #201 by adding the ability for nations to build SAM launchers.

<img width="888" height="625" alt="image"
src="https://github.com/user-attachments/assets/b07f1b4e-d022-4674-b842-bc8b4247825d"
/>

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
2025-10-06 14:40:08 -07:00
Scott Anderson c7f7fb0ee4 Refactor structureSpawnTileValue() (#1927)
## Description:

Move `structureSpawnTileValue()` into its own file, as
`FakeHumanExecution.ts` was getting quite large.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
2025-10-06 14:36:22 -07:00
evanpelle 469a14d62a Allow attacking allies or teammates if player is disconnected (#2144)
## Description:

This will allow players to conquer land from afk teammates in team
games.

No troop loss if attacking afk teammate.

Also remove the team check in attack execution because we already do an
isFriendly check.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-10-06 14:25:46 -07:00
Abdallah Bahrawi 6061c97d78 Fix nations break alliance too ealry bug (#2123)
## Description:
Betrayal was being considered too early (inside shouldAttack), causing
alliances to break before calling attackChance.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

abodcraft1
2025-10-02 11:59:06 -07:00
Daniel Popsuevich d16accafef Revoking alliances request during nuke (#2101)
Closes #2071 


## Description:

- Created Functional Test for scenario
- Added an alliance revoker function to 'NukeExection'

## Please complete the following:

- [ ] I have added screenshots for all UI updates
- [ ] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

dpop
2025-09-28 17:56:09 -07:00
DevelopingTom c2cf2ce65f Record player deaths (#2102)
## Description:

Record player death ticks and "conquests" (when a player has < 100
tiles).
Tournaments would be easier to manage with those information.

Related infra PR: https://github.com/openfrontio/infra/pull/196

Tested locally with docker/infra repo

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

IngloriousTom
2025-09-27 15:52:50 -07:00
Will Dunlop eeb9f0c279 add target visualization for boat attacks (#2025)
## Description:
- Adds warship count, transport count (deployed out of maximum) to unit
display
- Adds a target that appears when a boat attack is dispatched, which
disappears when the boat attack arrives
- Updates the unit display alt text to pass through translation

## Please complete the following:

- [X] I have added screenshots for all UI updates (see below)
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file (in this case it is only alt-text)
- [X] I have added relevant tests to the test directory (n/a, fully
visual)
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

See new target effect and addition to units display 

As each transport ship arrives, the target draw stops, together with the
effect for the trail.


https://github.com/user-attachments/assets/c36c57d3-e2b7-456e-85ab-1e786bd28a07

## Please put your Discord username so you can be contacted if a bug or
regression is found:

@dxtron_28992 (my invite is still pending to dev discord)
2025-09-24 11:08:52 -07:00
Abdallah Bahrawi 0a6ab07d2e fix: traitor bug when attacking immediately after initiating an alliance (#2044)
## Description:

This PR fixes a critical race condition bug where players could
unintentionally receive the traitor debuff when alliance requests were
accepted mid-attack.


Critical Bug Fixes #1866

**Root Cause:** 
Players could bypass UI alliance checks ( isFriendly() ) by accepting
alliances and immediately attacking after that, causing the server to
treat the attack as betrayal
Solution: Added server-side alliance validation in
AttackExecution.init()
This ensures attacks on allies are blocked at the server level.

- Once Bots and Nations decide to attack, they breaks the alliance. I
added maybeConsiderBetrayal(), which currently always returns true. I’ll
add proper logic for alliance-breaking soon on another PR; this didn’t
exist in the code before.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

abodcraft1

---------

Co-authored-by: evanpelle <evanpelle@gmail.com>
2025-09-13 09:21:21 -07:00
evanpelle 1fa2685495 format using prettier 2025-09-03 19:32:35 -07:00
Scott Anderson b0ec4c5558 Fix trainwreck bug (#1925)
Fixes #1922, the trainwreck bug.

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
2025-09-03 16:31:48 -07:00
ElMelchizedek 3f98cb0ac1 Allies no longer embargo each other (#1863)
## Description:

Bots on the same team as a human player will no longer embargo them if
they betray an alliance with an opposing team player.
Fixes #1845 

## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

sibyljudith
2025-09-03 16:27:36 -07:00
Scott Anderson d5a7b041c2 Smarter nation structure placement (#1851)
## Description:

Smarter nation structure placement.

Fixes #881

<img width="2464" height="1235" alt="image"
src="https://github.com/user-attachments/assets/b8ec0041-6f12-4ff3-9279-f5e8529521e5"
/>

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
2025-09-03 16:27:16 -07:00
Scott Anderson ec4eff2656 Remove hard structure limit for nations (#1853)
## Description:

Remove the structure building limit for AI players, in favor of a simple
cost heuristic.

Fixes #1561

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
2025-09-03 16:26:54 -07:00
Cameron Clark 1ecd6c4ee1 Private lobby toggle donation (#1752)
Resolve #1652

1. Add the ability to toggle **gold donations** and **troop donations**
for private lobbies
~2. Add relevant translations.~
3. Refactor `canDonate` to be specific to gold and troop donations
4. Add placeholders for singleplayer mode if this is to be extended to
support that too.
5. Add Tests for Donate logic
<img width="1643" height="1788" alt="image"
src="https://github.com/user-attachments/assets/82b93400-a1f0-45f0-8b2b-a7f78dc0c3e9"
/>

_Private Lobby_

![donatetroopsprivatelobby](https://github.com/user-attachments/assets/c6690bbc-958e-48a1-9cf1-e2b361dfb1b2)
_Testing Troop Send In Private Lobby_

![donatetroopsprivatelobby2](https://github.com/user-attachments/assets/698c7603-6b4b-4da7-91ab-7bdc38bb49a5)

_Troop Send Complete In Private Lobby_

![testtradepublicteams](https://github.com/user-attachments/assets/1010332c-3f38-4644-9218-46aa7141f578)
Confirming that public teams still works

- [X] I have added screenshots for all UI updates
- [X] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [X] I have added relevant tests to the test directory
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [X] I have read and accepted the CLA agreement (only required once).
regression is found:

DISCORD_USERNAME: cool_clarky

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
2025-09-03 16:19:13 -07:00
DevelopingTom e027983f41 Cancel alliance requests if the recipient attacks (#1733)
Problem: attacking a player right before accepting an alliance request
is very effective since the requester can't fight back or reclaim his
territory without canceling the alliance and being penalized with the
traitor debuff.

Change:
- Attacking a player after he requested an alliance automatically
rejects the request
- No changes to existing attacks in both directions, only new attacks
affect the request

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA agreement (only required once).

regression is found:

IngloriousTom
2025-09-03 16:08:50 -07:00
Kipstz 4b129a2f7f Add button for remove building (#1609)
## Description:

Added a red delete button with trash can icon to the right-click radial
menu that allows players to voluntarily delete their own units.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA agreement (only required once).

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Kipstz

<img width="286" height="209" alt="image"
src="https://github.com/user-attachments/assets/85142be3-2aa5-4c84-ab30-0c68289c8f85"
/>

---------

Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
2025-09-03 16:06:07 -07:00
evanpelle 0f60825b9f reduce number of trade ships by 50%, double gold per trade ship (#1934)
## Description:

v25 increased the number of trade ships from v24, causing lag
complaints. On my chromebook pathfinding is using over 60% of cpu.

So reduced the number of trade ships roughly by half, but double the
gold per trade ship so it should balance out,

World v25: 
* 2 mins: ~ 60 trade ships 
* 5 mins: ~ 140 trade ships

World on this branch:
* 2 mins: ~ 35 trade ships
* 5 mins: ~ 70 trade ships


Also increased the probably of trade ship spawn for players with under 2
tradeships to prevent larger players from starving out smaller players.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-08-25 16:13:54 -07:00
DevelopingTom 3f1efc624f Fix long-distance nuke interception (#1900)
## Description:

Fix a bug introduced by an optimization that caused some incoming nukes
to be ignored. As a result, long-distance nukes could evade in-range
SAM.

Changes:
Replaced the ignored nukes list with a list of precomputed nukes.
For incoming long-distance nukes, the interception tile is now computed
in advance.
When the nuke enters range, the precomputed interception tile is used
for interception.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

IngloriousTom

---------

Co-authored-by: evanpelle <evanpelle@gmail.com>
2025-08-25 01:28:36 -04:00
DevelopingTom 713db43f42 Create stations regardless of factory ownership (#1904)
## Description:

Bug fix: cities and ports would only connect to factories owned by the
current player, ignoring those belonging to other players.

This update makes the player ID optional when searching for nearby
units: if no player ID is provided, unit ownership is disregarded,
allowing connections to all factories regardless of ownership.
## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

IngloriousTom
2025-08-24 13:41:51 -04:00
evanpelle 3e880a34ef v25 meta update (#1872)
## Description:

v25 meta update:

- Trade ship spawn rate is determined by number of ports players has and
total number of tradeships on the map
- Train spawn rate scales hyperbolically with number of factories owned
by player
- Factory & Port share the same early unit discount (eg building a port
makes the factory more expensive), this is to encourage more
specialization: become a naval economy or land based economy.
- Trains spawn from factories and arrive on cities
- Trains only give gold on cities
- Trains give 50k gold for allies, 25k for nonallies, and 10k for self
- Large players are given a 30% speed/attack debuff in sigmoid curve
- Reduced attack bonus for large players
- Nerf bot gold production from 1k/s => 500/s
- Nerf bot max troops

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-08-19 18:53:42 -07:00
evanpelle 081735bf55 Improve alliance UX, prevent hung alliance requests (#1868)
## Description:

This PR does two things:

1. Allows you to send an alliance request to approve an existing
request, ex:
* player A sends req to player B
* now player B can send an ally request to player A, which accepts the
request from player A.

This way even if you lose or don't see the alliance notification, you
can still accept the alliance.

2. Have AllianceRequestExecution reject the request if not accepted or
rejected. There is a bug where sometimes the EventDisplay does not
trigger the delete() function, resulting in hung alliance requests. I
couldn't figure out why the delete() function is sometimes not called,
but I think it's better design to have core/ itself handle abandoned
alliance requests, this was UI bugs can't break the game state.


## Please complete the following:

- [ ] I have added screenshots for all UI updates
- [ ] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [ ] I have added relevant tests to the test directory
- [ ] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-08-19 12:52:54 -07:00
evanpelle 53fbde07dc increase MIRV warhead distance, after improved pseudorandom (#1839)
## Description:

seedrandom provides much better randomization
(https://github.com/openfrontio/OpenFrontIO/commit/77fd82b4b4b2b43e455d8db6100b64f10fdbb680)
causing MIRV warheads to cover the target much more efficiently, and
wiping out much more territory than in v24. This change makes the MIRV
more similar to v24.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-08-16 18:36:07 -07:00
evanpelle 8ca4548e0a bugfix: SAMs targeting not updating owner after capture (#1838)
## Description:

After a SAM was captured, SAMTargetingSystem's player was not updated,
so it thought it was still owned by the original player. So it wouldn't
shoot down nukes launched from the original owner.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-08-16 18:09:29 -07:00
evanpelle 7de962eb5b fix alternate view perf regression (#1734)
## Description:

Have the diplomacy view only draw border, not interior tiles. Drawing
the interior tiles is a very expensive operation and caused main thread
cpu usage to spike to close to 100%.

Also change the color scheme so that neutral players are gray, and
embargoed players are red. I think long term embargo should be more of a
war state.

Added embargo update and cleaned it up to use Player instead of
PlayerID. There's no reason to pass ids around.


<img width="493" height="466" alt="Screenshot 2025-08-07 at 6 25 55 PM"
src="https://github.com/user-attachments/assets/75552036-42f1-4103-9537-234ff1c0464f"
/>

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA agreement (only required once).

## Please put your Discord username so you can be contacted if a bug or
regression is found:

evan
2025-08-08 16:37:17 -07:00
VariableVince a71ac7a218 Fix oversight: non-human player never responds to alliance renewal request (#1536)
## Description:

**--Fix oversight in v24--**
In v24, alliance renewal was introduced. But a Bot or Nation never
answers to it. So the Event Panel expiration message + clicking to Renew
and waiting, is all in vain if the other player is not a human. Like in
Single player in all cases. The message after ~30 seconds is always
"Alliance with xxx expired". This feels illogical and there's no purpose
for showing a Request to Renew button if it then always expires.

Also reported by players like here:
https://discord.com/channels/1284581928254701718/1284581928833388619/1398249123093676094

This PR fixes it by having the non-human reciever of the request, say
yes to depending on attiude towards the human and chance. This feels
more realistic.

The requestor is always the human player because they click a button in
EventsDisplay. So there is always already an extension request which the
bot can react to with another extension request to have the alliance be
extended.

**--Add tests--** 
It adds tests for extending alliance between human and non-human player.
One for AllianceExtensionExecution simply testing if alliance between
human and non-human can be extended. And one in BotBehavior, testing if
it correctly handles an extension request by adding a new
AllianceExtensionExecution.

**--Fix silent bug in existing test--**
Adding the new test for human and non-human for
AllianceExtensionExecution, i ran into a bug in the existing test for
extending alliance between humans. Which made the test always pass
because expirationAt wasn't fetched correctly. Had to fix that too,
without intending that for this PR beforehand. And then had to include
the bugfix from PR #1582 (v25) in it too to have the alliance actually
extended. More details below:

(-- The existing test would always return 'all passed' because it did
not get the expiresAt() but got the createdAt +
config.AllianceDuration() for both expirationBefore and expirationAfter.
createdAt is immutable so before and after would be the same. And then
it did not test for toBeGreaterThan, which would have failed. But it
tested wrongfully for toBeGreaterThanOrEqual which was a pass even when
the expirationBefore and expirationAfter would be the same and no
extension had taken place.

-- The bugfix from PR 1582 needed to be included now too. Because only
with those changes, the existing test has its alliance truly extended
and only with that the expirationAt actually changed. Actually, checking
if extend() was called isn't needed anymore, since we now check the
expirationAt correctly which on its own tells us if extend() was
succesful. But left this addition from PR 1582 in since it can't do any
harm.)

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [ ] I have read and accepted the CLA agreement (only required once).

## Please put your Discord username so you can be contacted if a bug or
regression is found:

tryout33

---------

Co-authored-by: evanpelle <openfrontio@gmail.com>
Co-authored-by: Drills Kibo <59177241+drillskibo@users.noreply.github.com>
2025-08-06 06:14:34 -04:00
DevelopingTom a05814a7fb Rework trains to encourage alliances (#1697)
## Description:

This update encourages alliances by modifying how train-based trading
works. Trading is now restricted to allied networks, and allied trades
offer better rewards than self-trades, incentivizing cooperation.

Changes:
- Train destinations are now limited to stations owned by the player or
their allies.
    - Delivering a train to one’s own station grants 4,000 gold.
- Delivering a train to an ally’s station grants 5,000 gold to both the
sender and the receiver.

This system encourages players to form alliances, especially with
factory-focused players.


## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA agreement (only required once).

## Please put your Discord username so you can be contacted if a bug or
regression is found:

IngloriousTom
2025-08-03 23:13:27 +00:00
Antoine ad2598361b Fix remaining errors and enable strict mode (#1628)
## Description:

#1075 

Fixing all remaining type errors caused by strict mode and enable it.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA agreement (only required once).

## Please put your Discord username so you can be contacted if a bug or
regression is found:

azlod

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-08-03 23:06:31 +00:00
Kipstz Avenger 0943b1544c Fix Race conditions on alliances (#1605)
## Description:

Players received "traitor" debuff when alliances were formed after
attacks started, creating an unfair race condition.

the problem was mentioned here
https://discord.com/channels/1284581928254701718/1399115120486912100

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA agreement (only required once).

## Please put your Discord username so you can be contacted if a bug or
regression is found:

Kipstzz

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-08-02 22:12:23 +00:00
Kipstz Avenger 86a329f7cb Add random shell damage (#1665)
Closes #555 

## Description:

Added random damage for warship shells and defence posts.
Damage mapping: roll 1-5 → 200, 225, 250, 275, 300 damage respectively.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA agreement (only required once).

## Please put your Discord username so you can be contacted if a bug or
regression is found:

kipstzz
2025-08-02 22:08:17 +00:00
DevelopingTom eeeb7e4b4e SAM smart targeting (#1618)
## Description:

Current SAM behavior is to shoot a missile as soon as a nuke is in
range.
Players can exploit it by overshooting behind the SAM, so the SAM
missile will take way longer to reach the nuke, usually too late to
prevent its explosion.

This PR introduces a "smart" targeting system that allows SAM to
calculate an optimal interception tile along the nuke's trajectory. They
can also preshot before the nuke becomes vulnerable, as long as the
interception tile will be within the vulnerable window.

This change makes SAM range enforcement much more strict.

Changes:
- Nukes now precompute their full trajectory on creation and update
their current position index every tick.
- SAMs use this trajectory data and their own missile speed to calculate
the ideal interception tile.
- SAM missiles now aim directly at that interception point rather than
chasing the nuke.

Small changes on the fly:
- `BezierCurve` now uses a provided increment so the curve LUT is the
optimal size
- Increased nuke opacity when untargetable: 0.4 → 0.5
- Slightly extended nuke vulnerability range to SAMs: 120 → 150


===

Preshot an incoming nuke still in the unfocusable state. Notice how the
nuke is destroyed as soon as becomes focusable:



https://github.com/user-attachments/assets/9fbf1ae4-33b4-4fa0-9b53-cb53f3adc17b


Shooting right at the range limit:


https://github.com/user-attachments/assets/d68793ac-b249-45fe-88bf-e20f70758449


Shooting behind the SAM:


https://github.com/user-attachments/assets/800cd7ff-d9d9-40f3-aba8-fa3ab526b3b2




## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I have read and accepted the CLA agreement (only required once).

## Please put your Discord username so you can be contacted if a bug or
regression is found:

IngloriousTom
2025-08-02 22:03:29 +00:00
djmrFunnyMan 4626f4dc4a Remove gold from dead players (#1450)
Fixes #1519 

## Description:
Currently if a player is killed via a nuke, they keep their gold despite
being eliminated and other players have no way to access that gold as
there is no territory to conquer. This PR fixes this by removing gold
from dead players.

This doesn't affect gameplay itself, because that gold was already
inaccessible. It'll just be clearer to the remaining players now.

<img width="1566" height="827" alt="Zrzut ekranu 2025-07-16 210908"
src="https://github.com/user-attachments/assets/438081e5-c145-4691-a36c-92ceb1049469"
/>
^ This is what this PR fixes

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- [x] I have added relevant tests to the test directory
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
aceralex
2025-08-02 01:22:12 -04:00