mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-24 02:33:35 +00:00
85def73bd951f8cd0023a7c70281fd22bcd0669e
523 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
35b7213c5c |
Enhance nuke alliance breaking logic to account for allied structures in blast radius 💣 (#2887)
## Description: Doesn't need a description :D https://github.com/user-attachments/assets/8de576fd-050b-4b35-8526-e4c88d1a9f25 https://github.com/user-attachments/assets/c99147a1-efdf-426b-96d1-e996e01f89aa ## 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 |
||
|
|
0e3ced3bfa |
Pathfinding Refactor pt. 2 (#2866)
## Playtest https://pf-pt-2.openfront.dev/ ## Pathfinding Refactor pt. 2 <img width="1536" height="1024" alt="image" src="https://github.com/user-attachments/assets/9477958e-54b7-4c83-b317-ba789e809e9e" /> This is a follow-up to a previous PR introducing pathfinding changes. This time, it introduces a complete refactor of `pathfinding` directory and breakdown into composable pieces. ### Unified PathFinder interface `PathFinder<T>` and `SteppingPathFinder<T>` are introduced to unify **all** pathfinding across the application. First one exposes complete path, while stepping variant allows the callee to iterate over the path by calling `.next`. All pathfinders share this one common interface, which makes them easy to use in any scenario - `PathFinding.Water(game).search(from, to)`. `SteppingPathFinder<T>` extends `PathFinder<T>` with an ability to iterate over the path. It handles caching, storing current index and invalidation. This allows the units to not care about the inner workings of the pathfinder and just call `pf.next(current, target)` and receive instructions on what to do next. ### Common entry point All pathfinders are now exposed from common `PathFinding` entrypoint: - `PathFinding.Water` - `PathFinding.Rail` - `PathFinding.Stations` - `PathFinding.Rail` Additional entry point is introduced for pathfinders which need to work both in the worker, but also on the frontend, which lacks `Game` interface. Currently only `UniversalPathFinding.Parabola` is available. ### Spatial Query New module has been introduced close to `pathfinding` - `SpatialQuery`. It aims to resolve any questions game may have about finding tiles meeting criteria. Currently `SpatialQuery.closestShore(player, target)` and `SpatialQuery.closestShoreByWater(player, target)` are available - they help answering questions about naval invasion: "What is the best landing location from user's click?" and "Which our tile should be used to launch the transport ship?". Under the hood they use very similar mechanics to pathfinding, so it felt right to put them close by. ### Modular architecture Pathfinders now support transformers: `MiniMapTransformer`, `ShoreCoercingTransformer`, `ComponentCheckTransformer`, `SmoothingTransformer`. Transformers functions like a middleware in the pathfinding chain. They wrap around the pathfinder and provide additional functionality. This allows the pathfinder to focus on actually finding the path instead of doing unrelated things. Example chain for simple (A*) water pathfinding: ```ts static WaterSimple(game: Game): SteppingPathFinder<TileRef> { const miniMap = game.miniMap(); const pf = new AStarWater(miniMap); return PathFinderBuilder.create(pf) .wrap((pf) => new ShoreCoercingTransformer(pf, miniMap)) .wrap((pf) => new MiniMapTransformer(pf, game.map(), miniMap)) .buildWithStepper(tileStepperConfig(game)); } ``` The Pathfinder - here `AStarWater` - does not care about the conversion between minimap and main map tiles. It also does not care if the source or destination is a land tile. The transformers take care of that. The pathfinder gets a set of valid coordinates and produces the path - that's it. Modular approach makes working on a particular set of utilities much easier - for example map upscaling is handled consistently across all pathfinders. Additionally, the pathfinders are not tied to the particular map resolution used. Pass them a different map and they will work the same. ### Algorithms Algorithms used are neatly organized inside `src/core/pathfinding/algorithms`. They are prefixed with the algorithm name and suffixed with the use case. File without suffix exposes generic version ready to traverse any graph with adapters. Specialized versions either use an adapter or inline logic when performance is critical - using adapters leads to 20-30% performance loss. The directory includes `A*` and `BFS` but also other useful utils, such as `AbstractGraph` used to generate... an abstract graph on top of the tile map and `ConnectedComponents` helping to identify whether two tiles are connected by a path without actually computing the path. ### Playground The playground have been updated with new algorithms, including tweaked very greedy `A*`. <img width="2175" height="1424" alt="image" src="https://github.com/user-attachments/assets/1f833651-0024-4299-bf86-882f5368358c" /> ### Tests Yeah, there are some, a little too many if I say so myself. But there are no useless tests. I had to ensure refactored code works somehow reliably. This PR comes with trust me bro guarantee, but I would appreciate someone confirming **naval invasions, nukes (esp. MIRV) and warships**. ### Discord `moleole` GL & HF |
||
|
|
8235da9335 |
Translate displayMessage events via events_display keys (#2847)
If this PR fixes an issue, link it below. If not, delete these two lines. Resolves #1225 ## Description: Replace all raw displayMessage strings with events_display.* keys + params and add the new English translations in resources/ lang/en.json so EventsDisplay can translate them. ## 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: Ryan <7389646+ryanbarlow97@users.noreply.github.com> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> |
||
|
|
e130574c5c |
Very small UI fix 🔧 (#2862)
## Description: Didier map name had a little UI problem. And unrelated change: Because Lewis today said "it should be super low" I turned down the frequency of this map from 2 to 1. Previous: <img width="1916" height="1312" alt="image2" src="https://github.com/user-attachments/assets/0a84160b-91a8-4d02-b707-fa9eea1a15fd" /> Fixed: <img width="562" height="476" alt="image" src="https://github.com/user-attachments/assets/31fed7b5-c128-45cd-a63d-0aab3345cea3" /> ## 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 |
||
|
|
dc118708c0 |
Second Didier Map for Fuze 🧸 (#2846)
## Description: Discussed that with Lewis. Fuze liked the Didier map without the real france more... So here it is. It won't get added to the playlist, the france version stays in the playlist. (Unrelated: Also quickly changed "Europe (classic)" to Europe (Classic)" to match with "Britannia (Classic)") <img width="934" height="839" alt="Screenshot 2026-01-10 005646" src="https://github.com/user-attachments/assets/64925635-c15a-4167-a5bc-5cf7b3b140f8" /> <img width="1064" height="961" alt="Screenshot 2026-01-10 003335" src="https://github.com/user-attachments/assets/9b6aa936-2c33-4a24-8076-a74a4704adc4" /> <img width="635" height="427" alt="Screenshot 2026-01-10 003316" src="https://github.com/user-attachments/assets/e2b46db8-ef0b-4b45-8ea7-711b9b8f7524" /> ## 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 |
||
|
|
8b6dfeaf4a |
Feat: Sierpinski map - live play-tested (#2819)
## Description: Map requested by creator on [dev discord](https://discord.com/channels/1359946986937258015/1458638914012315741/1458638914012315741) and playtested by 42 players on [Rex's stream](https://www.youtube.com/watch?v=r9w9nr5Toso), adds map Sierpinski, which is a sierpinski carpet shape. The map is a "party map" great for private matches, but is not part of the public map rotation. <img width="1400" height="1400" alt="image" src="https://github.com/user-attachments/assets/8eead359-73d5-497f-8fee-40f413a22d0e" /> https://github.com/user-attachments/assets/3a726343-18e4-4f91-9f5c-1fff459d5a5f ## 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: bijx --------- Co-authored-by: iamlewis <lewismmmm@gmail.com> |
||
|
|
eaef00e05c |
Some little HumansVsNations improvements before public games launch 🤖 (#2825)
## Description:
- Added `generateUniqueNationName()` to `NationCreation` because I saw a
duplicate name while spawning 300 nations on Pangaea 😄
- Switched HumansVsNations public game difficulty from hard to
impossible because I realized how crazy strong troop donations between
humans are (in an enzo HVN stream).
Maybe I have to make nations donate troops to each other, we will see...
Playtests won't tell the truth because the players attending these are
probably better than the usual OF player. I will try to check the HVN
winrate via API after launch
## 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
|
||
|
|
971e7f4a45 |
Move UI elements from the FX layer to a new UI layer (#2827)
## Description: Some FX animations were previously used as UI elements (e.g. nuke area, naval invasion target, gold text). This PR moves those animations to a dedicated UI layer. Those UI elements handle correctly the current zoom level and remain sharply rendered at all zoom levels. The new UI layer can be disabled using the same setting that disables the FX layer. Performance-wise, this layer is equivalent to the FX layer, as it reuses the same animations. ### Naval target Don't scale with the zoom level, but has a minimum zoom level so the targeted tile can still be easily highlighted by zooming  ### Nukes Has to scale because the size is set, but the border radius is not so the area is more visible from afar.  ### Popup text Scale with zoom level, and stop showing when zoomed-out:  ## 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 |
||
|
|
2dada6f516 |
Handle Nation win condition (#2824)
Resolves #2823 ## Description: When playing in single-player mode, if an NPC reaches 80% land control before the player, the game enters a broken state where: - The game clock stops - Win checking stops permanently - Even if the player later conquers 100% of land, victory is never awarded - The game becomes "stuck" in a zombie state. This PR addresses this allowing Nations to be set as winners in single mode, and in this case showing a "Nation {nation} has won" modal to the user. This WinModal is the same as the "{player} has won", with the only change being the title. Nation wins in FFA, from the human player perspective: <img width="1457" height="837" alt="image" src="https://github.com/user-attachments/assets/1ce569bd-6616-4a23-b4a4-afedad2c64f8" /> ## 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: deshack_82603 |
||
|
|
b090f2f624 |
HPA* Pathfinding (#2815)
## Pathfinding with HPA*
Hi! The primary objective of this PR is to replace per-tile A* with
hierarchical pathfinding - HPA*. In practice, this means we create an
abstract graph on top of the actual map with far fewer points and use it
to decide on general path structure. Only then we go back to tile-level
and build path between selected waypoints. This speeds up long distance
pathfinding by over 1000x in some cases. To make the review easier, it
comes with a benchmark and visual playground.
## PREPROCESSING
H part of HPA* means "hierarchical" and requires preprocessing.
This PR includes pre-processing as part inside `new Game()` constructor.
It takes about 135ms for `giantworldmap` on my machine, which increases
the effective initialization from ~95ms to ~230ms. This time could be
reduced in different ways, which are **out of scope** for this PR.
After confirming the initialization time is bearable on low-end devices,
I argue merging this PR as-is is acceptable tradeoff. It creates small
lag at the beginning of a round but pays for itself in the first minute
of the match.
## Nerdy details
**Architecture**
- HPA*-style hierarchical pathfinding
- 32×32 sectors on minimap with gateway nodes on borders
- Gateway graph built via BFS during preprocessing
- Water component optimization skips unreachable gateway pairs
- A* on gateway graph → local A* within sectors → Bresenham path
smoothing
- Minimap upscaling identical to currently used in MiniAStar
**Key Optimizations**
- Typed arrays instead of high-level primitives
- Stamp-based visited tracking (no need to recreate buffers, O(1)
clearing)
- Optional - enabled by default - caching of tile paths between gateways
- Line of sight smoothing for the final path
## Review Focus
Play with included tools, benchmark and visualization. Pathfinding
should be safe to merge as a black box - you do not need to understand
the details. Outcomes can be tested empirically in-game. Visualize (and
share!) edge cases with included playground. Confirm the 100x speedup is
real with benchmark.
If you plan to dive into the code, I suggest the following order:
- Pathfinding abstraction in `src/core/pathfinding/`
- Pathfinding tests in `tests/core/pathfinding/`
- NavMesh in `src/core/pathfinding/navmesh/` + integration with
`Game.ts`
- Benchmark in `tests/pathfinding/benchmark/`
Do not look at playground's code, it has been created with a clanker.
The design is 100% mine and I spent way too long polishing it, but I
haven't even once edited the code manually. There is probably no
abstraction whatsoever, just do not look at the code, let it play.
## Core Changes
#### Pathfinding (`src/core/pathfinding/navmesh/`)
- HPA* + refinement -> three phased pathfinding: A* over the graph ->
naive path -> refinement
- comes with A* and BFS optimized for for specific needs
#### Pre-Processing (`src/core/pathfinding/navmesh/`)
- identify water bodies to avoid pathfinding between disconnected nodes
- create high-level graph of gateways on top of tile map
#### Abstraction (`src/core/pathfinding/`)
- common `PathFinder` interface that can return full path and also act
as state machine (`.next()`)
- adapters for both new and legacy algorithm with fallback to legacy if
navigation mesh not available
#### Benchmark (`tests/pathfinding/benchmark/`)
- `npx tsx tests/pathfinding/benchmark/run.ts` - no guesswork, numbers
- `npx tsx tests/pathfinding/benchmark/run.ts --synthetic` - 1000s of
synthetic paths
- `npx tsc tests/pathfinding/benchmark/generate.ts` - generate more as
needed, test new maps
- includes ONE synthetic scenario to avoid PR bloat, generate more
locally / later
#### Playground (`tests/pathfinding/playground/`)
- `npx tsx tests/pathfinding/playground/server.ts` - visualize paths
with both new and legacy algorithm
## Benchmarks
### Compared with legacy in default - hand picked - scenario:
```
Initialization: 95.95ms -> 227.29ms
Pathfinding: 3038.43ms -> 6.45ms
Distance: 26972 -> 26810 tiles
```
### 42,000 synthetic routes across all maps
```
Running 42 synthetic scenarios with hpa.cached adapter...
✅ synthetic/achiran | Init: 93.42ms | Path: 139.07ms | Dist: 1481630 tiles | Routes: 1000/1000
✅ synthetic/africa | Init: 87.14ms | Path: 155.08ms | Dist: 1829414 tiles | Routes: 1000/1000
✅ synthetic/asia | Init: 57.60ms | Path: 112.55ms | Dist:
|
||
|
|
516d268c88 |
Restructured PR for Britannia Remastered Addition (#2813)
## Description: Adds a new detailed Britannia map featuring modern UK, Ireland, and northern France regions. The previous Britannia map has been preserved as "Britannia Classic". <img width="4096" height="5031" alt="United Kingdom" src="https://github.com/user-attachments/assets/8a6ca3ab-bc91-438f-8ca7-7fdf7c5260b8" /> <img width="4096" height="5031" alt="United Kingdom_debug" src="https://github.com/user-attachments/assets/a9a7bcd2-1dc5-40c6-a547-a7a79e636060" /> Changes Added new Britannia map with modern county/region divisions Renamed existing Britannia map to "Britannia Classic" Added map-generator source assets for both maps Updated GameMapType enum with BritanniaClassic Configured player counts: 50/30/20 for both maps Added playlist frequencies: Britannia (5), Britannia Classic (4) Updated language translations New Britannia Nations (partial list) Ireland: Mayo, Kerry, Clare, Meath, and more Scotland: Highland, Argyll and Bute, and more England: North Yorkshire, and more France: Pas-de-Calais Britannia Classic The original Britannia map with historical kingdoms (Dumnonia, Dyfed, Gwent, Gwynedd, Powys, Strathclyde, Dalriata, Wessex, Sussex, Kent, etc.) is now available as "Britannia Classic". ## 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: TSProphet --------- Co-authored-by: Harry <Harry.bath94@gmail.com> Co-authored-by: iamlewis <lewismmmm@gmail.com> |
||
|
|
ebcb654825 |
Added a public game modifier system 😮 For more variety (#2801)
## Description: Added a public game modifier system. It causes that 5% of public games are played on the compact version of the map 10% of public games have "Random Spawn" activated Percentages can easily get changed via `DefaultConfig`. We can also easily add more modifiers. Modifiers can stack, so in rare cases you will play on a compact map with random spawn 😄 More variety! ### "Compact Map" modifier implementation - With the "Compact Map" modifier the lobby max player count gets reduced to 25% and only 25% of the regular bots and only 25% of the regular nations will spawn (because the map has only 25% of its regular size) - In private lobbies and singleplayer the nation reduction happens too (When "Compact Map" is enabled). ### Restrictions - Duos/Trios/Quads team modes do not get Random Spawn (defeats the purpose) - Maps with smallest player count < 50 do not get Compact Map in team games (not enough players after the reduction to 25%). I have calculated all the possible max player counts. ### How it looks like Random Spawn modifier: <img width="528" height="183" alt="Screenshot 2026-01-06 194959" src="https://github.com/user-attachments/assets/2f729da9-80c3-4548-8205-71129da2a76a" /> Very rare case: Two modifiers at the same time and only 10 max players have been chosen from `[GameMapType.FaroeIslands]: [20, 15, 10]`. Because of the 75% reduction in player count only 3 players are allowed (3 is the minimum). I think its funny that you can play a 1v1v1 in rare occasions 😄 <img width="526" height="184" alt="Screenshot 2026-01-06 194938" src="https://github.com/user-attachments/assets/834326eb-df03-41b7-b1db-1efa3f1013b5" /> ### Funny side-effect Team games with random spawn. That will be interesting. No more "Who is better in donating troops to the frontline". Instead you have to heavily coordinate with your teammates. ## 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 |
||
|
|
387190b916 |
New map! "Amazon River" 🏞️ (#2798)
## Description: We didn't have a river map and we didn't have a map with a crazy size. So I made a "Amazon River" map with a crazy size. 280 x 5536! 21 nations based on real locations. Should be interesting gameplay because you don't have many attack options, your only escape is the river. The land tiles size is similar to the achiran and iceland map. <img width="2442" height="147" alt="Screenshot 2026-01-06 150831" src="https://github.com/user-attachments/assets/91c4142d-c1e3-4aee-ac49-529b8d9f60c4" /> <img width="2324" height="139" alt="Screenshot 2026-01-06 150957" src="https://github.com/user-attachments/assets/5e049ae5-f32a-495f-afde-9e20257b3676" /> Because the map is so wide, it looked really ugly stretched in the thumbnails. So I added some CSS which removes the thumbnail stretching of the Amazon River map. We can also use this logic for other thumbnails which shouldn't get stretched. In `Maps.ts`, `PublicLobby.ts` and `GameInfoModal.ts`. ## 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 |
||
|
|
ecc174d248 |
New map! "Didier" 🧸 (#2794)
## Description: Didier map for the big french youtuber Fuze which already published several OpenFront videos. I took the real france, cut away the bordering countries and made it look like Didier 😄 Gave it eyes, hands and feet. Made sure we have some rivers, also put Corsica in the right bottom corner! It's quite large. Similar to the europe map. Has 42 nations (38 french cities and 4 funny custom nations for the youtuber). Made with [TsProphets map generator](https://github.com/TsProphet94/OpenFrontMapGenerator), QGIS and GIMP. For public games I put a rare map frequenzy of 2 because most people probably don't know Fuze. @ibnhalwa from discord gave some insider knowledge about Fuze (He's french, I'm not). <img width="2100" height="2250" alt="image" src="https://github.com/user-attachments/assets/5d1c3c45-4b2e-4f60-a02f-89b26f938652" /> <img width="1278" height="1218" alt="Screenshot 2026-01-05 184540" src="https://github.com/user-attachments/assets/6e300bb0-6e9f-4b0f-bad8-94f031d250b1" />  ## 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 |
||
|
|
af0b8a8d50 |
Configurable immunity timer (#2763)
## Description: Resolve discussions about stalled PR https://github.com/openfrontio/OpenFrontIO/pull/2460 <img width="724" height="348" alt="image" src="https://github.com/user-attachments/assets/c2c9fa79-cace-431a-9ca4-b3656612fa9d" /> Changes: - Added a `Player::canAttackPlayer(other)` function to determine whether a player can be attacked. - This function is now used in most places where a fight can occur: - AttackExecution (land attacks) - Naval invasion - Warship fight - Nukes can't be thrown during the truce - Immunity only affect human players. Nations and bot will fight as usual, and can be fought against. - The immunity timer uses minutes in the modal window. UI: - The immunity phase is displayed with a timer bar at the top. This is from the original PR, to be discussed if it's not deemed visible enough: <img width="632" height="215" alt="image" src="https://github.com/user-attachments/assets/f5ab9aa0-bd4f-4503-b8d6-b40b121fba65" /> ## 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: newyearnewphil <git@nynp.dev> |
||
|
|
ab5b044362 |
Fix train was destroyed message spam (#2774)
## Description: Trains are made of a primary unit (`TrainExecution.train`) followed by 6 cars (`TrainExecution.cars`). Currently when any of the units is destroyed, a message "Your Train was destroyed" is shown. In worst case scenario, when all cars are blasted by a nuke, 7 messages are displayed to the user, but the train continues. Since the actual logic is unaffected as long as the primary unit stays alive, displaying messages is confusing. This PR fixes it. The message is only displayed when the primary unit is destroyed. The following cars are only there for fancy visuals. ## Screencast ##### Current - multiple messages for single train https://github.com/user-attachments/assets/3df04c71-d899-4f68-af83-36c9d0ffa730 First nuke was a test. Second nuke destroyed the entire train, prompting 7 messages. Third nuke destroyed one full train and then some. Prompting many too many messages. ##### Fixed - one message, only if train was fully destroyed https://github.com/user-attachments/assets/1f3840a7-6c62-487d-af3a-82de39dad9e8 First train was only partially destroyed, no message was shown, delivery mission completed A+. Following 2 trains had the front engine destroyed and therefore were promptly decommissioned. ## Please complete the following: - [x] 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 - [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: moleole |
||
|
|
1eee8b4ddb |
New Map! "Surrounded" 🏝️ (#2770)
## Description: A new map where you basically have to hop from island to island :) We don't have such a map at the moment. There is a special center island which isn't necessary to get 80% of the map. This map could be very interesting in team games. One hydro will destroy an entire island. Size: 1976 x 1976 Nations: 8 <img width="949" height="951" alt="Screenshot 2026-01-02 214219" src="https://github.com/user-attachments/assets/7139bcc9-6a05-414d-90c1-33cc36dd94fb" /> ## 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 |
||
|
|
23e4bf6725 |
☢️ Nations send much better nukes now (Part 1) ☢️ (#2756)
This is a very important PR for HumansVsNations (But also for
singleplayer).
Humans will throw lots of nukes onto nations, but nations didn't do
that. Until now :)
## Refactor
- Moved all the nuking logic to the new file `NationNukeBehavior.ts`
- Moved `randTerritoryTileArray()` and `randTerritoryTile()` to the new
file `NationUtils.ts` because we need that method in multiple places now
- Because we already have an `NationUtils.ts` (It contains the method
`createNationsForGame` for HumansVsNations) I renamed the old one to
`NationCreation.ts` to avoid confusion
## Bug fixed
- `allRelationsSorted()` in `PlayerImpl` returned dead players all the
time... Which caused nations to not attack / send nukes in some cases...
## Nuke-sending features / improvements
- On hard and impossible difficulty, nations no longer make sure that
nukes will only hit inside of their targets border. This logic very
often stopped nations from throwing nukes. Now their nukes are allowed
to hit TerraNullius (=> ocean!). And in team games, it's even allowed
that their nukes hit other non-friendly players as well! This is very
important for HumansVsNations.
- The basic check for SAMs now gets skipped if we are on easy difficulty
(easy nations are not smart enough to do that)
- I improved the basic check for SAMs (medium difficulty) a bit (nations
send less nukes into SAMs)
- On hard and impossible difficulty, we now use the new method
`isTrajectoryInterceptableBySam()` to avoid SAMs completely. It's
mirroring `NukeTrajectoryPreviewLayer.ts` logic a bit.
- I added "perceived cost" to simulate nations saving up for a MIRV
(Otherwise most hard/impossible nations will spend all their gold on
nukes). But if we are in a team game (MIRVs are not relevant) or if we
already saved up for a MIRV, the "perceived cost" gets ignored.
- Updated the "most hated player" selection in `findBestNukeTarget()` to
ignore very weak players. We don't need to throw nukes at players which
we can easily steamroll by land.
- Added `findFFACrownTarget()` to nuke the crown (based on difficulty).
- Added `findStrongestTeamTarget()` to nuke the strongest team.
- Updated `randTerritoryTile()` so that it has a higher chance of
returning the tiles of a
"leftover-nuked-to-death-player-with-some-tiles-left": `if
(p.numTilesOwned() <= 100) {return
random.randElement(Array.from(p.tiles()));}`.
- Changed `const range = nukeType === UnitType.HydrogenBomb ? 60 : 15`
to `config().nukeMagnitudes(nukeType).inner`. Should make more sense.
- Adjusted `nukeTileScore()` to search for units in
`this.mg.config().nukeMagnitudes(nukeType).inner` instead of fixed 25
- Adjusted `nukeTileScore()` to account for unit levels (levels got
ignored previously). Also increased score for ports from 10_000 to
15_000.
- I made sure that nations can nuke EVERY SINGLE TILE from an enemy,
even if the enemy has no structures ("Prefer tiles that are closer to a
silo" can no longer make the `nukeTileScore()` drop too much,
`bestValue` in `maybeSendNuke()` starts at -1 now)
- In the entire nuking logic, factories were missing. Now they are
added.
## Media
Nation team vs. nation team: They are nuking the very last pixels of
red, just like humans would do it 😀
<img width="915" height="683" alt="image"
src="https://github.com/user-attachments/assets/109c7921-b959-4aa9-a971-0d7742971686"
/>
Hard difficulty FFA game: Nations throwing much more nukes. And they are
nuking the crown.
https://github.com/user-attachments/assets/a6e43924-a6ca-4b1a-a578-4e4f8252e383
Lots of nukes flying:
https://github.com/user-attachments/assets/8fc4edad-a6e6-4476-8a86-08cdef58169e
## 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
---------
Co-authored-by: iamlewis <lewismmmm@gmail.com>
|
||
|
|
9d5f167446 |
Feat: Strait of Hormuz map (#2747)
## Description: Introduces the Strait of Hormuz section in the Persian Gulf as a map! This map is actually crazy fun to play on because of how the water narrows to a small strait where control is necessary otherwise enemies can transport boat to you easily. I figured a strategic map based on modern-ish day conflicts would fit the theme, but man it's a great map to play on. ### Full Map <img width="2739" height="1822" alt="image" src="https://github.com/user-attachments/assets/f35bdefa-723a-4bb2-9dc9-fb42898528ce" /> ### In game with nations <img width="2218" height="1502" alt="image" src="https://github.com/user-attachments/assets/00e350cf-8654-4638-8654-178accdf6a48" /> ## 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: bijx |
||
|
|
11b2591fa6 |
Add Two Lakes (#2743)
## Description: This PR adds the Two Lakes map, based on the irl area around lake Ohrid and lake Prespa Describe the PR. ## 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 |
||
|
|
26f5d40819 |
build: migrate build system to Vite and test runner to Vitest & Remove depracated husky usage (#2703)
- Replace Webpack with Vite for faster client bundling and HMR. - Migrate tests from Jest to Vitest and update configuration. - Update Web Worker instantiation to standard ESM syntax. - Implement Env utility in `src/core` for safe, hybrid environment variable access (Vite vs Node). - Refactor configuration loaders to remove direct `process.env` dependencies in shared code. - Update TypeScript environment definitions and project scripts for the new toolchain. - Remove the [depracated usage of the husky](https://github.com/typicode/husky/releases/tag/v9.0.1). ## Description: migrate build system to Vite and test runner to Vitest & Remove depracated husky usage ## 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 - [ ] 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: wraith4081 --------- Co-authored-by: evanpelle <evanpelle@gmail.com> |
||
|
|
f6412a5979 |
Re-Enable HumansVsNations 🎉 (#2689)
## Description: **HumansVsNations is back!** The original PR had an issue: only the nations listed in the map’s `manifest.json` were being spawned, which resulted in completely unbalanced games. What did I change with this PR? - The number of humans and nations is now always the same. - If a map contains too many nations, we take a random subset. - If a map doesn’t contain enough nations, we dynamically add additional ones. These get random spawn locations, and their names are taken from the new name generator `NationNames.ts`. The name generator was taken from the closed PR #2245 (idea from @VariableVince). These changes apply to private lobbies and singleplayer as well. In singleplayer, you now simply play a 1-vs-1 against a nation. For public lobbies, we use 50% of the regular team-game player count. The remaining 50% are nations. We are also using the Hard difficulty for HumansVsNations. At the moment, it’s important that nations cheat a little because humans can donate troops, whereas nations cannot, at least not yet. In the future, we may make that work. We might need to adjust the difficulty or do fine-tuning depending on the humans’ win rate in production. Ideally, we want a ~50% win rate; otherwise, the mode may become boring. Over time, humans will likely develop strategies that nations can’t counter, in which case we’ll need to improve the nation AI. Here is a screenshot showing that the number of nations now matches the number of humans in the private lobby UI: <img width="806" height="304" alt="Screenshot 2025-12-25 004023" src="https://github.com/user-attachments/assets/cb4ac6f6-13cc-452c-8cc5-7a500670d7f2" /> The `PuplicLobby` display was a bit bugged for HumansVsNations: <img width="532" height="191" alt="Screenshot 2025-12-23 221832" src="https://github.com/user-attachments/assets/3950bcd9-0072-4c28-b1a0-83c0a24e9b8e" /> So I fixed it to look like this; <img width="532" height="195" alt="Screenshot 2025-12-23 224127" src="https://github.com/user-attachments/assets/690fc554-b607-4c8a-8b22-0c2912ee671a" /> ## 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 --------- Co-authored-by: iamlewis <lewismmmm@gmail.com> |
||
|
|
5a065d71c5 |
Fix alliance renewal popup not being removed when alliance is broken (#2722)
Resolves #2464 ## Description This PR fixes a bug where the alliance renewal popup remained visible after an alliance was broken or betrayed. The issue occurred because renewal UI events were tied to player identifiers instead of the unique allianceId. When a player had multiple alliances, breaking one alliance did not correctly remove the associated renewal popup. This change ensures that renewal popups are correctly removed only for the specific alliance that was broken. ### What was wrong Alliance renewal UI events were previously associated implicitly with players. This caused incorrect behavior when a player had **multiple alliances**, because **players are not unique identifiers of an alliance**. As a result, breaking one alliance could leave stale renewal popups visible. ### What was changed - Alliance break logic now relies on **allianceId**, not player IDs - Renewal popups are removed **only for the specific broken alliance** - Alliances involving the same player but different allianceIds are unaffected - Added tests to ensure this bug cannot reappear ### Result - Renewal popup disappears immediately when an alliance is betrayed/broken - No unintended removal of other alliance renewal popups - Correct behavior even when a player is involved in multiple alliances ## 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: assessin. |
||
|
|
5d52f73278 |
The clown is gone! 🤡 Nations send much better emojis now (#2696)
## Description: Previously, nations just spammed these two rather toxic emojis: 🤡😡 They now send fewer emojis while attacking, and the clown emoji is reserved for special cases. They got the ability to send emojis in much more cases: - Human didn't donate enough for relation update - Human did donate an ok amount - Human did donate a lot - Responding to emojis that they get sent from a human - Nuke sent - MIRV sent - Retaliation warship sent - Traitor tries to ally - Threat asks for / accepts an alliance request - Disliked human tries to ally - Friendly human tries to ally - They are getting attacked by very much troops - They are getting attacked by very little troops - Congratulating the winner - Bragging with their crown - Charming their allies - Clown-Emoting traitors - Easteregg: Sending a rat emoji to very small humans ## 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 --------- Co-authored-by: iamlewis <lewismmmm@gmail.com> |
||
|
|
664d66613b |
fix: Check alliance breakage once at launch, and is deterministic now (#2554)
## Description: Removes the check to break alliance after nuke is launched, and alliance breaking is now determined before tiles are randomly chosen for destruction. (It is now slightly stricter, I believe, as a weighted average calculation is a little tricky) ## 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: bibizu |
||
|
|
677a17d05a |
Feat: Lemnos Map (#2683)
## Description: Introduces the Greek island, Lemnos, as a map. The island is both fun and challenging to play (because of the terrain and elevation) and this addition was inspired by Altis from the game [Arma 3](https://armedassault.fandom.com/wiki/Altis). The nation names are set based on the real landmarks, towns, and regions. <img width="2190" height="1791" alt="image" src="https://github.com/user-attachments/assets/a7a6de54-f376-43ac-87da-f20aecfebbe0" /> <img width="1994" height="1608" alt="image" src="https://github.com/user-attachments/assets/bc280780-298f-4342-8313-db6cc27ac188" /> ## 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: bijx |
||
|
|
1c52d20e83 |
Added pause functionality for private multiplayer games (#2657)
If this PR fixes an issue, link it below. If not, delete these two lines. Resolves #2491 ## Description: Adds pause/unpause functionality for private multiplayer games. Only the lobby creator can pause the game, and all players see a pause overlay when the game is paused. **Key features:** - Lobby creator sees pause/play button in control panel (alongside existing singleplayer/replay controls) - Server validates that only lobby creator can toggle pause - All players see "Game paused by Lobby Creator" overlay when paused - Game state freezes (no turn execution) while paused - Unpause resumes normal gameplay **Implementation details:** - Server-side pause state (`isPaused`) prevents turn execution during pause - Each client receives `isLobbyCreator` flag in `GameStartInfo` to show/hide pause button - Added `TogglePauseIntent` that broadcasts to all clients via `NoOpExecution` - New `PauseOverlay` component (shows in single player also) ## 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: furo18 <img width="1459" height="861" alt="Screenshot 2025-12-20 at 15 16 33" src="https://github.com/user-attachments/assets/f5a3222f-f54b-473c-b0f6-104ce4c1e7a8" /> |
||
|
|
0e3200d647 |
Tint territory borders based on player relationships. (#2439)
## Description: Add visual indicators to territory borders that reflect diplomatic relationships between players, making it easier to identify relations at a glance. ### Problem Statement Currently, players must check diplomatic status through other UI elements. There's no immediate visual feedback on the map showing which borders represent embargo or friendly relationships. ### Benefits 1. **Improved Gameplay Clarity**: Quickly identify diplomatic relationships without opening menus 2. **Strategic Awareness**: Visual feedback helps make tactical decisions about border defense ### Proposed Solution Tint territory borders based on neighbor relationships: embargo red, friendly green ### Implementation Details - Border variants are based on this._borderColor (theme/style handling unchanged) computed in the constructor and stored in userSettings UnitView - Apply tinting to checkerboard for defended borders - borderColor() checks all neighbors to determine the worst relationship status - Embargos take priority. <img width="1193" height="601" alt="image" src="https://github.com/user-attachments/assets/cb516402-4f4b-473c-a31b-02397fee9203" /> <img width="959" height="682" alt="image" src="https://github.com/user-attachments/assets/de01a4b9-0fd4-44b2-895d-96705b6cf30b" /> ## 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 |
||
|
|
9ab1319126 |
Map Generator Go Code Documentation (#2656)
Resolves #2602 ## Description: tldr: `npm run docs:map-generator` Adds documentation to the `map-generator` go code. This has no functional changes, other than the renaming of the package. I used the github url, though this can be set to anything as long as it contains a `.` so that the docs parse it correctly. Go doc best practices seem a little verbose and terse, but attempted to comply Future Facing (to get these docs viewable without running locally): - Wait until the -http issue is sorted, then these are easy to statically host alongside builds - Could use the legacy `godoc` - Could do formatting after outputting the `txt` output ## Change List: - Add documentation to all types/fns in map-generator go code - Ensure this outputs correctly with `go doc` - Add `docs:map-generator` command to package.json. This runs `go doc` in `map-generator` w/ appropriate flags to generate full documentation. (see notes in readme) - rename `map-generator` module to work around pkgsite assuming all packages without a . are stdlib (this makes `-http` work at all) - Add new sections to README and update existing sections - Add additional references to locations in the primary code base where things can be found - Update documentation in the ts theme files to add output color mappings - this ensures that everything needed to trace the input file -> in game rendered asset is fully documented. ## 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: tidwell |
||
|
|
6112547273 |
Improve random spawn (#2503)
## Description: This is a previously approved PR with an additional commit that fixes case when nations change spawn & jump around, their previous territory wasn't getting 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: nikolaj_mykola --------- Co-authored-by: Evan <evanpelle@gmail.com> |
||
|
|
4ee3319397 |
Feat: Added cursor price option to user and basic settings (#2655)
## Description: Following the hotkey cursor price textbox addition of #2650, this feature adds the option to enable and disable the visual feature via the User Settings menu or the Basic Settings modal in game. Also added a [new icon](https://thenounproject.com/icon/pay-per-click-2586454/) for the Basic Settings modal from the Noun Project and added credit for it to the `CREDITS.md` file. ### Video Demo https://github.com/user-attachments/assets/1667081e-45e3-4b11-9bda-3f00c341e03c ### User Settings Menu <img width="1029" height="1436" alt="image" src="https://github.com/user-attachments/assets/e4e6bf6d-db59-463a-81fb-f622ef6e3931" /> ### Basic Settings Menu <img width="964" height="1545" alt="image" src="https://github.com/user-attachments/assets/6b083655-b96e-4937-95d6-f3458858f03d" /> ## 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: bijx |
||
|
|
e554ffb1b0 |
Cleanup nations (Part 3) 🧹 Remove nation strength (#2649)
## Description: This PR removes the nation strength. Reasoning: - It is currently unused. The backstory can be found in #2498 - It forces map-makers to do balancing work, which is probably not a good idea - It increases map-making work - It increases nation balancing complexity by a lot (we need to have all the json files in mind) - It makes humans avoid map areas completely because there is always that one, same, strong nation - The map lead Nikola123 wants to "not deal with the stupid nations and their balancing" If the goal of nation strength was to make them feel different I would suggest a nation personality system. Nations that love to boat, love to ally, love to nuke, love to fullsend, etc. Link to a discord discussion about nation strength: https://discord.com/channels/1359946986937258015/1360078040222142564/1450973197251117218 ## 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 |
||
|
|
4d5bb7a835 |
Cleanup nations (Part 1) 🧹 (#2637)
## Description: 1. Using the wording `"Nation"`, `"FakeHuman"` and `"NPC"` at the same time is confusing. So I renamed every mention of `"FakeHuman"` and `"NPC"` in the entire project to `"Nation"`. Just like they are called ingame. 2. `BotBehavior.ts` was originally intended for sharing the logic between nations and bots. But at the moment, the logic there isn't really shared and it's basically just about attacking. So I renamed `BotBehavior.ts` to `AiAttackBehavior.ts`. I use "Ai" to indicate that this file is used by bots AND nations. 3. Moved `execuction/utils/AllianceBehavior.ts` to `execuction/nation/NationAllianceBehavior.ts` to make sure everybody understands that this file is not about alliances in general. It's just about nations and how they handle alliances. 4. Removed `difficultyModifier` from `DefaultConfig`. It's unused and I think we usually want to finetune the difficulty instead of using that method. 5. Added `assertNever` in all `switch (difficulty)` default cases. ## 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 |
||
|
|
58c7cdd46f |
Task: Unify username validation and remove username sanitation (#2622)
## Description: This PR centralizes all username validation using UsernameSchema with a set maximum, minimum, and a regex pattern, It also removes sanitization, as all places where the username would be sanitized on the server have been gatekept, so no unvalidated usernames can get onto the server past the ClientMessageSchema safeParse in GameServer's on message func. Here is how the errors look if that happens, Note that if the client is funtioning correctly and the user doesn't manually send a WS message, they should never see this. The screenshots are from a debug build where client uname validation was disabled. <img height="300" alt="error message too short" src="https://github.com/user-attachments/assets/1b7ac32c-2f03-40fb-8ce9-1f4ab66100bd" /> <img height="300" alt="error message bad regex" src="https://github.com/user-attachments/assets/c78b4114-7e4b-4d39-a135-4cab3ad52c0b" /> Profanity sanitization was not changed. Additionally, the censor tests were updated to reflect the new expectations. Jose was added to the jest config as an allowed transform pattern, as it didn't make sense to me to mock a zod schema. The UsernameSchema pattern was set to `^[a-zA-Z0-9_ \[\]üÜ]+$`, I personally think either we should allow all latin characters (regex has a pattern for this, `\p{L}` or `\p{sc=Latin}`) and then we'd use some kind of library to normalize all latin characters into regular ascii for name filtering, or we should only keep ascii letters. ## 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 (I just realized sanitization isn't a word, it's supposed to be sanitation, sorry.) |
||
|
|
690b7e1155 |
Add Manicouagan Map and Credit OpenTopography (#2620)
## Description: Adds a map based on the Manicouagan Reservoir in Quebec and credits OpenTopography ## Checklist: - [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 <img width="1017" height="1017" alt="Screenshot 2025-12-14 214706" src="https://github.com/user-attachments/assets/030c4bbd-0325-4da4-bef5-71053dc8f183" /> ## Discord username: sehentsin |
||
|
|
71cf309252 |
increase mirv price with total number of merged launched (#2621)
## Description: To prevent MAD stalemates, have the price of MIRVs increase after each launch. This will encourage players to launch a MIRV once they have enough money for it. Also reduce the price of the first MIRV to 25 million to reduce snowballing, each subsequent MIRV cost an extra 15 million: 1. 25 million 2. 40 million 3. 60 million 4. etc ## 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 |
||
|
|
e290e587ea |
perf: Optimize cluster calculation with DFS and zero-allocation patterns (#2539)
## Description: Replace BFS with DFS and eliminate GC pressure in calculateClusters(): - Switch from O(N) queue.shift() to O(1) stack.pop() operations - Replace Set.has()/Set.add() with Uint8Array bitfield - Add reusable buffer management to avoid repeated allocations - Implement callback-based neighbor iteration to eliminate array allocations - Add forEachNeighborWithDiag() method to Game interface and GameImpl - Remove now unused GameImpl import from PlayerExecution Describe the PR. ## 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 |
||
|
|
1f8adb4849 |
Add Svalmel (#2600)
## Description: This PR adds the Christmas map Svalmel with 5 nations. Describe the PR. ## 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 |
||
|
|
ae884cb902 |
Add New York City Map (#2542)
## Description: Adds New York City Map. ## 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: tidwell Screenshots <img width="1700" height="1081" alt="location-select" src="https://github.com/user-attachments/assets/06d229c1-f804-4766-bd58-35923c6696bc" /> <img width="1705" height="1079" alt="map-bots" src="https://github.com/user-attachments/assets/16a677d1-da6b-4aca-9ecf-8b0fbb161019" /> <img width="1706" height="1082" alt="map-select" src="https://github.com/user-attachments/assets/8adfd26b-f506-4c72-be05-a1fa638311ab" /> <img width="745" height="929" alt="nation-placement" src="https://github.com/user-attachments/assets/6b5ffd0e-0b2e-4189-b118-bd04c8ac4240" /> Misc Dimensions: 1500 x 1900 px Total Area: 2,850,000 px² New Flag Assets: None [Inspired by this Discord Thread](https://discord.com/channels/1284581928254701718/1440439003160641667/1440439003160641667) Some of the water features are adjusted for playability. NYC doesn't have a ton of elevation differences, so marshland is replicated w/ highland noise. This is roughly placed to match [Pre-WWI](https://www.geographicus.com/P/AntiqueMap/newyorkcity-usgs-1915), but allows maintaining the modern silhouette of the area. This 1901 map is also the main inspiration for composition and projection. For the Nations, British and Dutch Colonies along with Native Peoples make this a bit of an amalgamation of the 17th - 20th centuries Other elevation differences come from [Topographic Map](https://en-gb.topographic-map.com/map-6sm14/New-York/?center=40.63067%2C-73.89158&zoom=11) [Tribal Nation Names and Info](https://en.wikipedia.org/wiki/History_of_Long_Island) [Additional Tribal Names/Info](https://libguides.pratt.edu/c.php?g=1088684&p=9380209) --------- Co-authored-by: Evan <evanpelle@gmail.com> |
||
|
|
f0feabfb13 |
Fix: Filter out in construction buildings for totalunitlevels (#2580)
## Description: Fix for v28. After PR #2378 changes, unit type Construction doesn't exist anymore. Resulting in totalUnitLevels counting in construction buildings towards total units in TeamStats, old and new Build Menu and Player Info Overlay. To fix this we now need to filter out the construction phase. totalUnitLevels is only used for displaying total count purposes, it doesn't affect other logic. Before PR 2378 changes: https://github.com/user-attachments/assets/7748092a-8b7b-41bb-bc68-439ba922b479 After PR 2378 changes: https://github.com/user-attachments/assets/bc77d7c2-be02-487a-b46a-c02367ae5ad8 After fix in this PR it is back to what is was before: https://github.com/user-attachments/assets/8d7d14b6-7b6b-4ddb-96d1-17a0a45727f3 ## 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 |
||
|
|
327d425fd5 |
Fix obvious typos (#2585)
## Summary - fix obvious spelling typos flagged by codespell across docs, tests, comments - no functional changes ## Testing - pre-commit hooks (eslint/prettier) ran during commit |
||
|
|
1d7685a5bf | Merge branch 'v27' | ||
|
|
97e6c1cd77 |
feat: Nuke Trajectory SAM intercept prediction (#2541)
## Description: Overhaul to nuke previews: - Nuke previews now show when they become invulnerable (if invulnerability setting enabled). - Nuke previews now show if a SAM defense could intercept it, and where the intercept occurs. - SAMs range is now color-coded and outlined to be able to know if missile will be intercepted by it. <img width="1326" height="862" alt="image" src="https://github.com/user-attachments/assets/4cc43a0b-ebac-4707-85bb-4d422f23da28" /> Colors/outlines aren't meant to be final, and there are constants to play around with at the start of both files. I also kept the naive implementation since the performance cost isn't too high from my testing and any improvements I can think of are small and require a bigger rewrite. ## 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: bibizu |
||
|
|
997cfea730 |
Fixes lobby team preview: clan players aren't assigned a team + add nation count + other small fixes (#2536)
## Description: Fixes for v28. In https://github.com/openfrontio/OpenFrontIO/pull/2444, lobby team preview was added. But for players with clan tags, this doesn't work correctly. They don't get assigned to the same team in the preview, while they do get assigned to the same team in the actual game. Also added some small fixes and QoL improvements like showing the number of Nations next to the number of Players. Since we needed that info anyway. Did not choose to show and assign Nations to teams (just the numbers), see why under CONSIDERED OPTIONS THAT I DIDN'T WENT WITH. **BEFORE:** https://youtu.be/AV_aDJ4PgOk <img width="767" height="117" alt="Malformed argument because of double accolades for remove_player" src="https://github.com/user-attachments/assets/7de1114e-7ce1-4a8f-95cc-6b0528a61e3b" /> **AFTER:** https://youtu.be/aDCKkwedqes Cause of bug: maxTeamSize is a number in assignTeams, only used to assign clan players. It uses the length of the players array as input. At actual game start, the Nations are also in the players array. But at lobby preview the Nations aren't yet fetched. So when 2 players want to do a 3 Teams private lobby with them using clan tags to be in the same team. maxTeamCount would do Math.ceil(2/3)=1. So only 1 clan player per team as a result. While actually there could be 10 Nations which would result in maxTeamCount Math.ceil(12/3)=4 so in the game they would actually be assigned to the same team. Fix for bug: fetch Nations count in HostLobbyModal and pass on to LobbyTeamView. Add it to the number of players for maxTeamCount that assignTeamsLobbyPreview uses for its calculation. Also added nation count to the similar teamMaxSize in LobbyTeamView itself, to display the same and correct number of max players. For random maps, we now need to know the random map before the game starts to get its Nation count. So made some changes for that too in HostLobbyModal. Also fixed: - willUpdate ran comptuteTeamPreview every second, now checks if properties like 'client' actually changed. PollPlayers in HostLobbyModal 'changes' the clients property every second even if there are no actual changes. Checks if the other properties are actually changed too, to make it more future proof. - cache teamsList so it is only fetched once instead of first in computeTeamPreview and then again for showTeamColors. - don't show the "Empty Teams" header if there are no empty teams. - console error ICU format error SyntaxError: MALFORMED ARGUMENT. Because of double accolades around remove_player in translation value. - remove fallback for comparing clients on clientID, which used client name. Players may have the same names so it's not safe to compare based on name. Also show number of Nations next to number of Players: now we now the nationCount since it is needed for the fix, show number of Nations next to number of Players. It's handy and it prevents confusion as to why it says 2/32 for two teams if there are only 2 players; it is because there are 61 Nations as well on the World map for example. Also determine number of teams based on Players + Nations: now we now the nationCount since it is needed for the fix, use it to determine the number of teams. Just like populateTeams in GameImpl does. This means for Duos on the World map, a minimum of 31 teams will be shown since there are 61 Nations. This is better than just show two teams based on 1 or 2 humans in the lobby. Also it makes more clear how many teams there'll be the game and how the players and nations are divided over the teams. Choose to not show the Nations' team assignments though. That could be for another PR. See explanation under CONSIDERED OPTIONS THAT I DIDN'T WENT WITH. Also show Nations team as pre-filled for HumansVSNations: now we now the nationCount since it is needed for the fix, for HumansVSNations, show the Nations team as fully assigned and non-empty. For example for World map it shows Nations 61/61. Don't show them as Empty Team but as Assigned Team. Although i choose not to show the actual Nations (see CONSIDERED OPTIONS THAT I DIDN'T WENT WITH), this makes it clear their team is pre-filled and how many Nations you're actually up against. Whereas for other Team game types like 7 Teams or Duos, it will display the teams that the Nations will fill up as empty. CONSIDERED OPTIONS THAT I DIDN'T WENT WITH - Use an optional param 'nationsCount' to assignTeams with default = 0. And simply add nationsCount to the players.length count for maxTeamSize. This would be error prone; 'nationsCount' should then never be assigned a value except when called from LobbyTeamView. But in the future someone might assign it a value even when called from somewhere else. Then you could say, check if there are Nations in the players array and if so, do not use Nationscount because we know they are already counted from players.length. But if Disable Nations is enabled, there would be no Nations in the players array but if nationsCount was somehow given a value we still should not use it. So again, too developer error prone. - Not only fetch the number of Nations, but actually get the Nations themselves to show them in the team assign preview as well. They are shuffled on team assignment but of course deterministicly (nation player ID assigned based on Pseudorandom seeded with GameID in GameRunner, then shuffled in TeamAssignment with Pseudorandom seeded with map's first Nation's playerID), so we could replicate it. But then, how to distinguish humans and Nations in the UI? This feels like something for a follow-up PR. FOR A FUTURE PR - change the way Clan team overflow is handled. Now they're "kicked" as in not assigned to a team without their knowing, are loaded into the game but cannot spawn. This UX could need some improvement. And the logic can be improved too, ie. don't "kick" too soon, check the number of Clans in the lobby and the number of teams to decide if we can assign the 'overflowing' Clan player to another team that doesn't have rivalling Clan players. Far out of scope for this PR. ## 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 |
||
|
|
96cf177a5f |
Add the Lisbon Map and Credit Copernicus DEM (#2545)
## Description: Adds a map based on Lisbon and the surrounding area. Also credits the ESA's Copernicus Digital Elevation Model, which was used to create this map and the Gulf of St. Lawrence map. <img width="1257" height="1257" alt="screenshot of the new Lisbon map" src="https://github.com/user-attachments/assets/39fa73da-c77d-4d5c-8d00-7ee2794d0298" /> ## Checklist: - [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: sehentsin |
||
|
|
8f3e09c6a3 |
Add Gulf of St. Lawrence Map and Related Flags (#2524)
## Description: Adds the Gulf of St. Lawrence map and the flags of New Brunswick (ca_nb), Nova Scotia (ca_ns), and Prince Edward Island (ca_pe). ## 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 <img width="1380" height="1150" alt="Screenshot 2025-11-26 201008" src="https://github.com/user-attachments/assets/77531058-b429-4c68-b645-a3e59033458b" /> <img width="1434" height="1195" alt="Screenshot 2025-11-26 202128" src="https://github.com/user-attachments/assets/9c3e2bc2-882f-4662-a32b-16e17db852f2" /> ## Discord username sehentsin |
||
|
|
55e413c528 |
Fix Territory Skins option (#2538)
Resolves #2517 ## Description: Fixes territory skin option not doing anything. Also changes some instances of directly accessing "this.cosmetics.pattern" to use the precalculated "pattern" variable. ## 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 |
||
|
|
8f53785a80 |
BUG FIX: Gold double deduction + Rmoval of UnitType.Construction (#2378)
## Description: - Removed the temporary UnitType.Construction and embedded construction state into real units via isUnderConstruction(). - Centralized non-structure spawning to perform a single validation right before unit creation/launch. - Updated UI layers to render construction state without relying on the removed enum. - Adjusted and created tests to match the new flow and to cover the no-refundscenarios. # Tests updated - tests/economy/ConstructionGold.test.ts: covers structure cost deduction and income, tolerant of passive income; ensures no refunds during construction. - tests/nukes/HydrogenAndMirv.test.ts: accounts for single-check launch flow; MIRV test targets a player-owned tile; ensures launch after payment. - tests/client/graphics/UILayer.test.ts: mocks now provide isUnderConstruction and real type strings; ## 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: CrackeRR1 --------- Co-authored-by: Evan <evanpelle@gmail.com> |
||
|
|
c8fb8e7f04 | record stats for factory build and capture | ||
|
|
9b125c8cfe |
Bugfix: nation strength undefined in only place it is used (#2498)
## Description: In commit https://github.com/openfrontio/OpenFrontIO/commit/bbf72bd14f7f31146c687523aea8fc0aff31bbe1#diff-ee2fcbca50d87cc09d2c7d2667210defe2e3e111239820c89c40283be5385b64 it was added that startManpower in DefaultConfig used playerInfo.nation.strength to set the starting troops for a Nation. In ExecutionManager, param nation of PlayerInfo was set during the instantiation of a new FakeHumanExecution. However in commit https://github.com/openfrontio/OpenFrontIO/commit/d6a412aa50dd86d474d80c216fd9ba36e7426ef9#diff-2d0a5d8b171d8b504f934891025e42742e142ef0964d6e17712bfdcd30bf050c the changes made it so that **param nation of PlayerInfo was never set**. While startManpower in DefaultConfig still checked for playerinfo.nation.strength. Since it was always undefined, it would use a multiplier of 1 instead of the actual nation strength. This PR fixes it by passing the nation strength to param nationStrength in PlayerInfo. Removing param strength from class Nation. Strength isn't used anywhere else so this isn't a problem and it also consolidates human player info and nation player info even more. We could have also used the Nation.strength directly, but that would have required more code in addPlayers and addPlayer in GameImpl, especially for Teams games. So this PR has the simplest solution. - I did add a config setting useNationStrengthForStartManpower with a comment that explains its reason for being. Namely that in the months that startManpower didn't get to use nation strength because of the bug, FakeHumans have become much harder to fight. Re-enabling higher starting troops from this fix would make them even harder to fight, and i think rebalancing is needed before that. - Or we could decide to scrap Nation strength altogether, as it is only ever used to set starting troops anyway. This would make map making a little easier as a bycatch. ## 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 |