From 3d469d9a93c040052ad0c1f88c9095ea25c192ac Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Tue, 27 Oct 2026 10:09:12 +0100 Subject: [PATCH] City density rule: retire 15 crowded Brazilian cities from new games A small city (P < 60) may not sit within 300 km of a bigger city in the same country unless it is a cable landing or a capital (Canberra gets a capital flag); a test enforces it everywhere. The 15 Brazilian cities that broke it get off:true: still in the data so saves keep their POPs, routing and links there, but new games do not draw them, offer them to customers, list them in network presence, or let you build a POP there. Brazil goes from 40 to 25 cities (Europe has 44). Order and Progress now needs 15 IX.brrr ports. --- CHANGELOG.md | 1 + site/i18n/fr.js | 2 +- site/i18n/it.js | 2 +- site/i18n/pt.js | 2 +- site/index.html | 59 +++++++++++++++++++++++-------------------- tests/issues.test.js | 8 +++--- tests/regions.test.js | 23 +++++++++++++++++ 7 files changed, 63 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 25c4d5b..c736e69 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Brazil is slimmer: 15 small cities that sat right next to bigger ones are gone from new games, leaving 25 in Brazil. A small city no longer crowds a bigger one in the same country unless it is a cable landing or a capital. Saved games keep their POPs in those cities, and the Order and Progress scenario now asks for 15 IX.brrr ports instead of 20. ## [1.33.0] — 2026-10-27 - Australia arrives: start in Sydney on hard mode. Expensive transit, a national network that keeps 45% of every broadband bill, real Australian exchanges and carriers, Adelaide, Canberra, Hobart and the South Island of New Zealand, new cables, very Australian outages and a new scenario, Fibre to the Basement. Older saves with Australian POPs are told once what changed. diff --git a/site/i18n/fr.js b/site/i18n/fr.js index 30dbf74..c87e593 100644 --- a/site/i18n/fr.js +++ b/site/i18n/fr.js @@ -2471,7 +2471,7 @@ "Prepaid mobile from Paraguay to Guatemala, with a logo that roars.":"Du mobile prépayé du Paraguay au Guatemala, avec un logo qui rugit.", "Order and Progress":"Ordre et progrès", "São Paulo. Brazil is a continent: forty IX.brrr exchanges, thousands of provedores, and the Amazon between you and the north.":"São Paulo. Le Brésil est un continent : quarante IX.brrr, des milliers de provedores, et l’Amazonie entre toi et le nord.", -"Ports on 20 IX.brrr exchanges, one of them in Manaus, and 200 Gbps served":"Des ports sur 20 IX.brrr, dont un à Manaus, et 200 Gbps servis", +"Ports on 15 IX.brrr exchanges, one of them in Manaus, and 200 Gbps served":"Des ports sur 15 IX.brrr, dont un à Manaus, et 200 Gbps servis", "This route goes into the Amazon: 2× the price. The fiber runs along rivers and jungle roads, and repairs go by boat.":"Ce parcours entre en Amazonie : 2× le prix. La fibre longe les fleuves et les pistes de la jungle, et les réparations se font en bateau.", "IX.brrr ports":"Ports IX.brrr", "A port on IX.brrr Manaus":"Un port sur IX.brrr Manaus", diff --git a/site/i18n/it.js b/site/i18n/it.js index d8707a4..650f535 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -2473,7 +2473,7 @@ "Prepaid mobile from Paraguay to Guatemala, with a logo that roars.":"Mobile prepagato dal Paraguay al Guatemala, con un logo che ruggisce.", "Order and Progress":"Ordine e Progresso", "São Paulo. Brazil is a continent: forty IX.brrr exchanges, thousands of provedores, and the Amazon between you and the north.":"São Paulo. Il Brasile è un continente: quaranta exchange IX.brrr, migliaia di provedores e l’Amazzonia tra te e il nord.", -"Ports on 20 IX.brrr exchanges, one of them in Manaus, and 200 Gbps served":"Porte su 20 exchange IX.brrr, una delle quali a Manaus, e 200 Gbps serviti", +"Ports on 15 IX.brrr exchanges, one of them in Manaus, and 200 Gbps served":"Porte su 15 exchange IX.brrr, una delle quali a Manaus, e 200 Gbps serviti", "This route goes into the Amazon: 2× the price. The fiber runs along rivers and jungle roads, and repairs go by boat.":"Questa rotta entra in Amazzonia: 2× il prezzo. La fibra corre lungo fiumi e strade nella giungla, e le riparazioni si fanno in barca.", "IX.brrr ports":"Porte IX.brrr", "A port on IX.brrr Manaus":"Una porta su IX.brrr Manaus", diff --git a/site/i18n/pt.js b/site/i18n/pt.js index d29ce8b..0bf2374 100644 --- a/site/i18n/pt.js +++ b/site/i18n/pt.js @@ -2472,7 +2472,7 @@ "Prepaid mobile from Paraguay to Guatemala, with a logo that roars.":"Celular pré-pago do Paraguai à Guatemala, com um logo que ruge.", "Order and Progress":"Ordem e Progresso", "São Paulo. Brazil is a continent: forty IX.brrr exchanges, thousands of provedores, and the Amazon between you and the north.":"São Paulo. O Brasil é um continente: quarenta exchanges IX.brrr, milhares de provedores e a Amazônia entre você e o norte.", -"Ports on 20 IX.brrr exchanges, one of them in Manaus, and 200 Gbps served":"Portas em 20 exchanges IX.brrr, uma delas em Manaus, e 200 Gbps servidos", +"Ports on 15 IX.brrr exchanges, one of them in Manaus, and 200 Gbps served":"Portas em 15 exchanges IX.brrr, uma delas em Manaus, e 200 Gbps servidos", "This route goes into the Amazon: 2× the price. The fiber runs along rivers and jungle roads, and repairs go by boat.":"Esta rota entra na Amazônia: 2× o preço. A fibra corre por rios e estradas na mata, e os reparos vão de barco.", "Ports on IX.brrr in São Paulo, Rio and Fortaleza.":"Portas no IX.brrr em São Paulo, Rio e Fortaleza.", "IX.brrr ports":"Portas no IX.brrr", diff --git a/site/index.html b/site/index.html index b5d50c1..85a21e8 100644 --- a/site/index.html +++ b/site/index.html @@ -910,36 +910,36 @@ const CITIES=[ {id:'bhz',name:'Belo Horizonte',x:0,y:0,land:'sa',reg:'SA',P:250,br:true,andes:'e',ix:'IX.brrr BH',ixCheap:0.3,dc:'Pão de Queijo Point',note:tr('Mountains, mines and more bars per head than anywhere else in Brazil. Peering deals get signed over cheese bread.')}, {id:'cwb',name:'Curitiba',x:0,y:0,land:'sa',reg:'SA',P:200,br:true,andes:'e',ix:'IX.brrr Curitiba',ixCheap:0.3,dc:'Pine Nut Park DC',note:tr('Brazil’s coldest big city, and the one that invented bus lanes for everyone else. Half the year, the air outside is free cooling.')}, {id:'poa',name:'Porto Alegre',x:0,y:0,land:'sa',reg:'SA',P:200,br:true,andes:'e',ix:'IX.brrr Porto Alegre',ixCheap:0.3,dc:'Chimarrão Colo',note:tr('The deep south, halfway to Buenos Aires. Barbecue every Sunday, and a hot gourd of mate in every hand, even in summer.')}, - {id:'aju',name:'Aracaju',x:0,y:0,land:'sa',reg:'SA',P:40,br:true,andes:'e',ix:'IX.brrr Aracaju',ixCheap:0.3,dc:'Crab Walk Colo'}, + {id:'aju',off:true,name:'Aracaju',x:0,y:0,land:'sa',reg:'SA',P:40,br:true,andes:'e',ix:'IX.brrr Aracaju',ixCheap:0.3,dc:'Crab Walk Colo'}, {id:'bel',name:'Belém',x:0,y:0,land:'sa',reg:'SA',P:100,br:true,andes:'e',rain:true,ix:'IX.brrr Belém',ixCheap:0.3,dc:'Açaí Bowl DC',note:tr('Gateway to the Amazon, at the mouth of a river so wide you cannot see the other side. It rains every afternoon, right on schedule.')}, {id:'bvb',name:'Boa Vista',x:0,y:0,land:'sa',reg:'SA',P:20,br:true,andes:'e',rain:true,ix:'IX.brrr Boa Vista',ixCheap:0.3,dc:'Northern Lights Racks',note:tr('Brazil’s northernmost capital. The only road south crosses an indigenous reserve that closes to traffic every night.')}, - {id:'cac',name:'Cascavel',x:0,y:0,land:'sa',reg:'SA',P:20,br:true,andes:'e',ix:'IX.brrr Cascavel',ixCheap:0.3,dc:'Soybean Silo DC'}, - {id:'cpv',name:'Campina Grande',x:0,y:0,land:'sa',reg:'SA',P:20,br:true,andes:'e',ix:'IX.brrr Campina Grande',ixCheap:0.3,dc:'Forró Forum DC',note:tr('Throws the biggest São João festival in the world: a whole month of forró every June. Also a university town full of engineers.')}, + {id:'cac',off:true,name:'Cascavel',x:0,y:0,land:'sa',reg:'SA',P:20,br:true,andes:'e',ix:'IX.brrr Cascavel',ixCheap:0.3,dc:'Soybean Silo DC'}, + {id:'cpv',off:true,name:'Campina Grande',x:0,y:0,land:'sa',reg:'SA',P:20,br:true,andes:'e',ix:'IX.brrr Campina Grande',ixCheap:0.3,dc:'Forró Forum DC',note:tr('Throws the biggest São João festival in the world: a whole month of forró every June. Also a university town full of engineers.')}, {id:'cpq',name:'Campinas',x:0,y:0,land:'sa',reg:'SA',P:130,br:true,andes:'e',ix:'IX.brrr Campinas',ixCheap:0.3,dc:'Silicon Sugarcane Park',note:tr('Brazil’s tech hub, an hour from São Paulo: universities, labs and data centers lined up along the highway.')}, {id:'cgr',name:'Campo Grande',x:0,y:0,land:'sa',reg:'SA',P:40,br:true,andes:'e',ix:'IX.brrr Campo Grande',ixCheap:0.3,dc:'Pantanal Edge Colo'}, - {id:'cau',name:'Caruaru',x:0,y:0,land:'sa',reg:'SA',P:20,br:true,andes:'e',ix:'IX.brrr Caruaru',ixCheap:0.3,dc:'Clay Doll Datacenter'}, + {id:'cau',off:true,name:'Caruaru',x:0,y:0,land:'sa',reg:'SA',P:20,br:true,andes:'e',ix:'IX.brrr Caruaru',ixCheap:0.3,dc:'Clay Doll Datacenter'}, {id:'cgb',name:'Cuiabá',x:0,y:0,land:'sa',reg:'SA',P:40,br:true,andes:'e',ix:'IX.brrr Cuiabá',ixCheap:0.3,dc:'Forty Degrees DC',note:tr('The geographic center of South America, and one of the hottest cities in Brazil. The chillers never get a day off.')}, - {id:'cxj',name:'Caxias do Sul',x:0,y:0,land:'sa',reg:'SA',P:25,br:true,andes:'e',ix:'IX.brrr Caxias do Sul',ixCheap:0.3,dc:'Wine Cellar Racks',note:tr('Italian immigrants, vineyards and factories. Your racks share the hills with the grape harvest.')}, - {id:'fec',name:'Feira de Santana',x:0,y:0,land:'sa',reg:'SA',P:25,br:true,andes:'e',ix:'IX.brrr Feira de Santana',ixCheap:0.3,dc:'Crossroads Colo'}, - {id:'fln',name:'Florianópolis',x:0,y:0,land:'sa',reg:'SA',P:50,br:true,andes:'e',ix:'IX.brrr Florianópolis',ixCheap:0.3,dc:'Island Uplink DC',note:tr('An island capital of beaches and startups. Half the city works remotely from a surf shack.')}, - {id:'igu',name:'Foz do Iguaçu',x:0,y:0,land:'sa',reg:'SA',P:15,br:true,andes:'e',ix:'IX.brrr Foz do Iguaçu',ixCheap:0.3,dc:'Triple Border Racks',note:tr('Where Brazil, Argentina and Paraguay meet, next to giant waterfalls and an even bigger hydro dam. Power is cheap, customs paperwork is not.')}, + {id:'cxj',off:true,name:'Caxias do Sul',x:0,y:0,land:'sa',reg:'SA',P:25,br:true,andes:'e',ix:'IX.brrr Caxias do Sul',ixCheap:0.3,dc:'Wine Cellar Racks',note:tr('Italian immigrants, vineyards and factories. Your racks share the hills with the grape harvest.')}, + {id:'fec',off:true,name:'Feira de Santana',x:0,y:0,land:'sa',reg:'SA',P:25,br:true,andes:'e',ix:'IX.brrr Feira de Santana',ixCheap:0.3,dc:'Crossroads Colo'}, + {id:'fln',off:true,name:'Florianópolis',x:0,y:0,land:'sa',reg:'SA',P:50,br:true,andes:'e',ix:'IX.brrr Florianópolis',ixCheap:0.3,dc:'Island Uplink DC',note:tr('An island capital of beaches and startups. Half the city works remotely from a surf shack.')}, + {id:'igu',off:true,name:'Foz do Iguaçu',x:0,y:0,land:'sa',reg:'SA',P:15,br:true,andes:'e',ix:'IX.brrr Foz do Iguaçu',ixCheap:0.3,dc:'Triple Border Racks',note:tr('Where Brazil, Argentina and Paraguay meet, next to giant waterfalls and an even bigger hydro dam. Power is cheap, customs paperwork is not.')}, {id:'gyn',name:'Goiânia',x:0,y:0,land:'sa',reg:'SA',P:100,br:true,andes:'e',ix:'IX.brrr Goiânia',ixCheap:0.3,dc:'Pequi Peak DC',note:tr('Agribusiness capital and home of sertanejo music. Every truck, tractor and silo wants a connection.')}, - {id:'jpa',name:'João Pessoa',x:0,y:0,land:'sa',reg:'SA',P:50,br:true,andes:'e',ix:'IX.brrr João Pessoa',ixCheap:0.3,dc:'Sunrise Point DC',note:tr('The easternmost city of the Americas, where the sun rises first. Your NOC shift starts early too.')}, - {id:'ljd',name:'Lajeado',x:0,y:0,land:'sa',reg:'SA',P:10,br:true,andes:'e',ix:'IX.brrr Lajeado',ixCheap:0.3,dc:'Valley Co-op Colo',note:tr('A small town with its own IX.brrr, because the local provedores wanted one. Peering is not just for big cities.')}, + {id:'jpa',off:true,name:'João Pessoa',x:0,y:0,land:'sa',reg:'SA',P:50,br:true,andes:'e',ix:'IX.brrr João Pessoa',ixCheap:0.3,dc:'Sunrise Point DC',note:tr('The easternmost city of the Americas, where the sun rises first. Your NOC shift starts early too.')}, + {id:'ljd',off:true,name:'Lajeado',x:0,y:0,land:'sa',reg:'SA',P:10,br:true,andes:'e',ix:'IX.brrr Lajeado',ixCheap:0.3,dc:'Valley Co-op Colo',note:tr('A small town with its own IX.brrr, because the local provedores wanted one. Peering is not just for big cities.')}, {id:'ldb',name:'Londrina',x:0,y:0,land:'sa',reg:'SA',P:35,br:true,andes:'e',ix:'IX.brrr Londrina',ixCheap:0.3,dc:'Red Soil DC'}, {id:'mcp',name:'Macapá',x:0,y:0,land:'sa',reg:'SA',P:25,br:true,andes:'e',rain:true,blackout:true,ix:'IX.brrr Macapá',ixCheap:0.3,dc:'Equator Line Colo',note:tr('Right on the equator, at the mouth of the Amazon. No road links it to the rest of Brazil, and its power grid has had very long bad weeks.')}, - {id:'mcz',name:'Maceió',x:0,y:0,land:'sa',reg:'SA',P:55,br:true,andes:'e',ix:'IX.brrr Maceió',ixCheap:0.3,dc:'Lagoon View Racks'}, + {id:'mcz',off:true,name:'Maceió',x:0,y:0,land:'sa',reg:'SA',P:55,br:true,andes:'e',ix:'IX.brrr Maceió',ixCheap:0.3,dc:'Lagoon View Racks'}, {id:'mao',name:'Manaus',x:0,y:0,land:'sa',reg:'SA',P:90,br:true,andes:'e',rain:true,ix:'IX.brrr Manaus',ixCheap:0.3,dc:'Free Zone Colo',note:tr('Two million people in the middle of the rainforest, with a duty-free factory zone. The fiber follows the rivers, and when it breaks, the repair crew goes by boat.')}, - {id:'mgf',name:'Maringá',x:0,y:0,land:'sa',reg:'SA',P:30,br:true,andes:'e',ix:'IX.brrr Maringá',ixCheap:0.3,dc:'Cathedral Cone DC'}, + {id:'mgf',off:true,name:'Maringá',x:0,y:0,land:'sa',reg:'SA',P:30,br:true,andes:'e',ix:'IX.brrr Maringá',ixCheap:0.3,dc:'Cathedral Cone DC'}, {id:'nat',name:'Natal',x:0,y:0,land:'sa',reg:'SA',P:60,br:true,andes:'e',ix:'IX.brrr Natal',ixCheap:0.3,dc:'Dune Buggy DC',note:tr('Dunes, buggies and the corner of Brazil closest to Africa.')}, {id:'pmw',name:'Palmas',x:0,y:0,land:'sa',reg:'SA',P:15,br:true,andes:'e',ix:'IX.brrr Palmas',ixCheap:0.3,dc:'Planned Grid DC',note:tr('Brazil’s youngest state capital, built from scratch in 1989. The streets are numbered, and so is everything else.')}, {id:'pvh',name:'Porto Velho',x:0,y:0,land:'sa',reg:'SA',P:25,br:true,andes:'e',rain:true,ix:'IX.brrr Porto Velho',ixCheap:0.3,dc:'Madeira River Racks'}, - {id:'rao',name:'Ribeirão Preto',x:0,y:0,land:'sa',reg:'SA',P:50,br:true,andes:'e',ix:'IX.brrr Ribeirão Preto',ixCheap:0.3,dc:'Sugarcane & Servers',note:tr('Brazil’s agribusiness capital: sugarcane, orange juice and, by local opinion, the coldest draft beer in the country.')}, + {id:'rao',off:true,name:'Ribeirão Preto',x:0,y:0,land:'sa',reg:'SA',P:50,br:true,andes:'e',ix:'IX.brrr Ribeirão Preto',ixCheap:0.3,dc:'Sugarcane & Servers',note:tr('Brazil’s agribusiness capital: sugarcane, orange juice and, by local opinion, the coldest draft beer in the country.')}, {id:'rec',name:'Recife',x:0,y:0,land:'sa',reg:'SA',P:160,br:true,andes:'e',ix:'IX.brrr Recife',ixCheap:0.3,dc:'Frevo Colo',note:tr('The Venice of Brazil, all bridges and rivers, with one of the country’s biggest tech parks in its old harbour.')}, {id:'rbr',name:'Rio Branco',x:0,y:0,land:'sa',reg:'SA',P:20,br:true,andes:'e',rain:true,ix:'IX.brrr Rio Branco',ixCheap:0.3,dc:'Acre-ly Real DC',note:tr('The capital of Acre, a state Brazilians joke does not exist. Your traceroutes say otherwise.')}, {id:'ssa',name:'Salvador',x:0,y:0,land:'sa',reg:'SA',P:160,br:true,andes:'e',ix:'IX.brrr Salvador',ixCheap:0.3,dc:'Axé Uplink DC',note:tr('Brazil’s first capital, with cables landing in the bay and a Carnival of two million people dancing behind trucks full of speakers.')}, - {id:'ria',name:'Santa Maria',x:0,y:0,land:'sa',reg:'SA',P:15,br:true,andes:'e',ix:'IX.brrr Santa Maria',ixCheap:0.3,dc:'Gaúcho Plains Colo'}, - {id:'sjp',name:'São José do Rio Preto',x:0,y:0,land:'sa',reg:'SA',P:25,br:true,andes:'e',ix:'IX.brrr São José do Rio Preto',ixCheap:0.3,dc:'Rio Preto Racks'}, + {id:'ria',off:true,name:'Santa Maria',x:0,y:0,land:'sa',reg:'SA',P:15,br:true,andes:'e',ix:'IX.brrr Santa Maria',ixCheap:0.3,dc:'Gaúcho Plains Colo'}, + {id:'sjp',off:true,name:'São José do Rio Preto',x:0,y:0,land:'sa',reg:'SA',P:25,br:true,andes:'e',ix:'IX.brrr São José do Rio Preto',ixCheap:0.3,dc:'Rio Preto Racks'}, {id:'slz',name:'São Luís',x:0,y:0,land:'sa',reg:'SA',P:65,br:true,andes:'e',ix:'IX.brrr São Luís',ixCheap:0.3,dc:'Reggae Island DC',note:tr('An island city of tiled colonial houses, known as Brazil’s reggae capital. Its tides are among the biggest in the country.')}, {id:'the',name:'Teresina',x:0,y:0,land:'sa',reg:'SA',P:50,br:true,andes:'e',ix:'IX.brrr Teresina',ixCheap:0.3,dc:'Sunbaked Server Hall',note:tr('The only northeastern capital away from the sea. Famously hot, with lightning storms that keep the surge protectors busy.')}, {id:'vix',name:'Vitória',x:0,y:0,land:'sa',reg:'SA',P:80,br:true,andes:'e',ix:'IX.brrr Vitória',ixCheap:0.3,dc:'Moqueca Colo',note:tr('An island capital with a big iron ore port. Its fish stew is the original, ask anyone from Espírito Santo.')}, @@ -993,7 +993,7 @@ const CITIES=[ {id:'bne',name:'Brisbane',x:0,y:0,land:'oc',reg:'OC',au:true,arpu:AU_ARPU,P:250,ix:'Bris-Vegas-IX',dc:'Sunshine State Shed',dc2:'Next-Door-DC B#',dc2N:2,note:tr('BrisVegas: big sky, a thunderstorm at four every summer afternoon, and closer to the Pacific cables than Sydney would like to admit. Megapork grew up here.')}, {id:'drw',name:'Darwin',x:0,y:0,land:'oc',reg:'OC',au:true,arpu:AU_ARPU,P:15,ix:'Gator-IX',dc:'Crocodile-proof Landing Station',note:tr('Tiny, tropical and the closest Australian city to Asia. New cables to Singapore and Jakarta land here, next to the crocodiles.')}, {id:'adl',name:'Adelaide',x:0,y:0,land:'oc',reg:'OC',au:true,arpu:AU_ARPU,P:150,ix:'Vineyard-IX',dc:'OurDC',dc2:'Next-Door-DC A1',note:tr('Twenty minutes from everything, except anywhere else.')}, - {id:'cbr',name:'Canberra',x:0,y:0,land:'oc',reg:'OC',au:true,arpu:AU_ARPU,P:50,ix:'Capital-IX',dc:'Classified Data Cupboard',dc2:'Next-Door-DC C1',note:tr('Built for the government. The data centres have more security clearances than staff, and every road ends in a roundabout.')}, + {id:'cbr',capital:true,name:'Canberra',x:0,y:0,land:'oc',reg:'OC',au:true,arpu:AU_ARPU,P:50,ix:'Capital-IX',dc:'Classified Data Cupboard',dc2:'Next-Door-DC C1',note:tr('Built for the government. The data centres have more security clearances than staff, and every road ends in a roundabout.')}, {id:'chc',name:'Christchurch',x:0,y:0,land:'nzs',reg:'OC',P:40,ix:'Garden-City-IX',dc:'Mainland Colo',note:tr('The Garden City, and the biggest city on the South Island, which locals call the Mainland with a straight face. Everything bound for the North Island crosses Cook Strait.')}, {id:'ivc',name:'Invercargill',x:0,y:0,land:'nzs',reg:'OC',P:10,ix:'',dc:'Sheargrid Makarewa',note:tr('The bottom of the country, on power lines built for an aluminium smelter. Someone is building a 280 MW AI campus in a paddock out of town, so the cables are coming. Probably.')}, {id:'hba',name:'Hobart',x:0,y:0,land:'tas',reg:'OC',au:true,arpu:AU_ARPU,P:25,ix:'Cousin-IX',dc:'Firmest',note:tr('The bottom of the map. Cool air, cheap hydro, and all of Bass Strait between you and the mainland.')}, @@ -1177,6 +1177,11 @@ function cablesOk(a,b){const ban=S&&S.ev&&S.ev.landban&&S.ev.landban.until>S.day function cablesFor(a,b){return CABLE_PAIRS.filter(c=>(c.a===a&&c.b===b)||(c.a===b&&c.b===a));} function cablePair(cid,a,b){const c=CABLE_PAIRS.find(x=>x.cid===cid&&((x.a===a&&x.b===b)||(x.a===b&&x.b===a)));if(!c)return null;return c.a===a?c:{...c,pts:c.pts.slice().reverse()};} const ALLC=CITIES.filter(c=>!c.cn&&!c.ru&&!c.ixOnly).map(c=>c.id); +/* City density: a small city (P under 60) does not sit within 300 km of a bigger city in the same country, unless it + is a cable landing or a capital (tests/regions.test.js enforces it). Cities retired by that rule are marked off: + they stay in the data so old saves keep their POPs there, but new games never see them. */ +const cityOn=id=>{const c=CITY[id];return !!c&&(!c.off||!!(S&&(S.pops[id]||S.ixp[id]!==undefined)));}; +const OFFC=ALLC.filter(c=>!CITY[c].off); const ruCity=c=>!!CITY[c].ru; const cnCity=c=>!!CITY[c].cn; const BIGC=['man','edi','bcn','mil','rom','lis','ath','atn','den','phx','bos','hou','ruh','jed','doh','kyv','mel','bne','osa','kul','bkk','sgn','khi','dac','waw','prg','vie','bud','buh','ist','rio','bue','scl','bog','lim','del','maa','blr','hyd','tpe','cpt','auh','ber','zrh','nbo','cai','jkt','mnl','per','akl','dub','lax','tor','mex','dxb','cph','icn','sjc','dal','chi','ash','nyc','mia','sao','lon','ams','fra','par','mrs','mad','sto','bom','sin','hkg','tok','syd','jnb','lag']; @@ -1652,7 +1657,7 @@ const SCN=[ {id:'carnaval',n:tr('Carnaval'),city:'rio',cash:600000,days:100,rules:{},setup:()=>{S.biz.push({id:uid(),scripted:true,city:'rio',city2:null,reqs:[],name:'Carnaval Parade in Rio de Janeiro',type:'event',bw:400,rate:0,mood:100,since:0,start:90,dur:5,fee:400*5*70});},d:tr('Rio from scratch. Carnaval starts in 90 days and wants 400 Gbps for five days straight. The whole world is watching.'),goal:tr('Deliver Carnaval in full'),ok:()=>(S.stats.evFull||0)>=1}, {id:'darien',n:tr('Mind the Gap'),city:'pan',cash:900000,days:730,rules:{},d:tr('Start in Panama City. Nothing crosses the Darién Gap by land, and the Andes are in the way of everything else.'),goal:tr('POPs in Bogotá, Lima, Santiago and São Paulo, and 150 Gbps served'),ok:()=>['bog','lim','scl','sao'].every(c=>S.pops[c])&&R.served>=150}, {id:'c2c',n:tr('Cape to Cairo'),city:'cpt',cash:2000000,days:1095,rules:{},d:tr('Cape Town. Build a network across Africa: every border wants its own permit, and half the power grids are not on your side.'),goal:tr('A path from Cape Town to Cairo, POPs in Lagos and Nairobi, and 150 Gbps served'),ok:()=>pathExists('cpt','cai')&&S.pops.lag&&S.pops.nbo&&R.served>=150}, - {id:'ixbr',n:tr('Order and Progress'),city:'sao',cash:2500000,days:1095,rules:{},d:tr('São Paulo. Brazil is a continent: forty IX.brrr exchanges, thousands of provedores, and the Amazon between you and the north.'),goal:tr('Ports on 20 IX.brrr exchanges, one of them in Manaus, and 200 Gbps served'),ok:()=>brIxN()>=20&&S.ixp.mao!==undefined&&R.served>=200}, + {id:'ixbr',n:tr('Order and Progress'),city:'sao',cash:2500000,days:1095,rules:{},d:tr('São Paulo. Brazil is a continent: forty IX.brrr exchanges, thousands of provedores, and the Amazon between you and the north.'),goal:tr('Ports on 15 IX.brrr exchanges, one of them in Manaus, and 200 Gbps served'),ok:()=>brIxN()>=15&&S.ixp.mao!==undefined&&R.served>=200}, {id:'gangnam',n:tr('Gangnam Style Peering'),city:'icn',cash:900000,days:365,rules:{},d:tr('Seoul. The fastest, hungriest eyeballs on Earth, transit at four times the price, and three incumbents who bill you for every gigabit you send them.'),goal:tr('99% reach and 200 Gbps served without going broke'),ok:()=>R.reach>=0.99&&R.served>=200}, {id:'flood',n:tr('Flood Season'),city:'ams',cash:2000000,days:365,rules:{ddos:true},setup:()=>{S.lvl=Math.max(S.lvl||1,3);},d:tr('Amsterdam, hosting capital of Europe, in peak botnet season. Every smart toaster, baby monitor and unpatched fridge on Earth has picked a side, and it is not yours. A flood every few days, more and more of them in the terabits, while everything else keeps breaking too. You start with bigger gear unlocked, and you will need it.'),goal:tr('Hold 20 floods, 5 of them over 1 Tbps, keeping the city under attack at 97% or better'),ok:()=>(S.stats.ddosOk||0)>=20&&(S.stats.ddosOkBig||0)>=5}, {id:'fttb',n:tr('Fibre to the Basement'),city:'syd',cash:1500000,days:730,rules:{levy:true},d:tr('Sydney, 2013. The Toilet Paper Group ran its own fibre into apartment basements, and the national network cried cherry-picking. Your turn: skip the Nearly Broadband Network, pay the levy, and get there first.'),goal:tr('Broadband in Sydney, Melbourne, Brisbane, Adelaide and Perth, and two different cables overseas'),ok:()=>AU_BB.every(c=>S.pops[c]&&S.pops[c].bb)&&auExits()>=2}, @@ -2640,9 +2645,9 @@ function spawnMega(t,T,nm,mine){ function spawnSpecial(t){const T=BIZ_T[t],mine=Object.keys(S.pops),lv=S.lvl||1; const nm=()=>{const list=T.names.filter(n=>!S.usedNames.includes(n));const n=list.length?pick(list):pick(T.names);S.usedNames.push(n);return n;}; if(T.mega){spawnMega(t,T,nm,mine);return;} - if(T.event){const city=Math.random()<0.85&&mine.length?pick(mine):pick(ALLC);const bw=pick(T.opts.slice(0,Math.min(T.opts.length,lv+2)));const dur=3+Math.floor(Math.random()*5),start=S.day+12+Math.floor(Math.random()*14); + if(T.event){const city=Math.random()<0.85&&mine.length?pick(mine):pick(OFFC);const bw=pick(T.opts.slice(0,Math.min(T.opts.length,lv+2)));const dur=3+Math.floor(Math.random()*5),start=S.day+12+Math.floor(Math.random()*14); S.offers.push({id:uid(),city,city2:null,name:tr('{name} in {city}',{name:nm(),city:CITY[city].name}),type:t,bw,rate:0,reqs:[],start,dur,fee:Math.round(bw*dur*70),exp:start-2});return;} - if(T.sdwan){const hub=pick(mine),n=3+Math.floor(Math.random()*4),pool=(Math.random()<0.85?mine:ALLC).filter(c=>c!==hub),sites=[hub]; + if(T.sdwan){const hub=pick(mine),n=3+Math.floor(Math.random()*4),pool=(Math.random()<0.85?mine:OFFC).filter(c=>c!==hub),sites=[hub]; while(sites.lengthl.kind==='df'&&l.ready<=S.day); @@ -3103,8 +3108,8 @@ function spawnOffer(){ const base=pick(BIZ_N.filter(n=>!S.usedNames.includes(n)).concat(BIZ_N)).replace(/ (Inc\.|Co\.|Ltd)$/,'');const name=tr('{name} via {fab}',{name:base,fab:FAB[prov].name});S.usedNames.push(base); const rate=T.l2?Math.round((150+kmBetween(city,city2)*0.08)*T.km):T.rate; S.offers.push({id:uid(),city,city2,prov,name,type:t,bw,rate,reqs:['nni'],exp:S.day+40});return;} - let city=(Math.random()<0.65&&mine.length)?pick(mine):pick(ALLC.concat(cnOk()?['pek','sha']:[])),city2=null; - if(T.l2){city=pick(mine);const pool=(Math.random()<(T.lv>=3?0.8:0.6)?mine:ALLC).filter(c=>c!==city);city2=pick(pool.length?pool:ALLC.filter(c=>c!==city));} + let city=(Math.random()<0.65&&mine.length)?pick(mine):pick(OFFC.concat(cnOk()?['pek','sha']:[])),city2=null; + if(T.l2){city=pick(mine);const pool=(Math.random()<(T.lv>=3?0.8:0.6)?mine:OFFC).filter(c=>c!==city);city2=pick(pool.length?pool:OFFC.filter(c=>c!==city));} let bw=T.lv>=2?pick(T.opts):pick(T.opts.slice(0,mine.length>=4?4:3)); const list=(T.names||BIZ_N).filter(n=>!S.usedNames.includes(n)); let name=list.length?pick(list):(T.names?pick(T.names):'Startup #'+Math.floor(Math.random()*999)); @@ -3257,7 +3262,7 @@ const ACT={ logAll:()=>{UI.logAll=!UI.logAll;renderLeft();}, focusCity:({city})=>{selectCity(city);const C=CITY[city];cam.x=C.x;cam.y=C.y;cam.z=Math.max(cam.z,1.2);if(innerWidth<760)UI.leftOpen=false;renderLeft();}, selLink:({id})=>selectLink(id), - buildPop:({city})=>{if(S.pops[city])return;const flipNote=CITY[city]&&CITY[city].au;if(cnCity(city)&&!cnOk()){toast(tr('You need a license first.
Foreign networks need a joint venture to build in mainland China.'),'bad');sfx('err');return;}if(!spend(popCost(city)))return;S.pops[city]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false};floater(CITY[city].x,CITY[city].y-30,tr('New POP!'),'#FF4F9A');if(flipNote)toast(pick([tr('Router installed in {city}.
Upside down, as is customary down here. The packets don’t seem to mind.',{city:CITY[city].name}),tr('Router installed in {city}.
The vendor shipped it the right way up, so the local techs turned it over. Everything else here is upside down too.',{city:CITY[city].name})]),'good',[],{a:'city',v:city});UI.tab='cust';after();}, + buildPop:({city})=>{if(S.pops[city]||!cityOn(city))return;const flipNote=CITY[city]&&CITY[city].au;if(cnCity(city)&&!cnOk()){toast(tr('You need a license first.
Foreign networks need a joint venture to build in mainland China.'),'bad');sfx('err');return;}if(!spend(popCost(city)))return;S.pops[city]={day:S.day,bb:null,boost:0,down:0,routers:1,gen:false};floater(CITY[city].x,CITY[city].y-30,tr('New POP!'),'#FF4F9A');if(flipNote)toast(pick([tr('Router installed in {city}.
Upside down, as is customary down here. The packets don’t seem to mind.',{city:CITY[city].name}),tr('Router installed in {city}.
The vendor shipped it the right way up, so the local techs turned it over. Everything else here is upside down too.',{city:CITY[city].name})]),'good',[],{a:'city',v:city});UI.tab='cust';after();}, launchBB:({city})=>{const p=S.pops[city];if(!p||p.bb)return;const C=CITY[city];if(!spend(bbCost(city)))return;p.bb={d:bbStart(city)};floater(C.x,C.y-30,tr('Eyeballs online!'),'#16A866');after();}, ad:({city})=>{const p=S.pops[city];if(!p||!p.bb)return;if(!spend(8000))return;p.boost=S.day+30;floater(CITY[city].x,CITY[city].y-30,tr('Ad campaign!'),'#FF8A3D');after();}, buyTransit:({city,net,tier})=>{tier=+tier;if(scnRule('noTransit')){toast(tr('No transit in this scenario.
Peering, PNIs, caches and your own fiber only.'),'bad');sfx('err');return;}if(!S.pops[city]||!NET[net]||!sellsAt(NET[net],city)||!PORT[tier])return;if(!portOk(city,tier)){toast(tr("Your router can't take a {port} port.
Upgrade it in the Infra tab.",{port:PORT[tier].n}),'bad');sfx('err');return;}const ex=S.transit.find(t=>t.city===city&&t.net===net);if(ex&&tier<=ex.tier)return;if(!portGate(city,ex?(PORT_SLOT(tier)-PORT_SLOT(ex.tier))*(ex.n||1):PORT_SLOT(tier)))return;if(!spend(PORT[tier].setup*(ex&&ex.n||1)))return;if(ex)ex.tier=tier;else S.transit.push({id:uid(),city,net,tier,down:0});toast(tr('{net} transit is live in {city}.
Full table received: ~1,000,000 routes.',{net:esc(NET[net].name),city:CITY[city].name}),'good');after();}, @@ -4009,7 +4014,7 @@ const pSrv=g=>({l:tr('Traffic served'),v:R.served,max:g,txt:`${fmtG(R.served)} / const pReach=()=>({l:tr('Reach'),v:R.reach,max:0.99,txt:`${pct(R.reach)} / 99%`}); const pChk=(l,ok)=>({l,v:ok?1:0,max:1,txt:ok?'✓':'—'}); const SCN_PROG={stg:()=>[{l:tr('Reach'),v:R.reach,max:0.45,txt:`${pct(R.reach)} / 45%`},pSrv(300)],redsea:()=>{const g=asiaG(),n=S.stats.asiaRun||0;return [pChk(tr('A path from Marseille to Singapore'),pathExists('mrs','sin')),{l:tr('Your traffic to and from Asia'),v:Math.min(g,RS_G),max:RS_G,txt:`${fmtG(g)} / ${fmtG(RS_G)}`},{l:tr('Days in a row at {g} or more',{g:fmtG(RS_G)}),v:n,max:RS_DAYS,txt:`${n} / ${RS_DAYS}`}];},spat:()=>[pReach(),pSrv(150)], - carnaval:()=>[pChk(tr('Carnaval delivered in full'),(S.stats.evFull||0)>=1)],ixbr:()=>{const n=brIxN();return [{l:tr('IX.brrr ports'),v:n,max:20,txt:`${n} / 20`},pChk(tr('A port on IX.brrr Manaus'),S.ixp.mao!==undefined),pSrv(200)];}, + carnaval:()=>[pChk(tr('Carnaval delivered in full'),(S.stats.evFull||0)>=1)],ixbr:()=>{const n=brIxN();return [{l:tr('IX.brrr ports'),v:n,max:15,txt:`${n} / 15`},pChk(tr('A port on IX.brrr Manaus'),S.ixp.mao!==undefined),pSrv(200)];}, c2c:()=>[pChk(tr('A path from Cape Town to Cairo'),pathExists('cpt','cai')),...['lag','nbo'].map(c=>pChk(tr('POP in {city}',{city:CITY[c].name}),!!S.pops[c])),pSrv(150)], pac:()=>[pChk(tr('1.6T on every hop from Los Angeles to Sydney'),fastPath('lax','syd',1600)),pChk(tr('A path from Los Angeles to Tokyo'),pathExists('lax','tok')),pSrv(150)], atl:()=>[pChk(tr('1.6T on every hop from Miami to Madrid'),fastPath('mia','mad',1600)),pChk(tr('1.6T on every hop from Lisbon to Lagos'),fastPath('lis','lag',1600)),pSrv(100)], @@ -4035,8 +4040,8 @@ function lvlCard(){const lv=S.lvl||1,nx=LEVELS[lv]; /* ---------- where to meet a network (#12, #111, #121) ---------- */ // Static: the cities where a network takes PNIs and the exchanges it sits on. Built once, on first use. let PLACES=null; -function netPlaces(id){if(!PLACES){PLACES={};for(const n of NETS)PLACES[n.id]={p:n.pops.filter(c=>CITY[c]),x:[]}; - for(const c of CITIES)if(c.ix)for(const n of NETS)if(n.ix==='ALL'||(Array.isArray(n.ix)&&n.ix.includes(c.id)))PLACES[n.id].x.push(c.id); +function netPlaces(id){if(!PLACES){PLACES={};for(const n of NETS)PLACES[n.id]={p:n.pops.filter(c=>CITY[c]&&!CITY[c].off),x:[]}; + for(const c of CITIES)if(c.ix&&!c.off)for(const n of NETS)if(n.ix==='ALL'||(Array.isArray(n.ix)&&n.ix.includes(c.id)))PLACES[n.id].x.push(c.id); for(const X of XIX)for(const m of X.members)if(PLACES[m])PLACES[m].x.push(X.id);}return PLACES[id];} // km from each city to your nearest POP, cached until the set of POPs changes. let NEARK='',NEARM=null; @@ -4878,7 +4883,7 @@ function draw(now){ // cities UI.feed=null;if(UI.sel&&UI.sel.type==='link'){const sl=S.links.find(x=>x.id===UI.sel.id);const rec=sl&&R.ef[edgeKey(sl)];if(rec){UI.feed=new Set(Object.keys(rec.eg).map(k=>R.egDesc[k].city));UI.dest=new Set(Object.keys(rec.dst));}} // Place labels: your POPs and the selected city first, then others; a label that would overlap moves above its city or hides. - const vis=[];for(const C of CITIES)for(const k of ks){const [sx,sy]=toS(C.x,C.y,k);if(sx<-60||sx>CW+60||sy<-60||sy>CH+60)continue;vis.push({C,sx,sy});} + const vis=[];for(const C of CITIES){if(C.off&&!cityOn(C.id))continue;for(const k of ks){const [sx,sy]=toS(C.x,C.y,k);if(sx<-60||sx>CW+60||sy<-60||sy>CH+60)continue;vis.push({C,sx,sy});}} const prio=v=>(UI.sel&&UI.sel.type==='city'&&UI.sel.id===v.C.id?0:S.pops[v.C.id]?1:2);vis.sort((a,b)=>prio(a)-prio(b)||b.C.P-a.C.P); const rects=[],labs=[],hit=(r)=>rects.some(q=>r.x { const { ev, errors } = load(); - ev("ACT.start({city:'sao'});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;for(const c of ['poa','fln'])ACT.buildPop({city:c});UI.pending=null;UI.via=null;UI.lmode='wave';UI.route='main';openLinkModal('poa','fln');ACT.buildLink({tier:1});closeModal()"); + ev("ACT.start({city:'sao'});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;for(const c of ['cpq'])ACT.buildPop({city:c});UI.pending=null;UI.via=null;UI.lmode='wave';UI.route='main';openLinkModal('sao','cpq');ACT.buildLink({tier:1});closeModal()"); assert.ok(ev('ZMAX') >= 16); - const id = ev("S.links.find(l=>l.a==='poa'||l.b==='poa').id"); + const id = ev("S.links.find(l=>l.a==='sao'||l.b==='sao').id"); // the middle of the drawn link, on screen, fully zoomed in on it const at = (z) => JSON.parse(ev(`(()=>{const l=S.links.find(x=>x.id==='${id}'),g=linkGeom(l,pairIdx().get(edgeKey(l))),p=g.pts[Math.floor(g.pts.length/2)]; - cam.x=p[0];cam.y=p[1];cam.z=1;zoomAt(CW/2,CH/2,${z});const [sx,sy]=toS(p[0],p[1],visibleKs()[0]);const c=toS(CITY.poa.x,CITY.poa.y,visibleKs()[0]);return JSON.stringify({sx,sy,cx:c[0],cy:c[1],z:cam.z});})()`)); + cam.x=p[0];cam.y=p[1];cam.z=1;zoomAt(CW/2,CH/2,${z});const [sx,sy]=toS(p[0],p[1],visibleKs()[0]);const c=toS(CITY.sao.x,CITY.sao.y,visibleKs()[0]);return JSON.stringify({sx,sy,cx:c[0],cy:c[1],z:cam.z});})()`)); const m = at(100); assert.equal(m.z, ev('ZMAX'), 'zoom stops at the new maximum'); assert.equal(ev(`pickCity(${m.sx},${m.sy})`), null, 'the middle of the link is not grabbed by a city'); assert.equal(ev(`hitLink(${m.sx},${m.sy})`), id); - assert.equal(ev(`pickCity(${m.cx},${m.cy-4}).id`), 'poa', 'tapping the city icon still picks the city'); + assert.equal(ev(`pickCity(${m.cx},${m.cy-4}).id`), 'sao', 'tapping the city icon still picks the city'); // even at the old maximum, a click on the link now picks the link where it is not under a city icon const o = at(6); assert.ok(Math.abs(o.z - 6) < 1e-9); diff --git a/tests/regions.test.js b/tests/regions.test.js index 0dd91b4..f7cd3a6 100644 --- a/tests/regions.test.js +++ b/tests/regions.test.js @@ -1044,3 +1044,26 @@ test('an old save with Australian POPs is told once that Australia changed', () assert.doesNotMatch(c.ev("S.log.map(e=>e.t).join(' | ')"), /Australia got more/); assert.deepEqual(errors, []); }); + +test('city density: no small city crowds a bigger one, Brazil is slimmer than Europe, and old saves keep retired cities', () => { + const { ev, errors } = load(); + // A small city (P < 60) never sits within 300 km of a bigger city in the same country, unless it is a cable landing or a capital. + const bad = JSON.parse(ev(`JSON.stringify((()=>{const ctry=c=>c.cc||(c.br&&'BR')||(c.au&&'AU')||(c.ca&&'CA')||'land:'+c.land,out=[]; + for(const c of CITIES){if(c.off||c.P>=60||c.capital||landing(c.id))continue; + for(const o of CITIES)if(o!==c&&!o.off&&o.P>c.P&&ctry(o)===ctry(c)&&kmBetween(c.id,o.id)<300)out.push(c.id+' near '+o.id+' ('+kmBetween(c.id,o.id)+' km)');} + return out;})())`)); + assert.deepEqual(bad, [], 'add a bigger city, a capital flag or a cable landing, or mark it off'); + const br = ev("CITIES.filter(c=>c.br&&!c.off).length"), eu = ev("CITIES.filter(c=>c.reg==='EU'&&!c.off).length"); + assert.ok(br < eu * 0.7, `Brazil (${br}) well below Europe (${eu})`); + // a new game never shows or offers a retired city + ev("ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0"); + assert.equal(ev("cityOn('cpv')"), false); + assert.equal(ev("OFFC.includes('cpv')"), false); + assert.equal(ev("NETS.some(n=>{const p=netPlaces(n.id);return p.x.includes('cpv')||p.p.includes('cpv');})"), false); + // an old save with a POP there keeps it, on the map and in routing + ev("ACT.buildPop({city:'rec'});S.pops.cpv={day:0,bb:{d:5},boost:0,down:0,routers:1,gen:false};const o=JSON.parse(JSON.stringify(S));S=migrate(o);compute()"); + assert.ok(ev("!!S.pops.cpv&&cityOn('cpv')")); + assert.ok(ev("R.cityDem.cpv>0")); + ev('cam.x=CITY.cpv.x;cam.y=CITY.cpv.y;cam.z=6;draw(0)'); + assert.deepEqual(errors, []); +});