This commit is contained in:
evanpelle
2025-08-12 11:38:24 -07:00
parent a1c8abcb42
commit ff0ec79fbd
3 changed files with 275 additions and 20 deletions
+258
View File
@@ -16,6 +16,264 @@
"flag": "us",
"name": "United States",
"strength": 3
},
{
"coordinates": [372, 136],
"flag": "ca",
"name": "Canada",
"strength": 2
},
{
"coordinates": [375, 374],
"flag": "mx",
"name": "Mexico",
"strength": 1
},
{
"coordinates": [500, 378],
"flag": "cu",
"name": "Cuba",
"strength": 1
},
{
"coordinates": [524, 474],
"flag": "co",
"name": "Colombia",
"strength": 1
},
{
"coordinates": [593, 473],
"flag": "ve",
"name": "Venezuela",
"strength": 1
},
{
"coordinates": [596, 705],
"flag": "ar",
"name": "Argentina",
"strength": 1
},
{
"coordinates": [637, 567],
"flag": "br",
"name": "Brazil",
"strength": 1
},
{
"coordinates": [1280, 975],
"flag": "aq",
"name": "Antarctica",
"strength": 3
},
{
"coordinates": [709, 57],
"flag": "gl",
"name": "Greenland",
"strength": 2
},
{
"coordinates": [831, 112],
"flag": "is",
"name": "Iceland",
"strength": 1
},
{
"coordinates": [925, 186],
"flag": "gb",
"name": "United Kingdom",
"strength": 3
},
{
"coordinates": [887, 183],
"flag": "ie",
"name": "Ireland",
"strength": 1
},
{
"coordinates": [908, 264],
"flag": "es",
"name": "Spain",
"strength": 1
},
{
"coordinates": [1004, 250],
"flag": "it",
"name": "Italy",
"strength": 1
},
{
"coordinates": [958, 220],
"flag": "fr",
"name": "France",
"strength": 2
},
{
"coordinates": [997, 205],
"flag": "de",
"name": "Germany",
"strength": 1
},
{
"coordinates": [1064, 101],
"flag": "se",
"name": "Sweden",
"strength": 1
},
{
"coordinates": [1046, 193],
"flag": "pl",
"name": "Poland",
"strength": 1
},
{
"coordinates": [1061, 188],
"flag": "by",
"name": "Belarus",
"strength": 1
},
{
"coordinates": [1073, 243],
"flag": "ro",
"name": "Romania",
"strength": 1
},
{
"coordinates": [1161, 274],
"flag": "tr",
"name": "Turkey",
"strength": 1
},
{
"coordinates": [969, 133],
"flag": "no",
"name": "Norway",
"strength": 1
},
{
"coordinates": [1062, 133],
"flag": "fi",
"name": "Finland",
"strength": 1
},
{
"coordinates": [1099, 211],
"flag": "ua",
"name": "Ukraine",
"strength": 1
},
{
"coordinates": [1344, 136],
"flag": "ru",
"name": "Russia",
"strength": 3
},
{
"coordinates": [1537, 186],
"flag": "mn",
"name": "Mongolia",
"strength": 1
},
{
"coordinates": [1524, 328],
"flag": "cn",
"name": "China",
"strength": 3
},
{
"coordinates": [1368, 373],
"flag": "in",
"name": "India",
"strength": 2
},
{
"coordinates": [1276, 239],
"flag": "kz",
"name": "Kazakhstan",
"strength": 1
},
{
"coordinates": [1238, 309],
"flag": "ir",
"name": "Islamic Republic Of Iran",
"strength": 1
},
{
"coordinates": [1178, 351],
"flag": "sa",
"name": "Saudi Arabia",
"strength": 1
},
{
"coordinates": [1679, 657],
"flag": "au",
"name": "Australia",
"strength": 2
},
{
"coordinates": [1890, 775],
"flag": "nz",
"name": "New Zealand",
"strength": 0.5
},
{
"coordinates": [918, 342],
"flag": "dz",
"name": "Algeria",
"strength": 1
},
{
"coordinates": [1030, 332],
"flag": "ly",
"name": "Libyan Arab Jamahiriya",
"strength": 1
},
{
"coordinates": [1092, 335],
"flag": "eg",
"name": "Egypt",
"strength": 1
},
{
"coordinates": [963, 410],
"flag": "ne",
"name": "Niger",
"strength": 1
},
{
"coordinates": [1112, 406],
"flag": "sd",
"name": "Sudan",
"strength": 1
},
{
"coordinates": [1074, 508],
"flag": "cd",
"name": "The Democratic Republic of the Congo",
"strength": 1
},
{
"coordinates": [1154, 443],
"flag": "et",
"name": "Ethiopia",
"strength": 1
},
{
"coordinates": [1075, 707],
"flag": "za",
"name": "South Africa",
"strength": 1
},
{
"coordinates": [1194, 627],
"flag": "mg",
"name": "Madagascar",
"strength": 0.5
},
{
"coordinates": [1052, 420],
"flag": "td",
"name": "Chad",
"strength": 1
}
]
}
+17 -13
View File
@@ -29,6 +29,9 @@ import { Config, GameEnv, NukeMagnitude, ServerConfig, Theme } from "./Config";
import { PastelTheme } from "./PastelTheme";
import { PastelThemeDark } from "./PastelThemeDark";
const DEFENSE_DEBUFF_MIDPOINT = 70000;
const DEFENSE_DEBUFF_DECAY_RATE = Math.LN2 / 20000;
const JwksSchema = z.object({
keys: z
.object({
@@ -629,29 +632,30 @@ export class DefaultConfig implements Config {
}
}
let largeLossModifier = 1;
if (attacker.numTilesOwned() > 100_000) {
largeLossModifier = Math.sqrt(100_000 / attacker.numTilesOwned());
}
let largeSpeedMalus = 1;
if (attacker.numTilesOwned() > 75_000) {
// sqrt is only exponent 1/2 which doesn't slow enough huge players
largeSpeedMalus = (75_000 / attacker.numTilesOwned()) ** 0.6;
}
if (defender.isPlayer()) {
const defenseSig =
1 -
sigmoid(
defender.numTilesOwned(),
DEFENSE_DEBUFF_DECAY_RATE,
DEFENSE_DEBUFF_MIDPOINT,
);
const speedDebuff = 0.25 + 0.75 * defenseSig;
const defenseDebuff = 0.5 + 0.5 * defenseSig;
return {
attackerTroopLoss:
within(defender.troops() / attackTroops, 0.6, 2) *
mag *
0.8 *
largeLossModifier *
defenseDebuff *
(defender.isTraitor() ? this.traitorDefenseDebuff() : 1),
defenderTroopLoss: defender.troops() / defender.numTilesOwned(),
// Lower is faster
tilesPerTickUsed:
within(defender.troops() / (5 * attackTroops), 0.2, 1.5) *
speed *
largeSpeedMalus *
speedDebuff *
(defender.isTraitor() ? this.traitorSpeedDebuff() : 1),
};
} else {
-7
View File
@@ -328,13 +328,6 @@ export class GameImpl implements Game {
}
executeNextTick(): GameUpdates {
console.log(`number of trade ships: ${this.unitCount(UnitType.TradeShip)}`);
const myPlayer = this.players().find((p) => p.type() === PlayerType.Human);
if (myPlayer) {
console.log(
`my player: ${myPlayer.name()} has ${myPlayer.unitCount(UnitType.TradeShip)} trade ships`,
);
}
this.updates = createGameUpdatesMap();
this.execs.forEach((e) => {
if (