From ff0ec79fbd642048000e674a89eef527a1b5b4b5 Mon Sep 17 00:00:00 2001 From: evanpelle Date: Tue, 12 Aug 2025 11:38:24 -0700 Subject: [PATCH] meta --- resources/maps/world/manifest.json | 258 ++++++++++++++++++++++++ src/core/configuration/DefaultConfig.ts | 30 +-- src/core/game/GameImpl.ts | 7 - 3 files changed, 275 insertions(+), 20 deletions(-) diff --git a/resources/maps/world/manifest.json b/resources/maps/world/manifest.json index 62be274e1..809cc192c 100644 --- a/resources/maps/world/manifest.json +++ b/resources/maps/world/manifest.json @@ -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 } ] } diff --git a/src/core/configuration/DefaultConfig.ts b/src/core/configuration/DefaultConfig.ts index dd04c983c..35c59a514 100644 --- a/src/core/configuration/DefaultConfig.ts +++ b/src/core/configuration/DefaultConfig.ts @@ -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 { diff --git a/src/core/game/GameImpl.ts b/src/core/game/GameImpl.ts index 8addaac1f..e102587e7 100644 --- a/src/core/game/GameImpl.ts +++ b/src/core/game/GameImpl.ts @@ -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 (