Commit Graph

2750 Commits

Author SHA1 Message Date
evanpelle 91ff1c0e53 rename Mini Map => Compact Map for clarity 2025-11-04 10:34:24 -08:00
evanpelle 8fc1bf1c12 increased deletionamrkduration and deleteunitcooldown to 30 seconds 2025-11-04 09:32:53 -08:00
evanpelle 4144628808 Revert "Halloween Event (#2285)"
This reverts commit b69adf70b3.
2025-11-04 09:26:48 -08:00
evanpelle ca28db735f Revert "Resize structure sprites so they don't leave pixels behind when deleted (#2304)"
This reverts commit df8118e27d.
2025-11-04 09:26:39 -08:00
VariableVince 70597470c5 Fix empty Leaderboard on Teams replay (#2370)
## Description:

Fixes https://github.com/openfrontio/OpenFrontIO/issues/2356

Leaderboard was empty on replay of Team games. This fixes it.

For v26, since the bug was introduced in v26. Set main as target branch
though.

**BEFORE**
<img width="1918" height="1075"
alt="508510056-b5ec5c7e-33a7-4bae-92f8-103e6cc1f165"
src="https://github.com/user-attachments/assets/f8c7d029-1c8b-4bbe-8288-e73829f1c239"
/>

**AFTER**
<img width="1065" height="567" alt="image"
src="https://github.com/user-attachments/assets/f29fb7ef-78df-414e-8ea8-e1f86433b4c6"
/>

## 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-11-04 09:23:56 -08:00
Kerod Kibatu c371112e9e Add performance stats (#2338)
## Description:

Enhanced the performance overlay to display additional tick-related
performance metrics. The overlay now shows:

1. **Tick Execution Duration** - Average and maximum time (in
milliseconds) it takes to execute a game tick
2. **Tick Delay** - Average and maximum time (in milliseconds) between
receiving tick updates from the server

The server sends 10 updates per second (100ms interval), so these
metrics help identify:
- Client-side performance bottlenecks (tick execution duration)
- Network latency issues (tick delay)

**Additional improvements:**
- Renamed `FPSDisplay` component to `PerformanceOverlay` to better
reflect its expanded purpose
- Updated method names (`updateFPS` → `updateFrameMetrics`) and CSS
classes for consistency

All metrics are tracked over the last 60 ticks, providing rolling
averages and maximum values for performance analysis.

## Please complete the following:

- [x] I have added screenshots for all UI updates:
- <img width="495" height="227" alt="image"
src="https://github.com/user-attachments/assets/142b0313-61bf-46cc-b595-61fe73f6b54c"
/>


- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file
- Translation keys already exist in en.json for
"performance_overlay_label" and "performance_overlay_desc"

- [x] I have added relevant tests to the test directory
  - All existing tests pass (309/310 tests passed)
  - No new tests added as this is primarily a display enhancement

- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
  - Tested locally with npm test
  - Verified performance overlay displays all metrics correctly
  - Confirmed tick metrics are calculated and displayed accurately

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

Discord: kerverse

---------

Co-authored-by: Evan <evanpelle@gmail.com>
2025-11-03 13:25:54 -08:00
Thomas Cruveilher a335d3cd8d fix(replay): change text to 'replay speed' when watching a replay #2357 (#2365)
Before, the condition was "if it's not singleplayer", but replays are
counted as singleplayer game for some reason (will need to fix the
underlying issue) so it wasn't robust enough Now the condition is based
on are we in replay or not,.

## Description:

Related to issue https://github.com/openfrontio/OpenFrontIO/issues/2357

I cannot get to replay games locally for some reason (client just throws
an error that it cannot load the lobby), so I made sure that the
singleplayer text did not change (at least no regression) cf screenshot:

<img width="1920" height="963" alt="Screenshot 2025-11-02 at 17 46 57"
src="https://github.com/user-attachments/assets/27e055a8-3813-46bd-a8ae-0c463a94d1a8"
/>


## 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:

sorikairo
2025-11-03 13:18:36 -08:00
VariableVince efec27b834 Fix empty Leaderboard on Teams replay (#2370)
## Description:

Fixes https://github.com/openfrontio/OpenFrontIO/issues/2356

Leaderboard was empty on replay of Team games. This fixes it.

For v26, since the bug was introduced in v26. Set main as target branch
though.

**BEFORE**
<img width="1918" height="1075"
alt="508510056-b5ec5c7e-33a7-4bae-92f8-103e6cc1f165"
src="https://github.com/user-attachments/assets/f8c7d029-1c8b-4bbe-8288-e73829f1c239"
/>

**AFTER**
<img width="1065" height="567" alt="image"
src="https://github.com/user-attachments/assets/f29fb7ef-78df-414e-8ea8-e1f86433b4c6"
/>

## 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-11-03 12:48:20 -08:00
Aotumuri 9abb8c9faf Remove pattern MLS entries (#2371)
## Description:

Since pattern data is now dynamically fetched from the server,
maintaining direct translations here is no longer meaningful.
This change removes those entries and also helps prevent exceeding the
Crowdin string quota.

## 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:

aotumuri

Co-authored-by: Vivacious Box <jon@rouillard.org>
2025-11-03 12:47:40 -08:00
Vivacious Box 6ce1835d77 Fix socket log (#2369)
## Description:

Fix null socket crashing the log

## 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
2025-11-02 23:10:50 +00:00
FloPinguin f607f6d66b Nations rarely sent boats, now they do! (#2161)
## Description:

### Nations rarely sent random boats. Now they are sending twice as
many.
It feels right now, not too many and not too few random boats. 
To make sure that small island nations with, for example, 10k troops
don't repeatedly spam boats into an nation with 1.5M troops (that makes
no sense), they no longer send boats to opponents which have more than
twice the amount of troops.

| my optimizations - 27s into the game - `8 Boats active` | openfront.io
live - 27s into the game - `only 2 Boats active` |
| :---:   | :---: | 
| <img width="2560" height="1068" alt="27s into the game - 8 Boats
active"
src="https://github.com/user-attachments/assets/258e3d69-d86b-4c68-94ec-ade04c6c18b3"
/>|<img width="2560" height="1068" alt="27s into the game - 2 Boats
active"
src="https://github.com/user-attachments/assets/343603d6-e95d-402c-a660-cc54f715d148"
/>|

| my optimizations - 1m20s into the game - `much more boats` |
openfront.io live - 1m20s into the game - `only 4 boats active` |
| :---:   | :---: | 
| <img width="2560" height="1068" alt="1m20s into the game - much more
boats"
src="https://github.com/user-attachments/assets/bbe35603-8db4-4d82-af45-c77b8ef0dcbf"
/> | <img width="2560" height="1068" alt="1m20s into the game - 4 boats"
src="https://github.com/user-attachments/assets/f698794d-f94f-49fb-a09a-1a89b292456f"
/> |

### There was a bug in the random boat sending. 

It did not check if the target is the player himself.
That caused console warnings and a reduced amount of boat-sending.

### The Hiding-Strategy on small islands on the impossible difficulty is
now harder!

Because the random-boat-sending-method preferred large landmasses
instead of small islands (it randomly selects a valid tile),
human-players could easily hide on them, play a
warship-infestation-strat and nearly NEVER get boat-attacked by nations.

I implemented that the random boat functionality now searches for bots
and untaken tiles before searching for nations / humans. That way, they
will try to take some of these tiny islands before the human-player
does. Also its cool to see nations playing on the entire available
land-tiles instead of just the bigger landmasses.

Fixes #1916 (Please check this issue for screenshots and more info)

| my optimizations - 6m53s into the game - `only 5 islands not taken!` |
openfront.io live - 6m53s into the game - `19 islands not taken!` |
| :---:   | :---: | 
| <img width="1078" height="876" alt="6m53s into the game - 5 islands
not taken!"
src="https://github.com/user-attachments/assets/6c103ca1-7d4c-4d0d-948f-3313839302a7"
/> | <img width="1102" height="852" alt="6m53s into the game - 19
islands not taken!"
src="https://github.com/user-attachments/assets/01cc512d-71c9-47aa-b4b1-f7cd5123a782"
/> |


| my optimizations - 6m53s into the game - `all islands taken!` |
openfront.io live - 6m53s into the game - `8 islands not taken!` |
| :---:   | :---: | 
| <img width="2154" height="489" alt="6m53s into the game - 0 islands
not taken!"
src="https://github.com/user-attachments/assets/fc8000b2-de28-4d47-859d-0cc3c6d28ac3"
/> | <img width="2181" height="317" alt="6m53s into the game - 8 islands
not taken!"
src="https://github.com/user-attachments/assets/093243de-f6dc-41ee-ab5e-7e485fe27646"
/>|



### Nations now boat-attack other nations more often!
If there are two nations on two very large landmasses, which are divided
by water, they nearly NEVER attacked each other.

Most attack-functionality relies on the enemies sharing a border. If
they don't have one, the only possible attack-mechanism is the
random-boat-sending. But for very large landmasses (=> very large number
of coastal tiles) it can take a long, long time before it randomly
selects an enemy-tile. With the bug I described above ("did not check if
the target is the player himself") it took even longer. And on the
world-map, the nations have to go over iceland, this is also very
unlikely.

So I implemented the method selectNearestIslandEnemy, which specifically
doesn't cares about borders. It makes sure that a nation always has
someone to attack. This method only gets used as a fallback, and only if
a nation has no borders with anybody.

Fixes #1916 (Please check this issue for screenshots and more info)

| my optimizations - 29m41s into the game - `China won and is in the
process of killing the last enemy` | openfront.io live - NEARLY A HOUR
into the game - `UK finally won. There are still 14 players on the
map...` |
| :---:   | :---: | 
| <img width="2560" height="1068" alt="localhost_9000_"
src="https://github.com/user-attachments/assets/a8107b88-19c8-4df7-a3fd-76d3d3e05d8e"
/> | <img width="2560" height="1068" alt="openfront io_ (1)"
src="https://github.com/user-attachments/assets/0d80e503-d5ed-41d4-a103-33dffc302001"
/> |

## 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:

FloPinguin
2025-11-02 19:28:21 +00:00
Thomas Cruveilher 935ff7a970 Fix: prevent scrolling outside the map (#2360)
## Description:

Prevent users from "scrolling"/moving the map outside of viewport and
"being lost and unable to find the map back". This can happen by
pressing keys intentionally (RIP me) or conflict with browser shortcut
containing a WASD key which would keep moving.

Related to reports from discord as highlighted by here:


https://discord.com/channels/1359946986937258015/1360078040222142564/1432750863994192003

Here is the new behavior. I am actively pressing WASD key to try to "get
out" but I can't. Same with mouse clicks.

https://www.loom.com/share/a9ecb0a7514d4e54b92d24678833eb2e


## 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:

sorikairo
2025-11-01 12:54:22 -07:00
Will Dunlop 63a843177c add rivers to britannia (#2026)
## Description:

Adds rivers to the Britannia map. This uses OpenStreetMap river layer
data. Therefore the credits to this should be added somewhere visible
according to
https://osmfoundation.org/w/index.php?title=Licence/Attribution_Guidelines#Computer_games_and_simulations

See the issue https://github.com/openfrontio/OpenFrontIO/issues/2023

## 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 (N/A)
- [X] I have added relevant tests to the test directory (N/A)
- [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:
@dxtron_28992 (application to join Dev discord still pending)

<img width="1335" height="932" alt="image"
src="https://github.com/user-attachments/assets/158bc616-1618-4117-9a21-9b04cb70a949"
/>

---------

Co-authored-by: Vivacious Box <jon@rouillard.org>
2025-11-01 19:23:01 +00:00
Gabriel Jacques bac05fc69b Added cities to the Montreal map (#2207)
Added about 10 or so cities to the new montreal map.

## Description:

Very minor change, only changed the info.json file for the montreal map,
so that the map now comes with more NPCs. This should make the map more
challenging and fun in offline mode. There is now 13 nations, spread
evenly (as best i could) across the map.

## Please complete the following:

- [x] I have added screenshots for all UI updates - there is no ui
changes
- [x] I process any text displayed to the user through translateText()
and I've added it to the en.json file - there is no text displayed
change, only new nations.
- [x] I have added relevant tests to the test directory - No tests
relevant
- [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:

Lionhyde

---------

Co-authored-by: jrouillard <jon@rouillard.org>
2025-11-01 19:10:29 +00:00
Vivacious Box e7c49d57d2 Add deletion duration and indicators (#2216)
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)

- [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:

Mr.Box

---------

Co-authored-by: Evan <evanpelle@gmail.com>
2025-11-01 11:02:32 -07:00
evanpelle 02b4702a11 Merge branch 'v26' 2025-11-01 10:49:35 -07:00
VariableVince 896a8ebe92 AFK team mate: better ship handling + tests + bugfix (#2203)
## Description:

Have AFK player's Warships not attack team members ships, like Transport
Ships boating in. If team mate conquers the AFK player, transfer over
Warships and Transport Ships to conqueror. The transfered Transport
ships attack in the name of the new owner when landing, and when they
are retreated they move back to a new owner shore tile if they have any.

Added tests. Expectation is this PR will be merged in v26 as the real
solution for the temporary workaround of deleting warships.

**Currently:**
- An AFK player can be attacked without troop loss by their team
members. For this purpose, isFriendly now returns false if the other
player isDisconnected
- But that meant Warships would get False from isFriendly too, and
attack the ships and boats of their team members.
- [Temporary workaround was to delete
warships](https://github.com/openfrontio/OpenFrontIO/commit/eea8db7a06aed50c005db35ad55ece026f7a3643)
as soon as the player was deemed AFK. But this is a disadvantage to the
team. For example the AFK player could have 6 warships in the waters,
either defending team land or helping the team cross over to the enemy
team.
- Transport Ships that were on the way to attack, were still deleted
after the AFK player was conquered. But this is also a disadvantage, if
say a transport ship has just managed to breach through to the enemy
lands despite warships all around. That could have made the win for the
team.

(Left to think about: do we want to transfer part of the defender troops
to the isOnSameTeam attacker? Defender looses less troops in the attack
from their team mate. You'd expect troops to lay down their arms mostly,
if the attacker is on the same team and doesn't loose troops themselves.
Those troops that they loose less than normal, are then added to the
attacker once they've been deemed conqueror. The enemy team can still
attack and do normal damage, and can still also be the conqueror so the
team members have to be fast.)

**Changes in this PR:**
- GameImpl > conquerPlayer: Transfer ownership of the warships to the
conquerer of their lands. If the conqueror is not a team member (other
team can still attack, in their case with troop loss), they won't get
the warships and the ships will be deleted like normal. If the conqueror
is a team member, have them capture the warships.
(Captures need to happen in conquerPlayer since this is right before the
last tiles are conquered and PlayerExecution finds out the player is
dead and deletes its units. Captures will be recorded in the stats just
like normal. Things like this add an extra incentive to be the fastest
to conquer the AFK player, next to getting their gold which is also
recorded in stats. The normal Event Box messages are also displayed.)

- GameImpl > conquerPlayer: Also transfer Transport Ships. As a note:
the limit of 3 transport ships concurrently out on water for one player,
can be exceeded in this specific case (the boatMaxNumber is only checked
for canBuild via TransportShipUtils, and in the init of a
TransportShipExecution, not for an existing TransportShipExecution with
a changing owner). This keeps the situation even for the team in terms
of ships that are already out to attack, which is fair.
captureUnit/setOwner won't do the full job here though, so changes in
TransportShipExecution are needed.
- TransportShipExecution: Added originalOwner. So we can check within
the execution itself if the Original owner disconnected, and if so if
the new owner is on the same team. Only in that case change private
this.attacker. This.attacker can still not be changed from the outside
in this way. Find new src of new owner to retreat boat to if needed, and
if new owner has no shore set it to null so the boat will be deleted
upon retreat. To find new src tile of new owner, use
bestTransportShipSpawn instead of canBuild because canBuild checks for
max boats = 3 etcera but the boat is already on its way so those checks
don't apply (we could get false back from canBuild because there's 3
ships out, while we only need to find the source tile so use
bestTransportShipSpawn).
- TransportShipUtils: to use bestTransportShipSpawn to find new owner
source tile to retreat to, we need to make sure it can handle a new
owner without shore tiles. When the new owner has no shore tiles
(candidates.length === 0), return false. This way it won't go on to call
MiniAStar which would have SerialAStar error on an empty this.sources
array.


- WarshipExecution: Changed isFriendly. This makes sure we have the
wanted behavior: allied/team ships should not attack each other once one
of their owners goes AFK.

- AttackExecution: added one more test specifically to check if attack
on AFK teammate is still witthout troop loss "Player can attack
disconnected team mate without troop loss". Also a bugfix that I left in
after removing a related change from this PR: Add a check for
removeTroops === false in the retreat() function, so at the end of the
attack we don't add troops back to owner troops if they were never
removed in the init. This check in retreat() is actually a bug fix
because removeTroops is in the constructor and can be set to True, but
in retreat() troops would then have been given back after not being
removed at init.

- DefaultConfig: small addition to comment.

- Disconnected.test.ts: added tests. Added useRealAttackLogic because at
least "Player can attack disconnected team mate without troop loss"
needs to use the real attackLogic.
- TestConfig: new class useRealAttackLogic extends TestConfig class, so
a test setup can use the real attackLogic from DefaultConfig instead of
the mock function in TestConfig.
- Setup.ts: for the test setup, add parameter to accept
useRealAttackLogic extension class. Defaults to TestConfig.

## 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

---------

Co-authored-by: Evan <evanpelle@gmail.com>
2025-11-01 10:48:56 -07:00
VariableVince 64e8733132 Delete unit: 5s > 15s cooldown and new location in Radial Menu (#2345)
## Description:

- Move the Delete button to where the Boat button is otherwise. The Boat
and Delete button already mutually exclude eachother anyway; boat button
is only visible on other's tiles, delete button is only visible on your
own tiles. Evan agreed to this new position:
https://discord.com/channels/1359946986937258015/1381293863712591872/1429147325049077860

- Increase the cooldown between deletions from 5 to 15 seconds. PR #2216
introduced a destruction time (deletionMarkDuration) making it take 15s
to delete a building. With the cooldown of 15s between clicking the
Delete button (deleteUnitCooldown) on top of that, you can actually only
delete a building every 15 seconds while it also takes that same time to
destruct it. Players have voiced between 10s to 30s or more so 15s is
still a reasonable time, keeping deletion of mistakenly placed buildings
still possible, while also keeping a small 'scorched earth' option
during an attack but probably only being able to delete 1-2 units in an
attack. Evan and Vivacious Box agreed with the mentioned 10-15s cooldown
too:
https://discord.com/channels/1359946986937258015/1381293863712591872/1429103999088459897


**Video: Delete button new location and 15s cooldown:**

https://github.com/user-attachments/assets/b0b13fc1-1e50-4a7a-8f32-55f7891f9945

**Delete button new location disabled:**
<img width="310" height="316" alt="Delete button disabled new location
radial menu"
src="https://github.com/user-attachments/assets/f65b88ad-5859-4982-be53-8f2f693f5767"
/>

**Delete button new location enabled:**
<img width="332" height="305" alt="Delete button enabled new location
radial menu"
src="https://github.com/user-attachments/assets/037f07c5-622a-4857-9ab8-fc20981de816"
/>

**Radial menu unchanged on others' tiles:**
<img width="346" height="307" alt="Radial menu unchanged on other
territory"
src="https://github.com/user-attachments/assets/085b2043-096f-4c44-8917-467adb8a7213"
/>


## 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

---------

Co-authored-by: Vivacious Box <jon@rouillard.org>
2025-11-01 10:48:40 -07:00
Ryan Barlow daf3fee14d Change Colour/Thickness and Add Rotation to SAM Radius (#2348)
## Description:

Change Colour/Thickness and Add Rotation to SAM Radius



https://github.com/user-attachments/assets/c701c877-4b71-4266-ad86-bf8e8d61756a



https://github.com/user-attachments/assets/2ea24df7-ae8f-425e-bb07-19c731529ab6



## 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:

w.o.n
2025-10-31 19:30:49 -07:00
Ryan Barlow 380307e386 SAM Sites bugfix: due to ownership changes (#2342)
## Description:

There was a small bug when ownership was updated (annexed territory) and
it wasn't redrawing the radiuses. Complements #2307

## 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:

w.o.n
2025-10-31 11:32:30 -07:00
VariableVince d9ea9fd432 Fix betrayals for Nations always 0 on Player Info Panel (#2334)
## Description:

Betrayal count in PlayerUpdates came from stats. But stats are only kept
for players with ClientID aka real humans. So betrayals stayed 0 for
Nations even after betraying others. This PR fixes it by keeping a
seperate betrayal count for PlayerUpdates while stats are still being
kept to go in the database.

See bug report
https://discord.com/channels/1284581928254701718/1432759837560799403

After:
<img width="642" height="337" alt="image"
src="https://github.com/user-attachments/assets/1b8bcfa1-aadd-4bea-8a5f-7fa9f2c9111f"
/>


## 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-31 11:31:18 -07:00
evanpelle bf980b970d add no warranty to the agpl license notice 2025-10-31 11:28:36 -07:00
VariableVince 320a494ff4 Remove redundant function from FakeHumanExecution (#2335)
## Description:

Removed unused code.

PR https://github.com/openfrontio/OpenFrontIO/pull/2044 introduced
function "maybeConsiderBetrayal" in FakeHumanExecution. It was later
replaced by "betray" in BotBehavior, called in a chain of functions
resulting in the behavior that "maybeConsiderBetrayal" originally
intended:
https://github.com/openfrontio/OpenFrontIO/commit/b03f9778dbcada54e0f47232af4cd511a8629980.

## 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

Co-authored-by: Vivacious Box <jon@rouillard.org>
2025-10-31 07:40:33 +00:00
evanpelle 6fd1576d7b use sigmoid function for trade ship gold to punish short trades v0.26.13 2025-10-30 20:15:18 -07:00
evanpelle 04c240da18 Merge branch 'v26' 2025-10-30 19:28:17 -07:00
Evan 1165126a65 meta update: use rational function to discourage short trades, buff trains (#2337)
## Description:

Use a rational function to strongly nerf short trades. At 50 tiles the
reward is halved.

To compensate, increase gold given by trains by 20%.

## 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
v0.26.12
2025-10-30 19:27:46 -07:00
Evan d97184af35 add credits link to starting modal (#2333)
## Description:

* Create CREDITS.md
* add all link to it on loading page

<img width="338" height="254" alt="Screenshot 2025-10-30 at 6 24 07 PM"
src="https://github.com/user-attachments/assets/5e89c846-f672-44e1-9add-3d03608c849e"
/>


## 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-30 19:23:00 -07:00
VariableVince 2ac6b1306c Patterns are now named Skins, change leftover old translation strings (#2331)
## Description:

On the homepage, the Patterns modal now is titled Skins
(territory_pattern > title). This PR changes the other EN translation
strings to use the word skins, too.

## 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

---------

Co-authored-by: jrouillard <jon@rouillard.org>
2025-10-30 23:29:14 +00:00
Vivacious Box 0def339ad9 Fix modifierkey setting for mac (#2327)
## Description:

Currently not an issue, but this is a code smell in case we ever decide
to have it editable, current implementation will make the default
overwrite the custom setting

Pointed out by  #1804


## 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
2025-10-29 19:58:08 -07:00
Duwibi fbb818bab1 Add Nuke Wars Baikal Map (#2306)
## Description:
This PR adds the Nuke Wars Baikal map (more balanced out than the
original). This is made for the upcoming Nuke Wars gamemode.

## 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
Nikola123
2025-10-29 16:41:40 -07:00
Sam Bokai af86a9222f Feature: Enable FakeHumans ("Nation Bots") to Launch MIRVs Strategically (#2225)
## Description:

> [!IMPORTANT]
> Try here: https://mirv-test.openfront.dev/ 

> [!NOTE]
> Blocks PRs:
> - #2244 
> - #2263

### Summary
Implements intelligent MIRV usage for fakehuman players, enabling them
to make strategic nuclear strikes based on game state analysis.
 
### Changes

#### Core FakeHuman Strategy (`FakeHumanExecution.ts`)
- **MIRV Decision System**: Added `considerMIRV()` method that evaluates
game state and determines optimal MIRV usage
- **Three Strategic Targeting Modes**:
1. **Counter-MIRV**: Retaliatory strikes against players actively
launching MIRVs at the fakehuman
2. **Victory Denial**: Preemptive strikes against players approaching
win conditions
     - Team threshold: n% of total land (configurable)
     - Individual threshold: n% of total land (configurable)
3. **Steamroll Prevention**: Strikes against players with dominant city
counts (n% ahead of next competitor)

#### FakeHuman Behavior Tuning
- **Cooldown System**: n-minute cooldown between MIRV attempts
(configurable)
- **Failure Rate**: ~n% chance of cooldown trigger without launch
(simulates human hesitation/resource management; configurable)
- **Territory Targeting**: Centers MIRV strikes on enemy territory
center-of-mass for maximum impact

#### Technical Improvements
- **Type Safety**: Updated `UnitParamsMap` to include `targetTile`
parameter for MIRV units
- **Execution Flow**: Integrated MIRV consideration into fakehuman tick
cycle outside of standard attack logic, due to its holistic strategic
nature

### Game Balance Impact
- **FakeHuman Threat Level**: Increases late-game fakehuman
competitiveness
- **Endgame Dynamics**: Prevents runaway victories, extends game tension

### Breaking Changes
None - purely additive feature

### Related GitHub Issues:
-  #2205 

------
## Other

- [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

Discord Username: samsammiliah

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Evan <evanpelle@gmail.com>
2025-10-29 16:39:31 -07:00
Lavodan 7fe3b03b83 Fix stretched icons (#2316)
## Description:

Fixes #2257 (well, a part of it)
This PR implements a new async helper function in client Utils.ts (
getSvgAspectRatio), which caches and then retrieves aspect ratios for
Svg files. (I am not married to it being in Utils.ts, I just couldn't
find a better place to put it, and it seemed like something that should
be accessible to many files).
It then implements this helper in RadialMenu.ts to fix incorrect aspect
ratios. It uses the default value for the smaller side, and the computed
value for the larger side.
Before fixing the stretching in EventsDisplay.ts, this PR first
consolidates the hard coded html for toggle buttons into a helper
function (renderToggleButton). Afterwards, it adds width calculation to
this helper function using getSvgAspectRatio.

## Potential flaws

- getSvgAspectRatio might potentially be in the wrong file
- EventsDisplay.ts consolidation may be out of scope, but it seemed
necessary to make clean changes. It also introduces a slight delay
before toggle buttons are loaded once a player enters the match
- If the icon is not cached yet, the RadialMenu implementation shows the
old stretched icon for a split second. In regular gameplay this should
probably not be noticeable,
- For some reason (I guess because of slightly too many characters)
prettier split up exactly one of the renderToggleButton calls which
makes it ugly, but thats what prettier wants lol
- Not sure if I should add any tests? If so feel free to tell me, but I
didn't so far.

## Screenshots

Before
<img width="323" height="416" alt="image"
src="https://github.com/user-attachments/assets/709493c8-c8d6-48c1-9d44-4d6608d7da93"
/>

After
<img width="323" height="390" alt="image"
src="https://github.com/user-attachments/assets/a786c83e-2ef9-47d6-9858-1aeaa4ae548a"
/>


## 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:

Lavodan

---------

Co-authored-by: Evan <evanpelle@gmail.com>
2025-10-29 16:39:16 -07:00
Mike Harris 4ee3cbc255 Features: Team Game Spawn Color Tint (#2303)
## Description:

This PR addresses issue #2302: where there is no obvious information
about the self-player's team during the spawn phase of the game.

Currently, during TEAM games (where there is a set number of teams
defined), the self player's spawn highlight color is white, while all
other players are shown with a team-based spawn highlight color. This
makes it difficult to discern who is a teammate, especially since the
current live version (v0.26.7) uses green/yellow for other players to
depict teammate/other team, respectively.

Technically, the same is true for Duos, Trios, and Quads games, although
this has been addressed separately with PR #2298 by reverting to
green/yellow for teammate/other team players.

This PR changes the color of the self player's breathing spawn highlight
ring to match their assigned team color (with `alpha=0.5` for
transparency). The breathing ring is semi transparent on top of the
existing white static semi-transparent ring, giving the breathing ring a
**tint** of the team color instead of the exact team color.

This allows a player to immediately identify their assigned team and
maintains overall consistency with FFA, Duos, Trios, and Quads game
modes.

See below for example implementation. In this screenshot, the self
player is on the red team as shown by the red tint to the breathing
spawn highlight ring. The screenshot also shows some of the static white
semi-transparent ring around the spawn location. The self player's
teammate is to the top left of the image with a solid red spawn
highlight. The non-player (nation) opponent on the blue team is shown to
the bottom left. In online games, nations are not present in team games.
In single player or private lobby games they are shown as here, without
a spawn color highlight and only a territory color.

<img width="402" height="292" alt="Team Spawn Color Tint"
src="https://github.com/user-attachments/assets/5696a408-a633-4ec8-bf93-c8afa8e2e121"
/>

## 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:

GlacialDrift
2025-10-29 16:39:07 -07:00
evanpelle bb5ccbfa2c reduce statement test coverage to 21% 2025-10-29 16:29:13 -07:00
Ryan Barlow 323a5b59b2 SAM Radius (#2307)
## Description:

Adds a radius to SAM sites - but only when hovering/ghost mode for
sam/atom/hydrogen.

solves #1157 

<img width="395" height="321" alt="image"
src="https://github.com/user-attachments/assets/130c5fe5-c0d3-4637-bce5-11eec74b652a"
/>
<img width="561" height="468" alt="image"
src="https://github.com/user-attachments/assets/9b30149b-8596-4dd4-8399-908593c95e0d"
/>
<img width="844" height="634" alt="image"
src="https://github.com/user-attachments/assets/dafcca96-3f79-4985-88f4-935d461888f0"
/>
<img width="665" height="668" alt="image"
src="https://github.com/user-attachments/assets/924fdf7b-2cb6-4f64-9438-7412838f3d09"
/>
 

## 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:

w.o.n

---------

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Evan <evanpelle@gmail.com>
2025-10-29 22:51:59 +00:00
DevelopingTom b7519ab9b1 Add new nuke preview FX (#2322)
## Description:

New FX played to preview the nuke explosion area (follow up of
https://github.com/openfrontio/OpenFrontIO/pull/2309)
Will prevent over-nuking the same area in team games



![nuke_area](https://github.com/user-attachments/assets/cbff20b0-3650-43ab-9d93-43211856f12e)

Visuals inspired from
https://github.com/openfrontio/OpenFrontIO/pull/1814 (@ryanbarlow97)

## 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: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
2025-10-29 20:02:16 +00:00
VariableVince ecced3c6d0 Fix: remove duplicate setting of _troops from ControlPanel (#2315)
## Description:

PR https://github.com/openfrontio/OpenFrontIO/pull/1676 introduced a
duplicate line of code in ControlPanel. Resulting in _troops being set
twice in a row. Remove one to keep only the oldest one.

## 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-28 17:47:26 -07:00
Vivacious Box 9e694b498b Fill the range indicator with white for better clarity (#2319)
## Description:

Fill the range indicators

<img width="287" height="200" alt="image"
src="https://github.com/user-attachments/assets/2c75cb13-0574-40c9-be48-2f28cf77734e"
/>

## 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
2025-10-28 23:40:01 +00:00
Adarsh Das 0789f0d7f8 Add Nations Vs Players Game Mode (#2233)
## Description:
Fixes: #676 
This PR adds Players Vs Nations as a game mode in the menu.

For this change I have added two mutually exclusive option for this
mode:
1. Match number of nations to number of players who have joined
2. Set the number of nations to a fixed value

### Screenshots:
#### Options in Single player mode
<img width="1025" height="790" alt="image"
src="https://github.com/user-attachments/assets/c0685ea5-94f5-43c7-a9e5-390835fc94e9"
/>
<img width="1005" height="795" alt="image"
src="https://github.com/user-attachments/assets/dddba015-a424-40dd-a0fe-2571fd7b0fba"
/>

#### Options in lobby mode
<img width="1015" height="888" alt="image"
src="https://github.com/user-attachments/assets/45bc865b-c6a8-4b6a-9062-4eb499c1ea36"
/>

#### Example gameplay (1 Human Vs 90 Nations)
<img width="1888" height="912" alt="image"
src="https://github.com/user-attachments/assets/38faec75-171f-4358-a3be-93630cca1587"
/>


## 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:

saphereye

---------

Co-authored-by: Evan <evanpelle@gmail.com>
2025-10-28 16:40:30 -07:00
evanpelle 02bdaaa2c6 Merge branch 'v26' 2025-10-28 14:10:27 -07:00
evanpelle 4f00c4a12c Increase public game ffa frequency to 3:2 ffa:teams v0.26.11 2025-10-28 14:05:07 -07:00
Ryan Barlow 7dd45e8dd4 Bomb target location (same logic as naval invasions) (#2309)
## Description:

Added logic to hydro/atom bombs - using same FX as the boat invasion
(keeping PR smaller, can add more UX for hydro/atoms later)

Only you & teammates can see the target.

<img width="747" height="356" alt="image"
src="https://github.com/user-attachments/assets/bc1aaec0-8b41-4def-92ee-9f076a8cd550"
/>


Viewpoint from two players:
<img width="1667" height="680" alt="image"
src="https://github.com/user-attachments/assets/76e96ad1-af09-4584-a71a-823c85b6e26b"
/>



## 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:

w.o.n
2025-10-28 09:03:33 +00:00
Evan 3fd38e7306 Add clanTag to GameRecord for archiving (#2314)
## Description:

This will be used to determine clan winners in the api layer.

## 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
v0.26.10
2025-10-27 20:05:09 -07:00
Mike Harris b8fab0d359 Expand Clan Name Possibilities (#2178)
## Description:

**This PR expands clan name possibilities available to players.**
**Suggested Label:** Feature
**Suggested Milestone:** v26 or v27

The current clan name logic does not allow for all alphanumeric
characters (e.g. 0-9). Instead it only allows for uppercase and
lowercase letters (e.g. a-z and A-Z). This PR updates the logic to
include 0-9 in the allowable character set. This is in line with how
many other games utilize clan names.

Secondarily, the requirement for the clan name to occur at the start of
the player name has been relaxed. Now, the requirement is that the clan
name is matched with `\[([a-zA-Z0-9]{2,5})\]`. The pre-requisites for
clan regex matching have been updated so that both `[` and `]` must be
*included* in the player name (whereas previously the `[` was required
to appear at the start of the player name). This allows the clan name to
occur anywhere in the player name.

Finally, clan names (once matched by RegEx) are converted to Uppercase
so that clan names such as `[un]`, `[UN]`, `[Un]`, and `[uN]` are all
recognized as the *same* clan.

As a result, all existing clan names remain valid, but new clan names
are now possible. For example `[3M]MeanMrMustard` now has `3M`
recognized as the clan name and `T[UN]able` now has `UN` recognized as
the clan name. Test cases within the `tests/PlayerInfo.tests.ts` file
have been updated accordingly to accurately represent the full
alphanumeric character set.

This addresses issue #2267. 


## 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:

GlacialDrift (GlacialDrift_)
2025-10-27 19:25:46 -07:00
Lavodan cb744b49fc Fix incorrect display of ability to upgrade enemy units (#2308)
## Description:

Fixes #2135.
Adds an owner check to canUpgradeUnit to prevent enemy units from
seemingly being able to be upgraded when Ctrl+clicked on

## 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:

Lavodan
2025-10-27 21:13:05 +00:00
Thomas Cruveilher 4a9a19631e fix(client): do not spam public lobbies requests by waiting for previous request to end before firing a new one (#2276)
## Description:

This PR aims to (quickly, not definitely) address
https://github.com/openfrontio/OpenFrontIO/issues/2274 as I believe
that's an urgent DDOS problem with the frontend design.

I am looking at the backend to understand the underlying issue.

## How was this tested:

I added a 2 seconds "sleep" to the endpoint `public_lobbies` to simulate
loads.

The frontend would do request every seconds, which kept piling up on the
server and decreased performances, cf screenshot, instead of resolving
every 2 seconds, each subsequent request would take longer than the
previous one.
<img width="849" height="263" alt="Screenshot 2025-10-23 at 23 36 37"
src="https://github.com/user-attachments/assets/31ded504-a72e-4794-9c5e-b9b0c675dd33"
/>

After adding the fix to the frontend (which can only trigger 1 request
at a time, waiting for the previous one), all request completed in
approximatively 2 seconds as expected, cf screenshot.

<img width="849" height="263" alt="Screenshot 2025-10-23 at 23 36 54"
src="https://github.com/user-attachments/assets/bc680642-407a-4a55-aeed-6a03bad35327"
/>

 
## 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:

sorikairo

Co-authored-by: Vivacious Box <jon@rouillard.org>
2025-10-27 21:06:12 +00:00
evanpelle 74197d49e4 update API.md to include type parameter in games/ endpoint 2025-10-27 13:22:37 -07:00
evanpelle 48909d5d25 Add API.md to document public api 2025-10-27 12:45:10 -07:00
DevelopingTom df8118e27d Resize structure sprites so they don't leave pixels behind when deleted (#2304)
## Description:

Reduce halloween sprites size so they don't leave pixel behinds when
deleted

## 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-10-26 23:05:30 +01:00
VariableVince 91f1748d70 Perf: remove redundant code from PlayerExecution (#2299)
## Description:

Remove some lines of code that do nothing in surroundedBySamePlayer,
gain a small bit of performance back. The code says "if it is an ocean
shore tile but not an ocean shore tile" which can never be true.


(Why where the lines there and why can they be removed:

Before you were able to boat on a lake, you had no escape from your land
if it bordered a lake and no ocean. So it was logical, if you bordered a
lake with your cluster, to still treat it as fully surrounded annexable
land.

This is why this code was added in [this
commit](https://github.com/openfrontio/OpenFrontIO/commit/ee56d687484131c092599434247b3a036e0e9668)
back then:

`const isOceanShore = this.mg.isOceanShore(tile); if
(this.mg.isShore(tile) && !isOceanShore) { continue; }`

But [this newer
commit](https://github.com/openfrontio/OpenFrontIO/commit/c1383d76f1f76c5e5f9be3a6f30b8f3010258540#diff-fb1101a2b50dd7c353d082ff7a3351cff5469b8249b3ebca91c10573a3dfaaf1)
made it so you could from then on boat on lakes. So you have an escape
from your cluster since then. And just like being on the edge of the map
or when bordering the ocean, this means your cluster won't get annexed.

However, while the updated code for PlayerExecution in the last commit
does its work as intended (it does not exclude lake shore tiles
anymore)... The code contradicts itself:

`const isOceanShore = this.mg.isOceanShore(tile); if
(this.mg.isOceanShore(tile) && !isOceanShore) { continue;}`

Conclusion: the code on lines 136-138 can be deleted because it
literally says "if it is an ocean shore tile but not an ocean shore
tile" which can never be true. Also remove the const and check
isOceanShore directly in the if statement.)

## 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-26 21:48:54 +00:00