diff --git a/CHANGELOG.md b/CHANGELOG.md index 2747e8e..91e733e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,13 @@ All notable changes to this project are documented here. The project follows ## [Unreleased] +- Customer levels now go up to 13 instead of 4. Every new level asks for more peak traffic, POPs and continents, ending at 50 Tbps and 80 POPs on six continents, and each one unlocks new customers, gear or deals. Reaching level 13 earns a new legendary badge. +- Seven new router models arrive between levels 5 and 13, including the first 3.2T routers with 3.2T ports and 12.8T waves. The Absolute Unit 3.2T is the main upgrade; whitebox, licensed, deep-buffer, Finnish and budget side-grades sit next to it. +- Paid-peering giants now give you a free PNI once you are big enough. Doitsche Telekomm gives in at level 6, then Voda-Phony, Tel-Mess, Etis-a-lot, China Moble, Du-opoly and Ooh-redoo. +- New customers at the higher levels: esports world finals, sovereign cloud regions, cloud gaming platforms, metaverse platforms, AGI labs and Mars mission ground stations. +- Traffic keeps growing as you level up. Levels 5, 8, 10 and 12 each start a new era (4K everywhere, cloud gaming, VR, AI agents) that raises how many eyeballs every city wants. +- New optical gear for big networks: ROADMaster 9000 C+L line systems with 128 channels, Sienna WaveMagic 3.2T transponders, and eight fiber pairs in your own land trenches. Your own exchange gets a 102.4T fabric and scrubbing goes up to 100T. +- The "Next level" hint keeps names like Edge Lord 400 readable instead of lower-casing them. - Your own subsea cable now runs beside the existing cable on its route instead of looping far out to sea (#64). Leased and own fiber next to a busy trench no longer swing out in giant loops either, on any route. - Loans got stranger, and good ones got harder to get. Your credit rating now adds a risk premium to the interest rate, the big banks only lend to strong ratings, and a diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md index b12eb49..9db1b67 100644 --- a/docs/ARCHITECTURE.md +++ b/docs/ARCHITECTURE.md @@ -10,7 +10,7 @@ thousand lines), so find things by the section banners rather than by line numbe /* ================= CONSTANTS ================= */ prices, ports (PORT), routers (RG), optics /* ================= WORLD ================= */ CITIES, CABLES, display nudges /* ================= NETWORKS ================= */ NETS (other ASes), traffic shares (NSH) -/* ================= BUSINESSES ================= */ BIZ_T customer types, LEVELS +/* ================= BUSINESSES ================= */ BIZ_T customer types, LEVELS + LV_REQ (13 levels, traffic eras) /* ================= GOALS ================= */ GOALS checklist /* ================= STATE ================= */ S, R, UI globals /* ================= BANKS & LOANS ================= */ diff --git a/package.json b/package.json index c81a753..ebe4e94 100644 --- a/package.json +++ b/package.json @@ -7,7 +7,7 @@ "homepage": "https://seriesoftub.es/", "repository": { "type": "git", "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/issues.test.js tests/regions.test.js tests/modes.test.js tests/i18n.test.js", + "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/issues.test.js tests/regions.test.js tests/modes.test.js tests/levels.test.js tests/i18n.test.js", "build": "bash scripts/build.sh", "i18n:check": "node scripts/i18n-check.js", "serve": "npm run build && npx --yes serve@14.2.4 _site" diff --git a/site/i18n/it.js b/site/i18n/it.js index 7f8c691..97eb7aa 100644 --- a/site/i18n/it.js +++ b/site/i18n/it.js @@ -1656,8 +1656,6 @@ "{n} lit":"{n} accesi", "Line system":"Sistema di linea", "{n} amplifiers":"{n} amplificatori", -"Upgrade to ROADMaster 9000 {price}":"Passa a ROADMaster 9000 {price}", -"ROADMaster 9000 level 3":"ROADMaster 9000 livello 3", "Spares kit on ✓":"Kit ricambi attivo ✓", "Keep a spares kit {price}/mo":"Tieni un kit ricambi {price}/mese", "Spare optics and amplifier cards on the shelf turn multi-day hardware failures into one-day swaps.":"Ottiche e schede amplificatore di scorta sullo scaffale trasformano guasti hardware da più giorni in sostituzioni da un giorno.", @@ -2289,4 +2287,73 @@ "the rest is due at the end":"il resto si paga alla fine", "Nothing to pay until the end":"Niente da pagare fino alla fine", "then about {price} at once":"poi circa {price} tutto insieme", +"handed off as 4×3.2T":"consegnato come 4×3.2T", +"Tomahack 5 merchant silicon":"silicio merchant Tomahack 5", +"Sixty-four 1.6T ports on open-source software for the price of one line card. There is still nobody to call at 3 a.m., but now the crashes are 1.6T crashes.":"Sessantaquattro porte 1.6T con software open source al prezzo di una sola line card. Alle 3 di notte non c'è ancora nessuno da chiamare, ma adesso i crash sono crash da 1.6T.", +"Cheap chassis, eternal subscription. Every port needs a licence, every licence needs a licence server, and the licence server needs a licence.":"Chassis economico, abbonamento eterno. Ogni porta vuole una licenza, ogni licenza vuole un server di licenze, e il server di licenze vuole una licenza.", +"PacketOinker³ (a whole litter)":"PacketOinker³ (una cucciolata intera)", +"3.2T ports, and 12.8T waves handed off as 4×3.2T. Draws as much power as a small town and ships with its own substation. Needs a bigger forklift.":"Porte 3.2T e wave 12.8T consegnate come 4×3.2T. Consuma quanto un paesino e arriva con la sua cabina elettrica. Serve un muletto più grosso.", +"Jerry-cho⁵ deep-buffer silicon":"silicio deep-buffer Jerry-cho⁵", +"A hundred and forty-four 3.2T ports and buffers deep enough to hide a whole fleet. Still boots before your flat white. The beard now has a beard.":"Centoquarantaquattro porte 3.2T e buffer così profondi da nasconderci una flotta intera. Si avvia ancora prima del tuo flat white. Ora anche la barba ha la barba.", +"Fin-P6 network processor":"network processor Fin-P6", +"Built like a sauna door: heavy, hot and nearly impossible to break. The config is now so hierarchical it has a royal family.":"Costruito come la porta di una sauna: pesante, bollente e quasi indistruttibile. La config ormai è così gerarchica che ha una famiglia reale.", +"several hundred ARM cores and a prayer":"qualche centinaio di core ARM e una preghiera", +"A 3.2T router for the price of a used car. The web interface has nine hundred tabs, and one of them is the one you need.":"Un router 3.2T al prezzo di un'auto usata. L'interfaccia web ha novecento schede, e una di queste è quella che ti serve.", +"forty-two of them":"quarantadue", +"Two hundred and fifty-six 3.2T ports and enough forwarding for a small galaxy. Boots in 42 minutes. Nobody remembers what the question was.":"Duecentocinquantasei porte 3.2T e abbastanza forwarding per una piccola galassia. Si avvia in 42 minuti. Nessuno ricorda più quale fosse la domanda.", +"Lights the L-band as well: twice the spectrum, up to 128 channels on one fiber pair, and amplifiers that take twice as long to explain.":"Accende anche la banda L: il doppio dello spettro, fino a 128 canali su una coppia di fibre, e amplificatori che richiedono il doppio del tempo per essere spiegati.", +"Twice the WaveMagic. Full speed only on shorter spans, and a cooling fan you can hear from the car park.":"Il doppio del WaveMagic. Piena velocità solo sulle tratte più corte, e una ventola che senti dal parcheggio.", +"Esports world final":"Finale mondiale di esport", +"Sovereign cloud region":"Region di cloud sovrano", +"Cloud gaming platform":"Piattaforma di cloud gaming", +"Metaverse platform":"Piattaforma metaverso", +"AGI lab (allegedly)":"Laboratorio AGI (a sentir loro)", +"Mars mission ground station":"Stazione di terra per una missione su Marte", +"Your network diagram is a photo of a whiteboard.":"Il tuo schema di rete è la foto di una lavagna.", +"You now have a change freeze. Nobody remembers who declared it.":"Ora hai un change freeze. Nessuno ricorda chi l'ha dichiarato.", +"It's not DNS. There's no way it's DNS. It was DNS.":"Non è il DNS. Non può essere il DNS. Era il DNS.", +"Your MTU is 9000 on every link except the one that matters.":"Hai MTU 9000 su tutti i link tranne quello che conta.", +"Continental carrier":"Carrier continentale", +"Your NOC has a chat channel called #its-always-the-fiber, and it is always the fiber.":"Il tuo NOC ha un canale chat chiamato #è-sempre-la-fibra, ed è sempre la fibra.", +"peak 6 Tbps, 15 POPs, 4 continents":"picco 6 Tbps, 15 POP, 4 continenti", +"Esports world finals, and the 4K-everything era: eyeballs in every city want 15% more. Gear: Sonic the Whitebox 64 routers.":"Finali mondiali di esport, e l'era del 4K ovunque: gli eyeball di ogni città vogliono il 15% in più. Gear: router Sonic the Whitebox 64.", +"Transcontinental":"Transcontinentale", +"You joined the outages mailing list. Today you are the outage.":"Ti sei iscritto alla mailing list dei guasti. Oggi il guasto sei tu.", +"peak 9 Tbps and 20 POPs":"picco 9 Tbps e 20 POP", +"Sovereign cloud regions, and a free PNI with Doitsche Telekomm. Gear: ROADMaster 9000 C+L (128 channels), Disco 8K Ultra routers.":"Region di cloud sovrano, e un PNI gratuito con Doitsche Telekomm. Gear: ROADMaster 9000 C+L (128 canali), router Disco 8K Ultra.", +"Global backbone":"Backbone globale", +"Your ASN now shows up in other people's traceroutes, and in their tickets.":"Il tuo ASN ora compare nei traceroute degli altri, e nei loro ticket.", +"peak 12 Tbps, 25 POPs, 5 continents":"picco 12 Tbps, 25 POP, 5 continenti", +"A free PNI with Voda-Phony. Gear: Absolute Unit 3.2T routers, 3.2T ports and 12.8T waves.":"Un PNI gratuito con Voda-Phony. Gear: router Absolute Unit 3.2T, porte 3.2T e wave 12.8T.", +"Packet empire":"Impero dei pacchetti", +"Your maintenance window is 2 a.m. in every time zone at once.":"La tua finestra di manutenzione è alle 2 di notte in tutti i fusi orari contemporaneamente.", +"peak 16 Tbps and 32 POPs":"picco 16 Tbps e 32 POP", +"Cloud gaming platforms, and the cloud gaming era: eyeballs want another 15%. A free PNI with Tel-Mess. Gear: Sienna WaveMagic 3.2T transponders.":"Piattaforme di cloud gaming, e l'era del cloud gaming: gli eyeball vogliono un altro 15%. Un PNI gratuito con Tel-Mess. Gear: transponder Sienna WaveMagic 3.2T.", +"Six-continent carrier":"Carrier dei sei continenti", +"Somewhere, on every continent, a backhoe is thinking about you.":"Da qualche parte, in ogni continente, una ruspa sta pensando a te.", +"peak 21 Tbps, 40 POPs, 6 continents":"picco 21 Tbps, 40 POP, 6 continenti", +"Metaverse platforms (it finally took off), and a free PNI with Etis-a-lot. Gear: Arrrhipster 7800R5 routers, 102.4T fabrics for your own exchange.":"Piattaforme metaverso (alla fine è decollato), e un PNI gratuito con Etis-a-lot. Gear: router Arrrhipster 7800R5, fabric da 102.4T per il tuo exchange.", +"Backbone of backbones":"Backbone dei backbone", +"Your routing table needs its own routing table.":"La tua tabella di routing ha bisogno di una tabella di routing tutta sua.", +"peak 26 Tbps and 50 POPs":"picco 26 Tbps e 50 POP", +"The VR era: eyeballs want 20% more. A free PNI with China Moble. Gear: Knockia 7950 XRS routers, 100T scrubbing.":"L'era della realtà virtuale: gli eyeball vogliono il 20% in più. Un PNI gratuito con China Moble. Gear: router Knockia 7950 XRS, scrubbing da 100T.", +"Internet weather system":"Sistema meteorologico di internet", +"When your BGP sneezes, a small country catches a cold.":"Quando il tuo BGP starnutisce, un piccolo paese si prende il raffreddore.", +"peak 33 Tbps and 60 POPs":"picco 33 Tbps e 60 POP", +"AGI labs (allegedly) wanting AI WANs of 12.8 to 25.6 Tbps, and free PNIs with Du-opoly and Ooh-redoo. Gear: Mikrowtik CCR 3.2T routers.":"Laboratori AGI (a sentir loro) che vogliono AI WAN da 12.8 a 25.6 Tbps, e PNI gratuiti con Du-opoly e Ooh-redoo. Gear: router Mikrowtik CCR 3.2T.", +"Too big to route":"Troppo grande per essere instradato", +"Your last fat-fingered route leak has its own Wikipedia page.":"Il tuo ultimo route leak da dito grasso ha una pagina Wikipedia tutta sua.", +"peak 40 Tbps and 70 POPs":"picco 40 Tbps e 70 POP", +"The AI agent era: eyeballs want 25% more, because bots now browse the web for people and they never sleep. Gear: eight fiber pairs in your own land trenches.":"L'era degli agenti AI: gli eyeball vogliono il 25% in più, perché ora i bot navigano al posto delle persone e non dormono mai. Gear: otto coppie di fibre nei tuoi scavi via terra.", +"The Internet":"Internet", +"People phone you to ask if the internet is down. You are the internet. Have you tried turning yourself off and on again?":"La gente ti chiama per chiedere se internet è giù. Internet sei tu. Hai provato a spegnerti e riaccenderti?", +"peak 50 Tbps and 80 POPs":"picco 50 Tbps e 80 POP", +"Mars mission ground stations. Gear: The Router at the End of the Universe.":"Stazioni di terra per missioni su Marte. Gear: The Router at the End of the Universe.", +"Peers with you for free now, but only over a PNI":"Ora fa peering con te gratis, ma solo su un PNI", +"Is This the Internet?":"È questa internet?", +"Reach customer level 13.":"Raggiungi il livello clienti 13.", +"{sys} level {n}":"{sys} livello {n}", +"Upgrade to {sys} {price}":"Passa a {sys} {price}", +"Peers with you for free over a PNI. You got too big to charge.":"Fa peering con te gratis su un PNI. Sei diventato troppo grande per farti pagare.", +"Paid peering only: a PNI costs {price}/mo. Free from customer level {n}.":"Solo peering a pagamento: un PNI costa {price}/mese. Gratis dal livello clienti {n}.", }; diff --git a/site/index.html b/site/index.html index f20ea9e..fcb787e 100644 --- a/site/index.html +++ b/site/index.html @@ -602,7 +602,7 @@ const popCost=c=>POP_COST+(c&&CITY[c]&&CITY[c].ru?RU_BOX:0)+(c&&CITY[c]&&CITY[c] 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. -const SCRUB_TIERS=[{n:'100G',g:100,cost:60000,mo:5000,lvl:1},{n:'1T',g:1000,cost:180000,mo:15000,lvl:3},{n:'10T',g:10000,cost:500000,mo:40000,lvl:4}]; +const SCRUB_TIERS=[{n:'100G',g:100,cost:60000,mo:5000,lvl:1},{n:'1T',g:1000,cost:180000,mo:15000,lvl:3},{n:'10T',g:10000,cost:500000,mo:40000,lvl:4},{n:'100T',g:100000,cost:1500000,mo:110000,lvl:10}]; const SCRUB_DELAY=2, SLA_PEN=20000; const scrubG=()=>SCRUB_TIERS[S.scrubTier||0].g; const scrubMo=()=>Math.round(SCRUB_TIERS[S.scrubTier||0].mo*(S.scrubMode==='ondemand'?0.6:1)); @@ -622,10 +622,10 @@ const DDOS_VEC={ }; const MYIX_COST=80000, MYIX_MO=3000, MYIX_FEE=1500, START_CASH=200000; // Your own exchange's switching fabric. Bigger fabrics carry more and attract more members. -const MYIX_FAB=[{n:'400G',g:400,cost:0,mo:3000,max:12},{n:'1.6T',g:1600,cost:60000,mo:6000,max:20,lvl:2},{n:'6.4T',g:6400,cost:200000,mo:12000,max:30,lvl:3},{n:'25.6T',g:25600,cost:600000,mo:25000,max:45,lvl:4}]; +const MYIX_FAB=[{n:'400G',g:400,cost:0,mo:3000,max:12},{n:'1.6T',g:1600,cost:60000,mo:6000,max:20,lvl:2},{n:'6.4T',g:6400,cost:200000,mo:12000,max:30,lvl:3},{n:'25.6T',g:25600,cost:600000,mo:25000,max:45,lvl:4},{n:'102.4T',g:102400,cost:1800000,mo:60000,max:60,lvl:9}]; const myFab=c=>MYIX_FAB[Math.min(MYIX_FAB.length-1,Math.max(0,(S.myIx[c]&&S.myIx[c].fab)|0))]; -const LT=[{n:'10G',g:10,m:1},{n:'100G',g:100,m:2.8},{n:'400G',g:400,m:6},{n:'800G',g:800,m:9},{n:'1.6T',g:1600,m:13},{n:'6.4T',g:6400,m:28,note:tr('handed off as 4×1.6T')}]; -const PORT=[{n:'10G',g:10,setup:500,tmo:150,ix:400,pni:200},{n:'100G',g:100,setup:1500,tmo:400,ix:1500,pni:350},{n:'400G',g:400,setup:4000,tmo:900,ix:4000,pni:600},{n:'800G',g:800,setup:8000,tmo:1600,ix:7000,pni:1000},{n:'1.6T',g:1600,setup:16000,tmo:2800,ix:12000,pni:1600}]; +const LT=[{n:'10G',g:10,m:1},{n:'100G',g:100,m:2.8},{n:'400G',g:400,m:6},{n:'800G',g:800,m:9},{n:'1.6T',g:1600,m:13},{n:'6.4T',g:6400,m:28,note:tr('handed off as 4×1.6T')},{n:'12.8T',g:12800,m:45,note:tr('handed off as 4×3.2T')}]; +const PORT=[{n:'10G',g:10,setup:500,tmo:150,ix:400,pni:200},{n:'100G',g:100,setup:1500,tmo:400,ix:1500,pni:350},{n:'400G',g:400,setup:4000,tmo:900,ix:4000,pni:600},{n:'800G',g:800,setup:8000,tmo:1600,ix:7000,pni:1000},{n:'1.6T',g:1600,setup:16000,tmo:2800,ix:12000,pni:1600},{n:'3.2T',g:3200,setup:32000,tmo:5000,ix:20000,pni:2600}]; const RG=[ {n:'Rusty Router 9000',pn:'100G',cap:400,cost:0,mo:0,maxLT:1,maxP:1,ports:8,cls:0,lvl:1,boot:6,slowP:10,fs:0,chip:tr('a mystery ASIC'),blurb:tr('Bought used on eBuy. The fans sound like a jet engine.')}, {n:'Edge Lord 400',pn:'400G',cap:3200,cost:30000,mo:1000,maxLT:2,maxP:2,ports:24,cls:1,lvl:2,boot:11,slowP:20,fs:1,chip:tr('merchant silicon'),blurb:tr('Sharp, edgy, and finally speaks 400G and 400ZR+.')}, @@ -636,7 +636,14 @@ const RG=[ {n:'Arrrhipster 7280R',pn:'400G',cap:4800,cost:42000,mo:1300,maxLT:2,maxP:2,ports:48,cls:1,lvl:2,boot:3,slowP:2,badge:'A',fs:2,chip:tr('Jerry-cho deep-buffer silicon'),blurb:tr('Fixed config, deep buffers, a well-groomed beard and an eyepatch. Runs EOS, the Extensible Operating Ship. Boots before your oat-milk flat white is ready, and ships a Python shell nobody asked for.')}, {n:'Arrrhipster 7800R',pn:'800G',cap:16000,cost:130000,mo:4200,maxLT:3,maxP:3,ports:96,cls:2,lvl:3,boot:7,slowP:4,badge:'A',fs:2,chip:tr('Jerry-cho³ deep-buffer silicon'),blurb:tr('The modular one. Ninety-six 800G ports, buffers deep enough to lose a ship in, and a vinyl-only release notes policy. Arrr.')}, {n:'Disco 8K',pn:'800G',cap:12800,cost:80000,mo:4800,maxLT:3,maxP:3,ports:64,cls:2,lvl:3,boot:20,slowP:35,badge:'D',fs:2,chip:'Silly-con One',blurb:tr('Cheap to buy, expensive to own: licence keys for every port, every feature and, rumour has it, the fans. Smart Licensing phones home every week.')}, - {n:'Knockia 7750',pn:'1.6T',cap:40000,cost:200000,mo:7000,maxLT:5,maxP:4,ports:56,cls:3,lvl:4,boot:30,slowP:15,badge:'K',fs:2,chip:tr('Fin-P network processor'),blurb:tr('Finnish engineering: indestructible, extremely thorough, and the CLI only speaks hierarchical config. Boots like a Nordic sunrise.')} + {n:'Knockia 7750',pn:'1.6T',cap:40000,cost:200000,mo:7000,maxLT:5,maxP:4,ports:56,cls:3,lvl:4,boot:30,slowP:15,badge:'K',fs:2,chip:tr('Fin-P network processor'),blurb:tr('Finnish engineering: indestructible, extremely thorough, and the CLI only speaks hierarchical config. Boots like a Nordic sunrise.')}, + {n:'Sonic the Whitebox 64',pn:'1.6T',cap:25600,cost:60000,mo:1500,maxLT:5,maxP:4,ports:64,cls:3,lvl:5,boot:9,slowP:25,flaky:true,badge:'W',fs:1,chip:tr('Tomahack 5 merchant silicon'),blurb:tr('Sixty-four 1.6T ports on open-source software for the price of one line card. There is still nobody to call at 3 a.m., but now the crashes are 1.6T crashes.')}, + {n:'Disco 8K Ultra',pn:'1.6T',cap:51200,cost:140000,mo:11000,maxLT:5,maxP:4,ports:72,cls:3,lvl:6,boot:22,slowP:35,badge:'D',fs:2,chip:'Silly-con One G3',blurb:tr('Cheap chassis, eternal subscription. Every port needs a licence, every licence needs a licence server, and the licence server needs a licence.')}, + {n:'Absolute Unit 3.2T',pn:'3.2T',cap:204800,cost:600000,mo:18000,maxLT:6,maxP:5,ports:48,cls:4,lvl:7,boot:50,slowP:60,fs:2,chip:tr('PacketOinker³ (a whole litter)'),blurb:tr('3.2T ports, and 12.8T waves handed off as 4×3.2T. Draws as much power as a small town and ships with its own substation. Needs a bigger forklift.')}, + {n:'Arrrhipster 7800R5',pn:'3.2T',cap:160000,cost:450000,mo:14000,maxLT:6,maxP:5,ports:144,cls:4,lvl:9,boot:8,slowP:4,badge:'A',fs:2,chip:tr('Jerry-cho⁵ deep-buffer silicon'),blurb:tr('A hundred and forty-four 3.2T ports and buffers deep enough to hide a whole fleet. Still boots before your flat white. The beard now has a beard.')}, + {n:'Knockia 7950 XRS',pn:'3.2T',cap:180000,cost:520000,mo:15000,maxLT:6,maxP:5,ports:96,cls:4,lvl:10,boot:32,slowP:15,badge:'K',fs:2,chip:tr('Fin-P6 network processor'),blurb:tr('Built like a sauna door: heavy, hot and nearly impossible to break. The config is now so hierarchical it has a royal family.')}, + {n:'Mikrowtik CCR 3.2T',pn:'3.2T',cap:51200,cost:45000,mo:900,maxLT:6,maxP:5,ports:32,cls:4,lvl:11,boot:3,slowP:5,flaky:true,badge:'M',fs:1,chip:tr('several hundred ARM cores and a prayer'),blurb:tr('A 3.2T router for the price of a used car. The web interface has nine hundred tabs, and one of them is the one you need.')}, + {n:'The Router at the End of the Universe',pn:'3.2T',cap:819200,cost:3000000,mo:60000,maxLT:6,maxP:5,ports:256,cls:4,lvl:13,boot:42,slowP:42,badge:'U',fs:2,chip:tr('forty-two of them'),blurb:tr('Two hundred and fifty-six 3.2T ports and enough forwarding for a small galaxy. Boots in 42 minutes. Nobody remembers what the question was.')} ]; /* Some routers take forever to boot. Each POP's chassis has a personality per model: most come back in minutes, a few sit through every line card self-test known to the vendor. */ @@ -645,6 +652,10 @@ function slowBoot(c){const p=S.pops[c];if(!p)return false;const g=p.rgen||0;retu function bootMin(c){const p=S.pops[c],G=RG[(p&&p.rgen)||0];return slowBoot(c)?G.boot*9+40:G.boot;} const routerCost=g=>Math.round(ROUTER_COST+RG[g].cost*0.8); const RMAX=6; +// 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. +const portShown=i=>i<=4||RG.some(r=>r.lvl<=lvl()&&r.maxP>=i),waveShown=i=>i<=5||RG.some(r=>r.lvl<=lvl()&&r.maxLT>=i); /* Ports are finite. Every transit, IX, PNI and cache port, every wave and every fibre channel takes a router port. 10G ports ride a breakout cable, four to a port. */ const PORT_SLOT=i=>i===0?0.25:1; @@ -669,16 +680,19 @@ function modelFits(c,g){const G=RG[g],p=S.pops[c];if(!p)return ''; const DF_SYS={ lite:{n:'Rainbow-in-a-Box DWDM',max:16,cost:25000,lvl:2,blurb:tr('Fixed mux plus amplifiers. Up to 16 channels, no remote switching.')}, roadm:{n:'ROADMaster 9000',max:64,cost:60000,lvl:3,blurb:tr('Full C-band, remotely reconfigurable, takes long-haul transponders. Up to 64 channels.')}, + cl:{n:'ROADMaster 9000 C+L',max:128,cost:140000,lvl:6,blurb:tr('Lights the L-band as well: twice the spectrum, up to 128 channels on one fiber pair, and amplifiers that take twice as long to explain.')}, }; const AMP_EVERY=100, AMP_COST=8000, AMP_MO=300; /* Your own trench holds more than one fiber pair (#35). Once a ROADMaster is full you can light the next pair: another ROADMaster and another chain of amplifiers, 64 more channels. Regen huts are shared. */ -const PAIRS_MAX=4,SUB_PAIRS_MAX=8,SUB_PAIR_UP=1500000,pairsMax=l=>l.sub?SUB_PAIRS_MAX:PAIRS_MAX,chMax=l=>DF_SYS[l.sys].max*(l.sys==='roadm'&&l.own?Math.max(1,l.pairs|0):1), - pairCost=l=>DF_SYS.roadm.cost+(l.sub?SUB_PAIR_UP:ampCount(l.km)*AMP_COST); +const isRdm=y=>y==='roadm'||y==='cl'; +const PAIRS_MAX=4,PAIRS_BIG=8,PAIRS_LV=12,SUB_PAIRS_MAX=8,SUB_PAIR_UP=1500000,pairsMax=l=>l.sub?SUB_PAIRS_MAX:lvl()>=PAIRS_LV?PAIRS_BIG:PAIRS_MAX,chMax=l=>DF_SYS[l.sys].max*(isRdm(l.sys)&&l.own?Math.max(1,l.pairs|0):1), + pairCost=l=>DF_SYS[isRdm(l.sys)?l.sys:'roadm'].cost+(l.sub?SUB_PAIR_UP:ampCount(l.km)*AMP_COST); const OPT={ zr4:{n:'Ackackia 400ZR+',g:400,cost:12000,reach:1500,modes:[[400,1500],[200,3000]],rg:1,lvl:2,sys:'lite',blurb:tr('Coherent pluggable in the router. No transponder shelf.')}, zr8:{n:'Sizzle 800ZR+',g:800,cost:22000,reach:900,modes:[[800,900],[400,1800],[200,3600]],rg:2,lvl:3,sys:'lite',blurb:tr('Twice the speed, shorter reach.')}, tp16:{n:'Sienna WaveMagic 1.6T',g:1600,cost:70000,reach:4000,modes:[[1600,4000],[800,7000],[400,12000]],rg:2,lvl:4,sys:'roadm',blurb:tr('Big shelf, big reach, big invoice.')}, + tp32:{n:'Sienna WaveMagic 3.2T',g:3200,cost:130000,reach:1500,modes:[[3200,1500],[1600,4000],[800,7000]],rg:4,lvl:8,sys:'roadm',blurb:tr('Twice the WaveMagic. Full speed only on shorter spans, and a cooling fan you can hear from the car park.')}, }; const dfLeaseMo=km=>Math.round(400+km*1.0); const dfBuildCost=km=>Math.round(25000+km*120); @@ -945,12 +959,12 @@ const NETS=[ {id:'drz',name:'Drizzle Electric',asn:9369,type:'t2',pol:'open',share:.04,price:4,col:'#1E90FF',pops:['man','edi','svg','bde','bcn','mil','rom','pmo','lis','ath','atn','den','phx','bos','hou','slc','ber','zrh','nbo','akl','per','jkt','mnl','dub','rek','tor','mtl','lax','mex','sof','osl','icn','sea','sjc','dal','chi','ash','nyc','mia','lon','ams','fra','par','sto','mad','hkg','sin','tok','syd','jnb','for','rio','bue','scl','lim','bog','pan','del','maa','blr','hyd','tpe','auh','cpt','mel','bne','osa','kul','bkk','sgn','khi','dac','cbo','waw','prg','vie','bud','buh','tll','ist','kyv','jed','ruh','doh'],ix:'ALL',blurb:tr('Will peer with anyone, anywhere. Rumored to mail out IPv6 cakes.')}, {id:'tng',name:'Tangerine Telecom',asn:5115,type:'t2',pol:'selective',minIx:15,minPni:40,share:.03,price:6,col:'#FF8C42',pops:['bcn','cai','nbo','dxb','par','mrs','mad','lon','ams','lag','jnb','waw','buh'],ix:['bcn','par','mrs','mad','lon','ams','lag','jnb','waw'],blurb:tr('Juicy reach into Europe and Africa.')}, {id:'sgt',name:'SingTell',asn:7474,type:'t2',pol:'selective',minIx:15,minPni:40,share:.03,price:7,col:'#00A6A6',pops:['jkt','mnl','per','akl','icn','sin','hkg','tok','syd','bom','tpe','maa','kul','bkk','sgn','mel'],ix:['sin','hkg','tok','syd','bom','tpe','maa','kul','bkk'],blurb:tr('Sings your packets across Asia-Pacific.')}, - {id:'vdp',name:'Voda-Phony',asn:1373,type:'t2',pol:'paid',paidFee:8000,share:.03,price:6,col:'#E63946',pops:['man','edi','mil','rom','lis','ath','nbo','cai','ber','dub','dxb','lon','fra','ams','mad','mrs','jnb','bom','lag','cpt','del','maa','ist','prg','bud','buh','doh'],ix:[],blurb:tr('Ended free peering across Europe and handed it to Inter.Clink, its “interconnection partner”, who will happily sell you a direct connection. Paid peering only, over a PNI. Ring ring, it’s the invoice.')}, + {id:'vdp',name:'Voda-Phony',asn:1373,type:'t2',pol:'paid',freeLv:7,paidFee:8000,share:.03,price:6,col:'#E63946',pops:['man','edi','mil','rom','lis','ath','nbo','cai','ber','dub','dxb','lon','fra','ams','mad','mrs','jnb','bom','lag','cpt','del','maa','ist','prg','bud','buh','doh'],ix:[],blurb:tr('Ended free peering across Europe and handed it to Inter.Clink, its “interconnection partner”, who will happily sell you a direct connection. Paid peering only, over a PNI. Ring ring, it’s the invoice.')}, {id:'ctc',name:'China Telecomet',asn:4314,type:'t2',pol:'restrictive',share:.02,price:22,premium:2.5,cn:true,col:'#0B5CAD',pops:['pek','sha','hkg','sin','tok','lon','fra','nyc','sjc'],ix:[],blurb:tr('The biggest network in China. Its CN-Too premium route skips the congested border, for a price.')}, {id:'cun',name:'China Unicorn',asn:4837,type:'t2',pol:'restrictive',share:.015,price:16,cn:true,col:'#D7000F',pops:['pek','sha','hkg','fra','sjc','lon'],ix:[],blurb:tr('Number two in China, with a horn for every backbone.')}, - {id:'cmb',name:'China Moble',asn:9880,type:'eye',pol:'paid',paidFee:12000,share:.01,cn:true,col:'#0085CA',pops:['pek','sha','hkg'],ix:[],blurb:tr('The largest mobile network on Earth. Paid peering only.')}, + {id:'cmb',name:'China Moble',asn:9880,type:'eye',pol:'paid',freeLv:10,paidFee:12000,share:.01,cn:true,col:'#0085CA',pops:['pek','sha','hkg'],ix:[],blurb:tr('The largest mobile network on Earth. Paid peering only.')}, {id:'cmc',name:'Comecast',asn:7227,type:'eye',pol:'selective',minIx:10,minPni:30,share:.03,col:'#2C7A7B',pops:['atn','den','bos','hou','phx','slc','ash','nyc','chi','sjc','sea','mia'],ix:['atn','den','bos','ash','nyc','chi','sjc','sea'],blurb:tr('Huge eyeball network. Come for the broadband, stay because there is no other choice.')}, - {id:'dtk',name:'Doitsche Telekomm',asn:3203,type:'eye',pol:'paid',paidFee:9000,share:.03,col:'#E20074',pops:['fra','ams','lon'],ix:[],blurb:tr('Pink eyeball giant. Peering is available... for a monthly fee.')}, + {id:'dtk',name:'Doitsche Telekomm',asn:3203,type:'eye',pol:'paid',freeLv:6,paidFee:9000,share:.03,col:'#E20074',pops:['fra','ams','lon'],ix:[],blurb:tr('Pink eyeball giant. Peering is available... for a monthly fee.')}, {id:'nfx',name:'NetChill',asn:2906,type:'cdn',pol:'selective',minIx:5,minPni:30,share:.15,cache:{name:'Open Couch',min:12},col:'#C8102E',pops:ALLC,ix:'ALL',blurb:tr('Streams 40% of evening traffic. Hands out free caches if you send enough eyeballs.')}, {id:'ggl',name:'Goggle',asn:15961,type:'cdn',pol:'selective',minIx:5,minPni:30,share:.13,cache:{name:'Goggle Global Cache',min:15},col:'#3A7BEA',pops:ALLC,ix:'ALL',blurb:tr('Search, video and goggles. Mostly goggles.')}, {id:'fbk',name:'Faceplant',asn:32943,type:'cdn',pol:'selective',minIx:5,minPni:25,share:.08,cache:{name:'Faceplant Node Thingy',min:10},col:'#3B5BDB',pops:BIGC,ix:'ALL',blurb:tr('Social media. Everyone keeps falling for it.')}, @@ -969,8 +983,8 @@ NETS.push( {id:'rtc',name:'Rostelecomedy',asn:12389,type:'t2',pol:'selective',minIx:20,minPni:40,share:.01,price:6,col:'#7700FF',pops:['mos','hel','sto','fra','ams'],ix:['mos','fra','ams'],blurb:tr('The national carrier. Every punchline is pre-approved.')}, {id:'ydx',name:'Yawndex',asn:13238,type:'cdn',pol:'open',share:.008,col:'#FC3F1D',pops:['mos','hel','fra','ams'],ix:['mos','hel','fra','ams'],blurb:tr('Search, taxis and maps. Slightly sleepy.')}, {id:'vkl',name:'VKontakt-lens',asn:47541,type:'cdn',pol:'open',share:.006,col:'#0077FF',pops:['mos','hel'],ix:['mos','hel'],blurb:tr('Social network with perfect vision.')}, - {id:'ets',name:'Etis-a-lot',asn:5384,type:'eye',pol:'paid',paidFee:8000,share:.006,col:'#719E19',pops:['dxb','mrs','lon','fra','sin','auh','fuj','doh'],ix:[],blurb:tr('Charges a lot. Paid peering only, and the name says it all.')}, - {id:'tmx',name:'Tel-Mess',asn:8151,type:'eye',pol:'paid',paidFee:7000,share:.008,col:'#00A0DF',pops:['mex','dal','lax','mia'],ix:[],blurb:tr('Mexico’s giant. Paid peering only, and the pricing is a mess.')}, + {id:'ets',name:'Etis-a-lot',asn:5384,type:'eye',pol:'paid',freeLv:9,paidFee:8000,share:.006,col:'#719E19',pops:['dxb','mrs','lon','fra','sin','auh','fuj','doh'],ix:[],blurb:tr('Charges a lot. Paid peering only, and the name says it all.')}, + {id:'tmx',name:'Tel-Mess',asn:8151,type:'eye',pol:'paid',freeLv:8,paidFee:7000,share:.008,col:'#00A0DF',pops:['mex','dal','lax','mia'],ix:[],blurb:tr('Mexico’s giant. Paid peering only, and the pricing is a mess.')}, {id:'bcd',name:'Bell Canad-eh',asn:577,type:'eye',pol:'selective',minIx:10,minPni:30,share:.01,col:'#00549A',pops:['tor','mtl','nyc','chi'],ix:['tor','mtl'],blurb:tr('Polite, enormous, and sorry about the bill.')}); NETS.push( {id:'tsf',name:'Telkom-selfie',asn:7713,type:'eye',pol:'selective',minIx:10,minPni:30,share:.01,col:'#E4002B',pops:['jkt','sin'],ix:['jkt','sin'],blurb:tr('Indonesia’s mobile giant. Every packet poses for a photo first.')}, @@ -987,7 +1001,7 @@ NETS.push( {id:'jio',name:'Jio-graphy',asn:55863,type:'eye',pol:'selective',minIx:10,minPni:30,share:.02,col:'#0F3CC9',pops:['bom','del','maa','blr','hyd'],ix:['bom','del','maa','blr','hyd'],blurb:tr('Gave a billion people cheap data. Knows exactly where every one of them is.')}, {id:'atl',name:'Airtel-tale',asn:9849,type:'t2',pol:'selective',minIx:15,minPni:40,share:.01,price:7,col:'#E40000',pops:['bom','del','maa','blr','hyd','sin','lon','dxb','dac','cbo'],ix:['bom','del','maa','blr'],blurb:tr('India’s other giant. Every outage comes with a story.')}, {id:'cht',name:'Chunghwa Tele-calm',asn:3426,type:'t2',pol:'selective',minIx:10,minPni:30,share:.008,price:7,col:'#00A0E9',pops:['tpe','hkg','tok','lax','sin'],ix:['tpe','hkg'],blurb:tr('Taiwan’s incumbent. Stays calm while ships drag their anchors over its cables.')}, - {id:'duu',name:'Du-opoly',asn:15820,type:'eye',pol:'paid',paidFee:6000,share:.004,col:'#00A9CE',pops:['dxb','auh','fuj'],ix:[],blurb:tr('The other half of the UAE duopoly. Does what Etis-a-lot does, in a different colour.')}); + {id:'duu',name:'Du-opoly',asn:15820,type:'eye',pol:'paid',freeLv:11,paidFee:6000,share:.004,col:'#00A9CE',pops:['dxb','auh','fuj'],ix:[],blurb:tr('The other half of the UAE duopoly. Does what Etis-a-lot does, in a different colour.')}); NETS.push( {id:'kdi',name:'KD-DIY',asn:2561,type:'t2',pol:'selective',minIx:10,minPni:30,share:.008,price:6,col:'#E85D04',pops:['tok','osa','lax','sin','hkg'],ix:['tok','osa'],blurb:tr('Japanese carrier that builds everything itself. Even the cable ships.')}, {id:'opt',name:'Opt-Out-Us',asn:7745,type:'eye',pol:'selective',minIx:8,minPni:25,share:.006,col:'#00837E',pops:['syd','mel','bne','per'],ix:['syd','mel','bne'],blurb:tr('Australia’s number two. You can opt out of the marketing emails, eventually.')}, @@ -1000,7 +1014,7 @@ NETS.push( {id:'ups',name:'UPC-You-Later',asn:6380,type:'eye',pol:'selective',minIx:8,minPni:25,share:.006,col:'#D8001B',pops:['waw','prg','vie','bud','zrh','kyv'],ix:['waw','prg','vie','kyv'],blurb:tr('Cable broadband across Central Europe. See you later, in a support queue.')}); NETS.push({id:'kys',name:'Kyiv Superstar',asn:15859,type:'eye',pol:'selective',minIx:5,minPni:20,share:.006,col:'#0055B8',pops:['kyv','waw','fra'],ix:['kyv'],blurb:tr('Ukraine’s biggest mobile network. Has kept working through things most networks never have to plan for.')}); NETS.push({id:'stc',name:'Sticky Telecom',asn:39368,type:'t2',pol:'selective',minIx:10,minPni:30,share:.01,price:8,col:'#4F008C',pops:['ruh','jed','dxb','fra','lon','cai'],ix:['ruh'],blurb:tr('The Kingdom’s incumbent. Once you are in, you stay in.')}, - {id:'ord',name:'Ooh-redoo',asn:8871,type:'eye',pol:'paid',paidFee:5000,share:.004,col:'#ED1C24',pops:['doh','dxb','jkt'],ix:[],blurb:tr('Qatar’s big operator. Paid peering only, and it sings the price list to you.')}); + {id:'ord',name:'Ooh-redoo',asn:8871,type:'eye',pol:'paid',freeLv:11,paidFee:5000,share:.004,col:'#ED1C24',pops:['doh','dxb','jkt'],ix:[],blurb:tr('Qatar’s big operator. Paid peering only, and it sings the price list to you.')}); NETS.push( {id:'tim',name:'TIM-Tam Italia',asn:3269,type:'eye',pol:'selective',minIx:8,minPni:25,share:.008,col:'#004691',pops:['mil','rom','pmo'],ix:['mil','rom'],blurb:tr('Italy’s incumbent. Sweet on the outside, very firm about peering ratios.')}, {id:'skl',name:'Sparkly Seabone',asn:6762,type:'t1',pol:'restrictive',share:.04,price:6,col:'#5B2C83',pops:['pmo','mil','rom','ath','mrs','bcn','mad','lis','par','lon','ams','fra','zrh','vie','bud','prg','waw','buh','sof','ist','ber','sto','nyc','ash','mia','atn','dal','chi','lax','sjc','tor','mex','pan','bog','lim','scl','bue','sao','rio','for','cai','jed','dxb','bom','sin','hkg','tok'],ix:[],blurb:tr('The Tier 1 that grew up in Sicily. Its Seabone backbone owns the Mediterranean and reaches deep into the Americas, and it still calls Palermo home.')}, @@ -1157,16 +1171,39 @@ const BIZ_T={ mtrain:{l:tr('Multi-site training run'),opts:[1600,3200,6400],rate:0,l2:true,sdwan:true,mega:true,lv:4,names:['Gem-in-Eye Ultra Training Run','Frontier Model 9000','The Very Big Model','Checkpoint-Free Training Co.','Model Too Big For One Building']}, ingest:{l:tr('Dataset ingest (elephant flow)'),opts:[1600,3200,6400],rate:0,event:true,mega:true,lv:3,names:['Scrape-the-Whole-Web Ingest','Checkpoint Sync Storm','Video Dataset Firehose','Every Book Ever (allegedly licensed)','Synthetic Data Tsunami']}, pairs:{l:tr('Hundreds of fiber pairs'),opts:[1],rate:0,fiber:true,mega:true,lv:4,names:['A Hyperscaler Who Shall Not Be Named','Planet-Scale AI WAN Team','The Fiber-Hungry Giant','Project Very Long Glass']}, + esport:{l:tr('Esports world final'),opts:[400,800,1600,3200],rate:0,event:true,lv:5,names:['League of Lag Finals','Counter-Ping Major','Fortnightly World Cup','Dota Two Many Viewers','Rocket Leak Championship','Street Frighter Evo']}, + sov:{l:tr('Sovereign cloud region'),opts:[400,800,1600],rate:0,l2:true,div:true,km:0.6,lv:6,names:['Gaia-Ex Sovereign Cloud','Bundeswolke (Very Secure)','Le Cloud Souverain','Datenschutz Deluxe','Your Data Stays Here, Probably','A Cloud With a Flag on It','Data Residency Is a State of Mind']}, + cgame:{l:tr('Cloud gaming platform'),opts:[800,1600,3200],rate:45,lv:8,names:['Stadia-ium (Back Again)','GeForce Later','Ping Station Now','Luna-tick Gaming','Shadow of a Doubt Cloud PC','Input Lag Arcade','Bufferbloat Bros. Streaming']}, + metav:{l:tr('Metaverse platform'),opts:[1600,3200,6400],rate:35,lv:9,names:['Meh-taverse','Second Second Life','Horizon Worlds Apart','The Oasis (Ready Player Done)','Legs Finally Shipped Inc.','Decentra-landlocked']}, + agi:{l:tr('AGI lab (allegedly)'),opts:[12800,25600],rate:0,l2:true,div:true,mega:true,km:0.4,lv:11,names:['Almost General Intelligence Inc.','Superintelligence Pending','The Lab That Said Two More Years','Paperclip Maximizer Labs','Deep Thought Two','Benevolent Overlord Research']}, + mars:{l:tr('Mars mission ground station'),opts:[100,200,400],rate:0,l2:true,lat:true,km:4,lv:13,names:['Red Planet Relay','Ares Ground Segment','Olympus Mons Uplink','Mars or Bust Mission Control','Interplanetary Ping Society','Light-Minute Logistics','RFC 1149 Avian Carriers (Mars Division)']}, provedor:{l:tr('Provedor (small regional ISP)'),opts:[5,10,20,40],rate:20,br:true,names:['Provedor Capivara Net','Fibra do Sertão','Rapidinho Telecom','Net Jabuticaba','Caipirinha Online','Wi-Fi do Zé','Pão de Queijo Fibra','Açaí Net','Tucano Telecom','Forró Fibra','Saci Net','Brigadeiro Banda Larga','Mandioca Online','Churrasco Connect']}, }; const LEVELS=[ - {n:tr('Local ISP'),req:tr('Start here'),unlock:tr('Enterprises, game servers, hosting, L2VPNs and DDoS protection.')}, - {n:tr('Regional player'),req:tr('peak 200 Gbps and 3 POPs'),unlock:tr('Downstream ISPs, streaming startups and universities. Gear: Edge Lord 400 routers, dark fiber leases, Rainbow-in-a-Box DWDM, Ackackia 400ZR+ optics.')}, - {n:tr('Serious backbone'),req:tr('peak 1 Tbps and 6 POPs'),unlock:tr('AI GPU data centers and cloud on-ramps. Gear: Chonk 800 routers, Sizzle 800ZR+ optics, ROADMaster 9000 line systems, building your own fiber.')}, - {n:tr('Big league'),req:tr('peak 3 Tbps, 10 POPs, 3 continents'),unlock:tr('AI training interconnects and hyperscaler DCI deals in the terabits. Gear: Absolute Unit 1.6T routers, Sienna WaveMagic 1.6T transponders.')}, + {n:tr('Local ISP'),q:tr('Your network diagram is a photo of a whiteboard.'),req:tr('Start here'),unlock:tr('Enterprises, game servers, hosting, L2VPNs and DDoS protection.')}, + {n:tr('Regional player'),q:tr('You now have a change freeze. Nobody remembers who declared it.'),req:tr('peak 200 Gbps and 3 POPs'),unlock:tr('Downstream ISPs, streaming startups and universities. Gear: Edge Lord 400 routers, dark fiber leases, Rainbow-in-a-Box DWDM, Ackackia 400ZR+ optics.')}, + {n:tr('Serious backbone'),q:tr("It's not DNS. There's no way it's DNS. It was DNS."),req:tr('peak 1 Tbps and 6 POPs'),unlock:tr('AI GPU data centers and cloud on-ramps. Gear: Chonk 800 routers, Sizzle 800ZR+ optics, ROADMaster 9000 line systems, building your own fiber.')}, + {n:tr('Big league'),q:tr('Your MTU is 9000 on every link except the one that matters.'),req:tr('peak 3 Tbps, 10 POPs, 3 continents'),unlock:tr('AI training interconnects and hyperscaler DCI deals in the terabits. Gear: Absolute Unit 1.6T routers, Sienna WaveMagic 1.6T transponders.')}, + {n:tr('Continental carrier'),q:tr('Your NOC has a chat channel called #its-always-the-fiber, and it is always the fiber.'),req:tr('peak 6 Tbps, 15 POPs, 4 continents'),era:1.15,unlock:tr('Esports world finals, and the 4K-everything era: eyeballs in every city want 15% more. Gear: Sonic the Whitebox 64 routers.')}, + {n:tr('Transcontinental'),q:tr('You joined the outages mailing list. Today you are the outage.'),req:tr('peak 9 Tbps and 20 POPs'),unlock:tr('Sovereign cloud regions, and a free PNI with Doitsche Telekomm. Gear: ROADMaster 9000 C+L (128 channels), Disco 8K Ultra routers.')}, + {n:tr('Global backbone'),q:tr("Your ASN now shows up in other people's traceroutes, and in their tickets."),req:tr('peak 12 Tbps, 25 POPs, 5 continents'),unlock:tr('A free PNI with Voda-Phony. Gear: Absolute Unit 3.2T routers, 3.2T ports and 12.8T waves.')}, + {n:tr('Packet empire'),q:tr('Your maintenance window is 2 a.m. in every time zone at once.'),req:tr('peak 16 Tbps and 32 POPs'),era:1.15,unlock:tr('Cloud gaming platforms, and the cloud gaming era: eyeballs want another 15%. A free PNI with Tel-Mess. Gear: Sienna WaveMagic 3.2T transponders.')}, + {n:tr('Six-continent carrier'),q:tr('Somewhere, on every continent, a backhoe is thinking about you.'),req:tr('peak 21 Tbps, 40 POPs, 6 continents'),unlock:tr('Metaverse platforms (it finally took off), and a free PNI with Etis-a-lot. Gear: Arrrhipster 7800R5 routers, 102.4T fabrics for your own exchange.')}, + {n:tr('Backbone of backbones'),q:tr('Your routing table needs its own routing table.'),req:tr('peak 26 Tbps and 50 POPs'),era:1.2,unlock:tr('The VR era: eyeballs want 20% more. A free PNI with China Moble. Gear: Knockia 7950 XRS routers, 100T scrubbing.')}, + {n:tr('Internet weather system'),q:tr('When your BGP sneezes, a small country catches a cold.'),req:tr('peak 33 Tbps and 60 POPs'),unlock:tr('AGI labs (allegedly) wanting AI WANs of 12.8 to 25.6 Tbps, and free PNIs with Du-opoly and Ooh-redoo. Gear: Mikrowtik CCR 3.2T routers.')}, + {n:tr('Too big to route'),q:tr('Your last fat-fingered route leak has its own Wikipedia page.'),req:tr('peak 40 Tbps and 70 POPs'),era:1.25,unlock:tr('The AI agent era: eyeballs want 25% more, because bots now browse the web for people and they never sleep. Gear: eight fiber pairs in your own land trenches.')}, + {n:tr('The Internet'),q:tr('People phone you to ask if the internet is down. You are the internet. Have you tried turning yourself off and on again?'),req:tr('peak 50 Tbps and 80 POPs'),unlock:tr('Mars mission ground stations. Gear: The Router at the End of the Universe.')}, ]; +// What each level asks for (peak Gbps, POPs, continents). Continents carry over to the levels above. +const LV_REQ=[null,{pk:200,pops:3},{pk:1000,pops:6},{pk:3000,pops:10,reg:3},{pk:6000,pops:15,reg:4},{pk:9000,pops:20},{pk:12000,pops:25,reg:5},{pk:16000,pops:32},{pk:21000,pops:40,reg:6},{pk:26000,pops:50},{pk:33000,pops:60},{pk:40000,pops:70},{pk:50000,pops:80}]; +const lvReg=i=>Math.max(0,...LV_REQ.slice(1,i+1).map(q=>q.reg||0)); const lvl=()=>(S&&S.lvl)||1; -function custLevel(){const pops=Object.keys(S.pops).length,pk=S.stats.peak;if(pk>=3000&&pops>=10&®ionsCount()>=3)return 4;if(pk>=1000&&pops>=6)return 3;if(pk>=200&&pops>=3)return 2;return 1;} +// Lower-case just the first word for mid-sentence use, so names like Tel-Mess or AGI keep their capitals. +const lc1=t=>/^[A-Z][a-z]/.test(t)?t[0].toLowerCase()+t.slice(1):t; +function custLevel(){const pops=Object.keys(S.pops).length,pk=S.stats.peak,rc=regionsCount();let lv=1;for(let i=1;i=q.pk&&pops>=q.pops&&rc>=lvReg(i))lv=i+1;else break;}return lv;} +// Traffic eras: some levels bring a new reason to watch more video, and every city's eyeballs grow toward more. +const eraMul=()=>LEVELS.slice(0,lvl()).reduce((a,L)=>a*(L.era||1),1); +const eyeP=c=>CITY[c].P*eraMul(); const BIZ_N=['Byte-Size Bakery','Hamster Wheel Power Co.','Llama Logistics','Cloud Nine Hosting','Rural Rabbit Broadband','Tiny Telco','Pixel Pirates Games','Moo-Moo Dairy Corp','Snack Overflow','Git Happens Ltd','Kernel Sanders Fried Code','Lag-Free Llamas','404 Bistro','Ping Pong Sports','Null Pointer Pets','Buffer Bloat Boats','Packet Pizza','Latency Lattes','Ctrl-Alt-Deli','Sudo Sandwiches','Cache Me Outside','Hertz So Good Radio','Jitterbug Dance Hall','Bit Barn Hosting','Fiber Optimists','The Daily Ping','Squirrel Mesh Wireless','Spam & Eggs Diner','Router Rooter Plumbing','Kilobyte Kebab','Gigglebit Studios','Uptime Funk Records','Ohm Sweet Ohm','Dial-Up Nostalgia Club','Two-Factor Tacos']; /* ================= GOALS ================= */ @@ -1330,7 +1367,7 @@ function weekly(){const {y,w}=isoWeek(new Date());let r=(y*100+w)*2654435761>>>0 const scnRule=k=>!!(S&&S.scn&&S.scn.rules&&S.scn.rules[k]); function scnHof(){try{return JSON.parse(localStorage.getItem('sot-scn')||'{}')||{};}catch(e){return {};}} function beginGame(nm,city,o={}){if(needPitch()&&!UI.pitched){UI.pendGame=[nm,city,o];openModal(pitchHtml(true));return;}newGame(nm,city);S.mode=o.mode||'normal'; - if(S.mode==='sandbox'){S.cash=1e9;S.lvl=4;S.nextFail=1e9;S.nextEvent=1e9;} + if(S.mode==='sandbox'){S.cash=1e9;S.lvl=LEVELS.length;S.nextFail=1e9;S.nextEvent=1e9;} if(o.scn){const sc=o.scn;S.scn={id:sc.id,rules:sc.rules||{},days:sc.days,name:sc.n||tr('Weekly challenge {key}',{key:sc.key}),key:sc.key||null,mods:(sc.mods||[]).map(m=>m.id)};S.rng=(o.seed||hstr(sc.id))|0;S.mode='scenario';S.asn=200000+Math.floor(Math.random()*15000); if(sc.cash)S.cash=sc.cash;if(sc.setup)sc.setup(); for(const m of S.scn.mods){if(m==='pricey')S.priceMul=1.3;if(m==='poor')S.cash=100000;if(m==='chaos')S.scn.rules.chaos=true;if(m==='boom')S.scn.rules.boom=true;if(m==='dk')S.scn.rules.dkAll=true;if(m==='sharks')S.scn.rules.sharks=true;}} @@ -1561,12 +1598,15 @@ function dkTick(d){if(!S.dk)return;const dk=S.dk; function elephant(){S.phpDone=true;S.ev.php=S.day+4; toast(tr(`🐘 BREAKING: CVE-2026-31337 just took down half the internet.
A bug in PHP turned every WordPress-ish site on Earth into a crypto miner. Eyeball traffic is down 30% for a few days while the world patches. Your hosting customers are doing it at 3 a.m.`),'bad');sfx('alert');renderMega();} function snubWhy(sn){const d=Math.max(1,sn.until-S.day);return sn.why+' '+trn('They will reconsider in {n} day.','They will reconsider in {n} days.',d);} +// Paid-peering giants drop the fee for networks too big to ignore (freeLv: the customer level that does it). +const paidFree=n=>!!(n&&n.freeLv&&lvl()>=n.freeLv); function peerOk(id,via,city){ const n=NET[id],dem=R.demTo[id]||0; const sn=snub(id,city);if(sn&&(via==='ix'||sn.all))return {ok:false,snub:true,why:snubWhy(sn)}; if(via==='ix'&&city&&isRemote(city)&&noRemote(id))return {ok:false,remote:true,why:REMOTE_WHY[hstr(id)%REMOTE_WHY.length]}; if(n.pol==='open')return {ok:true}; if(n.pol==='selective'){const need=Math.round((via==='pni'?n.minPni:n.minIx)*confBoost(id));return dem>=need?{ok:true}:{ok:false,why:tr('Wants ≥ {need} Gbps of traffic from you (you send {dem})',{need,dem:dem.toFixed(1)})};} + if(n.pol==='paid'&&paidFree(n))return via==='pni'?{ok:true,free:true}:{ok:false,why:tr('Peers with you for free now, but only over a PNI')}; if(n.pol==='paid')return via==='pni'?{ok:true,fee:n.paidFee}:{ok:false,why:n.perG?tr('Sender pays: a paid PNI only, {fee}/mo plus {g} per Gbps you send',{fee:fmt$(n.paidFee),g:fmt$(n.perG)}):tr('Paid peering only, over a PNI')}; if(n.type!=='t1'){if(via!=='pni')return {ok:false,why:tr('Only peers over PNIs, and only with networks it considers important')};const need=Math.round(60*confBoost(id));return dem>=need||isTier2()?{ok:true}:{ok:false,why:tr('Wants you to be a Tier 2, or send ≥ {need} Gbps to it (you send {dem})',{need,dem:dem.toFixed(1)})};} if(via!=='pni')return {ok:false,why:tr('Tier 1s never peer at IXs')}; @@ -1786,7 +1826,7 @@ function compute(){ // 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.optical=S.links.filter(l=>l.kind==='df').reduce((a,l)=>a+(l.ready>S.day?0:ampCount(l.km)*AMP_MO*(l.own&&l.sys==='roadm'&&!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.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); C.transit=S.transit.reduce((a,t)=>{const q=p95(t,R2.useT[t.id]||0);R2.p95[t.id]=q;return a+transitMo(t,q);},0); @@ -1810,7 +1850,7 @@ function remoteCities(){return [...new Set(S.links.filter(l=>l.kind==='vxc').fla function nniUsed(c,prov){return S.links.filter(l=>l.kind==='vxc'&&l.prov===prov&&(l.a===c||l.b===c)).reduce((a,l)=>a+VXC[l.vt].g,0)+S.biz.filter(b=>BIZ_T[b.type].nni&&b.prov===prov&&b.city===c).reduce((a,b)=>a+b.bw,0);} // Monthly price of one connection; compute() sums these, the connections overview lists them. function transitMo(t,q){const n=t.n||1;return Math.max(q,PORT[t.tier].g*n*0.2)*NET[t.net].price*(t.premium&&t.city==='hkg'?NET[t.net].premium:1)*S.priceMul*regionMult(t.city)+PORT[t.tier].tmo*n+(t.clean?cleanMo(t):0);} -function pniMo(p,use){return PORT[p.tier].pni*(p.n||1)+(NET[p.net].pol==='paid'?NET[p.net].paidFee:0)+(NET[p.net].perG?Math.round(NET[p.net].perG*use):0);} +function pniMo(p,use){return PORT[p.tier].pni*(p.n||1)+(NET[p.net].pol==='paid'&&!paidFree(NET[p.net])?NET[p.net].paidFee:0)+(NET[p.net].perG?Math.round(NET[p.net].perG*use):0);} function ixMo(c){return S.myIx[c]?myFab(c).mo:ixPortMo(c,S.ixp[c])*((S.ixn||{})[c]||1)+dkAddonMo(c);} function nniPort(c,prov){return (S.nni||[]).find(x=>x.city===c&&x.prov===prov);} function repayCost(l,B){return B.equity?Math.round(l.amount*3):Math.round(Math.max(l.bal,B.crypto&&l.got?l.got:0)*1.02);} @@ -1824,13 +1864,13 @@ function sanitize(s){ ['links','nni','transit','pni','caches','biz','offers','inc','usedNames','loans','loanOffers','hist','log'].forEach(arr); ['pops','ixp','rs','peers','myIx','done','ev','stats','ixn','ixPref','ixSite','confReg','ach'].forEach(obj); s.v=1;s.name=String(s.name==null?'Packet Pals':s.name).slice(0,24);s.day=int(s.day,0,1e7,0);s.cash=num(s.cash,0);s.asn=int(s.asn,1,4294967294,200000); - s.priceMul=num(s.priceMul,1);s.nextFail=num(s.nextFail,s.day+45);s.nextEvent=num(s.nextEvent,s.day+40);s.lvl=int(s.lvl,1,4,1);s.neg=int(s.neg,0,1e7,0);s.loanStrikes=int(s.loanStrikes,0,1e3,0); + s.priceMul=num(s.priceMul,1);s.nextFail=num(s.nextFail,s.day+45);s.nextEvent=num(s.nextEvent,s.day+40);s.lvl=int(s.lvl,1,LEVELS.length,1);s.neg=int(s.neg,0,1e7,0);s.loanStrikes=int(s.loanStrikes,0,1e3,0); for(const k of Object.keys(s.stats)){const v=s.stats[k];if(k==='by'||k==='f'){if(!v||typeof v!=='object')s.stats[k]={};else for(const j of Object.keys(v))v[j]=num(v[j],0);}else if(typeof v!=='boolean')s.stats[k]=num(v,0);} for(const k of ['survived','incidents','peak'])s.stats[k]=num(s.stats[k],0); 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.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: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);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);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;}); 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)); @@ -1916,7 +1956,7 @@ function spawnMega(t,T,nm,mine){ const megaMine=MEGA.filter(m=>mine.includes(m.c));if(!megaMine.length)return; if(t==='ingest'){const m=pick(megaMine),bw=pick(T.opts),dur=3+Math.floor(Math.random()*4),start=S.day+10+Math.floor(Math.random()*12); S.offers.push({id:uid(),city:m.c,city2:null,name:tr('{name} at {site}',{name:nm(),site:m.n}),type:t,bw,rate:0,reqs:[],start,dur,fee:Math.round(bw*dur*55),exp:start-2,mega:true});return;} - if(t==='aiwan'){const a=pick(megaMine),others=MEGA.filter(m=>m.c!==a.c&&(Math.random()<0.7?mine.includes(m.c):true));if(!others.length)return;const b=pick(others),km=kmBetween(a.c,b.c),bw=pick(T.opts); + if(t==='aiwan'||t==='agi'){const a=pick(megaMine),others=MEGA.filter(m=>m.c!==a.c&&(Math.random()<0.7?mine.includes(m.c):true));if(!others.length)return;const b=pick(others),km=kmBetween(a.c,b.c),bw=pick(T.opts); const reqs=['diverse'];if(Math.random()<0.4)reqs.push('metro'); S.offers.push({id:uid(),city:a.c,city2:b.c,name:`${nm()}: ${a.n} ⇄ ${b.n}`,type:t,bw,rate:Math.round((150+km*0.08)*T.km),reqs,exp:S.day+45,mega:true});return;} if(t==='mtrain'){const hub=pick(megaMine),reg=CITY[hub.c].reg,pool=[...new Set(MEGA.filter(m=>m.c!==hub.c&&CITY[m.c].reg===reg).map(m=>m.c))];if(pool.length<2)return; @@ -2300,7 +2340,7 @@ function dayTick(){ // resolve incidents for(const i of S.inc.slice())if(i.until<=d){clearInc(i);toast(tr('Resolved: {what} is fixed.',{what:incTitle(i.type).toLowerCase()}),'good');} // eyeball growth / churn uses last computed service - for(const c in S.pops){const p=S.pops[c];if(!p.bb)continue;const sf=sfOf(R,c),P=CITY[c].P; + for(const c in S.pops){const p=S.pops[c];if(!p.bb)continue;const sf=sfOf(R,c),P=eyeP(c); if(sf>=0.9){const g=0.025*(scnRule('boom')?1.5:1)*(p.boost>d?2:1)*sf*(0.7+0.6*(R.peerShare||0))*(CITY[c].reg==='AS'&&!CITY[c].cn?1.6:1);p.bb.d+=g*p.bb.d*(1-p.bb.d/P);} else p.bb.d=Math.max(3,p.bb.d*(1-(0.9-sf)*0.04));} compute(); @@ -2308,7 +2348,7 @@ function dayTick(){ S.cash+=(R.revMo-R.costMo)/30; S.stats.peak=Math.max(S.stats.peak,R.served); S.hist=S.hist||[];S.hist.push({d,dem:+R.demand.toFixed(2),srv:+R.served.toFixed(2),c:+(R.egT.c||0).toFixed(2),p:+(R.egT.p||0).toFixed(2),ix:+(R.egT.ix||0).toFixed(2),t:+(R.egT.t||0).toFixed(2),l2:+(R.egT.l2||0).toFixed(2),rev:Math.round(R.revMo),cost:Math.round(R.costMo),cash:Math.round(S.cash),inc:S.inc.length});if(S.hist.length>180)S.hist.shift(); - {const lv=custLevel();if(lv>(S.lvl||1)){S.lvl=lv;track('level_'+lv);toast(tr('Customer level {lv}: {name}
New customers unlocked: {unlock}',{lv,name:LEVELS[lv-1].n,unlock:LEVELS[lv-1].unlock}),'goal');sfx('coin');}} + {const top=custLevel();if(top>(S.lvl||1)){for(let lv=(S.lvl||1)+1;lv<=top;lv++){track('level_'+lv);toast(tr('Customer level {lv}: {name}
New customers unlocked: {unlock}',{lv,name:LEVELS[lv-1].n,unlock:LEVELS[lv-1].unlock})+`
${esc(LEVELS[lv-1].q)}`,'goal');}S.lvl=top;sfx('coin');}} for(const l of S.links){if(l.kind!=='df')continue; if(l.ready===d){toast(`${l.own?tr('Your fiber is finished: {a}–{b}',{a:CITY[l.a].name,b:CITY[l.b].name}):tr('Dark fiber handed over: {a}–{b}',{a:CITY[l.a].name,b:CITY[l.b].name})}
${(l.ch||[]).length?tr('Channels are lighting up now.'):tr('It is dark. Add optics to light it up.')}`,'goal',[{l:tr('Open'),act:'selLink',args:{id:l.id}}]);sfx('coin');} if(l.own&&l.ready>d&&Math.random()<0.012){const extra=10+Math.floor(Math.random()*40);l.ready+=extra;toast(tr('Construction delay: +{n} days
{why} ({a}–{b})',{n:extra,why:pick(l.sub?SEA_DELAYS.map(x=>tr(x)):[tr('Archaeologists found a Roman bathhouse on your route.'),tr('A protected hamster species lives along the right-of-way.'),tr('The railway changed its mind about the easement.'),tr('The drilling crew hit a granite boulder the size of a bus.'),tr('A town council wants a public hearing. About the color of the manhole covers.'),tr('Somebody else’s gas main was exactly where the map said it was not.'),tr('The permit office lost your permit. And then the replacement.')]),a:CITY[l.a].name,b:CITY[l.b].name}),'bad');}} @@ -2360,6 +2400,7 @@ function spawnOffer(){ if(lv>=2)types.push('isp','stream','edu','host','hft','bulk','event','event');if(mine.length>=3&&lv>=2)types.push('sdwan','sdwan'); if(S.links.some(l=>l.kind==='df'&&l.ready<=S.day))types.push('wwave','wwave');if(S.links.some(l=>l.kind==='df'&&l.own&&l.ready<=S.day))types.push('dfpair');if(lv>=3)types.push('gpu','gpu','onramp','onramp');if(lv>=4)types.push('ai','ai','hyper','hyper'); 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 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]; @@ -2429,6 +2470,7 @@ const BADGES=[ {id:'wall',i:'🧱',t:tr('Through the Wall'),d:tr('Run a licensed POP in mainland China.'),r:'e',ok:()=>cnOk()&&Object.keys(S.pops).some(cnCity)}, {id:'croc',i:'🐊',t:tr('Darwin Award'),d:tr('Have your fiber bitten by a crocodile.'),r:'l',ok:()=>!!(st().f||{}).croc}, {id:'unbreak',i:'🛡️',t:tr('Unbreakable'),d:tr('Survive 100 incidents without customer impact.'),r:'l',ok:()=>(st().survived||0)>=100}, + {id:'lv13',i:'🌐',t:tr('Is This the Internet?'),d:tr('Reach customer level 13.'),r:'l',ok:()=>(S.lvl||1)>=13}, {id:'gigawatt',i:'⚛️',t:tr('Gigawatt Landlord'),d:tr('Hold an AI WAN, a training run, an ingest and a fiber-pairs deal at the same time.'),r:'l',ok:()=>['aiwan','mtrain','ingest','pairs'].every(t=>S.biz.some(b=>b.type===t))}, {id:'blitz',i:'🚀',t:tr('Blitz'),d:tr('Reach Tier 1 within two years.'),r:'l',ok:()=>!!S.won&&S.day<=730}, {id:'peta',i:'🌌',t:tr('Hundred Terabits'),d:tr('Serve 100 Tbps.'),r:'l',ok:()=>R.served>=100000}, @@ -2641,7 +2683,7 @@ const ACT={ 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('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('Unplug something first.
{used} ports are in use, and one router fewer only has {max}.',{used:fmtPorts(portsUsed(city)),max:portsMax(city,undefined,p.routers-1)}),'bad');sfx('err');return;}p.routers--;after();}, - upRouter:({city,g})=>{const p=S.pops[city];if(!p)return;g=g===undefined?RG[p.rgen||0].cls+1:+g;if(!RG[g]||g===(p.rgen||0))return;{const why=modelFits(city,g);if(why){toast(tr("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('{model} unlocks at customer level {lv}.',{model:esc(RG[g].n),lv:RG[g].lvl}),'bad');sfx('err');return;} + 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("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('{model} unlocks at customer level {lv}.',{model:esc(RG[g].n),lv:RG[g].lvl}),'bad');sfx('err');return;} const rt=p.routers||1;if(!spend(RG[g].cost*rt))return;p.rgen=g; if(rt===1){const sl=slowBoot(city),dd=sl?3:1;p.down=Math.max(p.down||0,S.day+dd);addInc({type:'maint',ref:city,until:S.day+dd,msg:sl?tr('Swapping the only router in {city} for a {model}. The new one {how}. Back in {n} days.',{city:CITY[city].name,model:RG[g].n,how:pick(SLOW_BOOT),n:dd}):tr('Swapping the only router in {city} for a {model}. Maintenance window: back tomorrow.',{city:CITY[city].name,model:RG[g].n}),cost:0});toast(`${tr('Maintenance window in {city}',{city:CITY[city].name})}
${sl?tr('One router, and this one takes forever to boot. Back in {n} days.',{n:dd}):tr('One router means downtime during the swap. Back tomorrow.')}`,'bad');} else toast(tr('Rolling upgrade in {city}
{n} × {model}, swapped one at a time. Zero downtime.',{city:CITY[city].name,n:rt,model:esc(RG[g].n)}),'good'); @@ -2670,8 +2712,8 @@ const ACT={ addCh:({id,o})=>{const l=S.links.find(x=>x.id===id),O=OPT[o];if(!l||!O||l.kind!=='df')return;const why=chWhy(l,o);if(why){toast(tr("Can't add {optic}.
{why}",{optic:O.n,why:esc(why)}),'bad');sfx('err');return;}if(!portGate(l.a,1)||!portGate(l.b,1))return;const sp=spareN(o)>0;if(!spend(chCost(l,o)))return;if(sp)S.spares[o]--;(l.ch=l.ch||[]).push(o);floater((CITY[l.a].x+CITY[l.b].x)/2,(CITY[l.a].y+CITY[l.b].y)/2-20,`+${O.n}`,'#FF4F9A');after();}, rmCh:({id,o})=>{const l=S.links.find(x=>x.id===id);if(!l||!OPT[o])return;const i=(l.ch||[]).lastIndexOf(o);if(i<0)return;l.ch.splice(i,1);S.spares=S.spares||{};S.spares[o]=(S.spares[o]||0)+1;floater((CITY[l.a].x+CITY[l.b].x)/2,(CITY[l.a].y+CITY[l.b].y)/2-20,tr('{optic} to spares',{optic:OPT[o].n}),'#7B61FF');after();}, sellSpare:({o})=>{if(!OPT[o]||spareN(o)<1)return;S.spares[o]--;const v=spareValue(o);S.cash+=v;toast(tr('Sold a spare {optic} on eBuy.
{price} back, which is {p} of what it cost new.',{optic:OPT[o].n,price:fmt$(v),p:pct(SPARE_RESALE)}),'good');sfx('coin');after();}, - addPair:({id})=>{const l=S.links.find(x=>x.id===id);if(!l||l.kind!=='df'||!l.own||l.sys!=='roadm'||l.ready>S.day)return;const n=Math.max(1,l.pairs|0);if(n>=pairsMax(l))return;if((l.ch||[]).length+soldSlots(l)Fill this pair first.
Light all {max} channels before you light another fiber pair.',{max:chMax(l)}),'bad');sfx('err');return;}if(!spend(pairCost(l)))return;l.pairs=n+1;toast(tr('Fiber pair {n} is lit: {a}–{b}.
Another ROADMaster 9000 and a fresh chain of amplifiers. Room for {m} more channels.',{n:n+1,a:CITY[l.a].name,b:CITY[l.b].name,m:DF_SYS.roadm.max}),'good');sfx('build');after();}, - upSys:({id})=>{const l=S.links.find(x=>x.id===id);if(!l||l.sys==='roadm'||lvl()<3)return;if(!spend(DF_SYS.roadm.cost))return;l.sys='roadm';if(l.ready<=S.day){l.eqDown=S.day+1;toast(tr('Line system swap
All channels are dark for a day while the ROADMs go in.'),'bad');}after();}, + addPair:({id})=>{const l=S.links.find(x=>x.id===id);if(!l||l.kind!=='df'||!l.own||!isRdm(l.sys)||l.ready>S.day)return;const n=Math.max(1,l.pairs|0);if(n>=pairsMax(l))return;if((l.ch||[]).length+soldSlots(l)Fill this pair first.
Light all {max} channels before you light another fiber pair.',{max:chMax(l)}),'bad');sfx('err');return;}if(!spend(pairCost(l)))return;l.pairs=n+1;toast(tr('Fiber pair {n} is lit: {a}–{b}.
Another ROADMaster 9000 and a fresh chain of amplifiers. Room for {m} more channels.',{n:n+1,a:CITY[l.a].name,b:CITY[l.b].name,m:DF_SYS[l.sys].max}),'good');sfx('build');after();}, + upSys:({id})=>{const l=S.links.find(x=>x.id===id),to=l&&sysNext(l);if(!to||DF_SYS[to].lvl>lvl())return;if(!spend(sysUpCost(l)))return;l.sys=to;if(l.ready<=S.day){l.eqDown=S.day+1;toast(tr('Line system swap
All channels are dark for a day while the ROADMs go in.'),'bad');}after();}, spares:({id})=>{const l=S.links.find(x=>x.id===id);if(!l)return;l.spares=!l.spares;sfx('click');after();}, crews:({id})=>{const l=S.links.find(x=>x.id===id);if(!l||l.ready<=S.day)return;const c=Math.round(15000+l.km*6);if(!spend(c))return;l.ready=Math.max(S.day+1,l.ready-30);toast(tr('More crews on site.
Construction is 30 days ahead.'),'good');after();}, addGen:({city})=>{const p=S.pops[city];if(!p||p.gen)return;if(!spend(GEN_COST))return;p.gen=true;floater(CITY[city].x,CITY[city].y-30,tr('Generator!'),'#FF8A3D');after();}, @@ -2720,11 +2762,13 @@ function dfAllowed(a,b){if(isSub(a,b))return !!subDfCable(a,b);return cnCity(a)= const SPARE_RESALE=0.4,spareN=o=>(S&&S.spares&&S.spares[o])|0,spareValue=o=>Math.round(optCost(o)*SPARE_RESALE); function chCost(l,o){const r=REGEN_CH*(l.regen|0);return Math.round(optCost(o)*(spareN(o)>0?r:1+r));} function optCost(o){return Math.round(OPT[o].cost*(S&&S.ev&&S.ev.tariff>S.day?1.4:1));} -function pairBtn(l){if(!l.own||l.sys!=='roadm'||l.ready>S.day)return '';const n=Math.max(1,l.pairs|0);if(n>=pairsMax(l))return `${tr('{n} fiber pairs lit, the trench is full',{n})}`; +// Line systems upgrade in place: Rainbow → ROADMaster → C+L. Every lit pair gets the new gear. +const sysNext=l=>l.sys==='lite'?'roadm':l.sys==='roadm'?'cl':null,sysUpCost=l=>{const t=sysNext(l);return t?DF_SYS[t].cost*(t==='cl'&&l.own?Math.max(1,l.pairs|0):1):0;}; +function pairBtn(l){if(!l.own||!isRdm(l.sys)||l.ready>S.day)return '';const n=Math.max(1,l.pairs|0);if(n>=pairsMax(l))return `${tr('{n} fiber pairs lit, the trench is full',{n})}`; const full=(l.ch||[]).length+soldSlots(l)>=chMax(l),c=pairCost(l);return btn(l.sub?tr('Light fiber pair {n} {price}',{n:n+1,price:fmt$(c)}):tr('Light fiber pair {n} {price} + {mo}/mo',{n:n+1,price:fmt$(c),mo:fmt$(ampCount(l.km)*AMP_MO)}),'addPair',{id:l.id},full?'pink sm':'ghost sm',!full||S.cashlvl())return tr('Unlocks at customer level {n}.',{n:O.lvl});if(O.sys==='roadm'&&l.sys!=='roadm')return tr('Needs a ROADMaster 9000 line system.');if(!optMode(o,l)){const mx=(O.modes||[[0,O.reach]]).at(-1)[1];return tr('Too far even at its slowest setting: an optical span here is {span} km and it reaches {max} km. Add a regen site (Line system).',{span:spanKm(l).toLocaleString(),max:mx.toLocaleString()});} +function chWhy(l,o){const O=OPT[o];if(O.lvl>lvl())return tr('Unlocks at customer level {n}.',{n:O.lvl});if(O.sys==='roadm'&&!isRdm(l.sys))return tr('Needs a ROADMaster 9000 line system.');if(!optMode(o,l)){const mx=(O.modes||[[0,O.reach]]).at(-1)[1];return tr('Too far even at its slowest setting: an optical span here is {span} km and it reaches {max} km. Add a regen site (Line system).',{span:spanKm(l).toLocaleString(),max:mx.toLocaleString()});} if((l.ch||[]).length+soldSlots(l)>=chMax(l))return soldSlots(l)?tr('{sys} is full ({max} channels, {sold} sold to customers).',{sys:DF_SYS[l.sys].n,max:chMax(l),sold:soldSlots(l)}):tr('{sys} is full ({max} channels).',{sys:DF_SYS[l.sys].n,max:chMax(l)}); - for(const c of [l.a,l.b]){const p=S.pops[c];if(p&&RG[p.rgen||0].clsinnerWidth>760&&innerWidth<=1200; @@ -2860,7 +2904,7 @@ function renderLeft(){checkLayer(); }else if(UI.left==='deals'){ {const st=custStats();if(st.n)h+=`
${tr('Your customers')} ${st.n} · ${tr('happiness {p}%',{p:Math.round(st.avg)})}
${st.unhappy?`
${trn('{n} unhappy customer, {price}/mo at risk','{n} unhappy customers, {price}/mo at risk',st.unhappy,{price:fmt$(st.risk)})}
`:''}
${btn(st.unhappy?tr('See who'):tr('All customers'),'custOpen',{sad:st.unhappy?1:0},st.unhappy?'pink sm':'ghost sm')}
`;} h+=confSection(); - {const lv=S.lvl||1,nx=LEVELS[lv];h+=`
${tr('Customer level {lv}: {name}',{lv,name:LEVELS[lv-1].n})}
${nx?tr('Next: {req} unlocks {what}',{req:nx.req,what:nx.unlock.toLowerCase()}):tr('Every customer type is unlocked. Go get those terabits.')}
`;} + {const lv=S.lvl||1,nx=LEVELS[lv];h+=`
${tr('Customer level {lv}: {name}',{lv,name:LEVELS[lv-1].n})}
${nx?tr('Next: {req} unlocks {what}',{req:nx.req,what:lc1(nx.unlock)}):tr('Every customer type is unlocked. Go get those terabits.')}
`;} if(!S.offers.length)h+=`

${tr('No open offers right now. Businesses look for networks with POPs in their city. New ones pop up every few weeks.')}

`; for(const o of S.offers.slice().sort((a,b)=>a.exp-b.exp)){const has=bHas(o); h+=`
${esc(o.name)}
${esc(BIZ_T[o.type].l)} · ${CITY[o.city].name}${o.city2?' ⇄ '+CITY[o.city2].name:''} · ${bTerms(o)} · ${tr('{n}d left',{n:o.exp-S.day})}${(o.reqs||[]).length?` · ${trn('{n} special requirement','{n} special requirements',o.reqs.length)}`:''}
${reqList(o)} @@ -2905,7 +2949,7 @@ 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=`
${REG[C.reg]} · ${esc(C.dc)}

${C.name}

-
${tr('{g} of eyeballs',{g:fmtG(C.P)})}${regionMult(c)>1?`${tr('Transit {x}× pricier',{x:regionMult(c)})}`:''}${C.reg==='AS'&&!C.cn?''+tr('Underserved: users grow 60% faster')+'':''}${ix?`${tr('IX: {ix}',{ix:esc(ix)})}`:''}${p?`${tr('Your POP')}`:''}${down?`DOWN`:''}
+
${tr('{g} of eyeballs',{g:fmtG(eyeP(c))})}${regionMult(c)>1?`${tr('Transit {x}× pricier',{x:regionMult(c)})}`:''}${C.reg==='AS'&&!C.cn?''+tr('Underserved: users grow 60% faster')+'':''}${ix?`${tr('IX: {ix}',{ix:esc(ix)})}`:''}${p?`${tr('Your POP')}`:''}${down?`DOWN`:''}
`; if(!p){ h+=`
${C.note?`

${esc(C.note)}

`:''} @@ -2928,9 +2972,9 @@ function cityPanel(c){ if(UI.tab==='cust'){ {const nl=R.nodeLoad[c]||0,nc=R.nodeCap[c]||1;if(nl>=nc*0.95)h+=`

${tr('Router maxed out')}

${tr('Your routers here are forwarding {load} of {cap}. Traffic is being dropped. Upgrade or add a router in the Infra tab.',{load:fmtG(nl),cap:fmtG(nc)})}

${btn(tr('Open Infra'),'tab',{t:'links'},'pink sm')}
`;} h+=`

${tr('Home broadband')}

`; - if(!p.bb){const s=Math.max(8,C.P*0.03);h+=`

${tr('Sell internet to homes here. Starts around {start} and grows toward {max} while service is good. Pays {rate} per Gbps served, every month.',{start:fmtG(s),max:fmtG(C.P),rate:fmt$(EYE_RATE)})}

${btn(tr('Launch broadband {cost}',{cost:fmt$(bbCost(c))}),'launchBB',{city:c},'pink big',S.cash${tr('Sell internet to homes here. Starts around {start} and grows toward {max} while service is good. Pays {rate} per Gbps served, every month.',{start:fmtG(s),max:fmtG(eyeP(c)),rate:fmt$(EYE_RATE)})}

${btn(tr('Launch broadband {cost}',{cost:fmt$(bbCost(c))}),'launchBB',{city:c},'pink big',S.cash${tr('Eyeball demand')}${tr('{a} of {b}',{a:fmtG(eye),b:fmtG(C.P)})}
+ h+=`
${tr('Eyeball demand')}${tr('{a} of {b}',{a:fmtG(eye),b:fmtG(eyeP(c))})}
${tr('Served in {city}',{city:C.name})}${pct(sf)}
${tr('Revenue')}${tr('{price}/mo',{price:fmt$(eye*sf*EYE_RATE)})}
${tr('Network-wide peering ratio')}${pct(R.peerShare||0)}

${tr('More traffic over peering, PNIs and caches means lower latency, and happier users grow faster.')}

@@ -2950,8 +2994,8 @@ function cityPanel(c){ h+=`
${logo(n)}
${esc(n.name)} ${TYPE_L[n.type]}
${tr('${price} per Gbps / month · billed on 95th percentile',{price:pr.toFixed(2)})}
`; if(t){const u=R.useT[t.id]||0,cap=lagCap(PORT[t.tier].g,t.n),tdown=t.down>S.day; h+=`
${lagName(t.tier,t.n)}${tdown?' · '+tr('OUTAGE')+'':''}${fmtG(u)}
${prefCtl('t',t.id,t.pref)}${siteCtl('t',t.id,c,t.site)}${n.premium&&c==='hkg'?`
${btn(t.premium?tr('CN-Too premium on ✓'):tr('Switch to CN-Too premium {x}× price · ~3% loss into China',{x:n.premium}),'togglePrem',{id:t.id},t.premium?'green sm':'sm')}
`:''}${(()=>{const top=transitTop([t.id],4);return top.length?`
${tr('Top destinations on this port')}
${top.map(([id,v])=>`
${esc(NET[id].name)} · ${fmtG(v)} · ${esc(offTransitHint(id,c))}
`).join('')}
`:'';})()}
${tr('95th pct {p95} · commit {commit} · bill {bill}/mo',{p95:fmtG(R.p95[t.id]||0),commit:fmtG(cap*.2),bill:fmt$(Math.max(R.p95[t.id]||0,PORT[t.tier].g*(t.n||1)*.2)*pr+PORT[t.tier].tmo*(t.n||1))})}
-
${PORT.map((P2,i)=>i>t.tier?btn((t.n||1)>1?tr('Upgrade all to {port} {cost} + {mo}/mo',{port:P2.n,cost:fmt$(P2.setup*(t.n||1)),mo:fmt$(P2.tmo*(t.n||1))}):tr('Upgrade {port} {cost} + {mo}/mo',{port:P2.n,cost:fmt$(P2.setup*(t.n||1)),mo:fmt$(P2.tmo*(t.n||1))}),'buyTransit',{city:c,net:n.id,tier:i},'sm',S.cash{cost} + {mo}/mo',{cost:fmt$(PORT[t.tier].setup),mo:fmt$(PORT[t.tier].tmo)}),'lagT',{id:t.id,d:1},'sm',S.cash1?btn(tr('− member'),'lagT',{id:t.id,d:-1},'ghost sm'):''}${btn(t.clean?tr('Clean-pipe on ✓'):tr('+ Clean-pipe {mo}/mo · scrubs DDoS upstream',{mo:fmt$(cleanMo(t))}),'cleanPipe',{id:t.id},t.clean?'green sm':'sm')}${btn(UI.confirm===t.id?tr('Really cancel?'):tr('Cancel'),'cancelTransit',{id:t.id},'ghost sm')}
`;} - else h+=`
${PORT.map((P2,i)=>btn(tr('{port} {cost} + {mo}/mo',{port:P2.n,cost:fmt$(P2.setup),mo:fmt$(P2.tmo)}),'buyTransit',{city:c,net:n.id,tier:i},'sm',S.cash`; +
${PORT.map((P2,i)=>i>t.tier&&portShown(i)?btn((t.n||1)>1?tr('Upgrade all to {port} {cost} + {mo}/mo',{port:P2.n,cost:fmt$(P2.setup*(t.n||1)),mo:fmt$(P2.tmo*(t.n||1))}):tr('Upgrade {port} {cost} + {mo}/mo',{port:P2.n,cost:fmt$(P2.setup*(t.n||1)),mo:fmt$(P2.tmo*(t.n||1))}),'buyTransit',{city:c,net:n.id,tier:i},'sm',S.cash{cost} + {mo}/mo',{cost:fmt$(PORT[t.tier].setup),mo:fmt$(PORT[t.tier].tmo)}),'lagT',{id:t.id,d:1},'sm',S.cash1?btn(tr('− member'),'lagT',{id:t.id,d:-1},'ghost sm'):''}${btn(t.clean?tr('Clean-pipe on ✓'):tr('+ Clean-pipe {mo}/mo · scrubs DDoS upstream',{mo:fmt$(cleanMo(t))}),'cleanPipe',{id:t.id},t.clean?'green sm':'sm')}${btn(UI.confirm===t.id?tr('Really cancel?'):tr('Cancel'),'cancelTransit',{id:t.id},'ghost sm')}
`;} + else h+=`
${PORT.map((P2,i)=>portShown(i)?btn(tr('{port} {cost} + {mo}/mo',{port:P2.n,cost:fmt$(P2.setup),mo:fmt$(P2.tmo)}),'buyTransit',{city:c,net:n.id,tier:i},'sm',S.cash`; h+=`
`;} h+=``; }else if(UI.tab==='peer'){ @@ -2962,7 +3006,7 @@ function cityPanel(c){ for(const n of here){const pn=S.pni.find(x=>x.city===c&&x.net===n.id),chk=peerOk(n.id,'pni',c); h+=`
${logo(n)}
${esc(n.name)} ${n.pol}
`; if(pn){const u=R.usePni[pn.id]||0,cap=lagCap(PORT[pn.tier].g,pn.n);h+=`
${(pn.n||1)>1?`${pn.n}×${PORT[pn.tier].n} LAG`:PORT[pn.tier].n} PNI${fmtG(u)}
${prefCtl('p',pn.id,pn.pref)}${siteCtl('p',pn.id,c,pn.site)}
${PORT.map((P2,i)=>i>pn.tier?btn((pn.n||1)>1?tr('Upgrade all to {port} {cost}',{port:P2.n,cost:fmt$((1500+P2.setup/2)*(pn.n||1))}):tr('Upgrade {port} {cost}',{port:P2.n,cost:fmt$((1500+P2.setup/2)*(pn.n||1))}),'pni',{city:c,net:n.id,tier:i},'sm',!portOk(c,i)||S.cash<(1500+P2.setup/2)*(pn.n||1)):'').join('')}${(pn.n||1){cost} + {mo}/mo',{cost:fmt$(1500+PORT[pn.tier].setup/2),mo:fmt$(PORT[pn.tier].pni)}),'lagP',{id:pn.id,d:1},'sm',S.cash<1500+PORT[pn.tier].setup/2):''}${(pn.n||1)>1?btn(tr('− member'),'lagP',{id:pn.id,d:-1},'ghost sm'):''}${NET[n.id].cn?btn(pn.sacrif?tr('Sacrificial choke ✓'):tr('Make sacrificial contains floods · ½ capacity'),'sacrif',{id:pn.id},pn.sacrif?'green sm':'sm'):''}${btn(UI.confirm===pn.id?tr('Really remove?'):tr('Remove'),'cancelPni',{id:pn.id},'ghost sm')}
`;} - else{h+=chk.ok?`
${PORT.map((P2,i)=>btn(`${P2.n} ${fmt$(1500+P2.setup/2)}`,'pni',{city:c,net:n.id,tier:i},'sm',S.cash<1500+P2.setup/2||!portOk(c,i))).join('')}
${chk.fee?`
${tr('Paid peering: {price}/mo on top',{price:fmt$(chk.fee)})}
`:''}`:`
${esc(chk.why)}
`;} + else{h+=chk.ok?`
${PORT.map((P2,i)=>portShown(i)?btn(`${P2.n} ${fmt$(1500+P2.setup/2)}`,'pni',{city:c,net:n.id,tier:i},'sm',S.cash<1500+P2.setup/2||!portOk(c,i)):'').join('')}
${chk.fee?`
${tr('Paid peering: {price}/mo on top',{price:fmt$(chk.fee)})}
`:''}`:`
${esc(chk.why)}
`;} h+=`
`;} h+=`

${tr('Embedded caches')}

${tr('CDNs put free cache servers inside your POP. Most of their traffic is then served right here, with no transit and no IX port.')}

`; for(const n of NETS.filter(n=>n.cache)){const have=S.caches.filter(x=>x.city===c&&x.net===n.id),dem=R.demTo[n.id]||0,ok=dem>=n.cache.min; @@ -2971,9 +3015,9 @@ function cityPanel(c){ h+=`
`; }else{ const ls=S.links.filter(l=>l.a===c||l.b===c); - const rt=p.routers||1,g=p.rgen||0,G=RG[g],nl=R.nodeLoad[c]||0,nc=R.nodeCap[c]||nodeCap(c),N=g===G.cls?RG[G.cls+1]:null,Ni=N?G.cls+1:-1,pu=portsUsed(c),pm=portsMax(c); + const rt=p.routers||1,g=p.rgen||0,G=RG[g],nl=R.nodeLoad[c]||0,nc=R.nodeCap[c]||nodeCap(c),Ni=g===mainRG(G.cls)?mainRG(G.cls+1):-1,N=Ni>=0?RG[Ni]:null,pu=portsUsed(c),pm=portsMax(c); h+=`

${tr('Routers')}

${tr('The model sets your fastest interface and how much this POP can forward. More routers add capacity and survive crashes.')}

-
${rt} × ${esc(G.n)}
${tr('Up to {pn} interfaces · {ports} ports and {cap} per router',{pn:G.pn,ports:G.ports,cap:fmtG(G.cap)})} · ${esc(G.blurb)}
+
${rt} × ${esc(G.n)}
${tr('Up to {pn} interfaces · {ports} ports and {cap} per router',{pn:G.pn,ports:G.ports,cap:fmtG(G.cap)})} · ${esc(G.blurb)}
${tr('Router ports')}${tr('{used} / {max} in use',{used:fmtPorts(pu),max:pm})}
${pu>=pm?`

${tr('Every port is taken. Add a router or swap to a model with more ports before you plug in anything new.')}

`:''}
${tr('Forwarding chip')}${esc(G.chip)}
${tr('Boot time')}${slowBoot(c)?`${tr('~{n} min · a slow one',{n:bootMin(c)})}`:tr('~{n} min',{n:bootMin(c)})}
${slowBoot(c)?`

${tr('This chassis takes forever to boot: crashes last longer, and swapping the only router here takes 3 days. A second router hides it.')}

`:''}
${tr('Forwarding load')}${fmtG(nl)} / ${fmtG(nc)}
@@ -3050,7 +3094,7 @@ function ixBlock(c,multi){const city=ixCity(c),C=CITY[city],ix=ixName(c),X=XIXM[ for(const x of ad)h+=`
${esc(x.n)}
${esc(x.blurb)} · ${tr('{price}/mo',{price:fmt$(x.mo)})}
${btn(UI.confirm==='dk'+c+x.n?tr('Lose exclusive benefits?'):tr('Opt out'),'dkOptOut',{city:c,n:x.n},'ghost sm')}
`;} if(isRemote(c))h+=`

${trn('Remote port via a reseller: 1.5× price, 80% usable, and {n} member here refuse remote peers.','Remote port via a reseller: 1.5× price, 80% usable, and {n} members here refuse remote peers.',ixMembers(c).filter(noRemote).length)}

`; if(mine){const f=S.myIx[c].fab|0,N=MYIX_FAB[f+1];h+=`
${tr('Members paying you')}${tr('{n} of up to {max} · {price}/mo',{n:S.myIx[c].members.length,max:myFab(c).max,price:fmt$(S.myIx[c].members.length*MYIX_FEE)})}
${N?`
${btn(N.lvl>lvl()?tr('{name} fabric level {lv}',{name:N.n,lv:N.lvl}):tr('Upgrade fabric to {name} {cost} + {mo}/mo',{name:N.n,cost:fmt$(N.cost),mo:fmt$(N.mo)}),'myIxUp',{city:c},'pink sm',N.lvl>lvl()||S.cash

${tr('A bigger fabric carries more traffic and has room for more members. Your router here still has to keep up.')}

`:'

'+tr('Biggest fabric money can buy.')+'

'}`;} - else h+=`
${PORT.map((P2,i)=>i>S.ixp[c]?btn(tr('Upgrade {port} {price}',{port:P2.n,price:portMo(ixPortMo(c,i)*((S.ixn||{})[c]||1))}),'buyIx',{city:c,tier:i},'sm',(!!S.pops[city]&&!portOk(city,i))||(!S.pops[city]&&i>1)):'').join('')}${S.pops[city]&&((S.ixn||{})[c]||1){price}',{price:portMo(ixPortMo(c,S.ixp[c]))}),'lagIx',{city:c,d:1},'sm',S.cash1?btn(tr('− member'),'lagIx',{city:c,d:-1},'ghost sm'):''}${btn(S.rs[c]?tr('Leave route server'):tr('Join route server'),'rs',{city:c},S.rs[c]?'ghost sm':'pink sm')}${btn(UI.confirm==='ix'+c?tr('Really leave?'):tr('Leave IX'),'cancelIx',{city:c},'ghost sm')}
`; + else h+=`
${PORT.map((P2,i)=>i>S.ixp[c]&&portShown(i)?btn(tr('Upgrade {port} {price}',{port:P2.n,price:portMo(ixPortMo(c,i)*((S.ixn||{})[c]||1))}),'buyIx',{city:c,tier:i},'sm',(!!S.pops[city]&&!portOk(city,i))||(!S.pops[city]&&i>1)):'').join('')}${S.pops[city]&&((S.ixn||{})[c]||1){price}',{price:portMo(ixPortMo(c,S.ixp[c]))}),'lagIx',{city:c,d:1},'sm',S.cash1?btn(tr('− member'),'lagIx',{city:c,d:-1},'ghost sm'):''}${btn(S.rs[c]?tr('Leave route server'):tr('Join route server'),'rs',{city:c},S.rs[c]?'ghost sm':'pink sm')}${btn(UI.confirm==='ix'+c?tr('Really leave?'):tr('Leave IX'),'cancelIx',{city:c},'ghost sm')}
`; h+=`
`; {const elig=mine?[]:ixMembers(c).filter(id=>!set.has(id)&&peerOk(id,'ix',c).ok);if(elig.length>1)h+=`
${btn(tr('Request all {n} willing peers',{n:elig.length}),'peerAll',{city:c},'pink sm')}
`;} for(const id of ixMembers(c).sort((a,b)=>NSH[b]-NSH[a])){const n=NET[id],on=set.has(id),viaRs=on&&!S.peers[id+'@'+c]&&!mine,chk=peerOk(id,'ix',c); @@ -3112,7 +3156,7 @@ function dfPanel(l){ {const st=Object.keys(OPT).filter(k=>spareN(k)>0);h+=`

${tr('Unplugged optics go on the spares shelf and are used first next time.')}

`;if(st.length)h+=`

${tr('Spares shelf')}

`+st.map(k=>`
${spareN(k)} × ${OPT[k].n}
${btn(tr('Sell one {price}',{price:fmt$(spareValue(k))}),'sellSpare',{o:k},'ghost sm')}
`).join('');} const rg=l.regen|0,rgAdd=REGEN_COST+Math.round((l.ch||[]).reduce((a,c)=>a+optCost(c),0)*REGEN_CH); h+=`

${tr('Line system')}

${esc(sysD.n)}${tr('{n} amplifiers',{n:amps})}
-
${tr('Regen sites')}${rg?tr('{n} · optical spans of {km} km',{n:rg,km:spanKm(l).toLocaleString()}):tr('none')}

${tr('A regen site turns the light back into bits halfway and sends it on fresh, so optics only have to reach the next site. Each needs a regen card for every lit channel. {price}/mo per site for the hut.',{price:fmt$(REGEN_MO)})}

${l.sub&&l.own?`

${tr('No regen sites in the middle of the ocean: long cables run their optics in long-haul mode.')}

`:`
${rg{price}',{price:fmt$(rgAdd)}),'regen',{id:l.id,d:1},'sm',S.cash`}

${esc(sysD.blurb)}

${l.sys!=='roadm'?btn(lvl()>=3?tr('Upgrade to ROADMaster 9000 {price}',{price:fmt$(DF_SYS.roadm.cost)}):tr('ROADMaster 9000 level 3'),'upSys',{id:l.id},'sm',lvl()<3||S.cash{price}/mo',{price:fmt$(Math.round(150+(l.ch||[]).length*80))}),'spares',{id:l.id},l.spares?'green sm':'sm')}

${tr('Spare optics and amplifier cards on the shelf turn multi-day hardware failures into one-day swaps.')}

`; +
${tr('Regen sites')}${rg?tr('{n} · optical spans of {km} km',{n:rg,km:spanKm(l).toLocaleString()}):tr('none')}

${tr('A regen site turns the light back into bits halfway and sends it on fresh, so optics only have to reach the next site. Each needs a regen card for every lit channel. {price}/mo per site for the hut.',{price:fmt$(REGEN_MO)})}

${l.sub&&l.own?`

${tr('No regen sites in the middle of the ocean: long cables run their optics in long-haul mode.')}

`:`
${rg{price}',{price:fmt$(rgAdd)}),'regen',{id:l.id,d:1},'sm',S.cash`}

${esc(sysD.blurb)}

${(()=>{const t=sysNext(l);if(!t)return '';const T=DF_SYS[t],c=sysUpCost(l);return T.lvl>lvl()?btn(tr('{sys} level {n}',{sys:T.n,n:T.lvl}),'upSys',{id:l.id},'sm',true):btn(tr('Upgrade to {sys} {price}',{sys:T.n,price:fmt$(c)}),'upSys',{id:l.id},'sm',S.cash{price}/mo',{price:fmt$(Math.round(150+(l.ch||[]).length*80))}),'spares',{id:l.id},l.spares?'green sm':'sm')}

${tr('Spare optics and amplifier cards on the shelf turn multi-day hardware failures into one-day swaps.')}

`; {const sib=pairLinks(l.a,l.b).filter(x=>x!==l&&x.kind!=='vxc');h+=`

${tr('Redundancy')}

${sib.length?tr('Other links between these cities:'):tr('This is the only link between these cities. Add a parallel one, or a path through another city.')}

${sib.map(x=>`
${esc(capName(x))} ${linkDown(x)?''+tr('CUT')+'':''}
${(x.trench||x.id)===(l.trench||l.id)?tr('same trench'):tr('diverse route')}
${btn(tr('Open'),'selLink',{id:x.id},'ghost sm')}
`).join('')}
${btn(tr('Add parallel link'),'addParallel',{id:l.id},'pink sm')}
`;} h+=`${trafficSection(l)}${metricSection(l)}
${btn(UI.confirm===l.id?tr('Really give it up?'):(l.own?tr('Abandon the fiber'):tr('Cancel the IRU')),'rmLink',{id:l.id},'ghost sm')}
`; return h; @@ -3131,7 +3175,7 @@ function linkPanel(id){ h+=`

${tr('Capacity')}

${tr('{name} wave',{name:LT[l.tier].n})}${fmtG(load)} / ${fmtG(cap)}
${tr('Latency')}${tr('{ms} ms one-way',{ms:linkLat(l).toFixed(1)})}
${l.cable?`
${tr('Cable system')}${esc(CAB[l.cable].name)}
`:''}
${tr('Wave lease')}${tr('{price}/mo',{price:fmt$(l.mo)})}
${u>=0.9?`

${tr('Congested. Upgrade it or add a parallel path.')}

`:''} -
${LT.map((T,i)=>{const d=Math.round(waveMo(l.km,l.sub,i)*(l.mult||1)),ok=waveOk(l.a,l.b,i);return i>l.tier?btn(`${T.n} ${ok?tr('{price}/mo',{price:fmt$(d)}):tr('needs {what}',{what:esc(waveNeed(i))})}`,'upLink',{id:l.id,tier:i},'sm',S.cash
+
${LT.map((T,i)=>{const d=Math.round(waveMo(l.km,l.sub,i)*(l.mult||1)),ok=waveOk(l.a,l.b,i);return i>l.tier&&waveShown(i)?btn(`${T.n} ${ok?tr('{price}/mo',{price:fmt$(d)}):tr('needs {what}',{what:esc(waveNeed(i))})}`,'upLink',{id:l.id,tier:i},'sm',S.cash

${tr('Redundancy')}

${mates.length?trn('Shares a trench with {n} other link. One cut takes them all down.','Shares a trench with {n} other links. One cut takes them all down.',mates.length):sib.length?tr('Runs on its own route. A cut here leaves the other links up.'):tr('This is the only link between these cities. Add a parallel one, or a path through another city.')}

${sib.map(x=>`
${tr('{name} parallel link',{name:capName(x)})} ${x.cut>S.day?''+tr('CUT')+'':''}
${(x.trench||x.id)===trk?tr('same trench'):tr('diverse route')}
${btn(tr('Open'),'selLink',{id:x.id},'ghost sm')}
`).join('')}
${btn(tr('Add parallel link'),'addParallel',{id:l.id},'pink sm')}
@@ -3154,7 +3198,7 @@ function svgChart(rows,stackKeys,lines,fmtY){ function offTransitHint(id,city){const n=NET[id];if(n.type==='t1')return tr('Tier 1: only a PNI, and only once you are big enough for the Tier 1 club'); const ixc=Object.keys(S.pops).flatMap(ixIdsIn).filter(x=>ixMembers(x).includes(id)),here=city&&ixIdsIn(city).find(x=>ixMembers(x).includes(id))||null,pick1=here||ixc.find(x=>S.ixp[x]!==undefined)||ixc[0]; if(n.pol==='open')return pick1?(here?tr('Open peer: join the route server at {ix}',{ix:ixName(pick1)}):tr('Open peer: join the route server at {ix} ({city})',{ix:ixName(pick1),city:CITY[ixCity(pick1)].name})):tr('Open peer, but not on any IX where you have a POP'); - if(n.pol==='paid')return tr('Paid peering only: a PNI costs {price}/mo',{price:fmt$(n.paidFee)}); + if(n.pol==='paid')return paidFree(n)?tr('Peers with you for free over a PNI. You got too big to charge.'):n.freeLv?tr('Paid peering only: a PNI costs {price}/mo. Free from customer level {n}.',{price:fmt$(n.paidFee),n:n.freeLv}):tr('Paid peering only: a PNI costs {price}/mo',{price:fmt$(n.paidFee)}); const pniC=Object.keys(S.pops).filter(c=>n.pops.includes(c));const ixOk=pick1?peerOk(id,'ix',pick1):null,pOk=pniC.length?peerOk(id,'pni',pniC.includes(city)?city:pniC[0]):null; if(pOk&&pOk.ok)return tr('Ready for a PNI in {city}',{city:CITY[pniC.includes(city)?city:pniC[0]].name}); if(ixOk&&ixOk.ok)return tr('Will peer at {ix}: request a session',{ix:ixName(pick1)}); @@ -3178,11 +3222,10 @@ const pRow=x=>`
${esc(x.l)}${esc(x.txt)}
${tr('Done in {d} days!',{d:sc.done})}`:sc.failed?`${tr("Time's up")}`:tr('{n} days left',{n:left}); return `
${tr('Scenario')} · ${Math.round(P.f*100)}%
${esc(sc.name)}
🎯 ${esc(P.goal)}
${P.items.map(pRow).join('')}
${tr('Time')}${st}
`;} -function lvlItems(){const lv=S.lvl||1,pk=S.stats.peak||0,pops=Object.keys(S.pops).length,G=(l,v,max,txt)=>({l,v,max,txt}); - const peak=m=>G(tr('Peak traffic'),pk,m,`${fmtG(pk)} / ${fmtG(m)}`),pp=m=>G(tr('POPs'),pops,m,`${pops} / ${m}`); - return lv===1?[peak(200),pp(3)]:lv===2?[peak(1000),pp(6)]:lv===3?[peak(3000),pp(10),G(tr('Continents'),regionsCount(),3,`${regionsCount()} / 3`)]:[];} +function lvlItems(){const lv=S.lvl||1,pk=S.stats.peak||0,pops=Object.keys(S.pops).length,G=(l,v,max,txt)=>({l,v,max,txt}),q=LV_REQ[lv];if(!q)return []; + const out=[G(tr('Peak traffic'),pk,q.pk,`${fmtG(pk)} / ${fmtG(q.pk)}`),G(tr('POPs'),pops,q.pops,`${pops} / ${q.pops}`)],rg=lvReg(lv);if(rg)out.push(G(tr('Continents'),regionsCount(),rg,`${regionsCount()} / ${rg}`));return out;} function lvlCard(){const lv=S.lvl||1,nx=LEVELS[lv]; - return `
${tr('Customer level {lv} of {max}',{lv,max:LEVELS.length})}
${esc(LEVELS[lv-1].n)}
${nx?`
${tr('Next: {name} unlocks {what}',{name:esc(nx.n),what:esc(nx.unlock.toLowerCase())})}
${lvlItems().map(pRow).join('')}`:`
${tr('Every customer type is unlocked. Go get those terabits.')}
`}
`;} + return `
${tr('Customer level {lv} of {max}',{lv,max:LEVELS.length})}
${esc(LEVELS[lv-1].n)}
${esc(LEVELS[lv-1].q)}
${nx?`
${tr('Next: {name} unlocks {what}',{name:esc(nx.n),what:esc(lc1(nx.unlock))})}
${lvlItems().map(pRow).join('')}`:`
${tr('Every customer type is unlocked. Go get those terabits.')}
`}
`;} /* ---------- customers overview (#13, #14, #15) ---------- */ const bizMo=b=>{const T=BIZ_T[b.type];return T.event?0:T.fiber?b.rate:b.bw*b.rate;}; // Why a customer is unhappy, in the same terms the daily mood update uses. @@ -3437,7 +3480,7 @@ function openLinkModal(a,b){ openModal(`${head}

${tr('Waves are leased at a flat monthly rate. Bigger and longer costs more, and subsea is 1.8×. First month is due now.')}

${pop?`

${tr('Includes a new POP in {city} ({price}{extra}).',{city:CITY[b].name,price:fmt$(popCost(b)),extra:ruCity(b)?', '+tr('government box included'):CITY[b].uae?', '+tr('free-zone license included'):CITY[b].saudi?', '+tr('local telecom licence included'):''})}

`:''}${route}${viaSeg(a,b)} -
${LT.map((T,i)=>{const lc=Math.round(waveMo(wr.km,wr.sub,i)*wr.wm),c=lc+pop,ok=waveOk(a,b,i);return ``;}).join('')}
`); +
${LT.map((T,i)=>{const lc=Math.round(waveMo(wr.km,wr.sub,i)*wr.wm),c=lc+pop,ok=waveOk(a,b,i);return !waveShown(i)?'':``;}).join('')}
`); } /* Your own subsea cable (#22). Tier 1 networks lay their own: very expensive, slow to build, and it pays for itself after a few years if it replaces enough leased waves. Both ends need a cable landing station. You own diff --git a/tests/levels.test.js b/tests/levels.test.js new file mode 100644 index 0000000..41fdf4d --- /dev/null +++ b/tests/levels.test.js @@ -0,0 +1,139 @@ +const test = require('node:test'); +const assert = require('node:assert/strict'); +const { load } = require('./harness'); + +const fresh = ev => ev("ACT.start({});S.cash=1e9;for(const g of GOALS)S.done[g.id]=0;ACT.launchBB({city:'fra'})"); +// Fake a network of n POPs spread over the given regions, without building anything. +const fake = (ev, n, regs, peak) => ev(`(()=>{const rs=${JSON.stringify(regs)},pick=[];for(const r of rs){const c=CITIES.find(x=>x.reg===r&&!pick.includes(x.id));pick.push(c.id);}for(const c of CITIES){if(pick.length>=${n})break;if(!pick.includes(c.id)&&rs.includes(c.reg))pick.push(c.id);}S.pops={};for(const c of pick)S.pops[c]={day:0,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0};S.stats.peak=${peak};return custLevel();})()`); + +test('thirteen customer levels, each harder than the last', () => { + const { ev, errors } = load(); + fresh(ev); + assert.equal(ev('LEVELS.length'), 13); + assert.equal(ev('LV_REQ.length'), 13); + assert.equal(ev('LEVELS.every(L=>L.n&&L.req&&L.unlock&&L.q)'), true, 'every level has a name, a goal, an unlock and a joke'); + assert.equal(ev('LV_REQ.slice(2).every((q,i)=>q.pk>LV_REQ[i+1].pk&&q.pops>LV_REQ[i+1].pops)'), true); + assert.equal(fake(ev, 10, ['EU', 'AM', 'AS'], 3000), 4, 'level 4 is still where it was'); + assert.equal(fake(ev, 15, ['EU', 'AM', 'AS'], 6000), 4, 'level 5 needs a fourth continent'); + assert.equal(fake(ev, 15, ['EU', 'AM', 'AS', 'OC'], 6000), 5); + assert.equal(fake(ev, 79, ['EU', 'AM', 'AS', 'OC', 'SA', 'AF'], 60000), 12, 'level 13 needs 80 POPs'); + assert.equal(fake(ev, 80, ['EU', 'AM', 'AS', 'OC', 'SA', 'AF'], 50000), 13); + ev("S.lvl=8;S.pops={fra:S.pops.fra||{day:0,routers:1,rgen:0}};renderAll()"); + assert.equal(ev("lvlItems().map(x=>x.l+':'+x.max).join()"), 'Peak traffic:21000,POPs:40,Continents:6'); + assert.deepEqual(errors, []); +}); + +test('traffic eras raise the eyeball ceiling as you level up', () => { + const { ev, errors } = load(); + fresh(ev); + const P = ev('CITY.fra.P'); + ev('S.lvl=4'); + assert.equal(ev("eyeP('fra')"), P); + ev('S.lvl=5'); + assert.ok(Math.abs(ev("eyeP('fra')") - P * 1.15) < 1e-6, '4K everything'); + ev('S.lvl=13'); + assert.ok(Math.abs(ev("eyeP('fra')") / P - 1.15 * 1.15 * 1.2 * 1.25) < 1e-6); + // with great service, Frankfurt's eyeballs now grow past the old ceiling + ev("S.pops.fra.bb.d=CITY.fra.P*0.99;R.cityDem={fra:1};R.citySrv={fra:1};const t=compute;compute=()=>{};for(let i=0;i<60;i++){S.day++;dayTick();R.cityDem={fra:1};R.citySrv={fra:1};}compute=t"); + assert.ok(ev('S.pops.fra.bb.d') > P * 1.05, `grew to ${ev('S.pops.fra.bb.d')} of ${P}`); + assert.deepEqual(errors, []); +}); + +test('new routers: the 3.2T main line, side-grades, and 3.2T ports only once unlocked', () => { + const { ev, errors } = load(); + fresh(ev); + ev('S.lvl=4'); + const up = ev("RG[mainRG(RG[3].cls+1)].n"); + assert.equal(up, 'Absolute Unit 3.2T', 'the 1.6T Absolute Unit upgrades to its big sibling'); + assert.equal(ev("mainRG(1)"), 1, 'old main line keeps its indexes'); + assert.equal(ev('portShown(5)'), false, 'no 3.2T port buttons at level 4'); + assert.equal(ev('waveShown(6)'), false); + ev('S.lvl=7'); + assert.equal(ev('portShown(5)'), true); + assert.equal(ev('waveShown(6)'), true); + ev("S.pops.fra.rgen=3;S.pops.fra.routers=1;ACT.upRouter({city:'fra'})"); + assert.equal(ev("RG[S.pops.fra.rgen].n"), 'Absolute Unit 3.2T'); + ev("const g=RG.findIndex(r=>r.lvl===13);ACT.upRouter({city:'fra',g})"); + assert.equal(ev("RG[S.pops.fra.rgen].n"), 'Absolute Unit 3.2T', 'the Router at the End of the Universe waits for level 13'); + ev("S.lvl=13;ACT.upRouter({city:'fra',g:RG.findIndex(r=>r.lvl===13)})"); + assert.equal(ev("RG[S.pops.fra.rgen].ports"), 256); + // every model's numbers make sense for its class + assert.equal(ev("RG.every(r=>PORT[r.maxP]&<[r.maxLT]&&r.pn===PORT[r.maxP].n&&r.lvl>=1&&r.lvl<=LEVELS.length)"), true); + assert.deepEqual(errors, []); +}); + +test('C+L line systems double the channels; level 12 trenches hold eight pairs', () => { + const { ev, errors } = load(); + fresh(ev); + ev("S.lvl=6;ACT.buildPop({city:'ams'});S.pops.fra.rgen=S.pops.ams.rgen=3;S.links.push({id:'own1',a:'fra',b:'ams',kind:'df',own:true,km:450,sys:'roadm',ch:[],ready:0,mo:500,day:0,cut:0,pairs:2});compute()"); + assert.equal(ev("chMax(S.links[0])"), 128); + const c0 = ev('S.cash'); + ev("ACT.upSys({id:'own1'})"); + assert.equal(ev('S.links[0].sys'), 'cl'); + assert.equal(c0 - ev('S.cash'), 2 * ev('DF_SYS.cl.cost'), 'both lit pairs get the new gear'); + assert.equal(ev("chMax(S.links[0])"), 256); + assert.equal(ev("pairsMax(S.links[0])"), 4); + ev('S.lvl=12'); + assert.equal(ev("pairsMax(S.links[0])"), 8); + ev("S.links[0].pairs=8;S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('S.links[0].pairs'), 8, 'kept at level 12'); + ev("S.lvl=5;S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('S.links[0].pairs'), 4, 'clamped below level 12'); + ev("S.links[0].sys='cl';S.links[0].ch=['tp32'];compute()"); + assert.match(ev("chWhy(S.links[0],'tp32')"), /level 8/); + assert.deepEqual(errors, []); +}); + +test('paid-peering giants give you a free PNI once you are big enough', () => { + const { ev, errors } = load(); + fresh(ev); + ev("S.lvl=5;compute()"); + assert.equal(ev("peerOk('dtk','pni','fra').fee"), ev('NET.dtk.paidFee')); + assert.match(ev("offTransitHint('dtk','fra')"), /Free from customer level 6/); + const p = "({id:'p1',city:'fra',net:'dtk',tier:2,n:1})"; + assert.equal(ev(`pniMo(${p},0)`), ev('PORT[2].pni') + ev('NET.dtk.paidFee')); + ev('S.lvl=6'); + assert.equal(ev("peerOk('dtk','pni','fra').free"), true); + assert.match(ev("offTransitHint('dtk','fra')"), /too big to charge/); + assert.equal(ev(`pniMo(${p},0)`), ev('PORT[2].pni'), 'only the port is left to pay'); + assert.equal(ev("peerOk('dtk','ix','fra').ok"), false, 'still no IX peering'); + assert.equal(ev("NETS.filter(n=>n.freeLv).every(n=>n.pol==='paid'&&!n.perG&&n.freeLv>4)"), true, 'Korean sender-pays stays'); + assert.deepEqual(errors, []); +}); + +test('the new customer types turn up at their levels', () => { + const { ev, errors } = load(); + fresh(ev); + ev("for(const c of ['ams','lon','par','ash','nyc'])ACT.buildPop({city:c});S.lvl=4;S.offers=[];for(let i=0;i<600;i++){spawnOffer();S.offers.length=0;}"); + const types = lv => ev(`(()=>{S.lvl=${lv};const seen=new Set();for(let i=0;i<1500;i++){S.offers=[];spawnOffer();for(const o of S.offers)seen.add(o.type);}return [...seen].sort().join();})()`); + const at4 = types(4).split(','); + for (const t of ['esport', 'sov', 'cgame', 'metav', 'agi', 'mars']) assert.ok(!at4.includes(t), `${t} not before its level`); + const at13 = types(13).split(','); + for (const t of ['esport', 'sov', 'cgame', 'metav', 'agi', 'mars']) assert.ok(at13.includes(t), `${t} shows up at level 13 (${at13})`); + ev("S.offers=[];S.lvl=13;let o;for(let i=0;i<3000&&!o;i++){S.offers=[];spawnOffer();o=S.offers.find(x=>x.type==='agi');}window.__o=o"); + assert.ok(ev('__o.bw') >= 12800 && ev("__o.reqs.includes('diverse')"), 'AGI labs want huge diverse AI WANs'); + assert.deepEqual(errors, []); +}); + +test('old saves keep their level; nonsense levels are clamped', () => { + const { ev, errors } = load(); + fresh(ev); + ev("S.lvl=4;S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('S.lvl'), 4); + ev("S.lvl=99;S=migrate(JSON.parse(JSON.stringify(S)))"); + assert.equal(ev('S.lvl'), 13); + ev("UI.left='goals';UI.leftOpen=true;renderAll()"); + assert.match(ev("document.getElementById('leftBody').textContent"), /Customer level 13 of 13/); + assert.match(ev("document.getElementById('leftBody').textContent"), /You are the internet/); + assert.deepEqual(errors, []); +}); + +test('a big old network that jumps several levels hears about each one in the event log', () => { + const { ev, errors } = load(); + fresh(ev); + ev(`S.lvl=4;${"(()=>{const rs=['EU','AM','AS','OC','SA'],add=c=>{S.pops[c]=S.pops[c]||{day:0,bb:null,boost:0,down:0,routers:1,gen:false,rgen:0};};for(const r of rs)add(CITIES.find(c=>c.reg===r).id);for(const c of CITIES){if(Object.keys(S.pops).length>=25)break;if(rs.includes(c.reg))add(c.id);}})()"};S.stats.peak=12500;document.getElementById('toasts').innerHTML='';dayTick()`); + assert.equal(ev('S.lvl'), 7); + const t = ev("S.log.map(e=>e.t).join(' | ')"); + for (const n of ['Customer level 5', 'Customer level 6', 'Customer level 7']) assert.ok(t.includes(n), n); + assert.deepEqual(errors, []); +}); diff --git a/tests/modes.test.js b/tests/modes.test.js index 1660f2d..4463006 100644 --- a/tests/modes.test.js +++ b/tests/modes.test.js @@ -6,7 +6,8 @@ test('sandbox: endless money, every unlock, nothing breaks, no badges', () => { const { ev, errors } = load(); ev("ACT.modeSet({m:'sandbox'});ACT.start({})"); assert.equal(ev("S.mode"), 'sandbox'); - assert.equal(ev("S.lvl"), 4); + assert.equal(ev("S.lvl"), ev("LEVELS.length")); + assert.equal(ev("LEVELS.length"), 13); ev("S.cash=5;for(let i=0;i<120;i++)dayTick()"); assert.ok(ev("S.cash") >= 1e8, 'money refills'); assert.equal(ev("S.stats.incidents"), 0, 'no failures'); @@ -261,7 +262,7 @@ test('#34 scenario goal, progress and customer level are always in view', () => assert.match(left(), /Mind the Gap/); assert.match(left(), /POP in Bogotá/); assert.match(left(), /days left/); - assert.match(left(), /Customer level 1 of 4/); + assert.match(left(), /Customer level 1 of 13/); assert.equal(ev("$('hScn').hidden"), false, 'scenario chip in the top bar'); const f0 = ev('scnProg().f'); ev("S.cash=1e8;ACT.buildPop({city:'bog'});ACT.buildPop({city:'lim'});compute();renderAll()"); diff --git a/tests/regions.test.js b/tests/regions.test.js index 43db174..ed84cfd 100644 --- a/tests/regions.test.js +++ b/tests/regions.test.js @@ -170,7 +170,7 @@ test('#8 ports can be split across both buildings, so one dark site only halves test('routers: wave and port sizes match what the box can actually take', () => { const { ev } = load(); start(ev); - assert.equal(ev("LT.map(t=>t.n).join()"), '10G,100G,400G,800G,1.6T,6.4T'); + assert.equal(ev("LT.map(t=>t.n).join()"), '10G,100G,400G,800G,1.6T,6.4T,12.8T'); assert.equal(ev("PORT[RG[3].maxP].n"), '1.6T', 'the 1.6T router has 1.6T ports'); assert.equal(ev("LT[RG[2].maxLT].n"), '800G', 'an 800G router stops at 800G waves'); assert.equal(ev("LT[RG[3].maxLT].n"), '6.4T');