From 239682720e82740b5e1af706ad2fd720450ccfaa Mon Sep 17 00:00:00 2001
From: Frederic Jung
Date: Tue, 27 Oct 2026 18:22:37 +0100
Subject: [PATCH] Allow up to 16 routers per POP, with a cage extension past
six (#157)
---
CHANGELOG.md | 2 +
site/i18n/fr.js | 3 ++
site/i18n/it.js | 3 ++
site/i18n/pt.js | 3 ++
src/game/10-catalog/30-supply-chain.js | 7 +++-
src/game/80-simulation/30-compute.js | 2 +-
src/game/90-actions/85-routing-and-routers.js | 2 +-
src/game/93-ui/50-city-panel.js | 3 +-
src/i18n/en.js | 3 ++
tests/routers-per-pop.test.js | 41 +++++++++++++++++++
10 files changed, 64 insertions(+), 5 deletions(-)
create mode 100644 tests/routers-per-pop.test.js
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 738dc06..ecf661e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,8 @@ All notable changes to this project are documented here. The project follows
## [Unreleased]
+- Big POPs can now run up to 16 routers (#157). The standard cage still holds six: each router past that costs half again to install and adds rent for a cage extension.
+
## [1.34.1] — 2026-10-27
- The game starts faster in Italian, Portuguese and French: their translations are about 40% smaller to download.
diff --git a/site/i18n/fr.js b/site/i18n/fr.js
index cc2a128..1e875f1 100644
--- a/site/i18n/fr.js
+++ b/site/i18n/fr.js
@@ -572,6 +572,7 @@
"city_panel.build_pop_cost_mo_mo":"Construire le POP {cost} + {mo}/mois",
"city_panel.build_tier_cost_mo_mo":"Construire {tier} {cost} + {mo}/mois",
"city_panel.buy_a_port_on_a_fabric":"Achète un port sur un fabric, puis commande des circuits virtuels vers tes autres POP ou vers un IX distant. Rapide et souple, mais tu partages leur fabric.",
+"city_panel.cage_extension":"Extension de cage",
"city_panel.carrying_g":"transporte {g}",
"city_panel.carrying_g_per_site":"transporte {g} par site",
"city_panel.cdns_put_free_cache_servers_inside":"Les CDN installent gratuitement des serveurs de cache dans ton POP. L’essentiel de leur trafic est alors servi ici même, sans transit ni port IX.",
@@ -655,7 +656,9 @@
"city_panel.switch_to_on_demand_cheaper":"Passer à la demande moins cher",
"city_panel.the_model_sets_your_fastest":"Le modèle détermine ton interface la plus rapide et ce que ce POP peut transmettre. Plus de routeurs, c’est plus de capacité et une meilleure résistance aux plantages.",
"city_panel.the_nearly_broadband_network_keeps":"Le Nearly Broadband Network en garde {pct} pour le dernier kilomètre.",
+"city_panel.the_standard_cage_holds_n_routers":"La cage standard accueille {n} routeurs. Chacun au-delà demande une extension : l'installation coûte 50 % de plus et {mo}/mois en plus pour l'espace et l'énergie.",
"city_panel.this_chassis_takes_forever_to_boot":"Ce châssis met une éternité à booter : les plantages durent plus longtemps, et remplacer l’unique routeur d’ici prend 3 jours. Un second routeur masque le problème.",
+"city_panel.this_pop_has_the_most_routers":"Ce POP a {n} routeurs, autant que le bâtiment peut alimenter. Passez à un modèle plus gros pour aller plus loin.",
"city_panel.this_pop_is_down":"Ce POP est en panne",
"city_panel.top_destinations_on_this_port":"Principales destinations sur ce port",
"city_panel.transit_sellers_list":"Vendeurs de transit : {list}",
diff --git a/site/i18n/it.js b/site/i18n/it.js
index 4c0b658..2d0489d 100644
--- a/site/i18n/it.js
+++ b/site/i18n/it.js
@@ -572,6 +572,7 @@
"city_panel.build_pop_cost_mo_mo":"Costruisci POP {cost} + {mo}/mese",
"city_panel.build_tier_cost_mo_mo":"Costruisci {tier} {cost} + {mo}/mese",
"city_panel.buy_a_port_on_a_fabric":"Compra una porta su un fabric, poi ordina circuiti virtuali verso gli altri tuoi POP o verso un IX remoto. Veloce e flessibile, ma condividi il loro fabric.",
+"city_panel.cage_extension":"Ampliamento della gabbia",
"city_panel.carrying_g":"trasporta {g}",
"city_panel.carrying_g_per_site":"trasporta {g} per sede",
"city_panel.cdns_put_free_cache_servers_inside":"I CDN mettono server cache gratis dentro il tuo POP. Gran parte del loro traffico viene così servita direttamente qui, senza transit e senza porta IX.",
@@ -655,7 +656,9 @@
"city_panel.switch_to_on_demand_cheaper":"Passa a on-demand più economico",
"city_panel.the_model_sets_your_fastest":"Il modello decide la tua interfaccia più veloce e quanto può inoltrare questo POP. Più router aggiungono capacità e sopravvivono ai crash.",
"city_panel.the_nearly_broadband_network_keeps":"La Nearly Broadband Network se ne tiene il {pct} per l’ultimo miglio.",
+"city_panel.the_standard_cage_holds_n_routers":"La gabbia standard contiene {n} router. Ognuno in più richiede un ampliamento: l'installazione costa il 50% in più e paghi {mo}/mese in più per spazio ed energia.",
"city_panel.this_chassis_takes_forever_to_boot":"Questo chassis ci mette una vita a fare il boot: i crash durano di più, e sostituire l’unico router qui richiede 3 giorni. Un secondo router lo nasconde.",
+"city_panel.this_pop_has_the_most_routers":"Questo POP ha {n} router, tutti quelli che l'edificio riesce ad alimentare. Per crescere ancora passa a un modello più grande.",
"city_panel.this_pop_is_down":"Questo POP è down",
"city_panel.top_destinations_on_this_port":"Destinazioni principali su questa porta",
"city_panel.transit_sellers_list":"Venditori di transit: {list}",
diff --git a/site/i18n/pt.js b/site/i18n/pt.js
index c422345..76cc019 100644
--- a/site/i18n/pt.js
+++ b/site/i18n/pt.js
@@ -572,6 +572,7 @@
"city_panel.build_pop_cost_mo_mo":"Construir POP {cost} + {mo}/mês",
"city_panel.build_tier_cost_mo_mo":"Construir {tier} {cost} + {mo}/mês",
"city_panel.buy_a_port_on_a_fabric":"Compre uma porta num fabric e depois peça circuitos virtuais para seus outros POPs ou para um IX remoto. Rápido e flexível, mas você divide o fabric deles.",
+"city_panel.cage_extension":"Ampliação da gaiola",
"city_panel.carrying_g":"levando {g}",
"city_panel.carrying_g_per_site":"levando {g} por site",
"city_panel.cdns_put_free_cache_servers_inside":"CDNs colocam servidores de cache grátis dentro do seu POP. A maior parte do tráfego delas é servida aqui mesmo, sem transit e sem porta de IX.",
@@ -655,7 +656,9 @@
"city_panel.switch_to_on_demand_cheaper":"Mudar para on-demand mais barato",
"city_panel.the_model_sets_your_fastest":"O modelo define sua interface mais rápida e quanto este POP consegue encaminhar. Mais routers somam capacidade e sobrevivem a crashes.",
"city_panel.the_nearly_broadband_network_keeps":"A Nearly Broadband Network fica com {pct} disso pela última milha.",
+"city_panel.the_standard_cage_holds_n_routers":"A gaiola padrão comporta {n} routers. Cada um a mais precisa de uma ampliação: a instalação custa 50% a mais e paga {mo}/mês extra em espaço e energia.",
"city_panel.this_chassis_takes_forever_to_boot":"Este chassi demora uma eternidade pra dar boot: crashes duram mais, e trocar o único router daqui leva 3 dias. Um segundo router disfarça isso.",
+"city_panel.this_pop_has_the_most_routers":"Este POP tem {n} routers, todos os que o prédio consegue alimentar. Para crescer mais, troque para um modelo maior.",
"city_panel.this_pop_is_down":"Este POP está fora do ar",
"city_panel.top_destinations_on_this_port":"Principais destinos nesta porta",
"city_panel.transit_sellers_list":"Vendedores de transit: {list}",
diff --git a/src/game/10-catalog/30-supply-chain.js b/src/game/10-catalog/30-supply-chain.js
index f9cc122..d59b599 100644
--- a/src/game/10-catalog/30-supply-chain.js
+++ b/src/game/10-catalog/30-supply-chain.js
@@ -20,10 +20,13 @@ function hwCard(){if(!S||(S.day<=HW_FREE&&!hwShock()&&!hwLock()))return '';const
${s?`${tr('common.shortage')}${tr('supply_chain.what_p_n_days_left',{what:tr(HW_SHOCK[s.k].n),p:pct(s.mul-1),n:s.until-S.day})}
`:''}
${l?`${tr('common.price_lock')}${tr('supply_chain.until_date_at_p',{date:dateStr(l.until),p:pct(l.mul-1)})}
`
:`${tr('supply_chain.routers_optics_and_new_builds_at')}
${btn(tr('supply_chain.lock_prices_for_a_year_cost',{cost:fmt$(hwLockCost())}),'hwLock',{},'sm',S.cash`}
`;}
-const routerCost=g=>Math.round((ROUTER_COST+RG[g].cost*0.8)*hwMul('rt'));
+// Routers past the standard cage (#157) need a cage extension: pricier to install, and rent on top.
+const RCAGE=6,CAGE_MUL=1.5,CAGE_MO=2000;
+const routerCost=(g,rt)=>Math.round((ROUTER_COST+RG[g].cost*0.8)*((rt||1)>=RCAGE?CAGE_MUL:1)*hwMul('rt'));
+const routerMo=g=>ROUTER_MO+RG[g].mo,cageMo=rt=>Math.max(0,(rt||1)-RCAGE)*CAGE_MO;
// Old routers go on eBuy when you swap models or remove one (#82), like spare optics (#45). Chassis age faster.
const ROUTER_RESALE=0.3,tradeIn=(g,n)=>Math.round(RG[g].cost*n*ROUTER_RESALE),swapCost=(c,g)=>{const p=S.pops[c],rt=p.routers||1;return Math.max(0,Math.round(RG[g].cost*rt*hwMul('rt'))-tradeIn(p.rgen||0,rt));};
-const RMAX=6;
+const RMAX=16;
// The plain, badge-less model of each class is the default upgrade path; the others are side-grades.
const mainRG=k=>RG.findIndex(r=>r.cls===k&&!r.badge);
// Ports and waves beyond 1.6T / 6.4T only show once a router that takes them is unlocked.
diff --git a/src/game/80-simulation/30-compute.js b/src/game/80-simulation/30-compute.js
index 898f29a..518ba01 100644
--- a/src/game/80-simulation/30-compute.js
+++ b/src/game/80-simulation/30-compute.js
@@ -247,7 +247,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.values(S.pops).reduce((a,p)=>a+POP_MO+((p.routers||1)-1)*ROUTER_MO+cageMo(p.routers)+(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);
diff --git a/src/game/90-actions/85-routing-and-routers.js b/src/game/90-actions/85-routing-and-routers.js
index f6520d4..8883dac 100644
--- a/src/game/90-actions/85-routing-and-routers.js
+++ b/src/game/90-actions/85-routing-and-routers.js
@@ -3,7 +3,7 @@ Object.assign(ACT,{
setRoute:({id,m})=>{if(!own(RT,m))return;const b=S.biz.find(x=>x.id===id);if(b){b.route=m;sfx('click');after();}},
route:({r})=>{UI.route=r;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);},
addParallel:({id})=>{const l=S.links.find(x=>x.id===id);if(l)openLinkModal(l.a,l.b);},
- addRouter:({city})=>{const p=S.pops[city];if(!p||(p.routers||1)>=RMAX)return;if(!spend(routerCost(p.rgen||0)))return;p.routers=(p.routers||1)+1;floater(CITY[city].x,CITY[city].y-30,tr('common.router_added'),'#FF4F9A');after();},
+ addRouter:({city})=>{const p=S.pops[city];if(!p||(p.routers||1)>=RMAX)return;if(!spend(routerCost(p.rgen||0,p.routers||1)))return;p.routers=(p.routers||1)+1;floater(CITY[city].x,CITY[city].y-30,tr('common.router_added'),'#FF4F9A');after();},
models:()=>{UI.models=!UI.models;renderPanel();},
rmRouter:({city})=>{const p=S.pops[city];if(!p||(p.routers||1)<=1)return;if(portsUsed(city)>portsMax(city,undefined,p.routers-1)){toast(tr('routing_and_routers.unplug_something_first_used_ports',{used:fmtPorts(portsUsed(city)),max:portsMax(city,undefined,p.routers-1)}),'bad');sfx('err');return;}p.routers--;{const back=tradeIn(p.rgen||0,1);if(back>0){S.cash+=back;toast(tr('routing_and_routers.sold_a_model_on_ebuy_price',{model:esc(RG[p.rgen||0].n),price:fmt$(back)}),'good');}}after();},
upRouter:({city,g})=>{const p=S.pops[city];if(!p)return;g=g===undefined?mainRG(RG[p.rgen||0].cls+1):+g;if(!RG[g]||g===(p.rgen||0))return;{const why=modelFits(city,g);if(why){toast(tr('routing_and_routers.the_model_won_t_fit_why',{model:esc(RG[g].n),why:esc(why)}),'bad');sfx('err');return;}}if(RG[g].lvl>lvl()){toast(tr('routing_and_routers.model_unlocks_at_customer_level_lv',{model:esc(RG[g].n),lv:RG[g].lvl}),'bad');sfx('err');return;}
diff --git a/src/game/93-ui/50-city-panel.js b/src/game/93-ui/50-city-panel.js
index c124bcd..1707790 100644
--- a/src/game/93-ui/50-city-panel.js
+++ b/src/game/93-ui/50-city-panel.js
@@ -75,7 +75,8 @@ function cityPanel(c){
${tr('common.forwarding_chip')}${esc(G.chip)}
${tr('common.boot_time')}${slowBoot(c)?`${tr('city_panel.n_min_a_slow_one',{n:bootMin(c)})}`:tr('city_panel.n_min',{n:bootMin(c)})}
${slowBoot(c)?`${tr('city_panel.this_chassis_takes_forever_to_boot')}
`:''}
${tr('common.forwarding_load')}${fmtG(nl)} / ${fmtG(nc)}
${nl>=nc*0.95?`${tr('city_panel.maxed_out_traffic_here_is_being')}
`:''}
- ${N?btn(N.lvl>lvl()?tr('city_panel.model_level_lv',{model:esc(N.n),lv:N.lvl}):tr('city_panel.upgrade_to_model_cost_mo_mo',{model:esc(N.n),cost:fmt$(swapCost(c,Ni)),mo:fmt$(N.mo*rt)}),'upRouter',{city:c,g:Ni},'pink',N.lvl>lvl()||S.cash1?btn(tr('common.remove_one'),'rmRouter',{city:c},'ghost sm'):''}
+ ${N?btn(N.lvl>lvl()?tr('city_panel.model_level_lv',{model:esc(N.n),lv:N.lvl}):tr('city_panel.upgrade_to_model_cost_mo_mo',{model:esc(N.n),cost:fmt$(swapCost(c,Ni)),mo:fmt$(N.mo*rt)}),'upRouter',{city:c,g:Ni},'pink',N.lvl>lvl()||S.cash=RCAGE?CAGE_MO:0))}),'addRouter',{city:c},'',S.cash1?btn(tr('common.remove_one'),'rmRouter',{city:c},'ghost sm'):''}
+ ${rt>=RCAGE&&rt${tr('city_panel.the_standard_cage_holds_n_routers',{n:RCAGE,mo:fmt$(CAGE_MO)})}
`:''}${rt>=RMAX?`${tr('city_panel.this_pop_has_the_most_routers',{n:RMAX})}
`:''}${rt>RCAGE?`${tr('city_panel.cage_extension')}${fmt$(cageMo(rt))}/mo
`:''}
${UI.models?routerModels(c):''}
${N||UI.models?`${(p.rgen||0)>0?tr('city_panel.prices_include_p_back_for_the',{p:fmt$(tradeIn(p.rgen||0,rt))})+' ':''}${p.rupDay===S.day?tr('city_panel.new_routers_went_in_today_the')+' ':''}${rt>1?tr('city_panel.rolling_upgrade_one_router_at_a'):tr('city_panel.with_one_router_the_upgrade_needs')}
`:''}
${rt>=2?tr('city_panel.a_crash_here_only_costs_one'):tr('city_panel.one_router_is_a_single_point')}
diff --git a/src/i18n/en.js b/src/i18n/en.js
index bcc07fe..4dabfa8 100644
--- a/src/i18n/en.js
+++ b/src/i18n/en.js
@@ -573,6 +573,7 @@
"city_panel.build_pop_cost_mo_mo":"Build POP {cost} + {mo}/mo",
"city_panel.build_tier_cost_mo_mo":"Build {tier} {cost} + {mo}/mo",
"city_panel.buy_a_port_on_a_fabric":"Buy a port on a fabric, then order virtual circuits to your other POPs or to a remote IX. Fast and flexible, but you share their fabric.",
+"city_panel.cage_extension":"Cage extension",
"city_panel.carrying_g":"carrying {g}",
"city_panel.carrying_g_per_site":"carrying {g} per site",
"city_panel.cdns_put_free_cache_servers_inside":"CDNs put free cache servers inside your POP. Most of their traffic is then served right here, with no transit and no IX port.",
@@ -656,7 +657,9 @@
"city_panel.switch_to_on_demand_cheaper":"Switch to on-demand cheaper",
"city_panel.the_model_sets_your_fastest":"The model sets your fastest interface and how much this POP can forward. More routers add capacity and survive crashes.",
"city_panel.the_nearly_broadband_network_keeps":"The Nearly Broadband Network keeps {pct} of it for the last mile.",
+"city_panel.the_standard_cage_holds_n_routers":"The standard cage holds {n} routers. Each one past that needs a cage extension: it costs half again to install and {mo}/mo in extra space and power.",
"city_panel.this_chassis_takes_forever_to_boot":"This chassis takes forever to boot: crashes last longer, and swapping the only router here takes 3 days. A second router hides it.",
+"city_panel.this_pop_has_the_most_routers":"This POP has {n} routers, as many as the building will power. Swap to a bigger model to grow further.",
"city_panel.this_pop_is_down":"This POP is down",
"city_panel.top_destinations_on_this_port":"Top destinations on this port",
"city_panel.transit_sellers_list":"Transit sellers: {list}",
diff --git a/tests/routers-per-pop.test.js b/tests/routers-per-pop.test.js
new file mode 100644
index 0000000..b0fe9d3
--- /dev/null
+++ b/tests/routers-per-pop.test.js
@@ -0,0 +1,41 @@
+const test = require('node:test');
+const assert = require('node:assert/strict');
+const { load } = require('./harness');
+
+const start = "ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'})";
+
+test('#157 a POP can grow past six routers, with a cage extension', () => {
+ const { ev, dom, errors } = load();
+ ev(start);
+ for (let i = 0; i < 5; i++) ev("ACT.addRouter({city:'fra'})");
+ assert.equal(ev('S.pops.fra.routers'), 6);
+ const inCage = ev('routerCost(S.pops.fra.rgen||0,5)'), pastCage = ev('routerCost(S.pops.fra.rgen||0,6)');
+ assert.ok(pastCage > inCage, 'the seventh router costs more to install');
+ const cash = ev('S.cash');
+ ev("ACT.addRouter({city:'fra'})");
+ assert.equal(ev('S.pops.fra.routers'), 7, 'a seventh router goes in');
+ assert.equal(cash - ev('S.cash'), pastCage);
+ ev('compute()');
+ const withCage = ev('R.cost.pops');
+ ev("S.pops.fra.routers=6;compute()");
+ const without = ev('R.cost.pops');
+ assert.equal(withCage - without, ev('ROUTER_MO+RG[S.pops.fra.rgen||0].mo+CAGE_MO'), 'the cage extension is billed monthly');
+ ev("S.pops.fra.routers=7;compute()");
+ assert.ok(ev('nodeCap("fra")') === ev('RG[S.pops.fra.rgen||0].cap*7'), 'every router adds forwarding');
+ ev("UI.sel={k:'city',id:'fra'};renderAll()");
+ assert.match(dom.window.document.body.innerHTML, /Cage extension/);
+ assert.deepEqual(errors, []);
+});
+
+test('#157 the cap stops at RMAX and saves keep their routers', () => {
+ const { ev, errors } = load();
+ ev(start);
+ for (let i = 0; i < 30; i++) ev("ACT.addRouter({city:'fra'})");
+ assert.equal(ev('S.pops.fra.routers'), ev('RMAX'));
+ assert.ok(ev('RMAX') > 6);
+ ev("const s=JSON.parse(JSON.stringify(S));s.pops.fra.routers=12;window.__t=migrate(s)");
+ assert.equal(ev('__t.pops.fra.routers'), 12, 'a big POP survives a save round trip');
+ ev("const s=JSON.parse(JSON.stringify(S));s.pops.fra.routers=999;window.__t=migrate(s)");
+ assert.equal(ev('__t.pops.fra.routers'), ev('RMAX'), 'nonsense is clamped');
+ assert.deepEqual(errors, []);
+});