Merge branch 'feat/backbone-tech'

This commit is contained in:
Frederic Jung 2026-10-31 10:16:00 +01:00
commit 64d71adc35
No known key found for this signature in database
15 changed files with 214 additions and 5 deletions

View file

@ -28,7 +28,7 @@ const corePass=c=>coreOn()&&S.core.run>=1&&inCore(c)?CORE_PASS[S.core.run]:1;
function coreVendors(){const v=new Set();for(const c in S.pops)if(inCore(c))v.add(RG[S.pops[c].rgen||0].v);return v;}
function coreEdge(){if(!coreOn()||S.core.run<1)return false;for(const c in S.pops)if(inCore(c)&&RG[S.pops[c].rgen||0].cr===S.core.run)return true;return false;}
// Daily odds of an interop incident: none for one vendor, or below every router's top level.
function coreIopRisk(){if(!coreOn()||S.core.run<1||coreVendors().size<2||!coreEdge())return 0;return CORE_IOP[S.core.run];}
function coreIopRisk(){if(!coreOn()||S.core.run<1||coreVendors().size<2||!coreEdge())return 0;return CORE_IOP[S.core.run]*(S.core.lab?CORE_LAB_F:1);}
// POPs left out of the core (their router can't run it), for the panel.
const coreOut=()=>coreOn()&&S.core.run>=1?Object.keys(S.pops).filter(c=>!inCore(c)):[];
// Links where the vendors meet: both ends in the core, different vendors.
@ -37,3 +37,20 @@ const coreIopLinks=live=>live.filter(l=>S.pops[l.a]&&S.pops[l.b]&&inCore(l.a)&&i
const RG_V={arrrhipster:'Arrrhipster',brocadabra:'Brocadabra',disco:'Disco',edge:'Edge Lord',extremely:'Extremely Networks',junipurr:'Junipurr',knockia:'Knockia',mikrowtik:'Mikrowtik',rusty:'Rusty',universe:'Universe',whitebox:'Whitebox'};
// One line for a model: its vendor and the highest backbone it runs (SRv6-only boxes say so).
const coreMeta=g=>{const G=RG[g];return tr('core.vendor_v_backbone_up_to_lv',{v:RG_V[G.v],lv:tr(CORE_LV[G.cr])})+(G.noMpls?' · '+tr('core.no_mpls_srv6_only'):'');};
/* ---------- what an upgraded backbone brings (only good things) ----------
Customers who need it: offers of these appear once the backbone runs their level; a contract already signed keeps
paying whatever the backbone runs later. Real carriers sell L3VPNs over MPLS, low-latency planes with flex-algo
over segment routing, and slices over SRv6. */
Object.assign(BIZ_T,{
l3vpn:{l:tr('core.l3vpn_for_an_enterprise'),opts:[1,2,5,10],rate:0,l2:true,sdwan:true,siteRate:1100,km:0,lv:3,core:1,names:['Branch Office Bonanza','Head Office & Sons','Twelve Tills Retail','Regional Bank of Routes','Chain of Command Pharmacies','Franchise Fiesta']},
flex:{l:tr('core.flex_algo_low_latency_link'),opts:[5,10,40],rate:0,l2:true,lat:true,km:9,lv:3,core:3,names:['Microsecond Mike Markets','Low-Ping Esports League','Latency Arbitrage Partners','Photon Finish Trading','Lag-Free Ladder Games']},
slice:{l:tr('core.network_slice'),opts:[100,200,400],rate:0,l2:true,div:true,km:1.2,lv:3,core:4,names:['Fifth Gen Slices Ltd','Pizza-Slice Mobile','Sliced Bread Telecom','GPU Slice & Dice','Thin Crust Wireless']},
});
// The backbone's customer types now on offer (twice each, like the other types' weights).
function coreProducts(mine){if(!coreOn())return [];const run=S.core.run,out=[];
if(run>=1&&mine.length>=3)out.push('l3vpn','l3vpn');if(run>=3&&mine.length>=2)out.push('flex','flex');if(run>=4&&mine.length>=2)out.push('slice','slice');return out;}
// Fast reroute (RSVP-TE FRR, TI-LFA): backup paths are ready before a cut, so customers barely notice one.
const coreFrr=()=>coreOn()&&S.core.run>=2;
// An interop lab: test the vendors against each other before they meet in production.
const CORE_LAB=150000,CORE_LAB_F=0.4;
const coreLab=()=>!!(S.core&&S.core.lab);

View file

@ -57,7 +57,7 @@ function sanitize(s){
for(const k of Object.keys(s.confReg))s.confReg[k]=s.confReg[k]==='sp'?'sp':!!s.confReg[k];
if(s.conf){const c=s.conf;if(typeof c!=='object'||!own(REG,c.reg))s.conf=null;else s.conf={until:num(c.until,0),reg:c.reg,name:String(c.name||'').slice(0,40),sp:!!c.sp};}
// The backbone's technology: a save from before it with Auto-TE bought keeps the old rules on RSVP-TE (legacy).
{const c=s.core&&typeof s.core==='object'?s.core:null,lv=c?int(c.lv,0,4,0):(s.te?2:0);s.core={lv,run:c?int(c.run,0,lv,lv):lv};if(c?c.legacy===true:!!s.te)s.core.legacy=true;}
{const c=s.core&&typeof s.core==='object'?s.core:null,lv=c?int(c.lv,0,4,0):(s.te?2:0);s.core={lv,run:c?int(c.run,0,lv,lv):lv};if(c?c.legacy===true:!!s.te)s.core.legacy=true;if(c&&c.lab===true)s.core.lab=true;if(c&&c.since!==undefined)s.core.since=num(c.since,0);}
s.capDeal=s.capDeal&&typeof s.capDeal==='object'&&own(CAP_ROUTES,s.capDeal.c)?{at:num(s.capDeal.at,0),c:s.capDeal.c}:null;
s.inc=s.inc.filter(i=>i&&typeof i.type==='string').map(i=>(i.type==='maxpfx'&&(i.type='ixloop'),i.id=sid(i.id),i.until=num(i.until,s.day),i.cost=num(i.cost,0),i.msg=String(i.msg||'').slice(0,400),i.fix=i.fix==null?undefined:String(i.fix).slice(0,60),i));
s.loans=s.loans.filter(l=>l&&own(BANKS,l.bank));for(const l of s.loans){if(l.model!==undefined&&!['balloon','storm','transit','astro'].includes(l.model))delete l.model;for(const k of ['apr0','cut','share'])if(l[k]!==undefined&&!isFinite(+l[k]))delete l[k];if(!Array.isArray(l.covs))l.covs=[];l.covs=l.covs.filter(c=>own(COVS,c));}s.loanOffers=s.loanOffers.filter(l=>l&&own(BANKS,l.bank));

View file

@ -38,7 +38,7 @@ function spawnSpecial(t){const T=BIZ_T[t],mine=Object.keys(S.pops),lv=lvl();
S.offers.push({id:uid(),city,city2:null,name:tr('customers_and_events.name_in_city',{name:nm(),city:CITY[city].name}),type:t,bw,rate:0,reqs:[],start,dur,fee:Math.round(bw*dur*70),exp:start-2});return;}
if(T.sdwan){const hub=pick(mine),n=3+Math.floor(Math.random()*4),pool=(Math.random()<0.85?mine:OFFC).filter(c=>c!==hub),sites=[hub];
while(sites.length<n&&pool.length)sites.push(pool.splice(Math.floor(Math.random()*pool.length),1)[0]);if(sites.length<3)return;
S.offers.push({id:uid(),city:hub,city2:null,sites,name:nm(),type:t,bw:pick(T.opts),rate:700*sites.length,reqs:[],exp:S.day+40});return;}
S.offers.push({id:uid(),city:hub,city2:null,sites,name:nm(),type:t,bw:pick(T.opts),rate:(T.siteRate||700)*sites.length,reqs:[],exp:S.day+40});return;}
const ready=S.links.filter(l=>l.kind==='df'&&l.ready<=S.day);
if(t==='wwave'){const u=fiberUse(),ls=ready.filter(l=>freeCh(l,u)>=1&&brFree(l)>=1&&!S.offers.some(o=>o.link===l.id));if(!ls.length)return;S.offers.push(fiberOffer(t,pick(ls),nm));return;}
if(t==='dfpair'){const u=fiberUse(),ls=ready.filter(l=>pairFree(l,u)&&brFree(l)>=BR_PAIR&&!S.offers.some(o=>o.link===l.id));if(!ls.length)return;S.offers.push(fiberOffer(t,pick(ls),nm));}

View file

@ -41,10 +41,10 @@ function dayTick(){
(a.sla||(a.sla=[])).push(b.id);b.slaFor=a.start;S.cash-=SLA_PEN;b.mood=Math.max(0,b.mood-18);S.stats.sla=(S.stats.sla||0)+1;
toast(tr('day_tick.sla_breach_name_the_attack_on',{name:esc(b.name),city:CITY[a.city].name,pen:fmt$(SLA_PEN)}),'bad');sfx('err');}}
// businesses mood
const ids=linkIds();for(const b of S.biz.slice()){if(eventTick(b,d)||capPendTick(b,d))continue;b.pm=b.mood;const sf=bizSf(b,ids),reachOk=BIZ_T[b.type].l2||BIZ_T[b.type].fiber||R.reach>0.99||scnRule('local'),scrubOk=b.type!=='scrub'||(hasScrub()&&!scrubFar(b.city)),divOk=reqOk(b);
const ids=linkIds(),frr=coreFrr()&&S.links.some(l=>l.cut)?.5:1;for(const b of S.biz.slice()){if(eventTick(b,d)||capPendTick(b,d))continue;b.pm=b.mood;const sf=bizSf(b,ids),reachOk=BIZ_T[b.type].l2||BIZ_T[b.type].fiber||R.reach>0.99||scnRule('local'),scrubOk=b.type!=='scrub'||(hasScrub()&&!scrubFar(b.city)),divOk=reqOk(b);
if(sf>=0.95&&reachOk&&scrubOk&&divOk)b.mood=Math.min(100,b.mood+2);
else if(S.day-(b.since||0)<15){}
else{b.mood-=(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0));
else{b.mood-=frr*(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0));
if(b.mood<=0){S.biz=S.biz.filter(x=>x!==b);toast(tr('day_tick.name_cancelled_too_many_outages_and',{name:esc(b.name),city:CITY[b.city].name}),'bad');sfx('err');}
else if(b.mood<30&&!b.warned){b.warned=b.warn60=true;const why=bizWhy(b)[0],paused=pref('pauseFurious')&&autoPause();
toast(tr('day_tick.name_is_furious_fix_service_in',{name:esc(b.name),city:CITY[b.city].name})+(why?`<br><i>${esc(why)}</i>`:'')+(paused?`<br><b>${tr('common.game_paused')}</b>`:''),'bad',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}].concat(paused?[resumeAct()]:[]));sfx('err');}
@ -98,6 +98,7 @@ function spawnOffer(){
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');}
// What your network can already serve calls too, at a lower weight and the smallest size (#187).
const sp=spots(),spT=[...new Set(sp.map(s=>s.t))],bq=charter()==='boutique';for(const x of spT){types.push(x);if(x==='hft'&&bq)types.push(x,x);}if(bq&&lv>=2)types.push('hft','hft');
types.push(...coreProducts(mine));
const t=pick(types),T=BIZ_T[t];
if(T.lv>lv&&spT.includes(t)){spawnSpot(t,pick(sp.filter(s=>s.t===t)));return;}
if(T.event||T.sdwan||T.fiber||T.mega){spawnSpecial(t);return;}

View file

@ -72,6 +72,10 @@ const BADGES=[
{id:'monkey',i:'🛡️',t:tr('badges.monkey_proof'),d:tr('badges.outlast_a_chaos_monkey_visit'),r:'e',ok:()=>(st().mkSurv||0)>=1},
{id:'flood',i:'🌊',t:tr('badges.held_the_flood'),d:tr('badges.weather_a_multi_terabit_ddos'),r:'e',ok:()=>(st().ddosMonster||0)>=1},
{id:'skynot',i:'🤖',t:tr('common.skynot_smiles'),d:tr('badges.land_a_hackback_3000tm_that_actually'),r:'e',secret:true,ok:()=>(st().hackWin||0)>=1},
{id:'label',i:'🏷️',t:tr('core.label_switcher'),d:tr('core.run_an_mpls_backbone'),r:'c',ok:()=>coreOn()&&S.core.run>=1},
{id:'bleed',i:'🩸',t:tr('core.bleeding_edge'),d:tr('core.run_an_srv6_backbone'),r:'r',ok:()=>coreOn()&&S.core.run>=4},
{id:'mono',i:'🏪',t:tr('core.single_vendor_shop'),d:tr('core.run_sr_mpls_or_srv6_on'),r:'e',ok:()=>coreOn()&&S.core.run>=3&&Object.keys(S.pops).length>=8&&!coreOut().length&&coreVendors().size===1},
{id:'zoo',i:'🦓',t:tr('core.vendor_zoo'),d:tr('core.run_an_mpls_backbone_with_4'),r:'r',ok:()=>coreOn()&&S.core.run>=1&&coreVendors().size>=4},
{id:'zero',i:'🕳️',t:tr('badges.zero_peers_given'),d:tr('badges.reach_tier_2_with_every_single'),r:'l',secret:true,ok:()=>isTier2()&&!Object.keys(S.peers).length&&!S.pni.length},
];
/* Badge variants by ruleset (2.0): On-call earns the standard badge, Change Freeze a frosted one and BGP at 3 a.m. a

View file

@ -4,6 +4,8 @@ Object.assign(ACT,{
if(lvl()<CORE_REQ[n]){toast(tr('core.needs_customer_level_n',{n:CORE_REQ[n]}),'bad');sfx('err');return;}if(!spend(CORE_COST[n]))return;
S.core.lv=n;S.core.run=n;delete S.core.legacy;const out=coreOut().length;
toast(tr('core.your_backbone_now_runs_lv',{lv:tr(CORE_LV[n])})+(out?' '+trn('core.n_pops_stay_outside',out):''),'good');sfx('build');after();},
coreLab:()=>{if(!coreOn()||S.core.lab||S.core.lv<1)return;if(!spend(CORE_LAB))return;
S.core.lab=true;toast(tr('core.interop_lab_open_vendors_now'),'good');sfx('coin');after();},
coreSet:({v})=>{if(!S.core)return;v=+v;if(!(v>=0&&v<=S.core.lv)||(v===S.core.run&&!S.core.legacy))return;S.core.run=v;delete S.core.legacy;sfx('click');after();},
via:({v})=>{UI.via=v;if(UI.pending)openLinkModal(UI.pending.a,UI.pending.b);},
setRoute:({id,m})=>{if(!own(RT,m))return;const b=S.biz.find(x=>x.id===id);if(b){b.route=m;sfx('click');after();}},

View file

@ -11,4 +11,7 @@ function corePanel(){if(!S.core||S.mode==='puzzle'||S.pz||S.ar||S.scn)return '';
const out=coreOut();if(out.length)h+=`<p class="why">${trn('core.n_pop_outside_the_core_its',out.length,{list:out.slice(0,5).map(c=>CITY[c].name).join(', ')+(out.length>5?'…':''),lv:tr(CORE_LV[run])})}</p>`;
const v=coreOn()&&run>=1?coreVendors():null;
if(v&&v.size>1)h+=coreIopRisk()?`<p class="why">${tr('core.n_vendors_at_the_top_of',{n:v.size,lv:tr(CORE_LV[run])})}</p>`:`<p class="meta" style="margin:0 0 6px">${tr('core.n_vendors_one_step_below_their',{n:v.size})}</p>`;
if(run>=2)h+=`<p class="meta" style="margin:0 0 6px">🛟 ${tr('core.fast_reroute_customers_lose_half')}</p>`;
if(coreOn()&&lv>=1)h+=C.lab?`<p class="meta" style="margin:0 0 6px">🧪 ${tr('core.interop_lab_cuts_interop_incidents',{p:pct(1-CORE_LAB_F)})}</p>`
:`<div class="btns">${btn(tr('core.build_an_interop_lab_cost',{cost:fmt$(CORE_LAB)}),'coreLab',{},'ghost sm',S.cash<CORE_LAB)}</div><p class="meta" style="margin:2px 0 6px">${tr('core.test_vendors_against_each_other',{p:pct(1-CORE_LAB_F)})}</p>`;
return h;}

View file

@ -1546,9 +1546,17 @@
"core.auto_te_is_paused_it_needs":"Auto-TE is paused: it needs an RSVP-TE or segment-routing backbone. Run one again and it picks up where it left off.",
"core.auto_te_needs_an_rsvp_te_or":"Auto-TE needs an RSVP-TE or segment-routing backbone first.",
"core.backbone":"Backbone",
"core.bleeding_edge":"Bleeding edge",
"core.both_tacs_say_it_is":"{va} support says it is a {vb} bug, {vb} support says it is a {va} bug. Meanwhile the link from {a} to {b} is down.",
"core.build_an_interop_lab_cost":"🧪 Build an interop lab ({cost})",
"core.can_t_run_your_lv":"can't run your {lv} backbone",
"core.fast_reroute_customers_lose_half":"Fast reroute: backup paths are ready before a cut, so customers lose half as much happiness while a link is down.",
"core.flex_algo_low_latency_link":"Flex-algo low-latency link",
"core.interop_failure":"Vendor interop failure",
"core.interop_lab_cuts_interop_incidents":"Interop lab: vendors are tested against each other first, {p} fewer interop incidents.",
"core.interop_lab_open_vendors_now":"<b>Interop lab open.</b> New firmware now meets the other vendors in a rack before it meets them in production.",
"core.l3vpn_for_an_enterprise":"L3VPN for an enterprise",
"core.label_switcher":"Label switcher",
"core.labels_switch_traffic_that_only":"Labels switch traffic that only passes through a POP, so it costs that router less. No traffic engineering yet.",
"core.ldp_mpls":"LDP/MPLS",
"core.lv_at_customer_level_n":"{lv} <small>customer level {n}</small>",
@ -1557,23 +1565,31 @@
"core.n_vendors_at_the_top_of":"{n} vendors share the backbone, and {lv} is the top of what some of their routers can do: expect interop failures. Run one level lower, or stick to one vendor.",
"core.n_vendors_one_step_below_their":"{n} vendors, all running below their top level: they get along fine.",
"core.needs_customer_level_n":"That needs customer level {n}.",
"core.network_slice":"Network slice",
"core.no_mpls_srv6_only":"no MPLS, SRv6 only",
"core.open_a_ticket_with_both":"Get both vendors on a call",
"core.paused":"Paused",
"core.plain_igp":"Plain IGP",
"core.rsvp_te_mpls":"RSVP-TE/MPLS",
"core.run_an_mpls_backbone":"Run an MPLS backbone.",
"core.run_an_mpls_backbone_with_4":"Run an MPLS backbone with routers from 4 different vendors in it.",
"core.run_an_srv6_backbone":"Run an SRv6 backbone.",
"core.run_sr_mpls_or_srv6_on":"Run SR-MPLS or SRv6 on 8 or more POPs, all from one vendor.",
"core.running":"Running",
"core.segment_routing_over_ipv6_the":"Segment routing over IPv6: the same detours, almost no router CPU, and the most arguments between vendors.",
"core.segment_routing_te_detours_up":"Segment routing: traffic engineering detours up to twice the shortest path, with less router CPU than tunnels.",
"core.shortest_paths_only_every_router":"Shortest paths only. Every router looks up every packet, and a full link drops what doesn't fit.",
"core.single_vendor_shop":"Single-vendor shop",
"core.sr_mpls":"SR-MPLS",
"core.srv6":"SRv6",
"core.test_vendors_against_each_other":"A rack of every vendor you run: firmware is tested there first, so mixed vendors have {p} fewer interop incidents.",
"core.this_router_can_t_run_your":"This router can't run your {lv} backbone: this POP routes plain IP.",
"core.tunnels_unlock_auto_te_and":"Tunnels unlock Auto-TE and RouteScript: overflow detours up to one and a half times the shortest path.",
"core.upgrade_to_lv_cost":"Upgrade to {lv} <small>{cost}</small>",
"core.uses_p_of_router_cpu":"Uses {p} of router CPU.",
"core.va_and_vb_disagree_about":"{va} and {vb} disagree about {lv} between {a} and {b}. Both are sure they follow the RFC. The link is down.",
"core.vendor_v_backbone_up_to_lv":"{v} · backbone up to {lv}",
"core.vendor_zoo":"Vendor zoo",
"core.your_auto_te_predates_backbones":"Your Auto-TE was installed before backbones had a technology, so it runs as it always did. Changing the backbone switches to the new rules.",
"core.your_backbone_now_runs_lv":"Your backbone now runs {lv}.",
"customers.attacks_on_city_are_hauled_to":"attacks on {city} are hauled to {to} for scrubbing: +{ms} ms",