Merge the Gangnam Style redesign: sender pays

This commit is contained in:
Frederic Jung 2026-10-29 21:19:56 +01:00
commit 3de3e545e1
No known key found for this signature in database
20 changed files with 148 additions and 31 deletions

View file

@ -8,7 +8,7 @@ All notable changes to this project are documented here. The project follows
## [2.0.0] — 2026-10-29
- Scenario tuning: every handmade scenario now asks for what its story is about, with shorter clocks where it was won in a tenth of the time. Mind the Gap, Cape to Cairo and Order and Progress count cities and IX.brrr ports only when your network joins them up; Fibre to the Basement also wants 500 Gbps served; in Anchors Away nobody sells transit in Tallinn and ships really do drag their anchors over the Baltic links, while the Great Firewall's losses no longer break your 99.5% streak; in the Cogentle Spat, Goggle wants a lot more of your traffic before it peers; Flood Season's terabit floods count when your scrubbing or Flowspec took them; Stepping Stones and Mid-Atlantic Accent start with 5M, enough to light the whole 1.6T chain.
- Scenario tuning: every handmade scenario now asks for what its story is about, with shorter clocks where it was won in a tenth of the time. Mind the Gap, Cape to Cairo and Order and Progress count cities and IX.brrr ports only when your network joins them up; Fibre to the Basement also wants 500 Gbps served; in Anchors Away nobody sells transit in Tallinn and ships really do drag their anchors over the Baltic links, while the Great Firewall's losses no longer break your 99.5% streak; in the Cogentle Spat, Goggle wants a lot more of your traffic before it peers; Flood Season's terabit floods count when your scrubbing or Flowspec took them; Stepping Stones and Mid-Atlantic Accent start with 5M, enough to light the whole 1.6T chain. Gangnam Style Peering is now really about sender pays: Seoul transit carries a fee on every Gbps, the three incumbents only peer over a paid PNI, and Korean users notice every millisecond, so you win by hauling cheap Tokyo transit while keeping Seoul fast and in profit.
- Customers now call when your network can already serve them, not only when your level says so (#187). A fast path between two finance cities brings trading firms, lit dark fiber brings AI interconnects, two diverse paths in one country bring sovereign clouds and broadband in a big city brings cloud gaming, each at its smallest size and with a note on what they spotted; your level still makes them bigger and more frequent.
- Routers, line systems and optics one level above yours can be had early as a vendor demo unit (#187). Ask the vendor, wait about two weeks, then pay 60% over list until your level catches up; and you can dig your own dark fiber from level 2 as a pioneer, at 60% more than the level 3 price.
- Take a seat on a new consortium subsea cable (#173). Capacity conferences offer them, and now and then a consortium calls from level 2: pay your share of the build, wait for the ship, then own one, two or four fiber pairs and light them with your own optics, your way onto your own subsea glass before Tier 1. A cut on that cable cuts your pairs too.

View file

@ -9,6 +9,7 @@
// ['hire', orders, params] the NOC intern on standing orders, as soon as the level allows
// ['wait', day] until that day ['served', g] until g Gbps are served ['prep', c, g] capacity for an event
// ['scrub', c, tier] a scrubbing center ['pnis'] a PNI with every unreached network that takes one
// ['pni', c, net, tier] one PNI with that network there ['last', c] transit there only as a last resort
// ['loans'] take every loan the banks offer, from now on (the cheese plans)
const REF = String.raw`(()=>{
const Q=window.__ref={log:[]};
@ -19,6 +20,7 @@ Q.cheap=c=>NETS.filter(n=>n.price&&sellsAt(n,c)&&!(Q.avoid||[]).includes(n.id)&&
Q.pop=c=>{if(!S.pops[c])ACT.buildPop({city:c});return !!S.pops[c];};
Q.bb=c=>{Q.pop(c);if(S.pops[c]&&!S.pops[c].bb)ACT.launchBB({city:c});return !!(S.pops[c]&&S.pops[c].bb);};
Q.tr=(c,tier=1)=>{Q.pop(c);const n=Q.cheap(c);if(!n)return true;ACT.buyTransit({city:c,net:n.id,tier});return true;};
Q.last=c=>{for(const t of S.transit)if(t.city===c)ACT.setPref({kind:'t',id:t.id,v:'low'});return true;};
Q.ix=(c,tier=1)=>{if(!S.pops[c])return false;for(const x of ixIdsIn(c)){if(!ixName(x))continue;if(S.ixp[x]===undefined)ACT.buyIx({city:x,tier,signed:true});if(S.ixp[x]===undefined)continue;if(!S.rs[x])ACT.rs({city:x});ACT.peerAll({city:x});}return true;};
// A wave: big waves need big routers at both ends, and a router swap takes a day, so the step waits (null) until they fit.
Q.link=(a,b,tier=1,via)=>{for(const c of [a,b])Q.pop(c);if(!S.pops[a]||!S.pops[b])return false;
@ -28,6 +30,7 @@ Q.hire=(orders,par)=>{Q.wantHire=[orders||['transit','routers','repair'],par||{}
Q.hire0=(orders,par)=>{if(!opsCanHire()||!Q.can(20000))return false;if(!opsHired()){ACT.opsHire({id:'kevin'});closeModal();}if(!opsHired())return false;
for(const k of orders)if(!S.ops.on[k])ACT.opsToggle({k});for(const k in par)for(const [p,v] of Object.entries(par[k]))for(let i=0;i<8&&opsP(k,p)!==v;i++)ACT.opsParam({k,p});closeModal();return true;};
Q.pnis=(tier=0)=>{for(const n of NETS.filter(n=>!R.reachable[n.id]).sort((a,b)=>NSH[b.id]-NSH[a.id])){const b=pniBatch(n.id,tier);if(!b||!b.orders.length||!Q.can(b.cost))continue;ACT.pniAll({net:n.id,tier});}return true;};
Q.pni=(c,net,tier=0)=>{if(!S.pni.some(p=>p.city===c&&p.net===net))ACT.pni({city:c,net,tier});closeModal();return S.pni.some(p=>p.city===c&&p.net===net);};
Q.scrub=(c,tier=0)=>{ACT.buildScrub({city:c,tier});return true;};
Q.loans=()=>{Q.loan=true;return true;};
Q.served=g=>R.served>=g||null;
@ -38,7 +41,7 @@ Q.prep=(c,g)=>{const need=(S.stats.peak||R.served||0)*1.2+g*1.15,cap=()=>S.trans
if(t.tier<PORT.length-1&&PORT[t.tier+1].g>=need/4&&portOk(c,t.tier+1))ACT.buyTransit({city:c,net:t.net,tier:t.tier+1});else ACT.lagT({id:t.id,d:1});
if(cap()===c0){if(t.tier<PORT.length-1&&!portOk(c,t.tier+1))ACT.upRouter({city:c});else break;}}
for(let k=0;k<4;k++){const p=S.pops[c];if(!p||(p.routers||1)>=RMAX)break;const r0=p.routers||1;ACT.addRouter({city:c});if((p.routers||1)===r0)break;}return true;};
Q.est={pop:c=>S.pops[c]?0:popCost(c),bb:c=>(S.pops[c]?0:popCost(c))+bbCost(c),tr:()=>20000,ix:()=>25000,hire:()=>0,scrub:(c,t)=>SCRUB_TIERS[t||0].cost,
Q.est={pop:c=>S.pops[c]?0:popCost(c),bb:c=>(S.pops[c]?0:popCost(c))+bbCost(c),tr:()=>20000,pni:()=>20000,ix:()=>25000,hire:()=>0,scrub:(c,t)=>SCRUB_TIERS[t||0].cost,
link:(a,b,t)=>(S.pops[a]?0:popCost(a))+(S.pops[b]?0:popCost(b))+waveMo(kmBetween(a,b),isSub(a,b),t)*2+20000};
Q.upkeep=()=>{
for(const l of S.links){if(l.kind!=='wave'||l.tier>=LT.length-1||linkDown(l)||(R.load[l.id]||0)<LT[l.tier].g*0.75)continue;

View file

@ -757,6 +757,7 @@
"city_panel.second_site_and_metro_ring":"Zweiter Standort und Metro-Ring",
"city_panel.sell_internet_to_homes_here_starts":"Verkauf hier Internet an Haushalte. Startet bei etwa {start} und wächst Richtung {max}, solange der Service gut ist. Bringt jeden Monat {rate} pro ausgeliefertem Gbps.",
"city_panel.sells_pnis_down_to_1g":"verkauft PNIs ab 1G",
"city_panel.sender_pays_fee_per_gbps":"Sender zahlt: +{fee} pro Gbps Transit",
"city_panel.served_in_city":"Ausgeliefert in {city}",
"city_panel.serving_v":"liefert {v}",
"city_panel.shut_this_pop_down_its_links":"Diesen POP abschalten: Seine Links, Ports und Caches fallen mit weg, und allen Kunden, die davon abhängen, wird gekündigt. Dafür zahlst du eine Vertragsstrafe.",
@ -2928,9 +2929,11 @@
"progress.done_in_d_days":"Geschafft in {d} Tagen!",
"progress.floods_that_got_through":"Fluten, die durchgekommen sind",
"progress.ix_brrr_ports_on_your_backbone":"IX.brrr-Ports an deinem Backbone",
"progress.monthly_profit":"Monatsgewinn",
"progress.n_of_m":"{n} von {m}",
"progress.next_name_unlocks_what":"Als Nächstes: {name} schaltet {what} frei",
"progress.not_tier_1_right_now_why":"Gerade nicht Tier 1: {why}.",
"progress.seoul_served_well":"Seoul gut versorgt (geliefert und schnell)",
"progress.terabit_floods_held":"Abgewehrte Terabit-Fluten",
"progress.under_attack_now":"Gerade unter Beschuss",
"progress.your_score_peak_traffic":"Dein Ergebnis: Spitzen-Traffic",
@ -3359,7 +3362,6 @@
"scenarios.1_6t_on_every_hop_from":"1.6T auf jedem Hop von Miami nach Madrid und von Lissabon nach Lagos, und 100 Gbps bedient",
"scenarios.90_days_in_a_row_with":"90 Tage am Stück mit 99,5 % der Nachfrage bedient",
"scenarios.99_reach_and_150_gbps_served":"99 % Reichweite und 150 Gbps bedient",
"scenarios.99_reach_and_200_gbps_served":"99 % Reichweite und 200 Gbps bedient, ohne pleitezugehen",
"scenarios.a_path_from_cape_town_to_cairo_lagos":"Ein Pfad von Kapstadt nach Kairo, Lagos und Nairobi auch in deinem Netz, und 150 Gbps bedient",
"scenarios.a_path_from_los_angeles_to":"Ein Pfad von Los Angeles nach Sydney mit 1.6T auf jedem Hop, ein Pfad von Los Angeles nach Tokio, und 150 Gbps bedient",
"scenarios.a_path_from_marseille_to_singapore":"Ein Pfad von Marseille nach Singapur, und 80 Gbps zwischen Asien und dem Rest deines Netzes, 30 Tage am Stück",
@ -3388,7 +3390,8 @@
"scenarios.sandbox_mode_a_billion_dollars_chaos":"<b>Sandbox-Modus</b><br>Eine Milliarde Dollar und alles freigeschaltet. Chaos: {chaos}. Bau das Internet, das du immer wolltest, und halt einen Ersatzbagger bereit.",
"scenarios.sandbox_mode_a_billion_dollars_every":"<b>Sandbox-Modus</b><br>Eine Milliarde Dollar, alles freigeschaltet, und nichts geht jemals kaputt. Bau das Internet, das du schon immer wolltest.",
"scenarios.sao_paulo_brazil_is_a_continent":"São Paulo. Brasilien ist ein Kontinent: vierzig IX.brrr-Exchanges, Tausende Provedores und der Amazonas zwischen dir und dem Norden.",
"scenarios.seoul_the_fastest_hungriest_eyeballs":"Seoul. Die schnellsten, hungrigsten Privatkunden der Welt, Transit zum vierfachen Preis und drei Platzhirsche, die dir jedes Gigabit in Rechnung stellen, das du ihnen schickst.",
"scenarios.seoul_sender_pays_d":"Seoul, wo der Sender zahlt. Jedes Gbps, das ein Carrier nach Korea liefert, kostet dich zusätzlich zur Transitrechnung eine Sender-pays-Gebühr, die drei Platzhirsche reden nur über einen bezahlten PNI, Gigabit für zu Hause kostet so viel wie ein Bibimbap, und koreanische Nutzer merken jede Millisekunde. Transit in Tokio ist billig, wenn deine Kunden die Reise aushalten.",
"scenarios.seoul_sender_pays_goal":"{g} Gbps ausgeliefert, Seoul gut versorgt ({q} %), 99 % Reichweite und ein Monatsgewinn",
"scenarios.shark_season_subsea_cuts_twice_as":"Haisaison: Seekabelschnitte doppelt so wahrscheinlich",
"scenarios.start_in_panama_city_nothing_crosses":"Start in Panama-Stadt. Über Land kommt nichts durch den Darién Gap, und die Anden stehen allem anderen im Weg.",
"scenarios.start_in_stuttgart_where_nobody":"Start in Stuttgart, wo niemand Transit verkauft. Erreiche das Internet nur über Peering, PNIs, Caches und deine eigene Glasfaser. Kein Transit, nirgends, niemals.",
@ -3448,6 +3451,7 @@
"sites_and_service.level_n":"Level {n}",
"sites_and_service.n_ports":"{n} Ports",
"sites_and_service.no_path_right_now":"gerade kein Pfad",
"sites_and_service.p_of_city_s_traffic_comes_from_kr":"<b>{p} des Traffics von {city} kommt aus {to}: {ms} ms Round Trip.</b> Koreanische Nutzer merken alles über 8 ms, und ab 40 ms gilt Breitband als schlechter Service. Liefere mehr aus Seoul: Peering, Caches und PNIs hier oder lokaler Transit, wenn du die Sender-pays-Gebühr verkraftest.",
"sites_and_service.p_of_city_s_traffic_is":"<b>{p} des Traffics von {city} läuft per Backhaul zum Transit in {to}: {ms} ms Round Trip.</b> Nutzer merken alles über 20 ms (etwa 1.500 km), und ab 50 ms gelten Breitband und Internetdienste als schlechter Service. Kauf Transit hier oder in der Nähe oder peere lokal.",
"sites_and_service.path_latency_lat":"Pfad-Latenz: <b>{lat}</b>",
"sites_and_service.pn_routers":"{pn}-Router",

View file

@ -755,6 +755,7 @@
"city_panel.second_site_and_metro_ring":"Segunda sede y anillo metropolitano",
"city_panel.sell_internet_to_homes_here_starts":"Vende internet a hogares de aquí. Empieza en unos {start} y crece hacia {max} mientras el servicio sea bueno. Paga {rate} por Gbps servido, cada mes.",
"city_panel.sells_pnis_down_to_1g":"vende PNIs desde 1G",
"city_panel.sender_pays_fee_per_gbps":"Paga quien envía: +{fee} por Gbps de tránsito",
"city_panel.served_in_city":"Servido en {city}",
"city_panel.serving_v":"sirviendo {v}",
"city_panel.shut_this_pop_down_its_links":"Apagar este POP: sus enlaces, puertos y cachés se van con él, y todos los clientes que dependen de él se pierden, con una penalización por rescisión anticipada.",
@ -2926,9 +2927,11 @@
"progress.done_in_d_days":"¡Hecho en {d} días!",
"progress.floods_that_got_through":"Inundaciones que pasaron",
"progress.ix_brrr_ports_on_your_backbone":"Puertos IX.brrr en tu backbone",
"progress.monthly_profit":"Beneficio mensual",
"progress.n_of_m":"{n} de {m}",
"progress.next_name_unlocks_what":"Siguiente: {name} desbloquea {what}",
"progress.not_tier_1_right_now_why":"Ahora no eres Tier 1: {why}.",
"progress.seoul_served_well":"Seúl bien servida (entregado y rápido)",
"progress.terabit_floods_held":"Inundaciones de terabits contenidas",
"progress.under_attack_now":"Bajo ataque ahora",
"progress.your_score_peak_traffic":"Tu puntuación: tráfico pico",
@ -3357,7 +3360,6 @@
"scenarios.1_6t_on_every_hop_from":"1.6T en cada salto de Miami a Madrid y de Lisboa a Lagos, y 100 Gbps servidos",
"scenarios.90_days_in_a_row_with":"90 días seguidos con el 99,5 % de la demanda servida",
"scenarios.99_reach_and_150_gbps_served":"99 % de alcance y 150 Gbps servidos",
"scenarios.99_reach_and_200_gbps_served":"99 % de alcance y 200 Gbps servidos sin arruinarte",
"scenarios.a_path_from_cape_town_to_cairo_lagos":"Un camino de Ciudad del Cabo a El Cairo, con Lagos y Nairobi también en tu red, y 150 Gbps servidos",
"scenarios.a_path_from_los_angeles_to":"Un camino de Los Ángeles a Sídney con 1.6T en cada salto, un camino de Los Ángeles a Tokio, y 150 Gbps servidos",
"scenarios.a_path_from_marseille_to_singapore":"Un camino de Marsella a Singapur, y 80 Gbps entre Asia y el resto de tu red durante 30 días seguidos",
@ -3386,7 +3388,8 @@
"scenarios.sandbox_mode_a_billion_dollars_chaos":"<b>Modo sandbox</b><br>Mil millones de dólares y todo desbloqueado. Caos: {chaos}. Construye el internet que siempre quisiste, y ten a mano una excavadora de repuesto.",
"scenarios.sandbox_mode_a_billion_dollars_every":"<b>Modo sandbox</b><br>Mil millones de dólares, todos los desbloqueos y nada se rompe nunca. Construye el internet que siempre quisiste.",
"scenarios.sao_paulo_brazil_is_a_continent":"São Paulo. Brasil es un continente: cuarenta intercambios IX.brrr, miles de provedores, y el Amazonas entre tú y el norte.",
"scenarios.seoul_the_fastest_hungriest_eyeballs":"Seúl. Los eyeballs más rápidos y hambrientos de la Tierra, tránsito a cuatro veces el precio, y tres operadores históricos que te facturan cada gigabit que les mandas.",
"scenarios.seoul_sender_pays_d":"Seúl, donde paga quien envía. Cada Gbps que un carrier entrega en Corea te cuesta una tasa de «paga quien envía» además de la factura de tránsito, los tres operadores históricos solo hablan por un PNI de pago, el gigabit doméstico se vende al precio de un bibimbap y los usuarios coreanos notan cada milisegundo. El tránsito en Tokio es barato, si tus clientes aguantan el viaje.",
"scenarios.seoul_sender_pays_goal":"{g} Gbps servidos, Seúl bien servida ({q} %), 99 % de alcance y beneficio mensual",
"scenarios.shark_season_subsea_cuts_twice_as":"Temporada de tiburones: los cortes submarinos son el doble de probables",
"scenarios.start_in_panama_city_nothing_crosses":"Empieza en Ciudad de Panamá. Nada cruza el Tapón del Darién por tierra, y los Andes se interponen en todo lo demás.",
"scenarios.start_in_stuttgart_where_nobody":"Empieza en Stuttgart, donde nadie vende tránsito. Llega a internet solo por peering, PNIs, cachés y tu propia fibra. Sin tránsito en ningún sitio, nunca.",
@ -3446,6 +3449,7 @@
"sites_and_service.level_n":"Nivel {n}",
"sites_and_service.n_ports":"{n} puertos",
"sites_and_service.no_path_right_now":"sin ruta ahora mismo",
"sites_and_service.p_of_city_s_traffic_comes_from_kr":"<b>El {p} del tráfico de {city} viene de {to}: {ms} ms de ida y vuelta.</b> Los usuarios coreanos notan todo lo que pase de 8 ms, y por encima de 40 ms la banda ancha cuenta como mal servicio. Sirve más desde Seúl: peering, cachés y PNIs aquí, o tránsito local si aguantas la tasa de «paga quien envía».",
"sites_and_service.p_of_city_s_traffic_is":"<b>El {p} del tráfico de {city} se lleva por backhaul al tránsito de {to}: {ms} ms de ida y vuelta.</b> Los usuarios notan cualquier cosa por encima de 20 ms (unos 1500 km), y pasados 50 ms la banda ancha y los servicios de internet cuentan como mal servicio. Compra tránsito aquí o cerca, o haz peering local.",
"sites_and_service.path_latency_lat":"Latencia de la ruta: <b>{lat}</b>",
"sites_and_service.pn_routers":"{pn} routers",

View file

@ -755,6 +755,7 @@
"city_panel.second_site_and_metro_ring":"Second site et anneau métropolitain",
"city_panel.sell_internet_to_homes_here_starts":"Vends de l’Internet aux foyers d’ici. Démarre vers {start} et grimpe vers {max} tant que le service est bon. Rapporte {rate} par Gbps servi, chaque mois.",
"city_panel.sells_pnis_down_to_1g":"vend des PNI dès 1G",
"city_panel.sender_pays_fee_per_gbps":"L’expéditeur paie : +{fee} par Gbps de transit",
"city_panel.served_in_city":"Servi à {city}",
"city_panel.serving_v":"dessert {v}",
"city_panel.shut_this_pop_down_its_links":"Ferme ce POP : ses liens, ports et caches partent avec, et chaque client qui en dépend est lâché, avec une pénalité de résiliation anticipée.",
@ -2926,9 +2927,11 @@
"progress.done_in_d_days":"Fini en {d} jours !",
"progress.floods_that_got_through":"Vagues passées",
"progress.ix_brrr_ports_on_your_backbone":"Ports IX.brrr sur votre backbone",
"progress.monthly_profit":"Bénéfice mensuel",
"progress.n_of_m":"{n} sur {m}",
"progress.next_name_unlocks_what":"Prochain : {name} débloque {what}",
"progress.not_tier_1_right_now_why":"Pas Tier 1 pour l’instant : {why}.",
"progress.seoul_served_well":"Séoul bien servie (livré et rapide)",
"progress.terabit_floods_held":"Vagues térabit encaissées",
"progress.under_attack_now":"Sous attaque",
"progress.your_score_peak_traffic":"Ton score : pic de trafic",
@ -3357,7 +3360,6 @@
"scenarios.1_6t_on_every_hop_from":"1.6T sur chaque saut de Miami à Madrid et de Lisbonne à Lagos, et 100 Gbps servis",
"scenarios.90_days_in_a_row_with":"90 jours d’affilée avec 99,5 % de la demande servie",
"scenarios.99_reach_and_150_gbps_served":"99 % de couverture et 150 Gbps servis",
"scenarios.99_reach_and_200_gbps_served":"99 % de couverture et 200 Gbps servis sans faire faillite",
"scenarios.a_path_from_cape_town_to_cairo_lagos":"Un chemin du Cap au Caire, avec Lagos et Nairobi aussi sur votre réseau, et 150 Gbps servis",
"scenarios.a_path_from_los_angeles_to":"Un chemin de Los Angeles à Sydney en 1.6T sur chaque saut, un chemin de Los Angeles à Tokyo, et 150 Gbps servis",
"scenarios.a_path_from_marseille_to_singapore":"Un chemin de Marseille à Singapour, et 80 Gbps entre l’Asie et le reste de ton réseau pendant 30 jours d’affilée",
@ -3386,7 +3388,8 @@
"scenarios.sandbox_mode_a_billion_dollars_chaos":"<b>Mode bac à sable</b><br>Un milliard de dollars et tout débloqué. Chaos : {chaos}. Construis l’internet dont tu as toujours rêvé, et garde une pelleteuse de rechange sous la main.",
"scenarios.sandbox_mode_a_billion_dollars_every":"<b>Mode bac à sable</b><br>Un milliard de dollars, tout débloqué, et rien ne casse jamais. Construis l’Internet dont tu as toujours rêvé.",
"scenarios.sao_paulo_brazil_is_a_continent":"São Paulo. Le Brésil est un continent : quarante IX.brrr, des milliers de provedores, et l’Amazonie entre toi et le nord.",
"scenarios.seoul_the_fastest_hungriest_eyeballs":"Séoul. Les eyeballs les plus rapides et les plus voraces de la planète, du transit à quatre fois le prix, et trois opérateurs historiques qui te facturent chaque gigabit que tu leur envoies.",
"scenarios.seoul_sender_pays_d":"Séoul, où l’expéditeur paie. Chaque Gbps qu’un opérateur livre en Corée te coûte une taxe « l’expéditeur paie » en plus de la facture de transit, les trois opérateurs historiques ne parlent que par un PNI payant, le gigabit à la maison se vend au prix d’un bibimbap et les utilisateurs coréens remarquent chaque milliseconde. Le transit à Tokyo est bon marché, si tes clients supportent le voyage.",
"scenarios.seoul_sender_pays_goal":"{g} Gbps servis, Séoul bien servie ({q} %), 99 % de portée et un bénéfice mensuel",
"scenarios.shark_season_subsea_cuts_twice_as":"Saison des requins : coupures sous-marines deux fois plus probables",
"scenarios.start_in_panama_city_nothing_crosses":"Démarre à Panama City. Rien ne traverse le bouchon du Darién par voie terrestre, et les Andes barrent la route à tout le reste.",
"scenarios.start_in_stuttgart_where_nobody":"Démarre à Stuttgart, où personne ne vend de transit. Atteins Internet uniquement via peering, PNI, caches et ta propre fibre. Aucun transit, nulle part, jamais.",
@ -3446,6 +3449,7 @@
"sites_and_service.level_n":"Niveau {n}",
"sites_and_service.n_ports":"{n} ports",
"sites_and_service.no_path_right_now":"aucun chemin pour l’instant",
"sites_and_service.p_of_city_s_traffic_comes_from_kr":"<b>{p} du trafic de {city} vient de {to} : {ms} ms aller-retour.</b> Les utilisateurs coréens remarquent tout ce qui dépasse 8 ms, et au-delà de 40 ms le haut débit compte comme un mauvais service. Sers davantage depuis Séoul : peering, caches et PNI ici, ou du transit local si tu supportes la taxe « l’expéditeur paie ».",
"sites_and_service.p_of_city_s_traffic_is":"<b>{p} du trafic de {city} est ramené vers le transit à {to} : {ms} ms aller-retour.</b> Les utilisateurs le sentent au-delà de 20 ms (environ 1 500 km), et au-delà de 50 ms le haut débit et les services internet comptent comme un mauvais service. Achetez du transit ici ou à proximité, ou peerez localement.",
"sites_and_service.path_latency_lat":"Latence du chemin : <b>{lat}</b>",
"sites_and_service.pn_routers":"routeurs {pn}",

View file

@ -755,6 +755,7 @@
"city_panel.second_site_and_metro_ring":"Secondo sito e anello metropolitano",
"city_panel.sell_internet_to_homes_here_starts":"Vendi internet alle case di qui. Parte da circa {start} e cresce verso {max} finché il servizio è buono. Rende {rate} per Gbps servito, ogni mese.",
"city_panel.sells_pnis_down_to_1g":"vende PNI anche da 1G",
"city_panel.sender_pays_fee_per_gbps":"Paga chi invia: +{fee} per Gbps di transit",
"city_panel.served_in_city":"Servito a {city}",
"city_panel.serving_v":"serve {v}",
"city_panel.shut_this_pop_down_its_links":"Chiudi questo POP: link, porte e cache spariscono con lui, e ogni cliente che ne dipende viene lasciato andare, con una penale di recesso anticipato.",
@ -2926,9 +2927,11 @@
"progress.done_in_d_days":"Fatto in {d} giorni!",
"progress.floods_that_got_through":"Ondate passate",
"progress.ix_brrr_ports_on_your_backbone":"Porte IX.brrr sulla tua dorsale",
"progress.monthly_profit":"Utile mensile",
"progress.n_of_m":"{n} su {m}",
"progress.next_name_unlocks_what":"Prossimo: {name} sblocca {what}",
"progress.not_tier_1_right_now_why":"Al momento non sei Tier 1: {why}.",
"progress.seoul_served_well":"Seul servita bene (consegnato e veloce)",
"progress.terabit_floods_held":"Ondate terabit respinte",
"progress.under_attack_now":"Sotto attacco ora",
"progress.your_score_peak_traffic":"Il tuo punteggio: picco di traffico",
@ -3357,7 +3360,6 @@
"scenarios.1_6t_on_every_hop_from":"1.6T su ogni tratto da Miami a Madrid e da Lisbona a Lagos, e 100 Gbps serviti",
"scenarios.90_days_in_a_row_with":"90 giorni di fila con il 99.5% della domanda servita",
"scenarios.99_reach_and_150_gbps_served":"99% di copertura e 150 Gbps serviti",
"scenarios.99_reach_and_200_gbps_served":"99% di copertura e 200 Gbps serviti senza andare in rovina",
"scenarios.a_path_from_cape_town_to_cairo_lagos":"Un percorso da Città del Capo al Cairo, con Lagos e Nairobi anche loro sulla tua rete, e 150 Gbps serviti",
"scenarios.a_path_from_los_angeles_to":"Un percorso da Los Angeles a Sydney con 1.6T su ogni tratta, un percorso da Los Angeles a Tokyo e 150 Gbps serviti",
"scenarios.a_path_from_marseille_to_singapore":"Un percorso da Marsiglia a Singapore, e 80 Gbps tra l’Asia e il resto della tua rete per 30 giorni di fila",
@ -3386,7 +3388,8 @@
"scenarios.sandbox_mode_a_billion_dollars_chaos":"<b>Modalità sandbox</b><br>Un miliardo di dollari e tutto sbloccato. Caos: {chaos}. Costruisci l’internet che hai sempre sognato, e tieni una ruspa di scorta a portata di mano.",
"scenarios.sandbox_mode_a_billion_dollars_every":"<b>Modalità sandbox</b><br>Un miliardo di dollari, tutto sbloccato e non si rompe mai niente. Costruisci l’internet che hai sempre sognato.",
"scenarios.sao_paulo_brazil_is_a_continent":"São Paulo. Il Brasile è un continente: quaranta exchange IX.brrr, migliaia di provedores e l’Amazzonia tra te e il nord.",
"scenarios.seoul_the_fastest_hungriest_eyeballs":"Seoul. Gli eyeball più veloci e affamati della Terra, transit a quattro volte il prezzo, e tre incumbent che ti fatturano ogni gigabit che gli mandi.",
"scenarios.seoul_sender_pays_d":"Seul, dove paga chi invia. Ogni Gbps che un carrier consegna in Corea ti costa una tassa «sender pays» oltre alla bolletta del transit, i tre incumbent parlano solo tramite un PNI a pagamento, il gigabit di casa costa quanto un bibimbap e gli utenti coreani notano ogni millisecondo. Il transit a Tokyo è economico, se i tuoi clienti reggono il viaggio.",
"scenarios.seoul_sender_pays_goal":"{g} Gbps serviti, Seul servita bene ({q}%), 99% di copertura e un utile mensile",
"scenarios.shark_season_subsea_cuts_twice_as":"Stagione degli squali: tagli sottomarini due volte più probabili",
"scenarios.start_in_panama_city_nothing_crosses":"Parti da Panama City. Niente attraversa il Darién Gap via terra, e le Ande sono d’intralcio a tutto il resto.",
"scenarios.start_in_stuttgart_where_nobody":"Parti da Stuttgart, dove nessuno vende transit. Raggiungi internet solo con peering, PNI, cache e la tua fibra. Niente transit, da nessuna parte, mai.",
@ -3446,6 +3449,7 @@
"sites_and_service.level_n":"Livello {n}",
"sites_and_service.n_ports":"{n} porte",
"sites_and_service.no_path_right_now":"nessun percorso al momento",
"sites_and_service.p_of_city_s_traffic_comes_from_kr":"<b>Il {p} del traffico di {city} arriva da {to}: {ms} ms di round trip.</b> Gli utenti coreani notano tutto sopra gli 8 ms, e oltre i 40 ms la banda larga conta come servizio scadente. Servi di più da Seul: peering, cache e PNI qui, o transit locale se reggi la tassa «sender pays».",
"sites_and_service.p_of_city_s_traffic_is":"<b>Il {p} del traffico di {city} viene riportato al transito a {to}: {ms} ms di andata e ritorno.</b> Gli utenti se ne accorgono oltre i 20 ms (circa 1.500 km), e oltre i 50 ms banda larga e servizi internet contano come servizio scadente. Compra transito qui o vicino, o fai peering in loco.",
"sites_and_service.path_latency_lat":"Latenza del percorso: <b>{lat}</b>",
"sites_and_service.pn_routers":"router da {pn}",

View file

@ -755,6 +755,7 @@
"city_panel.second_site_and_metro_ring":"Segundo site e anel metro",
"city_panel.sell_internet_to_homes_here_starts":"Venda internet para as casas daqui. Começa em uns {start} e cresce até {max} enquanto o serviço for bom. Paga {rate} por Gbps servido, todo mês.",
"city_panel.sells_pnis_down_to_1g":"vende PNI a partir de 1G",
"city_panel.sender_pays_fee_per_gbps":"Quem envia paga: +{fee} por Gbps de trânsito",
"city_panel.served_in_city":"Servido em {city}",
"city_panel.serving_v":"atendendo {v}",
"city_panel.shut_this_pop_down_its_links":"Desligar este POP: links, portas e caches vão junto, e todo cliente que depende dele é dispensado, com multa por rescisão antecipada.",
@ -2926,9 +2927,11 @@
"progress.done_in_d_days":"Feito em {d} dias!",
"progress.floods_that_got_through":"Enxurradas que passaram",
"progress.ix_brrr_ports_on_your_backbone":"Portas no IX.brrr no seu backbone",
"progress.monthly_profit":"Lucro mensal",
"progress.n_of_m":"{n} de {m}",
"progress.next_name_unlocks_what":"Próximo: {name} desbloqueia {what}",
"progress.not_tier_1_right_now_why":"Não é Tier 1 agora: {why}.",
"progress.seoul_served_well":"Seul bem servida (entregue e rápido)",
"progress.terabit_floods_held":"Enxurradas de terabit contidas",
"progress.under_attack_now":"Sob ataque agora",
"progress.your_score_peak_traffic":"Sua pontuação: pico de tráfego",
@ -3357,7 +3360,6 @@
"scenarios.1_6t_on_every_hop_from":"1.6T em cada trecho de Miami a Madri e de Lisboa a Lagos, e 100 Gbps servidos",
"scenarios.90_days_in_a_row_with":"90 dias seguidos com 99.5% da demanda servida",
"scenarios.99_reach_and_150_gbps_served":"99% de alcance e 150 Gbps servidos",
"scenarios.99_reach_and_200_gbps_served":"99% de alcance e 200 Gbps entregues sem quebrar",
"scenarios.a_path_from_cape_town_to_cairo_lagos":"Um caminho da Cidade do Cabo ao Cairo, com Lagos e Nairóbi também na sua rede, e 150 Gbps atendidos",
"scenarios.a_path_from_los_angeles_to":"Um caminho de Los Angeles a Sydney com 1.6T em cada trecho, um caminho de Los Angeles a Tóquio e 150 Gbps atendidos",
"scenarios.a_path_from_marseille_to_singapore":"Um caminho de Marselha a Singapura, e 80 Gbps entre a Ásia e o resto da sua rede por 30 dias seguidos",
@ -3386,7 +3388,8 @@
"scenarios.sandbox_mode_a_billion_dollars_chaos":"<b>Modo sandbox</b><br>Um bilhão de dólares e tudo desbloqueado. Caos: {chaos}. Construa a internet que você sempre quis, e deixe uma retroescavadeira reserva à mão.",
"scenarios.sandbox_mode_a_billion_dollars_every":"<b>Modo sandbox</b><br>Um bilhão de dólares, tudo desbloqueado e nada nunca quebra. Construa a internet que você sempre quis.",
"scenarios.sao_paulo_brazil_is_a_continent":"São Paulo. O Brasil é um continente: quarenta exchanges IX.brrr, milhares de provedores e a Amazônia entre você e o norte.",
"scenarios.seoul_the_fastest_hungriest_eyeballs":"Seoul. Os eyeballs mais rápidos e famintos da Terra, transit a quatro vezes o preço, e três incumbentes que te cobram por cada gigabit que você manda.",
"scenarios.seoul_sender_pays_d":"Seul, onde quem envia paga. Cada Gbps que um carrier entrega na Coreia custa uma taxa de «quem envia paga» além da conta de trânsito, os três incumbentes só conversam por um PNI pago, o gigabit residencial sai pelo preço de um bibimbap e os usuários coreanos percebem cada milissegundo. O trânsito em Tóquio é barato, se seus clientes aguentarem a viagem.",
"scenarios.seoul_sender_pays_goal":"{g} Gbps servidos, Seul bem servida ({q}%), 99% de alcance e lucro mensal",
"scenarios.shark_season_subsea_cuts_twice_as":"Temporada de tubarão: cortes submarinos duas vezes mais prováveis",
"scenarios.start_in_panama_city_nothing_crosses":"Comece em Panama City. Nada atravessa o Darién Gap por terra, e os Andes atrapalham todo o resto.",
"scenarios.start_in_stuttgart_where_nobody":"Comece em Stuttgart, onde ninguém vende transit. Alcance a internet só com peering, PNIs, caches e sua própria fibra. Nada de transit, em lugar nenhum, nunca.",
@ -3446,6 +3449,7 @@
"sites_and_service.level_n":"Nível {n}",
"sites_and_service.n_ports":"{n} portas",
"sites_and_service.no_path_right_now":"sem caminho no momento",
"sites_and_service.p_of_city_s_traffic_comes_from_kr":"<b>{p} do tráfego de {city} vem de {to}: {ms} ms de ida e volta.</b> Usuários coreanos percebem qualquer coisa acima de 8 ms, e acima de 40 ms a banda larga conta como serviço ruim. Sirva mais a partir de Seul: peering, caches e PNIs aqui, ou trânsito local se você aguentar a taxa de «quem envia paga».",
"sites_and_service.p_of_city_s_traffic_is":"<b>{p} do tráfego de {city} vai até o trânsito em {to}: {ms} ms de ida e volta.</b> Os usuários percebem qualquer coisa acima de 20 ms (cerca de 1.500 km), e acima de 50 ms banda larga e serviços de internet contam como serviço ruim. Compre trânsito aqui ou perto, ou faça peering local.",
"sites_and_service.path_latency_lat":"Latência do caminho: <b>{lat}</b>",
"sites_and_service.pn_routers":"routers de {pn}",

View file

@ -6,6 +6,10 @@ const RU_BOX=40000, RU_BOX_MO=2000;
const UAE_LIC=15000,KSA_LIC=25000;
// Korea: "sender pays" interconnection makes transit into Seoul about four times the usual price.
const KR_TRANSIT=4;
/* Gangnam Style Peering (scenario rule `sender`) turns sender pays all the way up: every Gbps a carrier delivers into
Korea is billed again as a sender-pays fee, the incumbents take traffic only over a paid PNI, home gigabit is cheap,
and users notice every millisecond of a haul to Tokyo or Hong Kong. */
const KR_FEE=180,KR_ARPU=0.85,KR_LAT_OK=8,KR_LAT_BAD=40;
/* Australia: a long way from everywhere. Every gigabit out of the country rides a long, thin subsea
cable, so transit and waves cost more than almost anywhere else. IX ports are the exception: a
nonprofit exchange sells 10G for about AUD 350 a month. Retail broadband is dear, but the national

View file

@ -10,6 +10,8 @@ const scnName=()=>S.scn.wk?wsTxt(S.scn.wk.name):S.scn.id==='weekly'?tr('scenario
const AU_BB=['syd','mel','bne','adl','per'],auExits=()=>new Set(S.links.filter(l=>l.sub&&!!CITY[l.a].au!==!!CITY[l.b].au&&!(l.ready>S.day)).map(l=>l.cable||l.id)).size;
// Ports count only on POPs your backbone joins to São Paulo: islands of POPs with a port each skipped the Amazon (playtest).
const FTTB_G=500;
// Gangnam Style Peering: traffic, how well Seoul is served (delivered and fast) and a monthly profit.
const GN_G=700,GN_Q=0.92;
const brIxN=()=>CITIES.filter(c=>c.br&&S.ixp[c.id]!==undefined&&(c.id==='sao'||pathExists('sao',c.id))).length;
// Days and cash were tuned in the 2.0.0 playtest (tests/scenarios-playtest.test.js): a reference player wins each one in
// roughly a fifth to a half of its days, and the obvious shortcut does not win. The 1.6T scenarios start with enough cash to
@ -24,7 +26,9 @@ const SCN=[
// Lagos and Nairobi on the network too: one long wave to Cairo plus two empty POPs was not a network across Africa.
{id:'c2c',n:tr('scenarios.cape_to_cairo'),city:'cpt',cash:2000000,days:365,rules:{},d:tr('scenarios.cape_town_build_a_network_across'),goal:tr('scenarios.a_path_from_cape_town_to_cairo_lagos'),ok:()=>pathExists('cpt','cai')&&pathExists('cpt','lag')&&pathExists('cpt','nbo')&&R.served>=150},
{id:'ixbr',n:tr('scenarios.order_and_progress'),city:'sao',cash:600000,days:240,rules:{},d:tr('scenarios.sao_paulo_brazil_is_a_continent'),goal:tr('scenarios.ports_on_15_ix_brrr_exchanges_backbone'),ok:()=>brIxN()>=15&&S.ixp.mao!==undefined&&R.served>=200},
{id:'gangnam',n:tr('scenarios.gangnam_style_peering'),city:'icn',cash:900000,days:240,rules:{},d:tr('scenarios.seoul_the_fastest_hungriest_eyeballs'),goal:tr('scenarios.99_reach_and_200_gbps_served'),ok:()=>R.reach>=0.99&&R.served>=200},
// Sender pays, turned up: with Korea at the usual prices broadband swamped every bill and Seoul alone won on day 73
// (playtest). Now Seoul transit is dear, the incumbents want a paid PNI and Korean users mind every far exit.
{id:'gangnam',n:tr('scenarios.gangnam_style_peering'),city:'icn',cash:900000,days:240,rules:{sender:true},d:tr('scenarios.seoul_sender_pays_d'),goal:tr('scenarios.seoul_sender_pays_goal',{g:GN_G,q:Math.round(GN_Q*100)}),ok:()=>R.reach>=0.99&&R.served>=GN_G&&sfOf(R,'icn')>=GN_Q&&R.revMo>=R.costMo},
{id:'flood',n:tr('common.flood_season'),city:'ams',cash:2000000,days:365,rules:{ddos:true},setup:()=>{S.lvl=Math.max(S.lvl||1,3);},d:tr('scenarios.amsterdam_hosting_capital_of_europe'),goal:tr('scenarios.hold_20_floods_5_of_them'),ok:()=>(S.stats.ddosOk||0)>=20&&(S.stats.ddosOkBig||0)>=5},
// Traffic served too: broadband in five cities and two cables were bought on day 1 and won on day 2 (playtest).
{id:'fttb',n:tr('scenarios.fibre_to_the_basement'),city:'syd',cash:1500000,days:365,rules:{levy:true},d:tr('scenarios.sydney_2013_the_toilet_paper_group'),goal:tr('scenarios.broadband_in_sydney_melbourne_served'),ok:()=>AU_BB.every(c=>S.pops[c]&&S.pops[c].bb)&&auExits()>=2&&R.served>=FTTB_G},

View file

@ -20,10 +20,12 @@ function compute(){
const COMP=new Int32Array(NC).fill(-1);let NCOMP=0;for(const s of pops){const i=CIDX[s];if(COMP[i]>=0)continue;const D=SDi[i],k=NCOMP++;for(let x=0;x<NC;x++)if(D[x]<Infinity)COMP[x]=k;}
const E=[], ev=S.ev;
const depeer=ev.depeer>day||scnRule('spat'), leak=ev.leak&&ev.leak.until>day?ev.leak.net:null;
// Sender pays (Gangnam Style Peering): no carrier hands traffic to the Korean incumbents for you, only a paid PNI does.
const snd=scnRule('sender');
for(const t of S.transit){if(!popUp(t.city)||t.down>day||!liveN(t.city,t.site,t.n))continue;
// AS-path prepending (#96) moves part of the port to a last-resort exit of its own.
const cap=Math.min(liveCap(PORT[t.tier].g,t.city,t.site,t.n)*lagF(t),TRX&&TRX.cap[t.net]!==undefined?TRX.cap[t.net]:Infinity),pf=TRX&&TRX.prep[t.net]?PREPEND_F[TRX.prep[t.net]]:0;
const ex={k:'t',net:t.net,prem:premOn(t),pref:t.pref||'normal',lab:labOf(N_('common.net_transit'),'net',NET[t.net].name),id:t.id,city:t.city,cap:cap*(1-pf),used:0,rank:3,ok:n=>!(depeer&&t.net==='cog'&&n==='ggl')&&n!==leak};
const ex={k:'t',net:t.net,prem:premOn(t),pref:t.pref||'normal',lab:labOf(N_('common.net_transit'),'net',NET[t.net].name),id:t.id,city:t.city,cap:cap*(1-pf),used:0,rank:3,ok:n=>!(depeer&&t.net==='cog'&&n==='ggl')&&n!==leak&&!(snd&&NET[n].kr)};
E.push(ex);if(pf)E.push({...ex,cap:cap*pf,prep:true});}
// `nets`: every network ok() can say yes to, so it need not be asked about the other hundred.
for(const c in S.ixp){const ct=ixCity(c);if(!(popUp(ct)||remote.includes(ct))||(S.ev.ixdown&&S.ev.ixdown[c]>day)||!(S.myIx[c]?myIxLive(c):liveN(ct,(S.ixSite||{})[c],(S.ixn||{})[c])))continue;const set=ixSessions(c);R2.sessions+=set.size;
@ -195,11 +197,12 @@ function compute(){
e.used+=amt;f.rem-=amt;
if(!f.junk){let ok=amt;const cf=f.cn,ce=e.cn,cn=f.ncn;
if(cf!==ce||(cf&&!cn)||(!cf&&cn&&e.k==='t')){const prem=(e.k==='t'&&e.prem)||(e.k==='p'&&e.pnc)||path.some(x=>x.links&&x.links.some(y=>y.premium));const loss=prem?0.03:(ev.gfw>day?0.35:0.2);R2.gfwLost+=amt*loss;R2.gfwCross+=amt;ok=amt*(1-loss);}
SRV[f.ci]+=ok;R2.served+=ok;if(f.bz)R2.bizSrv[f.c]+=ok;if(e.rank<=2)R2.peered+=ok;if(e.k==='t'){const m=R2.tNet[e.id]||(R2.tNet[e.id]={});m[f.n]=(m[f.n]||0)+ok;
SRV[f.ci]+=ok;R2.served+=ok;if(f.bz)R2.bizSrv[f.c]+=ok;if(e.rank<=2)R2.peered+=ok;if(e.k==='t'){const m=R2.tNet[e.id]||(R2.tNet[e.id]={});m[f.n]=(m[f.n]||0)+ok;}
// Backhaul to transit: users notice the round trip to the exit. Up to 20 ms (about 1,500 km) is free, then
// it gets worse, and past 50 ms broadband and internet services count as bad service (#…).
if(path.length){let ms=P.ms;if(ms===undefined){ms=0;for(const l of path)ms+=l.lat;P.ms=ms;}const rtt=2*ms;
if(rtt>LAT_OK){LATP[f.ci]+=ok*latLoss(rtt);if(!P.fg){P.fg=0;FARL.push(P,f.ci,e.ci);}P.fg+=ok;}}}R2.egT[e.k]=(R2.egT[e.k]||0)+ok;const ne=NEG[f.nj]||(NEG[f.nj]=R2.netEg[f.n]={c:0,p:0,ix:0,t:0});ne[e.k]+=ok;
// it gets worse, and past 50 ms broadband and internet services count as bad service (#…). Under sender pays,
// Korean users notice any exit far away, transit or not, and much sooner.
if(path.length&&(e.k==='t'||snd&&CITIES[f.ci].kr)){let ms=P.ms;if(ms===undefined){ms=0;for(const l of path)ms+=l.lat;P.ms=ms;}const rtt=2*ms,kl=snd&&CITIES[f.ci].kr;
if(rtt>(kl?KR_LAT_OK:LAT_OK)){LATP[f.ci]+=ok*(kl?krLatLoss(rtt):latLoss(rtt));if(!P.fg){P.fg=0;FARL.push(P,f.ci,e.ci);}P.fg+=ok;}}R2.egT[e.k]=(R2.egT[e.k]||0)+ok;const ne=NEG[f.nj]||(NEG[f.nj]=R2.netEg[f.n]={c:0,p:0,ix:0,t:0});ne[e.k]+=ok;
// Where each flow left (the PNI list asks what a PNI here would take over, #175).
if(e.k==='t'){f.gt+=ok;f.ti=e.id;}else if(e.k==='ix'){f.gi+=ok;f.ii=e.id;}else if(e.k==='p'){if(e.net===f.n&&e.city===f.c)f.gh+=ok;else f.gp+=ok;}}
return amt;
@ -290,7 +293,7 @@ function compute(){
C.loans=(S.loans||[]).reduce((a,l)=>a+(BANKS[l.bank].equity?0:l.model==='transit'?Math.round((C.transit||0)*(l.cut||0.3)):l.pay)+loanFees(l),0);
C.extras=(S.cnLic&&S.cnLic.state==='ok'?CN_JV_MO:0)+scrubMo()+Object.keys(S.pops).filter(ruCity).length*RU_BOX_MO+Object.values(S.pops).filter(p=>p.site2).length*SITE2_MO+(S.te?TE_MO:0)+(S.inbox&&S.inbox.bot?AI_MO:0)+(S.ops&&S.ops.intern?INTERN_MO:0);
V.eyeballs=0;V.business=0;V.ix=0;V.grant=grantOn(R2)?GRANT_MO:0;
C.wholesale=0;C.levy=0;const lev=scnRule('levy');for(const c in S.pops){const sf=sfOf(R2,c),v=R2.cityEye[c]*sf*EYE_RATE*(CITY[c].arpu||1);V.eyeballs+=v;if(CITY[c].au){if(lev)C.levy+=v*AU_LEVY;else C.wholesale+=v*AU_WHOLESALE;}}
C.wholesale=0;C.levy=0;const lev=scnRule('levy');for(const c in S.pops){const sf=sfOf(R2,c),v=R2.cityEye[c]*sf*EYE_RATE*arpuOf(c);V.eyeballs+=v;if(CITY[c].au){if(lev)C.levy+=v*AU_LEVY;else C.wholesale+=v*AU_WHOLESALE;}}
const ids=linkIds();for(const b of S.biz){if(capPend(b))continue;const sf=BIZ_T[b.type].fiber?(fiberOk(b,ids)?1:0):BIZ_T[b.type].l2?clamp((R2.l2[b.id]||0)/b.bw,0,1):sfOf(R2,b.city);V.business+=b.bw*b.rate*Math.min(1,sf/0.95);}
for(const c in S.myIx)V.ix+=S.myIx[c].members.length*MYIX_FEE;
C.revshare=(S.loans||[]).reduce((a,l)=>a+(BANKS[l.bank].equity||l.bal>0?l.share||0:0),0)*(V.eyeballs+V.business+V.ix);

View file

@ -6,7 +6,9 @@ function linkDown(l){return l.cut>S.day||(S.ev.runet>S.day&&ruCity(l.a)!==ruCity
function remoteCities(){return [...new Set(S.links.filter(l=>l.kind==='vxc').flatMap(l=>[l.a,l.b]))].filter(c=>!S.pops[c]);}
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)*transitPerG(NET[t.net],t.city,premOn(t))*S.priceMul+PORT[t.tier].tmo*n+(t.clean?cleanMo(t):0);}
function transitMo(t,q){const n=t.n||1;return Math.max(q,PORT[t.tier].g*n*0.2)*transitPerG(NET[t.net],t.city,premOn(t))*S.priceMul+PORT[t.tier].tmo*n+(t.clean?cleanMo(t):0)+krFee(t,q);}
// Sender pays (Gangnam Style Peering): on top of the price, every Gbps delivered into Korea (95th percentile).
const krFee=(t,q)=>CITY[t.city].kr&&scnRule('sender')?Math.round(q*KR_FEE):0;
function pniMo(p,use){if(!pniOn(p))return 0;return (p.g1?Math.round(PORT[0].pni/2):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]?Math.round(myFab(c).mo*((S.ixSite||{})[c]==='ab'?1.5:1)):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);}

View file

@ -90,7 +90,7 @@ function migrate(s){sanitize(s);
// Older saves have one contract per broker sale: fold a carrier's alien waves on one fiber into one contract.
{const one=new Map();s.biz=s.biz.filter(b=>{if(b.type!=='wwave')return true;const k=b.link+'|'+b.name,a=one.get(k);if(!a){one.set(k,b);return true;}
a.slots=(a.slots||0)+(b.slots||0);a.rate=(a.rate||0)+(b.rate||0);a.since=Math.min(a.since??0,b.since??0);a.mood=Math.min(a.mood??100,b.mood??100);a.folded=true;return false;});
for(const a of one.values())if(a.folded){delete a.folded;const l=s.links.find(x=>x.id===a.link);if(l)a.what=wwWhat(l,a.slots);}}if(s.scn&&s.scn.id==='stg'&&s.scn.rules&&typeof s.scn.rules==='object')s.scn.rules.local=true;
for(const a of one.values())if(a.folded){delete a.folded;const l=s.links.find(x=>x.id===a.link);if(l)a.what=wwWhat(l,a.slots);}}if(s.scn&&s.scn.id==='stg'&&s.scn.rules&&typeof s.scn.rules==='object')s.scn.rules.local=true;if(s.scn&&s.scn.id==='gangnam'&&s.scn.rules&&typeof s.scn.rules==='object')s.scn.rules.sender=true;
// A published weekly scenario keeps its file in the save: checked again here; a bad one plays on as the in-browser weekly.
if(s.scn&&typeof s.scn==='object'&&s.scn.wk!==undefined){const d=wsValid(s.scn.wk,s.scn.key);if(d){s.scn.wk=d;s.scn.home=d.city;s.scn.run=Number.isInteger(s.scn.run)&&s.scn.run>=0?s.scn.run:0;}else{delete s.scn.wk;delete s.scn.home;delete s.scn.run;}}
for(const b of [...s.biz,...s.offers])if(Array.isArray(b.reqs))b.reqs=b.reqs.filter(k=>!REQS[k]||!REQS[k].can||(isCity(b.city)&&(!b.city2||isCity(b.city2))&&REQS[k].can(b,s)));if(s.ltv!==2){for(const l of s.links)if(l.kind==='wave'&&l.tier>=3)l.tier=Math.min(LT.length-1,l.tier+1);s.ltv=2;}if(s.dk){s.dk.m=s.dk.m||{};s.dk.add=s.dk.add||{};s.dk.ret=s.dk.ret||{};s.dk.retUsed=s.dk.retUsed||{};}s.hist=s.hist||[];s.loans=s.loans||[];s.loanOffers=s.loanOffers||[];s.loanStrikes=s.loanStrikes||0;for(const l of s.links||[])if(!l.kind)l.kind='wave';

View file

@ -7,6 +7,8 @@ const colo=c=>{const q=CITY_PDB[c];return !q?1:q[0]===0?1.5:q[0]<=2?1.25:1;};
const popMo=c=>Math.round(POP_MO*colo(c));
function regionMult(c){const C=CITY[c];if(!C||C.cn)return 1;if(C.kr)return KR_TRANSIT;if(C.au)return AU_TRANSIT;if(C.tape)return 1.5;const base=C.reg==='AS'?2.5:C.reg==='AF'?2:C.reg==='OC'?1.8:C.reg==='SA'?1.6:1;return Math.round(base*txComp(c)*10)/10;}
// A network's own markup on top of that, where it is far from home (Glowball Sakura Lager in Asia and New Zealand).
// What a home pays, against the usual bill.
const arpuOf=c=>CITY[c].arpu||(CITY[c].kr&&scnRule('sender')?KR_ARPU:1);
const netMult=(n,c)=>regionMult(c)*((n&&n.far&&CITY[c]&&n.far[CITY[c].reg])||1);
const uaePair=(a,b)=>!!CITY[a].uae&&!!CITY[b].uae;
const rainPair=(a,b)=>!!(CITY[a].rain||CITY[b].rain);

View file

@ -20,7 +20,8 @@ function routerModels(c){const p=S.pops[c],g=p.rgen||0,rt=p.routers||1;
function portNote(c){const p=S.pops[c];if(!p)return '';const g=p.rgen||0;return RG[g].maxP<PORT.length-1?`<p class="note" style="margin-top:0">${tr('sites_and_service.your_model_here_tops_out_at',{model:esc(RG[g].n),pn:RG[g].pn})}</p>`:'';}
// Service: what you deliver, times how it feels. Traffic backhauled far to transit is slow, and users notice.
const latSlow=c=>!!(R&&R.latF&&R.latF[c]<0.97&&R.latFar[c]);
function latNote(c){if(!latSlow(c))return '';const f=R.latFar[c];return `<div class="latwarn">🐢 ${tr('sites_and_service.p_of_city_s_traffic_is',{p:pct(Math.min(1,f.share)),city:esc(CITY[c].name),to:esc(CITY[f.to].name),ms:Math.round(f.ms)})}</div>`;}
function latNote(c){if(!latSlow(c))return '';const f=R.latFar[c];const v={p:pct(Math.min(1,f.share)),city:esc(CITY[c].name),to:esc(CITY[f.to].name),ms:Math.round(f.ms)};return `<div class="latwarn">🐢 ${CITY[c].kr&&scnRule('sender')?tr('sites_and_service.p_of_city_s_traffic_comes_from_kr',v):tr('sites_and_service.p_of_city_s_traffic_is',v)}</div>`;}
const LAT_OK=20,LAT_BAD=50,latLoss=rtt=>rtt<=LAT_OK?0:rtt<=LAT_BAD?0.2*(rtt-LAT_OK)/(LAT_BAD-LAT_OK):0.5;
const krLatLoss=rtt=>rtt<=KR_LAT_OK?0:rtt<=KR_LAT_BAD?0.25*(rtt-KR_LAT_OK)/(KR_LAT_BAD-KR_LAT_OK):0.5;
function sfOf(r,c){const d=r.cityDem[c]||0;return d<=1e-6?1:clamp(r.citySrv[c]/d,0,1)*((r.latF&&r.latF[c])??1);}

View file

@ -70,7 +70,7 @@ function dayTick(){
if(dirty)compute();
opsDay(d);
// payday floaters
if(d%30===0){for(const c in S.pops){let v=(R.cityEye[c]*sfOf(R,c)*EYE_RATE)+S.biz.filter(b=>b.city===c).reduce((a,b)=>a+b.bw*b.rate,0);v=v-R.cityEye[c]*sfOf(R,c)*EYE_RATE*(1-(CITY[c].arpu||1));if(v>500)floater(CITY[c].x,CITY[c].y-30,'+'+fmt$(v),'#16A866');}sfx('coin');}
if(d%30===0){for(const c in S.pops){let v=(R.cityEye[c]*sfOf(R,c)*EYE_RATE)+S.biz.filter(b=>b.city===c).reduce((a,b)=>a+b.bw*b.rate,0);v=v-R.cityEye[c]*sfOf(R,c)*EYE_RATE*(1-arpuOf(c));if(v>500)floater(CITY[c].x,CITY[c].y-30,'+'+fmt$(v),'#16A866');}sfx('coin');}
checkGoals();
scnTick(d);
confTick(d);

View file

@ -1,7 +1,7 @@
function cityPanel(c){
const C=CITY[c],p=S.pops[c],ix=ixName(c),down=p&&p.down>S.day;
let h=`<div class="ph"><div style="min-width:0"><div class="eyebrow">${REG[C.reg]} · ${esc(siteName(c,'a'))}</div><h2>${C.name}</h2>
<div class="facts"><span class="fact">${tr('city_panel.g_of_eyeballs',{g:fmtG(eyeP(c))})}</span>${grantFact(c)}${latSlow(c)?`<span class="fact bad">🐢 ${tr('city_panel.ms_ms_to_transit',{ms:Math.round(R.latFar[c].ms)})}</span>`:''}${regionMult(c)>1?`<span class="fact">${tr('city_panel.transit_x_pricier',{x:regionMult(c)})}</span>`:''}${colo(c)>1?`<span class="fact">${tr('city_panel.few_data_centers_pops_x',{x:colo(c)})}</span>`:''}${C.reg==='AS'&&!C.cn?'<span class="fact ixf">'+tr('city_panel.underserved_users_grow_60_faster')+'</span>':''}${ix?`<span class="fact ixf">${tr('city_panel.ix_ix',{ix:esc(ix)})}</span>`:''}${p?`<span class="fact mine">${tr('common.your_pop')}</span><button class="fact trb" data-act="trace" data-args='{"city":"${c}"}'>🔍 ${tr('common.traceroute')}</button>`:''}${down?`<span class="fact down">DOWN</span>`:''}</div></div>
<div class="facts"><span class="fact">${tr('city_panel.g_of_eyeballs',{g:fmtG(eyeP(c))})}</span>${grantFact(c)}${latSlow(c)?`<span class="fact bad">🐢 ${tr('city_panel.ms_ms_to_transit',{ms:Math.round(R.latFar[c].ms)})}</span>`:''}${regionMult(c)>1?`<span class="fact">${tr('city_panel.transit_x_pricier',{x:regionMult(c)})}</span>`:''}${C.kr&&scnRule('sender')?`<span class="fact">${tr('city_panel.sender_pays_fee_per_gbps',{fee:fmt$(KR_FEE)})}</span>`:''}${colo(c)>1?`<span class="fact">${tr('city_panel.few_data_centers_pops_x',{x:colo(c)})}</span>`:''}${C.reg==='AS'&&!C.cn?'<span class="fact ixf">'+tr('city_panel.underserved_users_grow_60_faster')+'</span>':''}${ix?`<span class="fact ixf">${tr('city_panel.ix_ix',{ix:esc(ix)})}</span>`:''}${p?`<span class="fact mine">${tr('common.your_pop')}</span><button class="fact trb" data-act="trace" data-args='{"city":"${c}"}'>🔍 ${tr('common.traceroute')}</button>`:''}${down?`<span class="fact down">DOWN</span>`:''}</div></div>
<button class="x" data-act="closePanel" aria-label="${tr('common.close')}">×</button></div>`;
if(!p){
h+=`<div class="scroll">${C.note?`<p class="note" style="margin-top:0">${esc(C.note)}</p>`:''}
@ -24,11 +24,11 @@ function cityPanel(c){
if(UI.tab==='cust'){
{const nl=R.nodeLoad[c]||0,nc=R.nodeCap[c]||1;if(nl>=nc*0.95)h+=`<section><h3 style="color:var(--bad)">${tr('city_panel.router_maxed_out')}</h3><p class="lead">${tr('city_panel.your_routers_here_are_forwarding',{load:fmtG(nl),cap:fmtG(nc)})}</p>${btn(tr('common.open_infra'),'tab',{t:'links'},'pink sm')}</section>`;}
h+=`<section><h3>${tr('common.home_broadband')}</h3>`;
if(!p.bb){const s=bbStart(c);h+=`<p class="lead">${tr('city_panel.sell_internet_to_homes_here_starts',{start:fmtG(s),max:fmtG(eyeP(c)),rate:fmt$(EYE_RATE*(C.arpu||1))})}${C.au?` ${scnRule('levy')?tr('city_panel.it_runs_on_your_own_fibre',{pct:pct(AU_LEVY)}):tr('city_panel.the_nearly_broadband_network_keeps',{pct:pct(AU_WHOLESALE)})}`:''}</p>${btn(tr('city_panel.launch_broadband_cost',{cost:fmt$(bbCost(c))}),'launchBB',{city:c},'pink big',S.cash<bbCost(c))}`;}
if(!p.bb){const s=bbStart(c);h+=`<p class="lead">${tr('city_panel.sell_internet_to_homes_here_starts',{start:fmtG(s),max:fmtG(eyeP(c)),rate:fmt$(EYE_RATE*arpuOf(c))})}${C.au?` ${scnRule('levy')?tr('city_panel.it_runs_on_your_own_fibre',{pct:pct(AU_LEVY)}):tr('city_panel.the_nearly_broadband_network_keeps',{pct:pct(AU_WHOLESALE)})}`:''}</p>${btn(tr('city_panel.launch_broadband_cost',{cost:fmt$(bbCost(c))}),'launchBB',{city:c},'pink big',S.cash<bbCost(c))}`;}
else{const eye=R.cityEye[c]||0;
h+=`<div class="kv"><span>${tr('common.eyeball_demand')}</span><b>${tr('city_panel.a_of_b',{a:fmtG(eye),b:fmtG(eyeP(c))})}</b></div><div class="bar me"><i style="width:${Math.min(100,eye/eyeP(c)*100)}%"></i></div>
<div class="kv"><span>${tr('city_panel.served_in_city',{city:C.name})}</span><b style="color:${sf<0.9?'var(--bad)':'var(--eye)'}">${pct(sf)}</b></div><div class="bar ${sf<0.9?'bad':''}"><i style="width:${sf*100}%"></i></div>
<div class="kv"><span>${tr('common.revenue')}</span><b>${tr('common.price_mo',{price:fmt$(eye*sf*EYE_RATE*(C.arpu||1))})}</b></div>
<div class="kv"><span>${tr('common.revenue')}</span><b>${tr('common.price_mo',{price:fmt$(eye*sf*EYE_RATE*arpuOf(c))})}</b></div>
<div class="kv"><span>${tr('city_panel.network_wide_peering_ratio')}</span><b>${pct(R.peerShare||0)}</b></div><p class="note">${tr('city_panel.more_traffic_over_peering_pnis_and')}</p>
${sf<0.9?`<p class="why">${tr('city_panel.customers_are_unhappy_and_leaving')}</p>`:''}
<div class="btns">${p.boost>S.day?`<span class="tag st on">${tr('city_panel.ad_campaign_n_d_left',{n:p.boost-S.day})}</span>`:btn(tr('city_panel.run_ad_campaign_8k_2_growth'),'ad',{city:c},'',S.cash<8000)}</div>`;}

View file

@ -10,7 +10,7 @@ const SCN_PROG={stg:()=>[{l:tr('common.reach'),v:R.reach,max:0.5,txt:`${pct(R.re
pac:()=>[pChk(tr('progress.1_6t_on_every_hop_from'),fastPath('lax','syd',1600)),pChk(tr('progress.a_path_from_los_angeles_to'),pathExists('lax','tok')),pSrv(150)],
atl:()=>[pChk(tr('progress.1_6t_on_every_hop_from_a90b'),fastPath('mia','mad',1600)),pChk(tr('progress.1_6t_on_every_hop_from_da01'),fastPath('lis','lag',1600)),pSrv(100)],
darien:()=>[...['bog','lim','scl','sao'].map(c=>pChk(tr('progress.city_on_your_network',{city:CITY[c].name}),pathExists('pan',c))),pSrv(150)],
gangnam:()=>[pReach(),pSrv(200)],
gangnam:()=>{const sf=S.pops.icn?sfOf(R,'icn'):0,pr=R.revMo-R.costMo;return [pReach(),pSrv(GN_G),{l:tr('progress.seoul_served_well'),v:sf,max:GN_Q,txt:`${pct(sf)} / ${pct(GN_Q)}`},{l:tr('progress.monthly_profit'),v:R.costMo>0?Math.min(1,R.revMo/R.costMo):1,max:1,txt:fmt$(Math.round(pr))}];},
fttb:()=>[...AU_BB.map(c=>pChk(tr('progress.broadband_in_city',{city:CITY[c].name}),!!(S.pops[c]&&S.pops[c].bb))),{l:tr('common.cables_overseas'),v:Math.min(2,auExits()),max:2,txt:`${auExits()} / 2`},pSrv(FTTB_G)],
flood:()=>{const ok=S.stats.ddosOk||0,big=S.stats.ddosOkBig||0,attacks=ddosAll();
return [{l:tr('common.floods_held'),v:ok,max:20,txt:`${ok} / 20`},{l:tr('progress.terabit_floods_held'),v:big,max:5,txt:`${big} / 5`},{l:tr('progress.floods_that_got_through'),v:0,max:0,txt:String(S.stats.ddosLost||0)}].concat(attacks.map(a=>({l:tr('progress.under_attack_now'),v:0,max:0,txt:`${fmtG(a.gbps)} · ${CITY[a.city].name} · ${pct(a.worst===undefined?1:a.worst)}`})));},baltic:()=>[{l:tr('progress.days_in_a_row_with_99'),v:S.stats.clean||0,max:90,txt:tr('progress.n_of_m',{n:S.stats.clean||0,m:90})}]};

View file

@ -756,6 +756,7 @@
"city_panel.second_site_and_metro_ring":"Second site and metro ring",
"city_panel.sell_internet_to_homes_here_starts":"Sell internet to homes here. Starts around {start} and grows toward {max} while service is good. Pays {rate} per Gbps served, every month.",
"city_panel.sells_pnis_down_to_1g":"sells PNIs down to 1G",
"city_panel.sender_pays_fee_per_gbps":"Sender pays: +{fee} per Gbps of transit",
"city_panel.served_in_city":"Served in {city}",
"city_panel.serving_v":"serving {v}",
"city_panel.shut_this_pop_down_its_links":"Shut this POP down: its links, ports and caches go with it, and every customer that depends on it is let go, with an early-termination penalty.",
@ -2927,9 +2928,11 @@
"progress.done_in_d_days":"Done in {d} days!",
"progress.floods_that_got_through":"Floods that got through",
"progress.ix_brrr_ports_on_your_backbone":"IX.brrr ports on your backbone",
"progress.monthly_profit":"Monthly profit",
"progress.n_of_m":"{n} of {m}",
"progress.next_name_unlocks_what":"Next: {name} unlocks {what}",
"progress.not_tier_1_right_now_why":"Not Tier 1 right now: {why}.",
"progress.seoul_served_well":"Seoul served well (delivered and fast)",
"progress.terabit_floods_held":"Terabit floods held",
"progress.under_attack_now":"Under attack now",
"progress.your_score_peak_traffic":"Your score: peak traffic",
@ -3358,7 +3361,6 @@
"scenarios.1_6t_on_every_hop_from":"1.6T on every hop from Miami to Madrid and from Lisbon to Lagos, and 100 Gbps served",
"scenarios.90_days_in_a_row_with":"90 days in a row with 99.5% of demand served",
"scenarios.99_reach_and_150_gbps_served":"99% reach and 150 Gbps served",
"scenarios.99_reach_and_200_gbps_served":"99% reach and 200 Gbps served without going broke",
"scenarios.a_path_from_cape_town_to_cairo_lagos":"A path from Cape Town to Cairo, Lagos and Nairobi on your network too, and 150 Gbps served",
"scenarios.a_path_from_los_angeles_to":"A path from Los Angeles to Sydney with 1.6T on every hop, a path from Los Angeles to Tokyo, and 150 Gbps served",
"scenarios.a_path_from_marseille_to_singapore":"A path from Marseille to Singapore, and 80 Gbps between Asia and the rest of your network for 30 days in a row",
@ -3387,7 +3389,8 @@
"scenarios.sandbox_mode_a_billion_dollars_chaos":"<b>Sandbox mode</b><br>A billion dollars and every unlock. Chaos: {chaos}. Build the internet you always wanted, and keep a spare backhoe handy.",
"scenarios.sandbox_mode_a_billion_dollars_every":"<b>Sandbox mode</b><br>A billion dollars, every unlock, and nothing ever breaks. Build the internet you always wanted.",
"scenarios.sao_paulo_brazil_is_a_continent":"São Paulo. Brazil is a continent: forty IX.brrr exchanges, thousands of provedores, and the Amazon between you and the north.",
"scenarios.seoul_the_fastest_hungriest_eyeballs":"Seoul. The fastest, hungriest eyeballs on Earth, transit at four times the price, and three incumbents who bill you for every gigabit you send them.",
"scenarios.seoul_sender_pays_d":"Seoul, where the sender pays. Every Gbps a carrier delivers into Korea costs you a sender-pays fee on top of the transit bill, the three incumbents only talk over a paid PNI, home gigabit sells for the price of a bibimbap, and Korean users notice every millisecond. Tokyo transit is cheap, if your customers can stand the trip.",
"scenarios.seoul_sender_pays_goal":"{g} Gbps served, Seoul served well ({q}%), 99% reach and a monthly profit",
"scenarios.shark_season_subsea_cuts_twice_as":"Shark season: subsea cuts twice as likely",
"scenarios.start_in_panama_city_nothing_crosses":"Start in Panama City. Nothing crosses the Darién Gap by land, and the Andes are in the way of everything else.",
"scenarios.start_in_stuttgart_where_nobody":"Start in Stuttgart, where nobody sells transit. Reach the internet through peering, PNIs, caches and your own fiber only. No transit anywhere, ever.",
@ -3447,6 +3450,7 @@
"sites_and_service.level_n":"Level {n}",
"sites_and_service.n_ports":"{n} ports",
"sites_and_service.no_path_right_now":"no path right now",
"sites_and_service.p_of_city_s_traffic_comes_from_kr":"<b>{p} of {city}’s traffic comes from {to}: {ms} ms round trip.</b> Korean users notice anything over 8 ms, and past 40 ms broadband counts as bad service. Serve more from Seoul: peering, caches and PNIs here, or local transit if you can stand the sender-pays fee.",
"sites_and_service.p_of_city_s_traffic_is":"<b>{p} of {city}’s traffic is backhauled to transit in {to}: {ms} ms round trip.</b> Users notice anything over 20 ms (about 1,500 km), and past 50 ms broadband and internet services count as bad service. Buy transit here or nearby, or peer locally.",
"sites_and_service.path_latency_lat":"Path latency: <b>{lat}</b>",
"sites_and_service.pn_routers":"{pn} routers",

54
tests/gangnam.test.js Normal file
View file

@ -0,0 +1,54 @@
// Gangnam Style Peering: sender pays, turned up by the scenario rule `sender` (and only there).
const test = require('node:test');
const assert = require('node:assert/strict');
const { load } = require('./harness');
const start = (ev) => ev(`beginGame('T','icn',{scn:SCN.find(x=>x.id==='gangnam')});if(UI.pendGame)ACT.pitchSkip();closeModal();S.cash=1e8`);
const seoul = "ACT.launchBB({city:'icn'});ACT.buyTransit({city:'icn',net:'cog',tier:1});compute();for(let i=0;i<20;i++)dayTick();compute()";
test('sender pays: fee on Seoul transit, incumbents only over a paid PNI, cheap broadband', () => {
const { ev, errors } = load();
start(ev);
ev(seoul);
assert.ok(ev("scnRule('sender')"));
assert.equal(ev("R.reachable.ktt||R.reachable.skb||R.reachable.lgu"), false, 'transit does not carry the incumbents');
assert.ok(ev('R.reach') < 0.99);
const t = JSON.parse(ev("(()=>{const t=S.transit[0],q=R.p95[t.id];return JSON.stringify({fee:krFee(t,q),q,mo:transitMo(t,q)})})()"));
assert.ok(t.q > 0 && t.fee === Math.round(t.q * ev('KR_FEE')), 'a sender-pays fee per Gbps of transit');
assert.ok(ev("Math.abs(R.rev.eyeballs-R.cityEye.icn*sfOf(R,'icn')*EYE_RATE*KR_ARPU)<1"));
ev("ACT.pni({city:'icn',net:'ktt',tier:0});closeModal();for(let i=0;i<90&&!S.pni.every(pniOn);i++)dayTick();compute()");
assert.ok(ev('R.reachable.ktt') && ev('R.reach') >= 0.99, 'a paid PNI with Kay-Tea brings the reach');
assert.match(ev('scnCard()'), /Seoul served well/);
assert.match(ev('scnCard()'), /Monthly profit/);
assert.deepEqual(errors, []);
});
test('sender pays: Korean users mind a haul to Tokyo even over peering', () => {
const { ev, errors } = load();
start(ev);
ev("ACT.launchBB({city:'icn'});UI.via=null;UI.route=null;openLinkModal('icn','tok');ACT.buildLink({tier:1});closeModal();for(const x of ixIdsIn('tok')){ACT.buyIx({city:x,tier:1,signed:true});ACT.rs({city:x});}compute()");
assert.ok(ev('R.egT.ix') > 0 && !ev('R.egT.t'), 'only peering in Tokyo');
assert.ok(ev('R.latF.icn') < 0.95, 'the haul costs service');
assert.match(ev("latNote('icn')"), /Korean users notice/);
assert.deepEqual(errors, []);
});
test('Korea outside the scenario keeps its usual prices', () => {
const { ev, errors } = load();
ev("UI.startCity='icn';ACT.start({});closeModal();S.cash=1e8");
ev(seoul);
assert.ok(!ev("scnRule('sender')"));
assert.ok(ev('R.reachable.ktt'), 'transit reaches the incumbents');
assert.equal(ev("krFee(S.transit[0],100)"), 0);
assert.ok(ev("Math.abs(R.rev.eyeballs-R.cityEye.icn*sfOf(R,'icn')*EYE_RATE)<1"));
assert.deepEqual(errors, []);
});
test('an older Gangnam save picks up the sender-pays rule', () => {
const { ev, errors } = load();
start(ev);
const s = ev("(()=>{const o=JSON.parse(JSON.stringify(S));o.scn.rules={};return JSON.stringify(o);})()");
ev(`S=migrate(JSON.parse(${JSON.stringify(s)}))`);
assert.ok(ev("S.scn.rules.sender===true"));
assert.deepEqual(errors, []);
});

View file

@ -9,6 +9,8 @@ const { play } = require('../scripts/lib/scenario-ref');
const HIRE = ['hire', ['transit', 'routers', 'repair', 'sales', 'ix']];
const home = (c) => [['bb', c], ['tr', c, 1], ['ix', c]];
const GN_H = ['hire', ['transit', 'routers', 'repair', 'sales', 'ix', 'caches', 'pni']];
const GN_REF = [['bb', 'icn'], ['ix', 'icn'], ['tr', 'icn', 1], ['pni', 'icn', 'ktt', 0], GN_H, ['served', 120], ['link', 'icn', 'tok', 1], ['tr', 'tok', 1], ['ix', 'tok'], ['last', 'icn'], ['pop', 'hkg']];
// ref: the reference plan; win: [earliest, latest] day it may win on; cheese: the shortcut, and `by`, the day before
// which it must not win (null: never within the scenario's days).
const PLAY = {
@ -25,8 +27,9 @@ const PLAY = {
win: [70, 200], cheese: [...home('cpt'), ['link', 'cpt', 'cai', 0], ['pop', 'lag'], ['pop', 'nbo'], ['hire']], by: null },
ixbr: { ref: [...home('sao'), ...[['sao', 'rio', 1], ['sao', 'cpq', 0], ['sao', 'cwb', 0], ['cwb', 'poa', 0], ['rio', 'bhz', 0], ['bhz', 'bsb', 0], ['bsb', 'gyn', 0], ['rio', 'ssa', 0], ['ssa', 'rec', 0], ['rec', 'for', 0], ['rec', 'nat', 0], ['for', 'bel', 0], ['bel', 'mao', 0], ['bsb', 'cgb', 0], ['sao', 'vix', 0]].flatMap(([a, b, t]) => [['link', a, b, t], ['ix', b, 0]]), ['bb', 'rio'], ['tr', 'rio', 1], ['bb', 'bsb'], ['tr', 'bsb', 1], ['bb', 'for'], ['tr', 'for', 1], HIRE],
win: [40, 120], cheese: [['bb', 'sao'], ['tr', 'sao', 1], ...['sao', 'rio', 'bsb', 'bhz', 'cwb', 'poa', 'for', 'rec', 'ssa', 'cpq', 'gyn', 'bel', 'mao', 'nat', 'vix', 'cgb'].flatMap((c) => [['pop', c], ['ix', c, 0]]), ['hire']], by: null },
// Seoul at home is enough here: the cheese is just playing, so it only must not be instant.
gangnam: { ref: [...home('icn'), ['link', 'icn', 'tok', 1], ['ix', 'tok'], ['tr', 'tok', 1], ['link', 'icn', 'hkg', 1], ['ix', 'hkg'], ['tr', 'hkg', 1], HIRE], win: [50, 120], cheese: [...home('icn'), ['loans']], by: 50 },
// Sender pays: Seoul transit to start (dear, but fast), one paid PNI with Kay-Tea for reach, then haul the bulk from
// Tokyo and keep Seoul transit as the last resort. Seoul alone loses money on the sender-pays fee and never wins.
gangnam: { ref: GN_REF, win: [130, 190], cheese: [...home('icn'), ['loans']], by: null },
// Bigger routers bring Flowspec, which also takes floods: without a scrubbing center it takes twice as long.
flood: { ref: [...home('ams'), ['scrub', 'ams', 1], ['tr', 'ams', 1], HIRE], win: [80, 200], cheese: [...home('ams'), ['tr', 'ams', 1], ['loans']], by: 180 },
fttb: { ref: [...home('syd'), ['link', 'syd', 'akl', 0, 'tasman'], ['link', 'syd', 'nou', 0, 'gond'], ...['mel', 'bne', 'adl', 'per'].flatMap((c) => [['bb', c], ['tr', c, 1]]), ['link', 'syd', 'mel', 1], ['link', 'syd', 'bne', 1], ['link', 'mel', 'adl', 1], ['link', 'adl', 'per', 0], HIRE],
@ -58,3 +61,20 @@ for (const [id, P] of Object.entries(PLAY)) {
assert.deepEqual(g.errors, []);
});
}
// Gangnam Style Peering bites every way (2.0.0 playtest): paying the sender-pays fee on everything loses money, hauling
// everything from Tokyo is too slow for Korean users, and the old plan (transit everywhere, no Kay-Tea) has neither
// the reach nor the profit. The reference's Seoul transit as first choice, not last resort, also stays in the red.
for (const [name, plan] of Object.entries({
'Seoul transit and Kay-Tea': [['bb', 'icn'], ['ix', 'icn'], ['tr', 'icn', 1], ['pni', 'icn', 'ktt', 0], GN_H],
'everything from Tokyo': [['bb', 'icn'], ['link', 'icn', 'tok', 1], ['tr', 'tok', 1], ['ix', 'tok'], ['pni', 'tok', 'ktt', 0], ['pop', 'hkg'], GN_H],
'the 1.x reference': [...home('icn'), ['link', 'icn', 'tok', 1], ['ix', 'tok'], ['tr', 'tok', 1], ['link', 'icn', 'hkg', 1], ['ix', 'hkg'], ['tr', 'hkg', 1], HIRE],
'Tokyo haul, Seoul transit first': GN_REF.filter((s) => s[0] !== 'last'),
})) {
test(`gangnam: ${name} does not win`, () => {
const g = load();
const r = play(g.ev, 'gangnam', plan);
assert.equal(r.won, null, `${name} won on day ${r.won}`);
assert.deepEqual(g.errors, []);
});
}