Commit Graph

93 Commits

Author SHA1 Message Date
Scott Anderson 71010ab14e AI nukes avoid SAM launchers (#1045)
## Description:

AI nukes avoid SAM launchers

## Please complete the following:

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

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
Co-authored-by: evanpelle <evanpelle@gmail.com>
2025-06-05 19:27:10 +02:00
falc 07916d46bf Changed consolex to console logging (#1036)
## Description:
Changed from consolex to console
## Please complete the following:

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

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

@qqkedsi
2025-06-05 16:14:27 +02:00
Scott Anderson e763ade705 Use bigint for gold (#1000) 2025-06-03 16:50:11 +02:00
1brucben a83d0cd4ac remove shield. adjust natoins 2025-06-02 18:08:42 +02:00
Scott Anderson 32f5723c72 Simplify bots retaliation logic (#946)
## Description:

Simplify bots retaliation logic. Do not counter-attack before reaching
the trigger ratio.

## Please complete the following:

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

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-05-29 17:53:18 -07:00
Scott Anderson 70745faac4 Enable strictNullChecks, eqeqeq (#436)
## Description:

Improve type safety and runtime correctness by:
1. Enabling TypeScript's
[strictNullChecks](https://www.typescriptlang.org/tsconfig/#strictNullChecks)
compiler option.
2. Replacing all loose equality operators (`==` and `!=`) with strict
equality operators (`===` and `!==`).
3. Cleaning up of type declarations, null handling logic, and equality
expressions throughout the project.

Currently, the code allows implicit assumptions that `null` and
`undefined` are interchangeable, and relies on type-coercing equality
checks that can introduce subtle bugs. These practices make it difficult
to reason about when values may be absent and hinder the effectiveness
of static analysis.

Migrating to strict null checks and enforcing strict equality
comparisons will clarify intent, reduce bugs, and make the codebase
safer and easier to maintain.

Fixes #466 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
Co-authored-by: evanpelle <openfrontio@gmail.com>
2025-05-15 16:39:40 -07:00
Léo Kosman 1b286f5518 Feat : Auto remove embargoes that were automatically created (#707)
## Description:

Adds two fields to an Embargo : 
- `createdAt` : the tick at which it was created
- `willExpire` : whether the embargo will expire on its own

An embargo will remove itself only if the player didn't intentionally
set it. It expires either when an alliance is made, or if enough time
has passed (according to the `embargoDuration` config entry).

I put 5 minutes for `embargoDuration` by default, which seems reasonable
to me.

closes #702 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

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

leo21_
2025-05-15 10:09:27 -07:00
Scott Anderson 9029c6e281 bug: fix nuke tile score (#749)
## Description:

Fix a bug with nuke tile scoring.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors
2025-05-14 09:34:25 -07:00
Aotumuri cddcc681dd Added custom disable settings (#593)
## Description:
I will write an issue later as I don't have time.

![スクリーンショット 2025-04-23 22 04
24](https://github.com/user-attachments/assets/77754140-eee9-46bd-a98f-a3abec35ca6a)
<img width="735" alt="スクリーンショット 2025-04-23 22 04 40"
src="https://github.com/user-attachments/assets/24bb3461-8e05-418c-8dbf-2ba1a624fe27"
/>
<img width="790" alt="スクリーンショット 2025-04-23 22 04 47"
src="https://github.com/user-attachments/assets/33387200-d0af-4394-9d60-af1f88a036e9"
/>

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
aotumuri
2025-05-07 06:14:54 -07:00
PilkeySEK ebc9e4877d Fix emoji exploit (#640)
## Description:
This should fix the exploit that allows players to send custom text as
an "emoji". It does this by introducing a emoji ID (index into the emoji
table) instead of sending the raw emoji as a string.

## Please complete the following:

- [ ] I have added screenshots for all UI updates
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [X] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
PilkeySEK
2025-05-02 07:37:29 -07:00
evanpelle d6a412aa50 implement duos (#630)
## Description:
Implement Duos team mode.
Also assign teams to nations at the start instead of assigning them
randomly on spawn. This gives more consistent team sizes

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

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

<DISCORD USERNAME>

Co-authored-by: evan <openfrontio@gmail.com>
2025-04-30 13:47:35 -07:00
Scott Anderson d9e8984df5 Refactor Nations AI (#427)
## Description:

Refactor AI troop management and strategic behavior based around two key
values: a trigger ratio and a reserve ratio.
- Reserve ratio: This determines the portion of the population the AI
will keep in reserve and will not send on attacks.
- Trigger ratio: This is the threshold at which the bot will initiate an
attack.

Additionally, when an incoming attack is detected, bots will now
prioritize retaliating by switching targets to the largest incoming
attacker.

Fixes #470 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

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

fake.neo

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-04-27 14:15:45 -07:00
evanpelle 71849b47cd better transport ship spawn (#587)
## Description:

Taken from PR #506

Improve transport source tile by considering border extremums

Only calculate better spawn tile for humans, and have the sender
calculate it and send the src tile in the intent for better performance.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

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

<DISCORD USERNAME>
evan

Co-authored-by: evan <openfrontio@gmail.com>
2025-04-21 19:49:17 -07:00
Scott Anderson 1b672420b3 Combine Bot and Nation behaviors in to a shared class (#434)
This is the first move in the effort to combine the redundant logic that
exists between BotExecution and FakeHumonExecution.

This commit:
1. Combines the alliance request handler, moving bots to use the same
logic as nations for acceptance.
2. Combines the sendAttack() functions, which may later be reworked.
3. Introduces selectEnemy() function to wrap enemy selection logic that
nations use.
4. Blocks nations from nuking bots.
5. Alters enemy selection to prefer neighboring bots if there are any.

## Description:

Fixes #467 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

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

fake.neo

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-04-17 19:37:16 -07:00
Scott Anderson ccadd7f6a8 Nations target structures with nukes (#393)
## Description:

Nations will prefer to target their nukes at structures. This updates
the existing logic, which attempts ten times to randomly select a
coordinate 15 tiles inside the border, to instead generate a list of ten
random tiles in addition to a list of all of the tiles of relevant
structures. The two lists are concatenated to create a set of tile
candidates. These candidates are scored, and the tile with the highest
score, if one is found, is nuked.

The scoring function considers three factors:
1. Damage potential: values of structures with 25 tiles of the target
tile.
2. Distance from silo to target (hang time).
3. Recently nuked locations.


![image](https://github.com/user-attachments/assets/10c7bd96-ad51-404c-84c9-c0840dc8250c)

Fixes #471 

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

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

fake.neo

---------

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-04-17 19:22:35 -07:00
Evan 0dbc246a63 reduce transport frequency for fakehumanexecution, make transport render more efficient 2025-04-05 17:14:56 -07:00
Evan 2cb8c239cf make sendBoat() more efficient: find random tiles instead of doing a breadth first search 2025-04-04 16:04:57 -07:00
Scott Anderson 10c411b1ee bug: lastEmojiSet is never used (#406)
## Description:

In the existing code, lastEmojiSent can only ever be set if it is
already set, causing it to never be used. This change updates the logic
to work as intended.

## Please complete the following:

- [x] I have added screenshots for all UI updates
- [x] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [x] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

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

fake.neo

Co-authored-by: Scott Anderson <662325+scottanderson@users.noreply.github.com>
2025-04-03 16:12:07 -07:00
Evan 8b6895d745 add prettier import plugin 2025-03-31 13:09:27 -07:00
PilkeySEK d6e596f7d8 fix: Make bots not attack teammates (#368)
Bug report:
https://discord.com/channels/1284581928254701718/1355194642592694412
## Please complete the following:

- [X] I have added screenshots for all UI updates
- [X] I confirm I have thoroughly tested these changes and take full
responsibility for any bugs introduced
- [X] I understand that submitting code with bugs that could have been
caught through manual testing blocks releases and new features for all
contributors

## Please put your Discord username so you can be contacted if a bug or
regression is found:
PilkeySEK
2025-03-30 10:43:24 -07:00
evanpelle d8fe41de7a teams (#349) 2025-03-27 20:43:56 -07:00
Readixyee e02361c2f4 Disable nukes option (#237)
This makes it possible to disable all nukes as well as missile silos
from the game in privat lobbies and singleplayer games
2025-03-21 13:52:36 -07:00
Ilan Schemoul 70c3c43a5f feat: handle embargo fake human (#240) 2025-03-13 14:53:27 -07:00
Evan 3dd02ec4df remove max boat distance 2025-03-07 10:38:26 -08:00
Evan e3896127d5 bugfix: full sending with boat makes you lose troops 2025-02-18 18:55:26 -08:00
Evan 64d13a46bd bugfix: bots were not losing troops in attack. rebalanced difficulties. 2025-02-13 11:50:15 -08:00
Evan 40966ca3b9 format all files with prettier 2025-02-12 08:28:15 -08:00
Evan 8d690c0130 NPCs break alliances less frequently 2025-02-09 10:37:10 -08:00
Evan 4182eaa449 rebalance difficulties 2025-02-08 20:59:44 -08:00
Evan 1594a45dac have buildings take time to construct 2025-02-08 13:53:58 -08:00
Evan bbf72bd14f simply start population calculation 2025-02-03 12:37:04 -08:00
Evan c109d23f9f combine battleship + destroyer => warship. 2025-02-02 14:31:30 -08:00
Evan af0d6a289a rename cansendlliance request fix ally self bug 2025-02-01 20:18:57 -08:00
Evan 4ee37323f9 format codebase with prettier 2025-02-01 12:05:11 -08:00
evanpelle 2af3c2a115 fix rebase errors 2025-02-01 12:05:11 -08:00
evanpelle de1dbff570 combine Game & MutableGame 2025-02-01 12:05:11 -08:00
evanpelle 7d15c0c065 combine Player & MutablePlayer interfaces 2025-02-01 12:05:11 -08:00
Evan b91d9d4148 fix bugs from using tilerefs 2025-02-01 12:05:11 -08:00
Evan f0f5bae79f thread_split: convert all tile to tileref 2025-02-01 12:05:11 -08:00
evanpelle c42cc2a9b4 have Game delegate to GameMap for cleaner API 2025-02-01 12:05:11 -08:00
evanpelle a17ae48cd3 use TileRef instead of tile 2025-02-01 12:05:11 -08:00
Evan 8616e9bfcb game runs in seperate thread 2025-02-01 12:05:11 -08:00
Evan dab427d614 put methods onto terraintile 2025-02-01 12:05:11 -08:00
Evan 8443095d89 create game runner 2025-02-01 12:05:11 -08:00
evanpelle ea1e2c99a0 NPCs send emojis less frequently 2025-01-06 07:53:23 -08:00
Evan 5e0367ae55 bufix: NPC is targeted at the same time it allies with targeter, causing it to try to attack itself 2025-01-05 20:04:55 -08:00
Evan 4800e0dd29 NPCs only send emojis to players 2025-01-05 12:59:14 -08:00
evanpelle b7af94ec47 bugfix: didn't call isTraitor so NPCs treated everyone as traitor 2024-12-31 10:26:43 -08:00
Evan 309ee84246 NPCs send boats at enemies when not adjacent 2024-12-30 20:23:09 -08:00
Evan c4061e8848 NPCs only attack target when friendly, more bonus for larger attack vs defender troops 2024-12-30 13:55:30 -08:00