From 13a29c2c2a7562a649e0cb1869d191e79dd20f2d Mon Sep 17 00:00:00 2001
From: Florian Krieger
Date: Sun, 25 Oct 2026 15:38:10 +0100
Subject: [PATCH 001/546] Add on-demand single-link redundancy checks
---
CHANGELOG.md | 2 ++
site/i18n/it.js | 13 +++++++++++++
site/index.html | 24 +++++++++++++++++++++---
tests/issues.test.js | 17 +++++++++++++++++
4 files changed, 53 insertions(+), 3 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 5c36434..bf32aa0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
+- Check a selected link’s redundancy against current demand: see disconnected endpoints, additional service loss and full fallback links without changing the live network.
+
## [1.25.2] — 2026-10-25
- Tier 1 networks can lay their own subsea cable (#22). Pick two cities with a
diff --git a/site/i18n/it.js b/site/i18n/it.js
index 8a0542a..46aeda8 100644
--- a/site/i18n/it.js
+++ b/site/i18n/it.js
@@ -2248,4 +2248,17 @@
"Replace ten of them and the cable pays for itself in about {n} months.":"Sostituiscine dieci e il cavo si ripaga in circa {n} mesi.",
"Cuts still happen, anchors and sharks included, but the repair ship is yours to call.":"I tagli succedono lo stesso, ancore e squali compresi, ma la nave di riparazione la chiami tu.",
"Lay the cable {price}":"Posa il cavo {price}",
+"This backhoe wins.":"Questa ruspa vince.",
+"Connected, but tight.":"Connesso, ma al limite.",
+"One backhoe is not enough.":"Una ruspa non basta.",
+"Redundancy check":"Verifica della ridondanza",
+"No alternate backbone path connects these endpoints if this link fails.":"Se questo collegamento si interrompe, nessun percorso alternativo della dorsale collega questi estremi.",
+"An alternate path exists, but current routing and capacity deliver less traffic.":"Esiste un percorso alternativo, ma con routing e capacità attuali viene consegnato meno traffico.",
+"With current demand and routing, this link can fail without additional traffic loss.":"Con domanda e routing attuali, questo collegamento può interrompersi senza ulteriori perdite di traffico.",
+"Additional traffic lost":"Ulteriore traffico perso",
+"Service affected":"Servizio interessato",
+"Full links during the test":"Collegamenti saturi durante il test",
+"Snapshot only: one selected link fails. Other links on the same cable, trench or fabric stay up. Existing outages and routing rules still apply. No time, money or game state is changed.":"Solo un’istantanea: si interrompe il collegamento selezionato. Gli altri collegamenti sullo stesso cavo, scavo o fabric restano attivi. I guasti e le regole di routing esistenti si applicano comunque. Tempo, denaro e stato della partita non cambiano.",
+"What happens if this link fails right now?":"Cosa succede se questo collegamento si interrompe adesso?",
+"Check redundancy":"Verifica ridondanza",
};
diff --git a/site/index.html b/site/index.html
index 44a609b..ab5b4aa 100644
--- a/site/index.html
+++ b/site/index.html
@@ -427,6 +427,7 @@ button,.chip,.b,a{touch-action:manipulation;-webkit-tap-highlight-color:transpar
#coach{top:auto !important;bottom:calc(var(--tabbar) + 8px);width:calc(100% - 16px);padding:7px 10px;font-size:13px}
body.sheet-open #coach{bottom:calc(var(--tabbar) + 8px + min(62vh,520px))}
#modal{align-items:end;padding:0}
+ #modal.link-check{bottom:var(--tabbar)}
#modal .cta{position:sticky;bottom:calc(-16px - env(safe-area-inset-bottom,0px));z-index:1;background:var(--paper);margin:12px -16px 0 !important;padding:10px 16px calc(10px + env(safe-area-inset-bottom,0px));border-top:2px solid var(--line)}
.title-art h1{font-size:34px}.title-art svg{width:54px;height:54px}
.tagline{font-size:13.5px;margin:8px 0 10px}
@@ -2443,6 +2444,7 @@ function checkGoals(){checkBadges();
/* ================= ACTIONS ================= */
function spend(c){if(S.cashNot enough cash. Wait for revenue, or speed up time.'),'bad');sfx('err');return false;}S.cash-=c;sfx('build');return true;}
const ACT={
+ linkCheck:({id})=>{const l=S.links.find(x=>x.id===id);if(!l||linkDown(l))return;linkCheckModal(l);},
speed:({v})=>{v=+v;if(![0,0.5,1,2,4,8].includes(v))return;if(v)UI.lastSpeed=v;UI.speed=v;renderHUD();},
help:()=>showHelp(),
dash:()=>{if(!S)return;const d=$('dash');d.hidden=!d.hidden;if(!d.hidden)renderDash();},
@@ -2470,7 +2472,7 @@ const ACT={
tab:({t})=>{UI.tab=t;UI.confirm=null;renderPanel();},
leftTab:({t})=>{UI.left=t;UI.leftOpen=true;renderLeft();},
toggleLeft:()=>{UI.leftOpen=!UI.leftOpen;renderLeft();},
- phoneTab:({t})=>{if(!['goals','deals','noc','nets'].includes(t))return;haptic(8);if(UI.leftOpen&&UI.left===t&&!UI.sel){UI.leftOpen=false;}else{UI.left=t;UI.leftOpen=true;UI.sel=null;renderPanel();}$('left').classList.remove('full');renderLeft();},
+ phoneTab:({t})=>{if(!['goals','deals','noc','nets'].includes(t))return;if($('modal').classList.contains('link-check'))closeModal();haptic(8);if(UI.leftOpen&&UI.left===t&&!UI.sel){UI.leftOpen=false;}else{UI.left=t;UI.leftOpen=true;UI.sel=null;renderPanel();}$('left').classList.remove('full');renderLeft();},
phonePlay:()=>{haptic(10);if(UI.speed){UI.lastSpeed=UI.speed;UI.speed=0;}else UI.speed=UI.lastSpeed||1;renderHUD();},
phoneSpeed:()=>{haptic(8);const cur=UI.speed||UI.lastSpeed||1,i=SPEEDS.indexOf(cur),n=SPEEDS[(i+1)%SPEEDS.length];UI.speed=n;UI.lastSpeed=n;renderHUD();},
install:()=>{if(installEvt){installEvt.prompt();installEvt.userChoice.finally(()=>{installEvt=null;});return;}
@@ -3041,9 +3043,25 @@ function vxcPanel(l){
return h;
}
function prefCtl(kind,id,cur){cur=cur||'normal';return `
${t.split?tr('No alternate backbone path connects these endpoints if this link fails.'):t.loss>.01?tr('An alternate path exists, but current routing and capacity deliver less traffic.'):tr('With current demand and routing, this link can fail without additional traffic loss.')}
${tr('Additional traffic lost')}${fmtG(t.loss)}
${t.losses.length?`
${tr('Service affected')}
${t.losses.map(x=>`
${esc(x.name)}−${fmtG(x.g)}
`).join('')}`:''}${t.busy.length?`
${tr('Full links during the test')}
${t.busy.slice(0,6).map(x=>`
${esc(x.name)}${fmtG(x.g)} / ${fmtG(x.cap)}
`).join('')}`:''}
${tr('Snapshot only: one selected link fails. Other links on the same cable, trench or fabric stay up. Existing outages and routing rules still apply. No time, money or game state is changed.')}
${tr('What happens if this link fails right now?')}
${btn(tr('Check redundancy'),'linkCheck',{id:l.id},'ghost sm',linkDown(l))}`;}
function trafficSection(l){
const rec=R.ef[edgeKey(l)],n=pairLinks(l.a,l.b).length;
- let h=`
${tr("What's on this link")}
`;
+ let h=linkCheckControl(l)+`
${tr("What's on this link")}
`;
if(!rec){return h+`
${tr('No traffic right now.')}
`;}
const tot=Object.values(rec.net).reduce((a,b)=>a+b,0)||1;
const nets=Object.entries(rec.net).sort((a,b)=>b[1]-a[1]);
@@ -3297,7 +3315,7 @@ function toast(html,kind='',actions=[]){
const markLayer=()=>{UI.layerAt=performance.now();};
// Which layers are open: when that changes (a sheet, the dashboard, the bank, a selection), taps in flight are void.
function checkLayer(){const q=id=>{const e=$(id);return e?(e.hidden?0:1):0;},sig=[q('modal'),q('dash'),q('bankBox'),UI.leftOpen?1:0,UI.left||'',UI.sel?UI.sel.type+UI.sel.id:'',UI.tab||''].join('|');if(sig!==UI._layer){UI._layer=sig;markLayer();}}
-function openModal(html){if($('modal').hidden)markLayer();$('modalCard').innerHTML=html;$('modal').hidden=false;}
+function openModal(html,cls=''){$('modal').className=cls;$('modalCard').setAttribute('aria-modal',cls==='link-check'&&isPhone()?'false':'true');if($('modal').hidden)markLayer();$('modalCard').innerHTML=html;$('modal').hidden=false;}
function closeModal(){if(!$('modal').hidden)markLayer();$('modal').hidden=true;UI.pending=null;}
const NETWORK_NAMES=[
'Packet Pals','Shinternet','Post, Telegraph & Tubes','Peering Pressure','Best Effort Telecom',
diff --git a/tests/issues.test.js b/tests/issues.test.js
index 13b30b8..06bfc03 100644
--- a/tests/issues.test.js
+++ b/tests/issues.test.js
@@ -539,3 +539,20 @@ test('#35 your own trench can light another fiber pair once a ROADMaster is full
assert.equal(ev('S.links[0].pairs'), 4, 'saves are clamped to four pairs');
assert.deepEqual(errors, []);
});
+
+test('link redundancy trials distinguish a bridge, a full fallback and a healthy alternate path without changing the game',()=>{
+ const {ev,errors}=load();
+ ev("ACT.start({});S.cash=1e8;ACT.buildPop({city:'bde'});ACT.buildPop({city:'ams'});S.biz=[{id:'circuit',name:'Test Circuit',type:'l2vpn',city:'fra',city2:'bde',bw:80,rate:1,reqs:[]}];S.links=[{id:'main',a:'fra',b:'bde',kind:'wave',tier:1,km:100,mo:100,cut:0,trench:'main'}];compute();window.state=JSON.stringify(S);window.live=R;window.hot=UI.hotMap;window.cache=TE_CACHE");
+ let t=JSON.parse(ev("JSON.stringify(linkTrial('main'))"));assert.equal(t.split,true);assert.equal(t.loss,80);
+ assert.equal(ev('JSON.stringify(S)'),ev('state'));assert.equal(ev('R===live&&UI.hotMap===hot&&TE_CACHE===cache'),true);
+ ev("S.links.push({id:'a',a:'fra',b:'ams',kind:'wave',tier:0,km:100,mo:100,cut:0},{id:'b',a:'ams',b:'bde',kind:'wave',tier:0,km:100,mo:100,cut:0});compute()");
+ t=JSON.parse(ev("JSON.stringify(linkTrial('main'))"));assert.equal(t.split,false);assert.equal(t.loss,70);assert.equal(t.busy.length,2);
+ ev("S.links[1].tier=1;S.links[2].tier=1;compute()");t=JSON.parse(ev("JSON.stringify(linkTrial('main'))"));assert.equal(t.split,false);assert.equal(t.loss,0);
+ ev("S.links[1].cut=S.day+5;compute()");assert.equal(ev("linkTrial('main').split"),true,'existing failures are respected');assert.equal(ev("linkTrial('a')"),null,'an already failed link is not tested');
+ ev("S.links=S.links.slice(0,1);S.links.push({...S.links[0],id:'parallel'});compute()");assert.equal(ev("linkTrial('main').split"),false,'only the selected link fails even when a trench is shared');assert.equal(ev("linkTrial('main').loss"),0);
+ ev("S.links[0]={...S.links[0],kind:'df',sys:'roadm',ch:['tp16'],pairs:1,regen:0,ready:0,own:true};compute()");assert.equal(ev("linkTrial('main').loss"),0,'dark fiber is tested as one link');
+ ev("window.innerWidth=360;ACT.linkCheck({id:'main'})");assert.match(ev("$('modalCard').textContent"),/One backhoe is not enough/);assert.equal(ev("$('modal').className"),'link-check');ev("ACT.phoneTab({t:'noc'})");assert.equal(ev("$('modal').hidden"),true);
+ ev("S.links[0]={...S.links[0],kind:'vxc',vt:1,prov:FABS[0].id};compute()");assert.equal(ev("linkTrial('main').loss"),0,'virtual circuits are tested individually');
+ ev("window.saveRef=S;window.liveRef=R;window.originalCompute=compute;compute=()=>{throw Error('trial failed')}");assert.throws(()=>ev("linkTrial('main')"),/trial failed/);ev('compute=originalCompute');assert.equal(ev('S===saveRef&&R===liveRef'),true,'even a failed trial restores the live state');
+ assert.deepEqual(errors,[]);
+});
From af155f27bb504086376a474053dbaca3d3f88ac7 Mon Sep 17 00:00:00 2001
From: clayberF <49653677+clayberF@users.noreply.github.com>
Date: Sun, 25 Oct 2026 22:38:19 -0300
Subject: [PATCH 002/546] Calibrate city prices with PeeringDB and Hurricane
Electric data
CITY_PDB holds, per city, the carrier-neutral facilities and network
presences from PeeringDB (within 50 km or same city name) and the ASN
count of its country from bgp.he.net, pulled 2026-10-25.
- Transit: the regional multiplier is scaled by competition, up to 1.8x
where few networks are present. Hubs (1000+ presences) are unchanged,
and hand-set markets (Korea, Belgian red tape) keep their price.
- POPs: 1.25x to build and run with one or two facilities, 1.5x with none.
- Offers: countries with 2000+ ASNs bring extra ISP customers.
---
CHANGELOG.md | 2 ++
site/i18n/it.js | 1 +
site/i18n/pt.js | 1 +
site/index.html | 24 +++++++++++++++++++-----
tests/regions.test.js | 16 ++++++++++++++++
5 files changed, 39 insertions(+), 5 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 04b01be..e476617 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
+- Prices now follow how connected each city really is, based on PeeringDB and Hurricane Electric data. Transit costs up to 1.8× more in cities where few networks are present, a POP costs 1.25× to 1.5× where there is little or no carrier-neutral data center, and countries with thousands of networks, like Brazil and the US, bring more ISP customers. Big hubs such as Frankfurt, Amsterdam, New York and São Paulo keep their prices.
+
## [1.30.0] — 2026-10-26
- Twelve Pacific islands join the map: Honolulu, Guam, Koror, Majuro, Port Moresby, Honiara, Nouméa, Suva, Nuku’alofa, Apia, Pago Pago and Papeete. The cables across the Pacific now stop where they really land, and a POP on an island splits a long crossing into shorter hops that each carry more: California to Sydney goes from 400G to 1.6T per wave via Honolulu and Suva, Hong Kong and Manila to Los Angeles from 400G to 800G via Guam, and Santiago to Sydney from 400G to 800G via Tahiti. Twelve new cables, among them SEA-US Later, Echo-Chamber and Coral Sea Shanty, link the islands, and the old ones gain island stops. Only islands with a real exchange today get one: Honolulu, Guam, Suva, Nouméa and Honiara. Island telcos from Hawaiian Telecombo to Never Too Atoll join the networks, PacNOG meets in Suva every December, Guam, Port Moresby and Honiara have unreliable power, Tonga’s cable has a volcano for a neighbour, and a new scenario, Stepping Stones, asks you to hop the Pacific at 1.6T.
diff --git a/site/i18n/it.js b/site/i18n/it.js
index 47d9ec7..4a15669 100644
--- a/site/i18n/it.js
+++ b/site/i18n/it.js
@@ -2585,4 +2585,5 @@
"The seabed off Tonga slid down a slope and took your {a}–{b} cable with it. The repair ship is coming from Papua New Guinea.":"Il fondale al largo di Tonga è franato giù per un pendio e si è portato via il tuo cavo {a}–{b}. La nave di riparazione arriva dalla Papua Nuova Guinea.",
"Tonga hangs on one cable from Fiji. In 2022 an undersea volcano cut it, and the country was offline for weeks.":"Tonga è appesa a un solo cavo dalle Figi. Nel 2022 un vulcano sottomarino l’ha tranciato e il paese è rimasto offline per settimane.",
"Tonga’s own telco. Lived through a volcano that cut its only cable, and jokes about it now.":"La telco di Tonga. È sopravvissuta a un vulcano che le ha tranciato l’unico cavo, e ora ci scherza su.",
+"Few data centers: POPs {x}×":"Pochi data center: POP {x}×",
};
diff --git a/site/i18n/pt.js b/site/i18n/pt.js
index b0f10d6..3d2e1f3 100644
--- a/site/i18n/pt.js
+++ b/site/i18n/pt.js
@@ -2585,4 +2585,5 @@
"The seabed off Tonga slid down a slope and took your {a}–{b} cable with it. The repair ship is coming from Papua New Guinea.":"O fundo do mar perto de Tonga deslizou encosta abaixo e levou junto o seu cabo {a}–{b}. O navio de reparo está vindo de Papua-Nova Guiné.",
"Tonga hangs on one cable from Fiji. In 2022 an undersea volcano cut it, and the country was offline for weeks.":"Tonga depende de um único cabo vindo de Fiji. Em 2022 um vulcão submarino o cortou, e o país ficou offline por semanas.",
"Tonga’s own telco. Lived through a volcano that cut its only cable, and jokes about it now.":"A operadora de Tonga. Sobreviveu a um vulcão que cortou seu único cabo e hoje faz piada disso.",
+"Few data centers: POPs {x}×":"Poucos data centers: POPs {x}×",
};
diff --git a/site/index.html b/site/index.html
index 35f84e6..47d0019 100644
--- a/site/index.html
+++ b/site/index.html
@@ -599,7 +599,7 @@ const SITE2_COST=45000,SITE2_MO=3000,TE_COST=60000,TE_MO=4000;
const SITE2_N=[tr('The Other Building'),tr('Campus B (the one with parking)'),tr('Across-the-River DC'),tr('The Annex'),tr('Suburban Mega-shed'),tr('The Cheaper One'),tr('Formerly a Shopping Mall'),tr('Bunker Two')];
const siteName=(c,s)=>s==='b'?SITE2_N[hstr(c)%SITE2_N.length]:CITY[c].dc;
const BE_TAPE=30000;
-const popCost=c=>POP_COST+(c&&CITY[c]&&CITY[c].tape?BE_TAPE:0)+(c&&CITY[c]&&CITY[c].ru?RU_BOX:0)+(c&&CITY[c]&&CITY[c].uae?UAE_LIC:0)+(c&&CITY[c]&&CITY[c].saudi?KSA_LIC:0);
+const popCost=c=>Math.round(POP_COST*(c&&CITY[c]?colo(c):1))+(c&&CITY[c]&&CITY[c].tape?BE_TAPE:0)+(c&&CITY[c]&&CITY[c].ru?RU_BOX:0)+(c&&CITY[c]&&CITY[c].uae?UAE_LIC:0)+(c&&CITY[c]&&CITY[c].saudi?KSA_LIC:0);
const CN_LIC=150000, CN_JV_MO=6000;
// Scrubbing centers come in tiers by clean bandwidth. Always-on diverts instantly; on-demand is cheaper
// but takes a couple of days to engage. A clean-pipe add-on on a transit scrubs upstream, per port.
@@ -2125,7 +2125,7 @@ function compute(){
for(const e of E){if(e.k==='t')R2.useT[e.id]=(R2.useT[e.id]||0)+e.used;else if(e.k==='ix')R2.useIx[e.id]=e.used;else if(e.k==='p')R2.usePni[e.id]=e.used;else R2.useCache[e.id]=e.used;}
// money
const C=R2.cost,V=R2.rev,pm=S.priceMul;
- C.pops=Object.values(S.pops).reduce((a,p)=>a+POP_MO+((p.routers||1)-1)*ROUTER_MO+(p.routers||1)*RG[p.rgen||0].mo+(p.gen?GEN_MO:0),0);
+ C.pops=Object.entries(S.pops).reduce((a,[c,p])=>a+popMo(c)+((p.routers||1)-1)*ROUTER_MO+(p.routers||1)*RG[p.rgen||0].mo+(p.gen?GEN_MO:0),0);
C.optical=S.links.filter(l=>l.kind==='df').reduce((a,l)=>a+(l.ready>S.day?0:ampCount(l.km)*AMP_MO*(l.own&&isRdm(l.sys)&&!l.sub?Math.max(1,l.pairs|0):1)+(l.regen|0)*REGEN_MO)+(l.spares?Math.round(150+(l.ch||[]).length*80):0),0);
C.links=S.links.reduce((a,l)=>a+(l.mo||0),0);
C.nni=(S.nni||[]).reduce((a,x)=>a+NNI[x.tier].mo,0);
@@ -2305,7 +2305,19 @@ function spawnSpecial(t){const T=BIZ_T[t],mine=Object.keys(S.pops),lv=S.lvl||1;
S.offers.push({id:uid(),city:l.a,city2:l.b,link:l.id,what:tr('a spare fiber pair in your {a}–{b} trench',{a:CITY[l.a].name,b:CITY[l.b].name}),name:nm(),type:t,bw:1,rate:Math.round(dfLeaseMo(l.km)*0.9),reqs:[],exp:S.day+30});}
}
function cnOk(){return S.cnLic&&S.cnLic.state==='ok';}
-function regionMult(c){const C=CITY[c];if(!C||C.cn)return 1;if(C.kr)return KR_TRANSIT;if(C.tape)return 1.5;return C.reg==='AS'?2.5:C.reg==='AF'?2:C.reg==='OC'?1.8:C.reg==='SA'?1.6:1;}
+/* Real-world calibration, pulled 2026-10-25 (Pacific islands 2026-10-26). Per city: [carrier-neutral facilities, network presences across them,
+ ASNs registered in its country]. Facilities and presences are PeeringDB facilities within 50 km or in the same city
+ (peeringdb.com/api/fac, net_count summed); ASNs per country are from bgp.he.net/report/world. */
+const CITY_PDB={sea:[37,539,33300],sjc:[57,1048,33300],dal:[59,969,33300],chi:[64,809,33300],ash:[86,1010,33300],nyc:[96,1322,33300],mia:[27,553,33300],sao:[70,1875,9693],lon:[100,2588,4027],ams:[69,2731,1827],fra:[56,2450,3705],par:[77,1528,2249],mrs:[8,273,2249],tor:[46,509,2595],bru:[33,328,443],oos:[5,22,443],bet:[16,174,152],mtl:[35,283,2595],kcy:[22,313,33300],cal:[15,127,2595],van:[13,214,2595],ott:[6,21,2595],lax:[44,939,33300],mex:[18,122,814],rek:[15,51,93],dub:[21,277,350],osl:[20,209,448],cph:[30,290,529],hel:[23,232,427],beg:[7,49,227],sof:[15,451,889],dxb:[8,135,231],mos:[49,632,6683],akl:[27,398,755],per:[12,248,3196],jkt:[98,3015,4108],mnl:[17,352,750],ber:[22,351,3705],ham:[26,228,3705],muc:[22,230,3705],zrh:[38,535,1209],nbo:[9,283,274],cai:[5,28,97],stg:[18,63,3705],sto:[31,539,1011],bcn:[13,159,1341],mad:[31,578,1341],lag:[13,279,304],jnb:[14,561,879],bom:[59,1050,6412],sin:[58,1271,782],hkg:[57,1107,1514],icn:[37,201,1197],pek:[10,15,6717],sha:[11,27,6717],tok:[58,917,1330],syd:[40,979,3196],for:[16,362,9693],rio:[33,577,9693],bsb:[14,108,9693],bhz:[13,40,9693],cwb:[11,79,9693],poa:[22,120,9693],aju:[4,3,9693],bel:[3,7,9693],bvb:[3,6,9693],cac:[4,6,9693],cpv:[4,12,9693],cpq:[19,65,9693],cgr:[4,4,9693],cau:[2,2,9693],cgb:[4,5,9693],cxj:[2,3,9693],fec:[5,4,9693],fln:[5,23,9693],igu:[5,26,124],gyn:[5,28,9693],jpa:[4,18,9693],ljd:[1,2,9693],ldb:[3,7,9693],mcp:[2,0,9693],mcz:[1,5,9693],mao:[7,15,9693],mgf:[4,9,9693],nat:[1,3,9693],pmw:[3,8,9693],pvh:[3,4,9693],rao:[6,3,9693],rec:[6,31,9693],rbr:[0,0,9693],ssa:[13,44,9693],ria:[2,2,9693],sjp:[2,4,9693],slz:[1,6,9693],the:[2,1,9693],vix:[6,30,9693],mvd:[1,2,53],asu:[3,8,124],cor:[2,29,1357],lpb:[1,2,71],uio:[9,16,287],mde:[2,18,598],ccs:[6,32,296],gua:[5,16,103],sjo:[8,6,128],qro:[11,144,814],mty:[5,27,814],gdl:[4,22,814],bue:[28,372,1357],scl:[36,274,450],lim:[12,156,267],bog:[16,195,598],pan:[8,26,158],del:[31,479,6412],maa:[20,374,6412],blr:[14,104,6412],hyd:[17,152,6412],tpe:[15,274,500],auh:[4,1,231],fuj:[1,49,231],cpt:[6,267,879],dkr:[2,4,23],abj:[5,11,32],acc:[7,78,124],dla:[3,14,34],fih:[7,19,57],lad:[8,27,79],cas:[2,2,39],alg:[0,0,16],tun:[2,0,30],jib:[3,19,5],add:[2,3,10],mba:[4,176,274],dar:[9,67,124],kla:[2,18,71],kgl:[5,14,34],mpm:[7,20,36],dur:[4,137,879],wdh:[1,2,22],lun:[4,3,24],hre:[1,0,37],gbe:[1,2,39],mel:[20,395,3196],bne:[21,277,3196],drw:[3,15,3196],osa:[19,229,1330],kul:[20,210,434],bkk:[32,397,675],sgn:[6,36,1068],khi:[7,15,488],dac:[30,107,2105],cbo:[1,0,33],waw:[25,855,2743],prg:[24,336,775],vie:[30,377,860],bud:[6,146,369],buh:[23,289,1424],tll:[7,80,256],ist:[28,334,1290],kyv:[33,506,2342],jed:[5,25,220],ruh:[8,29,220],doh:[6,29,31],mil:[29,728,1534],rom:[12,213,1534],pmo:[3,46,1534],lis:[9,129,187],ath:[6,108,307],atn:[42,589,33300],den:[28,310,33300],phx:[26,279,33300],bos:[31,209,33300],hou:[21,173,33300],slc:[22,202,33300],man:[29,353,4027],edi:[4,46,4027],bde:[0,0,4027],svg:[2,14,448],hnl:[7,33,33300],gum:[6,28,11],ror:[0,0,4],maj:[0,0,12],pom:[2,0,46],hir:[1,0,11],nou:[2,2,19],suv:[0,0,23],tbu:[0,0,5],apw:[0,0,11],ppg:[0,0,2],ppt:[0,0,6]};
+// Few networks in the building means few transit sellers to haggle with: up to 1.8× where almost nobody is present.
+// Hand-set markets (Korea, Belgian red tape) keep their own price.
+const txComp=c=>{const q=CITY_PDB[c];return q?clamp((1000/Math.max(q[1],10))**0.15,1,1.8):1;};
+// No neutral data center means building your own room: POPs cost more to build and to run.
+const colo=c=>{const q=CITY_PDB[c];return !q?1:q[0]===0?1.5:q[0]<=2?1.25:1;};
+const popMo=c=>Math.round(POP_MO*colo(c));
+// Countries with thousands of ASNs (Brazil's provedores, US regionals) are full of small ISPs shopping for transit.
+const asnDense=c=>{const q=CITY_PDB[c];return !!q&&q[2]>=2000;};
+function regionMult(c){const C=CITY[c];if(!C||C.cn)return 1;if(C.kr)return KR_TRANSIT;if(C.tape)return 1.5;const base=C.reg==='AS'?2.5:C.reg==='AF'?2:C.reg==='OC'?1.8:C.reg==='SA'?1.6:1;return Math.round(base*txComp(c)*10)/10;}
const uaePair=(a,b)=>!!CITY[a].uae&&!!CITY[b].uae;
const rainPair=(a,b)=>!!(CITY[a].rain||CITY[b].rain);
const borderPair=(a,b)=>!!CITY[a].cc&&!!CITY[b].cc&&CITY[a].cc!==CITY[b].cc;
@@ -2730,6 +2742,7 @@ function spawnOffer(){
if(lv>=3&&MEGA.some(m=>mine.includes(m.c)))types.push('ingest');if(lv>=4&&MEGA.some(m=>mine.includes(m.c)))types.push('aiwan','aiwan','mtrain');if(lv>=4&&S.links.some(l=>l.kind==='df'&&l.own&&l.ready<=S.day))types.push('pairs');
if(lv>=5)types.push('esport');if(lv>=6&&mine.length>=2)types.push('sov','sov');if(lv>=8)types.push('cgame','cgame');if(lv>=9)types.push('metav','metav');if(lv>=11&&MEGA.some(m=>mine.includes(m.c)))types.push('agi');if(lv>=13&&mine.length>=2)types.push('mars');
const br=mine.filter(c=>CITY[c].br);if(br.length)types.push('provedor','provedor','provedor');
+ const dense=mine.filter(asnDense);if(lv>=2&&dense.length)types.push('isp');
const fabC=mine.filter(c=>FABS.some(f=>f.cities.includes(c)));if(lv>=2&&fabC.length){types.push('fabip','fabip');if(mine.length>=2)types.push('fabl2');}
const t=pick(types),T=BIZ_T[t];
if(T.event||T.sdwan||T.fiber||T.mega){spawnSpecial(t);return;}
@@ -2744,6 +2757,7 @@ function spawnOffer(){
let name=list.length?pick(list):(T.names?pick(T.names):'Startup #'+Math.floor(Math.random()*999));
S.usedNames.push(name);
if(t==='provedor')city=pick(br);
+ if(t==='isp'&&dense.length&&Math.random()<0.5)city=pick(dense);
if(t==='hft'){const fin=['nyc','chi','lon','fra','tok','sin','hkg','ams','ash'],mf=mine.filter(c=>fin.includes(c));city=mf.length?pick(mf):pick(mine);city2=pick(fin.filter(c=>c!==city));}
const rate=T.l2?Math.round((150+kmBetween(city,city2)*0.08)*T.km):T.rate;
if(T.div&&!reqCan('diverse',{city,city2}))return;
@@ -3314,12 +3328,12 @@ function renderPanel(){checkLayer();
function cityPanel(c){
const C=CITY[c],p=S.pops[c],ix=ixName(c),down=p&&p.down>S.day;
let h=`
${tr('A POP (point of presence) is your router in a rack here. Then connect it: lay fiber from one of your POPs, or buy transit right here.')}
- ${C.ru?`
${tr('Includes the mandatory government box in your rack: {cost} + {mo}/mo. It comes with its own listener.',{cost:fmt$(RU_BOX),mo:fmt$(RU_BOX_MO)})}
`:''}${btn(tr('Build POP {cost} + {mo}/mo',{cost:fmt$(popCost(c)),mo:fmt$(POP_MO)}),'buildPop',{city:c},'pink big',S.cash${tr('Includes the mandatory government box in your rack: {cost} + {mo}/mo. It comes with its own listener.',{cost:fmt$(RU_BOX),mo:fmt$(RU_BOX_MO)})}`:''}${btn(tr('Build POP {cost} + {mo}/mo',{cost:fmt$(popCost(c)),mo:fmt$(popMo(c))}),'buildPop',{city:c},'pink big',S.cash${tr('Or drag from one of your routers to this city to lay fiber and build the POP in one go.')}`}`;
h+=offersHere(c);
const trs=NETS.filter(n=>n.price&&n.pops.includes(c));
diff --git a/tests/regions.test.js b/tests/regions.test.js
index 74a906a..5a3d8f8 100644
--- a/tests/regions.test.js
+++ b/tests/regions.test.js
@@ -634,5 +634,21 @@ test('Pacific islands: real landings, real exchanges only, and island hops carry
assert.ok(ev('!!S.pops.hnl') && ev('S.lvl') >= 4);
assert.equal(ev('scnProg().items.length'), 3);
ev('cam.z=0.5;draw(0);cam.z=2;draw(0)');
+
+test('prices follow real connectivity: thin markets cost more, hubs stay put', () => {
+ const { ev, errors } = load();
+ start(ev);
+ assert.ok(ev('Object.keys(CITY_PDB).length') === ev('CITIES.length'), 'every city has real-world data');
+ for (const c of ['fra', 'ams', 'lon', 'nyc']) assert.equal(ev(`txComp('${c}')`), 1, `${c} is a hub`);
+ assert.equal(ev("regionMult('sao')"), 1.6, 'São Paulo keeps the South American price');
+ assert.ok(ev("regionMult('rbr')") > ev("regionMult('sao')") * 1.5, 'Rio Branco has few sellers');
+ assert.ok(ev("txComp('rbr')") <= 1.8);
+ assert.equal(ev("colo('rbr')"), 1.5, 'no neutral data center');
+ assert.equal(ev("popCost('rbr')"), ev('POP_COST') * 1.5);
+ assert.equal(ev("popMo('fra')"), ev('POP_MO'));
+ ev("ACT.buildPop({city:'rbr'});compute()");
+ assert.ok(ev('R.cost.pops') >= ev("popMo('rbr')"), 'running cost uses the city rent');
+ ev("selectCity('rbr')");
+ assert.equal(ev('asnDense("sao")&&asnDense("nyc")&&!asnDense("kgl")'), true);
assert.deepEqual(errors, []);
});
From 6de56f79ebc7fa3eef1de62c55b1da80e70d8766 Mon Sep 17 00:00:00 2001
From: clayberF <49653677+clayberF@users.noreply.github.com>
Date: Mon, 26 Oct 2026 10:00:53 -0300
Subject: [PATCH 003/546] Calibration: drop a redundant guard and a one-caller
helper
---
site/index.html | 7 +++----
tests/regions.test.js | 4 +++-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/site/index.html b/site/index.html
index 47d0019..dcf523b 100644
--- a/site/index.html
+++ b/site/index.html
@@ -599,7 +599,7 @@ const SITE2_COST=45000,SITE2_MO=3000,TE_COST=60000,TE_MO=4000;
const SITE2_N=[tr('The Other Building'),tr('Campus B (the one with parking)'),tr('Across-the-River DC'),tr('The Annex'),tr('Suburban Mega-shed'),tr('The Cheaper One'),tr('Formerly a Shopping Mall'),tr('Bunker Two')];
const siteName=(c,s)=>s==='b'?SITE2_N[hstr(c)%SITE2_N.length]:CITY[c].dc;
const BE_TAPE=30000;
-const popCost=c=>Math.round(POP_COST*(c&&CITY[c]?colo(c):1))+(c&&CITY[c]&&CITY[c].tape?BE_TAPE:0)+(c&&CITY[c]&&CITY[c].ru?RU_BOX:0)+(c&&CITY[c]&&CITY[c].uae?UAE_LIC:0)+(c&&CITY[c]&&CITY[c].saudi?KSA_LIC:0);
+const popCost=c=>Math.round(POP_COST*colo(c))+(c&&CITY[c]&&CITY[c].tape?BE_TAPE:0)+(c&&CITY[c]&&CITY[c].ru?RU_BOX:0)+(c&&CITY[c]&&CITY[c].uae?UAE_LIC:0)+(c&&CITY[c]&&CITY[c].saudi?KSA_LIC:0);
const CN_LIC=150000, CN_JV_MO=6000;
// Scrubbing centers come in tiers by clean bandwidth. Always-on diverts instantly; on-demand is cheaper
// but takes a couple of days to engage. A clean-pipe add-on on a transit scrubs upstream, per port.
@@ -2315,8 +2315,6 @@ const txComp=c=>{const q=CITY_PDB[c];return q?clamp((1000/Math.max(q[1],10))**0.
// No neutral data center means building your own room: POPs cost more to build and to run.
const colo=c=>{const q=CITY_PDB[c];return !q?1:q[0]===0?1.5:q[0]<=2?1.25:1;};
const popMo=c=>Math.round(POP_MO*colo(c));
-// Countries with thousands of ASNs (Brazil's provedores, US regionals) are full of small ISPs shopping for transit.
-const asnDense=c=>{const q=CITY_PDB[c];return !!q&&q[2]>=2000;};
function regionMult(c){const C=CITY[c];if(!C||C.cn)return 1;if(C.kr)return KR_TRANSIT;if(C.tape)return 1.5;const base=C.reg==='AS'?2.5:C.reg==='AF'?2:C.reg==='OC'?1.8:C.reg==='SA'?1.6:1;return Math.round(base*txComp(c)*10)/10;}
const uaePair=(a,b)=>!!CITY[a].uae&&!!CITY[b].uae;
const rainPair=(a,b)=>!!(CITY[a].rain||CITY[b].rain);
@@ -2742,7 +2740,8 @@ function spawnOffer(){
if(lv>=3&&MEGA.some(m=>mine.includes(m.c)))types.push('ingest');if(lv>=4&&MEGA.some(m=>mine.includes(m.c)))types.push('aiwan','aiwan','mtrain');if(lv>=4&&S.links.some(l=>l.kind==='df'&&l.own&&l.ready<=S.day))types.push('pairs');
if(lv>=5)types.push('esport');if(lv>=6&&mine.length>=2)types.push('sov','sov');if(lv>=8)types.push('cgame','cgame');if(lv>=9)types.push('metav','metav');if(lv>=11&&MEGA.some(m=>mine.includes(m.c)))types.push('agi');if(lv>=13&&mine.length>=2)types.push('mars');
const br=mine.filter(c=>CITY[c].br);if(br.length)types.push('provedor','provedor','provedor');
- const dense=mine.filter(asnDense);if(lv>=2&&dense.length)types.push('isp');
+ // Countries with thousands of ASNs (Brazil's provedores, US regionals) are full of small ISPs shopping for transit.
+ const dense=mine.filter(c=>(CITY_PDB[c]||[])[2]>=2000);if(lv>=2&&dense.length)types.push('isp');
const fabC=mine.filter(c=>FABS.some(f=>f.cities.includes(c)));if(lv>=2&&fabC.length){types.push('fabip','fabip');if(mine.length>=2)types.push('fabl2');}
const t=pick(types),T=BIZ_T[t];
if(T.event||T.sdwan||T.fiber||T.mega){spawnSpecial(t);return;}
diff --git a/tests/regions.test.js b/tests/regions.test.js
index 5a3d8f8..41bc080 100644
--- a/tests/regions.test.js
+++ b/tests/regions.test.js
@@ -634,6 +634,8 @@ test('Pacific islands: real landings, real exchanges only, and island hops carry
assert.ok(ev('!!S.pops.hnl') && ev('S.lvl') >= 4);
assert.equal(ev('scnProg().items.length'), 3);
ev('cam.z=0.5;draw(0);cam.z=2;draw(0)');
+ assert.deepEqual(errors, []);
+});
test('prices follow real connectivity: thin markets cost more, hubs stay put', () => {
const { ev, errors } = load();
@@ -649,6 +651,6 @@ test('prices follow real connectivity: thin markets cost more, hubs stay put', (
ev("ACT.buildPop({city:'rbr'});compute()");
assert.ok(ev('R.cost.pops') >= ev("popMo('rbr')"), 'running cost uses the city rent');
ev("selectCity('rbr')");
- assert.equal(ev('asnDense("sao")&&asnDense("nyc")&&!asnDense("kgl")'), true);
+ assert.ok(ev("CITY_PDB.sao[2]>=2000&&CITY_PDB.nyc[2]>=2000&&CITY_PDB.kgl[2]<2000"), 'Brazil and the US are dense in ASNs, Rwanda is not');
assert.deepEqual(errors, []);
});
From 8a25ebdb95bccf8d744256f666ddbe2a9731e962 Mon Sep 17 00:00:00 2001
From: Marvin
Date: Mon, 26 Oct 2026 20:55:12 +0100
Subject: [PATCH 004/546] Custom routing metric for links
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
A link's routing metric could only be one of four presets (Prefer,
Normal, Avoid, Backup only). Links now also get a Custom option, closer
to how real networks tune IGP metrics:
- Multiplier mode scales the distance cost, (km + 60) × 0.1 to 100.
- Cost mode sets an exact cost, 1 to 65535 like an OSPF metric.
The preset buttons stay plain. Picking Custom explains how a link's cost
is worked out and lists what each preset comes to on that link. Choosing
Custom starts from the current preset and switching modes keeps the
effective cost, so nothing moves until the player changes the value.
Like the presets, it applies to every link between the two cities.
The cost formula lives in one helper, linkW(), used by compute() and the
traceroute paths. Custom links store mk/mv, which sanitize() repairs and
clamps; old saves load unchanged. The link panel skips its daily
re-render while the number field has focus, and Enter applies the value.
Tests cover routing equivalence with the presets, rerouting by cost,
mode switching, input clamping, saves, and the panel at desktop and
phone width. French, Italian and Portuguese for the new strings.
Perf on the big network: no change beyond noise, routing identical to
main.
---
CHANGELOG.md | 2 +
site/i18n/fr.js | 11 ++++-
site/i18n/it.js | 11 ++++-
site/i18n/pt.js | 11 ++++-
site/index.html | 34 +++++++++++----
tests/game.test.js | 102 +++++++++++++++++++++++++++++++++++++++++++++
6 files changed, 161 insertions(+), 10 deletions(-)
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 648e743..fe661d0 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
+- Links can now use a custom routing metric, set either as a multiplier or as an exact cost. Pick Custom under Routing metric to fine-tune where your traffic goes; it explains how a link's cost is worked out and what each preset comes to on that link.
+
## [1.31.0] — 2026-10-26
- Series of Tubes now speaks French. The game follows your browser's language the first time, and you can switch to Français under Settings or on the title screen.
diff --git a/site/i18n/fr.js b/site/i18n/fr.js
index 1b4c2ba..0bb9742 100644
--- a/site/i18n/fr.js
+++ b/site/i18n/fr.js
@@ -1604,7 +1604,6 @@
"Going to customers in":"Vers les clients de",
"Biggest feeder: {egress} in {city}. Set it to “Backup only”, give the customers a closer egress (peering, a cache, local transit), or raise this link's metric.":"Plus gros contributeur : {egress} à {city}. Passe-le en « Secours seul », donne aux clients une sortie plus proche (peering, cache, transit local) ou augmente la métrique de ce lien.",
"Routing metric":"Métrique de routage",
-"Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Applies to every link between these two cities.":"Tes routeurs choisissent le chemin le moins coûteux. Augmente la métrique pour pousser le trafic vers d’autres chemins. « Secours seul » le laisse au repos tant que le reste fonctionne. S’applique à tous les liens entre ces deux villes.",
"Behind the Great Firewall":"Derrière le Grand Pare-feu",
"Mainland China plays by its own rules. {list} and other foreign services are blocked here, so users mostly reach Chinese networks. Traffic crossing the border loses about {pct} to filtering and congestion, unless it rides a premium route: CN-Too transit or a premium cross-border circuit (both sold only in Hong Kong), or a PNI with a Chinese network. Revenue per user is lower here.":"La Chine continentale joue selon ses propres règles. {list} et d’autres services étrangers y sont bloqués, donc les utilisateurs atteignent surtout des réseaux chinois. Le trafic qui passe la frontière perd environ {pct} en filtrage et congestion, sauf s’il emprunte une route premium : du transit CN-Too ou un circuit transfrontalier premium (tous deux vendus uniquement à Hong Kong), ou un PNI avec un réseau chinois. Le revenu par utilisateur est plus faible ici.",
"Foreign networks need a local joint venture and an operating license to build infrastructure here.":"Les réseaux étrangers ont besoin d’une coentreprise locale et d’une licence d’opérateur pour construire ici.",
@@ -2631,4 +2630,14 @@
"via a capacity broker":"via un courtier en capacité",
"List it with a capacity broker they keep 10%":"La confier à un courtier en capacité il garde 10 %",
"Nothing spare to sell on this fiber right now.":"Rien à vendre sur cette fibre pour l’instant.",
+"Custom":"Perso",
+"Multiplier":"Multiplicateur",
+"Cost":"Coût",
+"Set":"Appliquer",
+"Cost on this link: {w}. Allowed: {lo} to {hi}.":"Coût sur ce lien : {w}. Autorisé : de {lo} à {hi}.",
+"Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Pick Custom to set your own multiplier or cost. Applies to every link between these two cities.":"Tes routeurs choisissent le chemin le moins coûteux. Augmente la métrique pour pousser le trafic vers d’autres chemins. « Secours seul » le laisse au repos tant que le reste fonctionne. Choisis Perso pour fixer ton propre multiplicateur ou coût. S’applique à tous les liens entre ces deux villes.",
+"A link’s cost is its length in km plus 60, times a multiplier. Traffic takes the path with the lowest total cost.":"Le coût d’un lien, c’est sa longueur en km plus 60, fois un multiplicateur. Le trafic prend le chemin au coût total le plus bas.",
+"Presets on this link: {list}.":"Préréglages sur ce lien : {list}.",
+"Cost: the exact number, whatever the distance.":"Coût : le nombre exact, quelle que soit la distance.",
+"Multiplier: scales the distance cost, so a longer link still costs more.":"Multiplicateur : il multiplie le coût de la distance, donc un lien plus long coûte toujours plus.",
};
diff --git a/site/i18n/it.js b/site/i18n/it.js
index 6bf8565..fdc589d 100644
--- a/site/i18n/it.js
+++ b/site/i18n/it.js
@@ -1603,7 +1603,6 @@
"Going to customers in":"Diretto ai clienti a",
"Biggest feeder: {egress} in {city}. Set it to “Backup only”, give the customers a closer egress (peering, a cache, local transit), or raise this link's metric.":"Fonte principale: {egress} a {city}. Impostala su “Solo backup”, dai ai clienti un’uscita più vicina (peering, una cache, transit locale) o alza la metrica di questo link.",
"Routing metric":"Metrica di routing",
-"Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Applies to every link between these two cities.":"I tuoi router scelgono il percorso a costo minore. Alza la metrica per spingere il traffico su altri percorsi. “Solo backup” lo lascia a riposo finché il resto funziona. Vale per tutti i link tra queste due città.",
"Behind the Great Firewall":"Dietro il Great Firewall",
"Mainland China plays by its own rules. {list} and other foreign services are blocked here, so users mostly reach Chinese networks. Traffic crossing the border loses about {pct} to filtering and congestion, unless it rides a premium route: CN-Too transit or a premium cross-border circuit (both sold only in Hong Kong), or a PNI with a Chinese network. Revenue per user is lower here.":"La Cina continentale gioca con regole tutte sue. {list} e altri servizi stranieri qui sono bloccati, quindi gli utenti raggiungono soprattutto reti cinesi. Il traffico che attraversa il confine perde circa il {pct} tra filtri e congestione, a meno che non viaggi su una rotta premium: transit CN-Too o un circuito transfrontaliero premium (entrambi venduti solo a Hong Kong), oppure un PNI con una rete cinese. Qui i ricavi per utente sono più bassi.",
"Foreign networks need a local joint venture and an operating license to build infrastructure here.":"Per costruire infrastrutture qui, le reti straniere hanno bisogno di una joint venture locale e di una licenza operativa.",
@@ -2631,4 +2630,14 @@
"via a capacity broker":"tramite un broker di capacità",
"List it with a capacity broker they keep 10%":"Mettila in vendita con un broker di capacità trattiene il 10%",
"Nothing spare to sell on this fiber right now.":"Per ora non c’è niente da vendere su questa fibra.",
+"Custom":"Personalizzata",
+"Multiplier":"Moltiplicatore",
+"Cost":"Costo",
+"Set":"Imposta",
+"Cost on this link: {w}. Allowed: {lo} to {hi}.":"Costo su questo link: {w}. Ammessi: da {lo} a {hi}.",
+"Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Pick Custom to set your own multiplier or cost. Applies to every link between these two cities.":"I tuoi router scelgono il percorso a costo minore. Alza la metrica per spingere il traffico su altri percorsi. “Solo backup” lo lascia a riposo finché il resto funziona. Scegli Personalizzata per impostare il tuo moltiplicatore o costo. Vale per tutti i link tra queste due città.",
+"A link’s cost is its length in km plus 60, times a multiplier. Traffic takes the path with the lowest total cost.":"Il costo di un link è la sua lunghezza in km più 60, per un moltiplicatore. Il traffico prende il percorso col costo totale più basso.",
+"Presets on this link: {list}.":"Preset su questo link: {list}.",
+"Cost: the exact number, whatever the distance.":"Costo: il numero esatto, a prescindere dalla distanza.",
+"Multiplier: scales the distance cost, so a longer link still costs more.":"Moltiplicatore: scala il costo della distanza, così un link più lungo costa comunque di più.",
};
diff --git a/site/i18n/pt.js b/site/i18n/pt.js
index 9c443f5..9f4950d 100644
--- a/site/i18n/pt.js
+++ b/site/i18n/pt.js
@@ -1602,7 +1602,6 @@
"Going to customers in":"Indo para clientes em",
"Biggest feeder: {egress} in {city}. Set it to “Backup only”, give the customers a closer egress (peering, a cache, local transit), or raise this link's metric.":"Maior fonte: {egress} em {city}. Coloque em “Só backup”, dê aos clientes uma saída mais próxima (peering, um cache, transit local) ou aumente a métrica deste link.",
"Routing metric":"Métrica de roteamento",
-"Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Applies to every link between these two cities.":"Seus routers escolhem o caminho de menor custo. Aumente a métrica para empurrar o tráfego para outros caminhos. “Só backup” deixa o link ocioso a menos que nada mais funcione. Vale para todos os links entre essas duas cidades.",
"Behind the Great Firewall":"Atrás do Great Firewall",
"Mainland China plays by its own rules. {list} and other foreign services are blocked here, so users mostly reach Chinese networks. Traffic crossing the border loses about {pct} to filtering and congestion, unless it rides a premium route: CN-Too transit or a premium cross-border circuit (both sold only in Hong Kong), or a PNI with a Chinese network. Revenue per user is lower here.":"A China continental joga com regras próprias. {list} e outros serviços estrangeiros são bloqueados aqui, então os usuários acessam principalmente redes chinesas. O tráfego que cruza a fronteira perde cerca de {pct} com filtragem e congestionamento, a menos que vá por uma rota premium: transit CN-Too ou um circuito transfronteiriço premium (ambos vendidos só em Hong Kong), ou um PNI com uma rede chinesa. A receita por usuário aqui é menor.",
"Foreign networks need a local joint venture and an operating license to build infrastructure here.":"Redes estrangeiras precisam de uma joint venture local e de uma licença de operação para construir infraestrutura aqui.",
@@ -2631,4 +2630,14 @@
"via a capacity broker":"por um corretor de capacidade",
"List it with a capacity broker they keep 10%":"Anunciar com um corretor de capacidade ele fica com 10%",
"Nothing spare to sell on this fiber right now.":"Nada sobrando para vender nesta fibra por enquanto.",
+"Custom":"Personalizada",
+"Multiplier":"Multiplicador",
+"Cost":"Custo",
+"Set":"Aplicar",
+"Cost on this link: {w}. Allowed: {lo} to {hi}.":"Custo neste link: {w}. Permitido: de {lo} a {hi}.",
+"Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Pick Custom to set your own multiplier or cost. Applies to every link between these two cities.":"Seus routers escolhem o caminho de menor custo. Aumente a métrica para empurrar o tráfego para outros caminhos. “Só backup” deixa o link ocioso a menos que nada mais funcione. Escolha Personalizada para definir seu próprio multiplicador ou custo. Vale para todos os links entre essas duas cidades.",
+"A link’s cost is its length in km plus 60, times a multiplier. Traffic takes the path with the lowest total cost.":"O custo de um link é seu comprimento em km mais 60, vezes um multiplicador. O tráfego segue o caminho de menor custo total.",
+"Presets on this link: {list}.":"Predefinições neste link: {list}.",
+"Cost: the exact number, whatever the distance.":"Custo: o número exato, seja qual for a distância.",
+"Multiplier: scales the distance cost, so a longer link still costs more.":"Multiplicador: multiplica o custo da distância, então um link mais longo continua custando mais.",
};
diff --git a/site/index.html b/site/index.html
index 9334e32..a125165 100644
--- a/site/index.html
+++ b/site/index.html
@@ -315,6 +315,7 @@ label.f{display:block;font-weight:900;font-size:12px;letter-spacing:.06em;text-t
input.t{width:100%;box-sizing:border-box;border:3px solid var(--ink);border-radius:12px;padding:8px 12px;font-family:var(--display);font-weight:800;font-size:18px;background:var(--soft)}
.network-name{display:flex;flex-wrap:wrap;align-items:center;gap:8px}
.network-name input.t{flex:1 1 240px;width:auto;min-width:0}
+.metric-in{display:flex;gap:6px;align-items:center;margin-top:6px}.metric-in input.t{flex:1 1 120px;width:auto;min-width:0;font-size:16px;padding:4px 10px}
.plug{display:flex;gap:12px;align-items:center;border:3px solid var(--ink);border-radius:14px;padding:10px 12px;margin:10px 0 4px;background:var(--soft);box-shadow:0 3px 0 var(--ink);color:var(--ink);text-decoration:none}
.plug:hover{background:#FFF6D6}.plug .pi{font-size:30px;line-height:1}.plug b{font-family:var(--display);font-size:16px}.plug .meta{display:block;margin-top:2px}.plug .go{margin-left:auto;font-weight:900;white-space:nowrap}
.starts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px}
@@ -719,6 +720,10 @@ const NNI=[{n:'10G',g:10,mo:500},{n:'100G',g:100,mo:1200}];
const VXC=[{n:'10G',g:10,m:1},{n:'50G',g:50,m:2.4},{n:'100G',g:100,m:3.6}];
const vxcMo=(km,sub,t)=>Math.round((150+km*0.12)*VXC[t].m*(sub?2:1));
const MET={prefer:{l:tr('Prefer'),f:0.5},normal:{l:tr('Normal'),f:1},avoid:{l:tr('Avoid'),f:4},backup:{l:tr('Backup only'),f:60}};
+// Custom metrics: a multiplier on the distance cost (f) or an absolute IGP cost (w), capped like an OSPF metric.
+const MET_LIM={f:[0.1,100],w:[1,65535]};
+const clampM=(k,v)=>{const [lo,hi]=MET_LIM[k];v=Math.min(hi,Math.max(lo,v));return k==='w'?Math.round(v):Math.round(v*100)/100;};
+const linkW=l=>l.metric==='custom'?(l.mk==='w'?l.mv:(l.km+60)*l.mv):(l.km+60)*MET[l.metric||'normal'].f;
const PREF={high:tr('Prefer'),normal:tr('Normal'),low:tr('Backup only')};
const edgeKey=l=>l.aString(t).toLowerCase().normalize('NFKD').replace(/[̀-ͯ]/g,'').replace(/[^a-z0-9]+/g,'-').replace(/^-|-$/g,'')||'x';
function trPaths(src){const live=S.links.filter(l=>!linkDown(l)),rem=remoteCities(),ok=c=>popUp(c)||rem.includes(c),adj={};
- for(const l of live){if(!ok(l.a)||!ok(l.b))continue;const w=(l.km+60)*MET[l.metric||'normal'].f;(adj[l.a]=adj[l.a]||[]).push([l.b,l,w]);(adj[l.b]=adj[l.b]||[]).push([l.a,l,w]);}
+ for(const l of live){if(!ok(l.a)||!ok(l.b))continue;const w=linkW(l);(adj[l.a]=adj[l.a]||[]).push([l.b,l,w]);(adj[l.b]=adj[l.b]||[]).push([l.a,l,w]);}
const dist={[src]:0},prev={},done=new Set();for(;;){let u=null,ud=Infinity;for(const k in dist)if(!done.has(k)&&dist[k]{if(dist[dst]===undefined)return null;const out=[];let v=dst;while(v!==src){const l=prev[v];out.unshift({l,from:l.a===v?l.b:l.a,to:v});v=l.a===v?l.b:l.a;}return out;};return {dist,path};}
function trExits(net){const day=S.day,ev=S.ev,leak=ev.leak&&ev.leak.until>day?ev.leak.net:null,out=[];
@@ -1924,7 +1929,7 @@ function compute(){
const remote=remoteCities(),adj=new Array(NC); pops.concat(remote).forEach(p=>adj[CIDX[p]]=[]);
const edges={},TRX=teRules(),live=[];let NE=0;R2.bizDem={};R2.bizSrv={};
for(const l of S.links){const ai=CIDX[l.a],bi=CIDX[l.b];if(linkDown(l)||!adj[ai]||!adj[bi])continue;live.push(l);const key=l.ae.w,wLat=e=>e.lat+0.05;
@@ -2202,7 +2207,7 @@ function sanitize(s){
for(const c of Object.keys(s.pops)){const p=s.pops[c];if(!isCity(c)||!p||typeof p!=='object'){delete s.pops[c];continue;}p.routers=int(p.routers,1,RMAX,1);if(p.rupDay!==undefined)p.rupDay=num(p.rupDay,-1);if(p.rgen!==undefined)p.rgen=int(p.rgen,0,RG.length-1,0);p.down=num(p.down,0);if(p.bb&&typeof p.bb==='object')p.bb.d=num(p.bb.d,0);else p.bb=null;}
if(!isCity(s.home))s.home=Object.keys(s.pops)[0]||'fra';
const tier=v=>int(v,0,PORT.length-1,0),lag=v=>int(v,1,LAG_MAX,1),sid=v=>String(v==null?uid():v).slice(0,40);
- s.links=s.links.filter(l=>l&&isCity(l.a)&&isCity(l.b)&&l.a!==l.b).map(l=>{l.id=sid(l.id);l.km=num(l.km,kmBetween(l.a,l.b));l.mo=num(l.mo,0);l.cut=num(l.cut,0);if(l.pairs!==undefined)l.pairs=Math.min(l.sub?SUB_PAIRS_MAX:s.lvl>=PAIRS_LV?PAIRS_BIG:PAIRS_MAX,Math.max(1,Math.floor(+l.pairs)||1));if(l.kind!=='df'&&l.kind!=='vxc')l.kind='wave';if(l.kind==='wave')l.tier=int(l.tier,0,LT.length-1,0);if(l.cable&&!own(CAB,l.cable))l.cable=null;if(l.kind==='vxc'&&!own(VXC,l.vt))l.vt=0;if(l.kind==='df'){if(!own(DF_SYS,l.sys))l.sys='lite';l.ch=Array.isArray(l.ch)?l.ch.filter(o=>own(OPT,o)):[];l.ready=num(l.ready,0);for(const k of Object.keys(SUB_UPGRADES)){const f='sub'+k;if(l[f]!==undefined){if(l.own&&l.sub&&Number.isFinite(l[f])&&l[f]>=0)l[f]=Math.round(l[f]);else delete l[f];}}if(l.paid!==undefined){if(l.own&&l.sub&&Number.isFinite(l.paid)&&l.paid>=0)l.paid=Math.round(l.paid);else delete l.paid;}if(l.own&&l.sub&&!own(SEA_DESIGNS,l.seaDesign))l.seaDesign='standard';l.regen=int(l.regen,0,REGEN_MAX,0);}const deg=v=>v&&typeof v==='object'?{until:num(v.until,0),f:Math.min(1,Math.max(0,num(v.f,1)))}:null;if(l.loss)l.loss=deg(l.loss);if(l.metric&&!own(MET,l.metric))l.metric='normal';return l;});
+ s.links=s.links.filter(l=>l&&isCity(l.a)&&isCity(l.b)&&l.a!==l.b).map(l=>{l.id=sid(l.id);l.km=num(l.km,kmBetween(l.a,l.b));l.mo=num(l.mo,0);l.cut=num(l.cut,0);if(l.pairs!==undefined)l.pairs=Math.min(l.sub?SUB_PAIRS_MAX:s.lvl>=PAIRS_LV?PAIRS_BIG:PAIRS_MAX,Math.max(1,Math.floor(+l.pairs)||1));if(l.kind!=='df'&&l.kind!=='vxc')l.kind='wave';if(l.kind==='wave')l.tier=int(l.tier,0,LT.length-1,0);if(l.cable&&!own(CAB,l.cable))l.cable=null;if(l.kind==='vxc'&&!own(VXC,l.vt))l.vt=0;if(l.kind==='df'){if(!own(DF_SYS,l.sys))l.sys='lite';l.ch=Array.isArray(l.ch)?l.ch.filter(o=>own(OPT,o)):[];l.ready=num(l.ready,0);for(const k of Object.keys(SUB_UPGRADES)){const f='sub'+k;if(l[f]!==undefined){if(l.own&&l.sub&&Number.isFinite(l[f])&&l[f]>=0)l[f]=Math.round(l[f]);else delete l[f];}}if(l.paid!==undefined){if(l.own&&l.sub&&Number.isFinite(l.paid)&&l.paid>=0)l.paid=Math.round(l.paid);else delete l.paid;}if(l.own&&l.sub&&!own(SEA_DESIGNS,l.seaDesign))l.seaDesign='standard';l.regen=int(l.regen,0,REGEN_MAX,0);}const deg=v=>v&&typeof v==='object'?{until:num(v.until,0),f:Math.min(1,Math.max(0,num(v.f,1)))}:null;if(l.loss)l.loss=deg(l.loss);if(l.metric==='custom'){if(l.mk!=='w')l.mk='f';l.mv=clampM(l.mk,num(l.mv,l.mk==='w'?l.km+60:1));}else{if(l.metric&&!own(MET,l.metric))l.metric='normal';delete l.mk;delete l.mv;}return l;});
const degO=v=>v&&typeof v==='object'?{until:num(v.until,0),f:Math.min(1,Math.max(0,num(v.f,1)))}:null;
s.transit=s.transit.filter(t=>t&&isCity(t.city)&&isNet(t.net)).map(t=>(t.lacp=degO(t.lacp),t.site=['a','b','ab'].includes(t.site)?t.site:'a',t.id=sid(t.id),t.tier=tier(t.tier),t.n=lag(t.n),t.down=num(t.down,0),t.clean=!!t.clean,t));
s.pni=s.pni.filter(x=>x&&isCity(x.city)&&isNet(x.net)).map(x=>(x.lacp=degO(x.lacp),x.site=['a','b','ab'].includes(x.site)?x.site:'a',x.id=sid(x.id),x.tier=tier(x.tier),x.n=lag(x.n),x.sacrif=!!x.sacrif,x));
@@ -3039,7 +3044,13 @@ const ACT={
upVxc:({id,t})=>{t=+t;const l=S.links.find(x=>x.id===id);if(!l||l.kind!=='vxc'||!VXC[t]||t<=l.vt)return;const extra=VXC[t].g-VXC[l.vt].g;for(const c of [l.a,l.b]){const pt=nniPort(c,l.prov);if(pt&&nniUsed(c,l.prov)+extra>NNI[pt.tier].g){toast(tr('Fabric port in {city} is full.',{city:CITY[c].name}),'bad');sfx('err');return;}}const mo=vxcMo(l.km,l.sub,t);if(!spend(mo))return;l.vt=t;l.mo=mo;after();},
cancelVxc:({id})=>{if(UI.confirm!==id){UI.confirm=id;renderPanel();return;}S.links=S.links.filter(l=>l.id!==id);const rem=remoteCities();for(const c in S.ixp){if(!S.pops[ixCity(c)]&&!rem.includes(ixCity(c))){delete S.ixp[c];delete S.rs[c];for(const k in S.peers)if(k.endsWith('@'+c))delete S.peers[k];}}UI.sel=null;UI.confirm=null;after();},
setPref:({kind,id,v})=>{if(!own(PREF,v))return;if(kind!=='t'&&kind!=='p'&&!(isIx(id)&&S.ixp[id]!==undefined))return;if(kind==='t'){const t=S.transit.find(x=>x.id===id);if(t)t.pref=v;}else if(kind==='p'){const x=S.pni.find(y=>y.id===id);if(x)x.pref=v;}else{S.ixPref=S.ixPref||{};S.ixPref[id]=v;}sfx('click');after();},
- setMetric:({id,v})=>{if(!own(MET,v))return;const l=S.links.find(x=>x.id===id);if(!l)return;for(const x of pairLinks(l.a,l.b))x.metric=v;sfx('click');after();},
+ setMetric:({id,v})=>{if(v!=='custom'&&!own(MET,v))return;const l=S.links.find(x=>x.id===id);if(!l)return;
+ // Switching to custom starts from the current preset's factor, so nothing moves until the player edits it.
+ for(const x of pairLinks(l.a,l.b)){if(v==='custom'){if(x.metric!=='custom'){x.mk='f';x.mv=MET[x.metric||'normal'].f;}}else{delete x.mk;delete x.mv;}x.metric=v;}sfx('click');after();},
+ metricMode:({id,k})=>{if(k!=='f'&&k!=='w')return;const l=S.links.find(x=>x.id===id);if(!l||l.metric!=='custom')return;
+ for(const x of pairLinks(l.a,l.b))if(x.metric==='custom'&&x.mk!==k){const w=linkW(x);x.mk=k;x.mv=clampM(k,k==='w'?w:w/(x.km+60));}sfx('click');after();},
+ metricSet:({id})=>{const l=S.links.find(x=>x.id===id),t=$('metIn');if(!l||l.metric!=='custom'||!t)return;const v=parseFloat(String(t.value).replace(',','.'));if(!Number.isFinite(v)){sfx('err');return;}
+ t.blur();for(const x of pairLinks(l.a,l.b))if(x.metric==='custom'){x.mk=l.mk;x.mv=clampM(l.mk,v);}sfx('click');after();},
goEgress:({city,k})=>{ACT.focusCity({city});UI.tab=k==='t'?'up':k==='l2'?'cust':k==='nni'?'links':'peer';renderPanel();},
custGo:({id})=>{const b=S.biz.find(x=>x.id===id);if(!b)return;$('dash').hidden=true;ACT.focusCity({city:b.city});UI.tab='cust';renderPanel();},
listMore:({k})=>{if(k!=='conn'&&k!=='cust')return;UI.listN=UI.listN||{};UI.listN[k]=listN(k)+LIST_PAGE;renderDash();},
@@ -3373,6 +3384,8 @@ function renderPanel(){checkLayer();
const P=$('panel');
if(!S||!UI.sel){P.hidden=true;return;}
P.hidden=false;
+ // Don't wipe a half-typed custom metric on the daily re-render.
+ const fe=document.activeElement;if(fe&&fe.id==='metIn'&&UI.sel.type!=='city'&&fe.dataset.id===UI.sel.id)return;
const scrollEl=$('panelBody').querySelector('.scroll');const st=scrollEl?scrollEl.scrollTop:0;
const html=UI.sel.type==='city'?cityPanel(UI.sel.id):linkPanel(UI.sel.id);if(html===UI._ph&&!P.hidden&&$('panelBody').firstChild)return;UI._ph=html;morph($('panelBody'),html);
const ns=$('panelBody').querySelector('.scroll');if(ns)ns.scrollTop=st;
@@ -3563,8 +3576,15 @@ function trafficSection(l){
if(u>=0.8&&egs.length){const d=R.egDesc[egs[0][0]];h+=`
${tr("Biggest feeder: {egress} in {city}. Set it to “Backup only”, give the customers a closer egress (peering, a cache, local transit), or raise this link's metric.",{egress:esc(d.lab),city:CITY[d.city].name})}
${tr('Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Applies to every link between these two cities.')}
`;}
+function metricSection(l){const cur=l.metric||'normal',base=l.km+60,sel=k=>cur===k?'pink sm':'ghost sm';
+ let h=`
${tr('Routing metric')}
${tr('Your routers pick the lowest-cost path. Raise the metric to push traffic onto other paths. “Backup only” keeps it idle unless nothing else works. Pick Custom to set your own multiplier or cost. Applies to every link between these two cities.')}
${tr('A link’s cost is its length in km plus 60, times a multiplier. Traffic takes the path with the lowest total cost.')} ${tr('Presets on this link: {list}.',{list:pre})}
${k==='w'?tr('Cost: the exact number, whatever the distance.'):tr('Multiplier: scales the distance cost, so a longer link still costs more.')} ${tr('Cost on this link: {w}. Allowed: {lo} to {hi}.',{w:Math.round(linkW(l)),lo:k==='w'?lo:'×'+lo,hi:k==='w'?hi:'×'+hi})}
`;}
+ return h+'';}
function chinaSection(c){const st=S.cnLic?S.cnLic.state:'none',loss=S.ev.gfw>S.day?0.35:0.2;
let h=`
${tr('Behind the Great Firewall')}
${tr('Mainland China plays by its own rules. {list} and other foreign services are blocked here, so users mostly reach Chinese networks. Traffic crossing the border loses about {pct} to filtering and congestion, unless it rides a premium route: CN-Too transit or a premium cross-border circuit (both sold only in Hong Kong), or a PNI with a Chinese network. Revenue per user is lower here.',{list:CN_BLOCKED.slice(0,4).map(esc).join(', '),pct:pct(loss)})}
`;
if(st==='none')h+=`
${tr('Foreign networks need a local joint venture and an operating license to build infrastructure here.')}
${btn(tr('Apply for a license {price} + {mo}/mo · ~45 days',{price:fmt$(CN_LIC),mo:fmt$(CN_JV_MO)}),'applyCn',{},'pink',S.cash{e.preventDefault();zoomAt(e.clientX,e.clientY,Math.exp(-e.deltaY*0.0015));},{passive:false});
-addEventListener('keydown',e=>{if(e.target.closest&&e.target.closest('input,textarea,select,[contenteditable]'))return;if(e.ctrlKey||e.metaKey||e.altKey)return;if(e.code==='Space'&&e.target.closest&&e.target.closest('button,a'))return;if(e.code==='Space'){e.preventDefault();UI.speed=UI.speed?0:1;renderHUD();}if(e.key==='0')ACT.speed({v:0.5});if(e.key==='1')ACT.speed({v:1});if(e.key==='2')ACT.speed({v:2});if(e.key==='3')ACT.speed({v:4});if(e.key==='4')ACT.speed({v:8});if(e.key==='Escape'&&!$('bankBox').hidden){$('bankBox').hidden=true;return;}if(e.key==='Escape'&&!$('dash').hidden){$('dash').hidden=true;return;}if(e.key==='Escape'){if(!$('modal').hidden){if(S&&UI.started&&!S.lost)closeModal();}else{UI.sel=null;renderPanel();}}});
+addEventListener('keydown',e=>{if(e.key==='Enter'&&e.target.id==='metIn'){ACT.metricSet({id:e.target.dataset.id});return;}if(e.target.closest&&e.target.closest('input,textarea,select,[contenteditable]'))return;if(e.ctrlKey||e.metaKey||e.altKey)return;if(e.code==='Space'&&e.target.closest&&e.target.closest('button,a'))return;if(e.code==='Space'){e.preventDefault();UI.speed=UI.speed?0:1;renderHUD();}if(e.key==='0')ACT.speed({v:0.5});if(e.key==='1')ACT.speed({v:1});if(e.key==='2')ACT.speed({v:2});if(e.key==='3')ACT.speed({v:4});if(e.key==='4')ACT.speed({v:8});if(e.key==='Escape'&&!$('bankBox').hidden){$('bankBox').hidden=true;return;}if(e.key==='Escape'&&!$('dash').hidden){$('dash').hidden=true;return;}if(e.key==='Escape'){if(!$('modal').hidden){if(S&&UI.started&&!S.lost)closeModal();}else{UI.sel=null;renderPanel();}}});
/* ---------- click delegation ---------- */
let pressing=false;
diff --git a/tests/game.test.js b/tests/game.test.js
index 6bbdadc..1502f83 100644
--- a/tests/game.test.js
+++ b/tests/game.test.js
@@ -405,3 +405,105 @@ test('#117 several scrubbing centers: nearest first, spill to the next, and far
assert.equal(ev("S.scrubs.some(x=>x.city==='lon')"), false);
assert.deepEqual(errors, []);
});
+
+// Custom routing metrics: a fra–ams–par triangle where the direct fra–par link is normally shortest.
+const triangle = (ev) => {
+ ev("ACT.start({});S.cash=1e9;S.lvl=4;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'})");
+ ev("for(const c of ['ams','par'])ACT.buildPop({city:c});const L=(a,b)=>{UI.via=null;openLinkModal(a,b);ACT.buildLink({tier:1});closeModal();};L('fra','ams');L('ams','par');L('fra','par');compute()");
+ ev("window.FP=S.links.find(l=>(l.a==='fra'&&l.b==='par')||(l.a==='par'&&l.b==='fra')).id;window.hops=()=>JSON.stringify(trPaths('fra').path('par').map(h=>h.l.id))");
+};
+
+test('a custom multiplier routes exactly like the matching preset', () => {
+ const { ev, errors } = load();
+ triangle(ev);
+ assert.equal(ev("hops()"), JSON.stringify([ev("FP")]), 'direct link wins by default');
+ ev("ACT.setMetric({id:FP,v:'avoid'})");
+ const avoid = ev("JSON.stringify({h:hops(),load:R.load,served:R.served})");
+ ev("ACT.setMetric({id:FP,v:'custom'})");
+ const l = ev("S.links.find(l=>l.id===FP)");
+ assert.equal(l.metric, 'custom');
+ assert.equal(l.mk, 'f');
+ assert.equal(l.mv, 4, 'custom starts from the preset it replaces');
+ assert.equal(ev("JSON.stringify({h:hops(),load:R.load,served:R.served})"), avoid);
+ ev("ACT.setMetric({id:FP,v:'normal'})");
+ assert.equal(ev("'mk' in S.links.find(l=>l.id===FP)||'mv' in S.links.find(l=>l.id===FP)"), false, 'presets drop the custom fields');
+ assert.deepEqual(errors, []);
+});
+
+test('an absolute custom cost steers the path, and switching modes keeps the cost', () => {
+ const { ev, errors } = load();
+ triangle(ev);
+ ev("ACT.setMetric({id:FP,v:'custom'});ACT.metricMode({id:FP,k:'w'})");
+ const l = ev("S.links.find(l=>l.id===FP)");
+ assert.equal(l.mk, 'w');
+ assert.equal(l.mv, Math.round(l.km + 60), 'switching to cost keeps the effective metric');
+ ev("ACT.selLink({id:FP});renderAll();$('metIn').value='65535';ACT.metricSet({id:FP})");
+ assert.equal(ev("S.links.find(l=>l.id===FP).mv"), 65535);
+ assert.ok(!JSON.parse(ev("hops()")).includes(ev("FP")), 'a huge cost sends traffic round via Amsterdam');
+ ev("renderAll();$('metIn').value='1';ACT.metricSet({id:FP})");
+ assert.equal(ev("hops()"), JSON.stringify([ev("FP")]));
+ ev("ACT.metricMode({id:FP,k:'f'})");
+ assert.equal(ev("S.links.find(l=>l.id===FP).mv"), 0.1, 'converted back to a multiplier, clamped to the minimum');
+ assert.deepEqual(errors, []);
+});
+
+test('custom metric input is validated and clamped', () => {
+ const { ev, errors } = load();
+ triangle(ev);
+ ev("ACT.setMetric({id:FP,v:'custom'});ACT.selLink({id:FP});renderAll()");
+ ev("$('metIn').value='';ACT.metricSet({id:FP})");
+ assert.equal(ev("S.links.find(l=>l.id===FP).mv"), 1, 'empty input changes nothing');
+ ev("renderAll();$('metIn').value='9999';ACT.metricSet({id:FP})");
+ assert.equal(ev("S.links.find(l=>l.id===FP).mv"), 100);
+ ev("renderAll();$('metIn').value='0';ACT.metricSet({id:FP})");
+ assert.equal(ev("S.links.find(l=>l.id===FP).mv"), 0.1);
+ ev("ACT.metricMode({id:FP,k:'x'});ACT.setMetric({id:FP,v:'bogus'})");
+ assert.equal(ev("S.links.find(l=>l.id===FP).metric"), 'custom');
+ assert.deepEqual(errors, []);
+});
+
+test('custom metrics survive a save, and broken ones are repaired', () => {
+ const { ev, errors } = load();
+ triangle(ev);
+ ev("ACT.setMetric({id:FP,v:'custom'});ACT.metricMode({id:FP,k:'w'});S.links.find(l=>l.id===FP).mv=777;S=migrate(JSON.parse(JSON.stringify(S)));compute()");
+ let l = ev("S.links.find(l=>l.id===FP)");
+ assert.deepEqual([l.metric, l.mk, l.mv], ['custom', 'w', 777]);
+ ev("Object.assign(S.links.find(l=>l.id===FP),{mk:'zz',mv:'lots'});S=migrate(JSON.parse(JSON.stringify(S)));compute()");
+ l = ev("S.links.find(l=>l.id===FP)");
+ assert.deepEqual([l.metric, l.mk, l.mv], ['custom', 'f', 1]);
+ ev("Object.assign(S.links.find(l=>l.id===FP),{metric:'custom',mk:'w',mv:1e9});S=migrate(JSON.parse(JSON.stringify(S)))");
+ assert.equal(ev("S.links.find(l=>l.id===FP).mv"), 65535);
+ // An old save: preset metric, no custom fields at all.
+ ev("const x=S.links.find(l=>l.id===FP);x.metric='avoid';delete x.mk;delete x.mv;S=migrate(JSON.parse(JSON.stringify(S)));compute()");
+ l = ev("S.links.find(l=>l.id===FP)");
+ assert.equal(l.metric, 'avoid');
+ assert.ok(!('mk' in l) && !('mv' in l));
+ assert.equal(JSON.parse(ev("hops()")).length, 2, 'the old save still routes, avoiding the direct link');
+ assert.deepEqual(errors, []);
+});
+
+test('preset buttons stay plain, and Custom explains the numbers, also on phones', () => {
+ const { ev, dom, errors } = load();
+ triangle(ev);
+ for (const w of [1280, 390]) {
+ ev(`window.innerWidth=${w};ACT.setMetric({id:FP,v:'normal'});ACT.selLink({id:FP});renderAll()`);
+ const doc = dom.window.document;
+ const btns = [...doc.querySelectorAll('#panel [data-act="setMetric"]')];
+ assert.equal(btns.length, 5);
+ const km = ev("S.links.find(l=>l.id===FP).km");
+ assert.deepEqual(btns.map(b => b.textContent), ['Prefer', 'Normal', 'Avoid', 'Backup only', 'Custom']);
+ assert.equal(doc.getElementById('metIn'), null);
+ assert.doesNotMatch(doc.getElementById('panel').textContent, /times a multiplier/);
+ ev("ACT.setMetric({id:FP,v:'custom'})");
+ assert.ok(doc.getElementById('metIn'), `custom editor at ${w}px`);
+ assert.ok(doc.querySelector('#panel [data-act="metricMode"]'));
+ const txt = doc.getElementById('panel').textContent;
+ assert.match(txt, /times a multiplier/);
+ assert.match(txt, new RegExp(`Normal ×1 = ${Math.round(km + 60)}, Avoid ×4 = ${Math.round((km + 60) * 4)}`));
+ assert.match(txt, /Multiplier: scales the distance cost/);
+ assert.match(txt, /Cost on this link/);
+ ev("ACT.metricMode({id:FP,k:'w'})");
+ assert.match(doc.getElementById('panel').textContent, /Cost: the exact number/);
+ }
+ assert.deepEqual(errors, []);
+});
From 67a40942b4123c615a727e57887fdcce93e4fad5 Mon Sep 17 00:00:00 2001
From: Frederic Jung
Date: Tue, 27 Oct 2026 10:05:56 +0100
Subject: [PATCH 005/546] Split the game page into partials under src/,
assembled into one index.html at build
site/index.html (900 KB of HTML, CSS and JS in one file) becomes src/: a shell
(src/index.html), styles/ and game/, concatenated in path order by
scripts/lib/page.js. The assembled page is byte-identical to the old file, so
load time and in-game performance are unchanged.
- scripts/build.js replaces build.sh (same env vars, same output)
- npm run dev: a zero-dependency dev server that assembles on every request
- tests assemble the page in memory; npm test runs every tests/*.test.js
- perf-bench takes --base-ref to build a git ref's page
- scripts/legacy/split-index-html.js is the splitter, kept for older branches
---
package.json | 6 +-
scripts/build.js | 52 +
scripts/build.sh | 44 -
scripts/dev.js | 59 +
scripts/i18n-check.js | 9 +-
scripts/legacy/split-index-html.js | 184 +
scripts/legacy/transforms.js | 2 +
scripts/lib/page.js | 103 +
scripts/perf-bench.js | 13 +-
scripts/test.js | 16 +
site/index.html | 5131 -----------------
src/game/00-core/10-language.js | 11 +
src/game/00-core/20-analytics.js | 21 +
src/game/10-catalog/10-economy.js | 50 +
src/game/10-catalog/20-routers.js | 24 +
src/game/10-catalog/30-supply-chain.js | 30 +
src/game/10-catalog/40-ports.js | 22 +
src/game/10-catalog/50-dark-fiber.js | 39 +
src/game/10-catalog/60-reach-and-subsea.js | 63 +
src/game/20-world/10-projection.js | 7 +
src/game/20-world/20-landmasses.js | 8 +
src/game/20-world/30-coastline.js | 4 +
src/game/20-world/40-city-coords.js | 1 +
src/game/20-world/50-cities.js | 208 +
src/game/20-world/60-cables.js | 129 +
src/game/30-networks/10-networks.js | 110 +
src/game/30-networks/20-rival-exchanges.js | 31 +
src/game/30-networks/30-long-tail.js | 95 +
src/game/30-networks/40-traffic-shares.js | 15 +
src/game/40-progress/10-businesses.js | 63 +
src/game/40-progress/20-goals.js | 23 +
src/game/50-state.js | 5 +
src/game/60-features/10-banks.js | 109 +
src/game/60-features/20-scenarios.js | 40 +
src/game/60-features/30-conferences.js | 15 +
src/game/60-features/40-tutorial.js | 16 +
src/game/60-features/50-traceroute.js | 43 +
src/game/60-features/60-share-card.js | 27 +
src/game/60-features/70-scenario-progress.js | 12 +
src/game/60-features/80-new-game.js | 6 +
src/game/70-rules/10-helpers.js | 24 +
src/game/70-rules/20-exchanges.js | 30 +
src/game/70-rules/30-pnis.js | 19 +
src/game/70-rules/40-peering-inbox.js | 76 +
src/game/70-rules/50-peering-policy.js | 32 +
src/game/70-rules/60-de-kicks.js | 30 +
src/game/70-rules/70-sold-out.js | 23 +
src/game/70-rules/80-hot-ports-and-rank.js | 19 +
src/game/80-simulation/10-dijkstra.js | 17 +
src/game/80-simulation/20-routescript.js | 129 +
src/game/80-simulation/30-compute.js | 268 +
src/game/80-simulation/40-billing.js | 10 +
src/game/80-simulation/50-sanitize.js | 73 +
src/game/80-simulation/60-requirements.js | 63 +
.../80-simulation/70-customers-and-events.js | 44 +
.../80-simulation/80-geography-and-latency.js | 39 +
.../80-simulation/90-sites-and-service.js | 26 +
.../85-incidents/10-incidents-and-ddos.js | 82 +
src/game/85-incidents/20-failures.js | 161 +
src/game/85-incidents/30-events.js | 55 +
src/game/88-days/10-day-tick.js | 108 +
src/game/88-days/20-badges.js | 89 +
src/game/90-actions/00-actions.js | 294 +
src/game/90-actions/90-action-helpers.js | 27 +
src/game/91-save.js | 23 +
src/game/92-audio.js | 12 +
src/game/93-ui/10-dom.js | 27 +
src/game/93-ui/20-phone.js | 23 +
src/game/93-ui/30-install.js | 23 +
src/game/93-ui/40-hud-and-panels.js | 91 +
src/game/93-ui/50-city-panel.js | 112 +
src/game/93-ui/60-decommission.js | 22 +
src/game/93-ui/70-link-panels.js | 139 +
src/game/94-dashboard/10-progress.js | 30 +
src/game/94-dashboard/20-meet-a-network.js | 31 +
src/game/94-dashboard/30-customers.js | 34 +
src/game/94-dashboard/40-connections.js | 65 +
src/game/94-dashboard/50-lease-swaps.js | 37 +
src/game/94-dashboard/60-dashboard.js | 31 +
src/game/94-dashboard/70-bank.js | 30 +
src/game/94-dashboard/80-hint.js | 9 +
src/game/95-modals/10-toasts.js | 8 +
src/game/95-modals/20-notifications.js | 31 +
src/game/95-modals/30-modal-and-names.js | 24 +
src/game/95-modals/40-title.js | 26 +
src/game/95-modals/50-release-notes.js | 17 +
src/game/95-modals/60-help.js | 24 +
src/game/95-modals/70-link-modal.js | 21 +
src/game/95-modals/80-own-cable.js | 215 +
src/game/95-modals/90-fiber-modals.js | 35 +
src/game/96-map/10-canvas.js | 27 +
src/game/96-map/20-land-and-clouds.js | 18 +
src/game/96-map/30-settings.js | 32 +
src/game/96-map/40-level-of-detail.js | 8 +
src/game/96-map/50-link-geometry.js | 54 +
src/game/96-map/60-draw.js | 103 +
src/game/96-map/70-world-layer.js | 34 +
src/game/96-map/80-cities.js | 74 +
src/game/96-map/90-input.js | 42 +
src/game/96-map/95-clicks.js | 15 +
src/game/99-loop.js | 48 +
src/index.html | 167 +
src/styles/00-base.css | 27 +
src/styles/10-hud.css | 31 +
src/styles/20-drawers.css | 76 +
src/styles/30-toasts.css | 13 +
src/styles/40-modal.css | 110 +
src/styles/50-tablet.css | 38 +
src/styles/60-phone.css | 111 +
tests/build.test.js | 10 +-
tests/harness.js | 13 +-
tests/perf.test.js | 2 +-
tests/persist.test.js | 2 +-
113 files changed, 5584 insertions(+), 5195 deletions(-)
create mode 100644 scripts/build.js
delete mode 100755 scripts/build.sh
create mode 100644 scripts/dev.js
create mode 100644 scripts/legacy/split-index-html.js
create mode 100644 scripts/legacy/transforms.js
create mode 100644 scripts/lib/page.js
create mode 100644 scripts/test.js
delete mode 100644 site/index.html
create mode 100644 src/game/00-core/10-language.js
create mode 100644 src/game/00-core/20-analytics.js
create mode 100644 src/game/10-catalog/10-economy.js
create mode 100644 src/game/10-catalog/20-routers.js
create mode 100644 src/game/10-catalog/30-supply-chain.js
create mode 100644 src/game/10-catalog/40-ports.js
create mode 100644 src/game/10-catalog/50-dark-fiber.js
create mode 100644 src/game/10-catalog/60-reach-and-subsea.js
create mode 100644 src/game/20-world/10-projection.js
create mode 100644 src/game/20-world/20-landmasses.js
create mode 100644 src/game/20-world/30-coastline.js
create mode 100644 src/game/20-world/40-city-coords.js
create mode 100644 src/game/20-world/50-cities.js
create mode 100644 src/game/20-world/60-cables.js
create mode 100644 src/game/30-networks/10-networks.js
create mode 100644 src/game/30-networks/20-rival-exchanges.js
create mode 100644 src/game/30-networks/30-long-tail.js
create mode 100644 src/game/30-networks/40-traffic-shares.js
create mode 100644 src/game/40-progress/10-businesses.js
create mode 100644 src/game/40-progress/20-goals.js
create mode 100644 src/game/50-state.js
create mode 100644 src/game/60-features/10-banks.js
create mode 100644 src/game/60-features/20-scenarios.js
create mode 100644 src/game/60-features/30-conferences.js
create mode 100644 src/game/60-features/40-tutorial.js
create mode 100644 src/game/60-features/50-traceroute.js
create mode 100644 src/game/60-features/60-share-card.js
create mode 100644 src/game/60-features/70-scenario-progress.js
create mode 100644 src/game/60-features/80-new-game.js
create mode 100644 src/game/70-rules/10-helpers.js
create mode 100644 src/game/70-rules/20-exchanges.js
create mode 100644 src/game/70-rules/30-pnis.js
create mode 100644 src/game/70-rules/40-peering-inbox.js
create mode 100644 src/game/70-rules/50-peering-policy.js
create mode 100644 src/game/70-rules/60-de-kicks.js
create mode 100644 src/game/70-rules/70-sold-out.js
create mode 100644 src/game/70-rules/80-hot-ports-and-rank.js
create mode 100644 src/game/80-simulation/10-dijkstra.js
create mode 100644 src/game/80-simulation/20-routescript.js
create mode 100644 src/game/80-simulation/30-compute.js
create mode 100644 src/game/80-simulation/40-billing.js
create mode 100644 src/game/80-simulation/50-sanitize.js
create mode 100644 src/game/80-simulation/60-requirements.js
create mode 100644 src/game/80-simulation/70-customers-and-events.js
create mode 100644 src/game/80-simulation/80-geography-and-latency.js
create mode 100644 src/game/80-simulation/90-sites-and-service.js
create mode 100644 src/game/85-incidents/10-incidents-and-ddos.js
create mode 100644 src/game/85-incidents/20-failures.js
create mode 100644 src/game/85-incidents/30-events.js
create mode 100644 src/game/88-days/10-day-tick.js
create mode 100644 src/game/88-days/20-badges.js
create mode 100644 src/game/90-actions/00-actions.js
create mode 100644 src/game/90-actions/90-action-helpers.js
create mode 100644 src/game/91-save.js
create mode 100644 src/game/92-audio.js
create mode 100644 src/game/93-ui/10-dom.js
create mode 100644 src/game/93-ui/20-phone.js
create mode 100644 src/game/93-ui/30-install.js
create mode 100644 src/game/93-ui/40-hud-and-panels.js
create mode 100644 src/game/93-ui/50-city-panel.js
create mode 100644 src/game/93-ui/60-decommission.js
create mode 100644 src/game/93-ui/70-link-panels.js
create mode 100644 src/game/94-dashboard/10-progress.js
create mode 100644 src/game/94-dashboard/20-meet-a-network.js
create mode 100644 src/game/94-dashboard/30-customers.js
create mode 100644 src/game/94-dashboard/40-connections.js
create mode 100644 src/game/94-dashboard/50-lease-swaps.js
create mode 100644 src/game/94-dashboard/60-dashboard.js
create mode 100644 src/game/94-dashboard/70-bank.js
create mode 100644 src/game/94-dashboard/80-hint.js
create mode 100644 src/game/95-modals/10-toasts.js
create mode 100644 src/game/95-modals/20-notifications.js
create mode 100644 src/game/95-modals/30-modal-and-names.js
create mode 100644 src/game/95-modals/40-title.js
create mode 100644 src/game/95-modals/50-release-notes.js
create mode 100644 src/game/95-modals/60-help.js
create mode 100644 src/game/95-modals/70-link-modal.js
create mode 100644 src/game/95-modals/80-own-cable.js
create mode 100644 src/game/95-modals/90-fiber-modals.js
create mode 100644 src/game/96-map/10-canvas.js
create mode 100644 src/game/96-map/20-land-and-clouds.js
create mode 100644 src/game/96-map/30-settings.js
create mode 100644 src/game/96-map/40-level-of-detail.js
create mode 100644 src/game/96-map/50-link-geometry.js
create mode 100644 src/game/96-map/60-draw.js
create mode 100644 src/game/96-map/70-world-layer.js
create mode 100644 src/game/96-map/80-cities.js
create mode 100644 src/game/96-map/90-input.js
create mode 100644 src/game/96-map/95-clicks.js
create mode 100644 src/game/99-loop.js
create mode 100644 src/index.html
create mode 100644 src/styles/00-base.css
create mode 100644 src/styles/10-hud.css
create mode 100644 src/styles/20-drawers.css
create mode 100644 src/styles/30-toasts.css
create mode 100644 src/styles/40-modal.css
create mode 100644 src/styles/50-tablet.css
create mode 100644 src/styles/60-phone.css
diff --git a/package.json b/package.json
index 322becd..85164a2 100644
--- a/package.json
+++ b/package.json
@@ -10,9 +10,11 @@
"url": "git+https://github.com/fjaeckel/seriesoftubes.git"
},
"scripts": {
- "test": "node --test --test-concurrency=1 tests/game.test.js tests/build.test.js tests/persist.test.js tests/services.test.js tests/peering.test.js tests/inbox.test.js tests/latency.test.js tests/supply.test.js tests/issues.test.js tests/regions.test.js tests/modes.test.js tests/levels.test.js tests/speed.test.js tests/i18n.test.js tests/routing-reference.test.js tests/perf.test.js tests/sea-routing.test.js tests/subsea-upgrade-timing.test.js",
- "build": "bash scripts/build.sh",
+ "test": "node scripts/test.js",
+ "build": "node scripts/build.js",
"i18n:check": "node scripts/i18n-check.js",
+ "dev": "node scripts/dev.js",
+ "page": "node scripts/lib/page.js",
"serve": "npm run build && npx --yes serve@14.2.4 _site",
"perf": "node scripts/perf-bench.js"
},
diff --git a/scripts/build.js b/scripts/build.js
new file mode 100644
index 0000000..60e6159
--- /dev/null
+++ b/scripts/build.js
@@ -0,0 +1,52 @@
+#!/usr/bin/env node
+// Builds the deployable site into _site/ (or $OUT) for GitHub Pages: copies the static files in site/,
+// assembles the game page from src/ into one index.html, and stamps the version (from package.json) and
+// the build date into the files that carry them. The output is plain static files and nothing else,
+// because GitHub Pages is where the game lives (docs/adr/0001-github-pages-only.md).
+//
+// npm run build VERSION, BUILD_DATE and OUT can be set in the environment
+// REQUIRE_NOTES=1 npm run build fail when CHANGELOG.md has no bullets for this version
+const fs = require('node:fs');
+const path = require('node:path');
+const { execFileSync } = require('node:child_process');
+const { assemble, ROOT } = require('./lib/page');
+
+const VERSION = process.env.VERSION || require(path.join(ROOT, 'package.json')).version;
+const BUILD_DATE = process.env.BUILD_DATE || new Date().toISOString().slice(0, 10);
+const OUT = path.resolve(ROOT, process.env.OUT || '_site');
+const die = (msg) => { console.error(`error: ${msg}`); process.exit(1); };
+
+if (!/^[0-9]+\.[0-9]+\.[0-9]+([-.+][0-9A-Za-z.-]+)?$/.test(VERSION)) die(`VERSION '${VERSION}' is not a semantic version`);
+if (!/^\d{4}-\d{2}-\d{2}$/.test(BUILD_DATE)) die(`BUILD_DATE '${BUILD_DATE}' is not YYYY-MM-DD`);
+if (OUT === ROOT || OUT === path.join(ROOT, 'site') || OUT === path.join(ROOT, 'src')) die(`refusing to build into ${OUT}`);
+
+fs.rmSync(OUT, { recursive: true, force: true });
+fs.cpSync(path.join(ROOT, 'site'), OUT, { recursive: true });
+if (fs.existsSync(path.join(OUT, 'index.html'))) die('site/index.html must not exist: the page is assembled from src/');
+fs.writeFileSync(path.join(OUT, 'index.html'), assemble().html);
+
+for (const f of ['index.html', 'sitemap.xml', 'llms.txt', 'sw.js']) {
+ const p = path.join(OUT, f);
+ fs.writeFileSync(p, fs.readFileSync(p, 'utf8').replaceAll('__VERSION__', VERSION).replaceAll('__BUILD_DATE__', BUILD_DATE));
+}
+
+// Release notes for this version, baked into the page ("What's new") and published as version.json so
+// open games can spot a newer release.
+const notes = execFileSync(process.execPath, [path.join(__dirname, 'release-notes.js'), VERSION], { encoding: 'utf8' });
+if (process.env.REQUIRE_NOTES === '1' && notes === '[]') die(`CHANGELOG.md has no '## [${VERSION}]' section with bullets (still under [Unreleased]?)`);
+const page = path.join(OUT, 'index.html'), PH = '/*__RELEASE_NOTES__*/[]', html = fs.readFileSync(page, 'utf8');
+if (!html.includes(PH)) die('release-notes placeholder missing from the page');
+// Function replacer: no $& / $$ expansion. Escape "<" so a note can never close the ';
+const clients = new Set();
+
+function page() {
+ const { html, map } = assemble();
+ // Errors report a line of the assembled page; the console also says which file under src/ that is.
+ const hint = ``;
+ return html.replace('
-
-
Series of Tubes: build the internet, one tube at a time
-
A free cartoon browser game about how the internet works. Start as a tiny network in one city, launch home broadband, buy IP transit from Tier 1 and Tier 2 carriers, peer at internet exchanges, set up private interconnects and embedded CDN caches, and lay terrestrial fiber, subsea waves and your own dark fiber with DWDM and ZR optics. Sign enterprise, hosting, high-frequency trading, AI GPU and hyperscaler customers, and keep them happy while backhoes, sharks, fat fingers, route leaks, DDoS attacks and geopolitics break things.
-
-
-
-
-
-
-
-
Traffic served
0
-
Reach
0%
-
Rank
Tier 3
-
-
-
-
-
Date
Y1 · Jan 1
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
🐘 BREAKING: CVE-2026-31337 IN PHP TAKES DOWN HALF THE INTERNETEvery WordPress-ish site on Earth is now a crypto miner<?php echo "sorry"; ?>Eyeball traffic down 30%Hosting customers patching at 3 a.m.Security team asks: “are we on PHP?” Everyone: “define we”🐘 BREAKING: CVE-2026-31337 IN PHP TAKES DOWN HALF THE INTERNETEvery WordPress-ish site on Earth is now a crypto miner<?php echo "sorry"; ?>Eyeball traffic down 30%Hosting customers patching at 3 a.m.Security team asks: “are we on PHP?” Everyone: “define we”