Strict latency contracts: big late-game customers who pay for a latency SLA (#137)
From customer level 7, low-latency wholesale routes ask for 1.6 or 3.2 Tbps between two cities with the latency limit trading links already have (REQS.lat on the circuit latency compute() measures). They pay about three times a hyperscaler DCI per Gbps on the same route, never grow past 3.2 Tbps, and every day over the limit after the provisioning grace credits a day's fee and costs extra patience. New rule F9 in gameplay-rules.
This commit is contained in:
parent
80baa970e7
commit
e51510a115
16 changed files with 255 additions and 13 deletions
|
|
@ -28,6 +28,10 @@ const BIZ_T={
|
|||
pairs:{l:tr('businesses.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('businesses.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('businesses.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']},
|
||||
// Strict latency contracts (#137): a carrier or market-data network buys big capacity on one route with a latency SLA,
|
||||
// the premium paid for the guaranteed milliseconds (km), credits paid for every day over it (38-latency-contracts.js),
|
||||
// and never more than max: one customer cannot carry a whole level.
|
||||
lowlat:{l:tr('businesses.low_latency_wholesale_route'),opts:[1600,3200],max:3200,rate:0,l2:true,lat:true,sla:true,km:2,lv:7,names:['Great Circle Clearing House','Straight Line Settlements','Millisecond Markets Exchange','Photon Arbitrage Partners','Shortest Path Securities','Tick Feed Torrent Co.','Matching Engine Mirror Ltd','Speed-of-Glass Replication','Order Book Express','Consolidated Tape Worm']},
|
||||
cgame:{l:tr('businesses.cloud_gaming_platform'),gaming:true,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('common.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('businesses.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']},
|
||||
|
|
@ -49,7 +53,7 @@ const LEVELS=[
|
|||
{n:tr('common.big_league'),q:tr('businesses.your_mtu_is_9000_on_every'),req:tr('businesses.peak_3_tbps_10_pops_3'),unlock:tr('businesses.ai_training_interconnects_and')},
|
||||
{n:tr('common.continental_carrier'),q:tr('businesses.your_noc_has_a_chat_channel'),req:tr('businesses.peak_6_tbps_15_pops_4'),era:1.15,unlock:tr('businesses.esports_world_finals_and_the_4k')},
|
||||
{n:tr('common.transcontinental'),q:tr('businesses.you_joined_the_outages_mailing_list'),req:tr('businesses.peak_9_tbps_and_20_pops'),unlock:tr('businesses.sovereign_cloud_regions_and_a_free')},
|
||||
{n:tr('common.global_backbone'),q:tr('businesses.your_asn_now_shows_up_in'),req:tr('businesses.peak_12_tbps_25_pops_5'),unlock:tr('businesses.a_free_pni_with_voda_phony')},
|
||||
{n:tr('common.global_backbone'),q:tr('businesses.your_asn_now_shows_up_in'),req:tr('businesses.peak_12_tbps_25_pops_5'),unlock:tr('businesses.low_latency_routes_and_a_free_pni')},
|
||||
{n:tr('common.packet_empire'),q:tr('businesses.your_maintenance_window_is_2_a'),req:tr('businesses.peak_16_tbps_and_32_pops'),era:1.15,unlock:tr('businesses.cloud_gaming_platforms_and_the_cloud')},
|
||||
{n:tr('businesses.six_continent_carrier'),q:tr('businesses.somewhere_on_every_continent_a'),req:tr('businesses.peak_21_tbps_40_pops_6'),unlock:tr('businesses.metaverse_platforms_it_finally_took')},
|
||||
{n:tr('businesses.backbone_of_backbones'),q:tr('businesses.your_routing_table_needs_its_own'),req:tr('businesses.peak_26_tbps_and_50_pops'),era:1.2,unlock:tr('businesses.the_vr_era_eyeballs_want_20')},
|
||||
|
|
|
|||
25
src/game/60-features/38-latency-contracts.js
Normal file
25
src/game/60-features/38-latency-contracts.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* ---------- Strict latency contracts (#137) ----------
|
||||
Late in the game, carriers and market-data networks buy 1.6 or 3.2T on one route with a latency SLA, the way real
|
||||
low-latency wholesale is sold: a premium per Gbps for guaranteed milliseconds, and a service credit for every day the
|
||||
circuit runs over them. They are an ordinary customer type (BIZ_T.lowlat) with the latency requirement every trading
|
||||
link has (REQS.lat on R.l2lat, the one-way path latency compute() measures), offered from customer level LC_LV, and
|
||||
never bigger than BIZ_T.lowlat.max: one contract cannot carry a level on its own. */
|
||||
const LC_LV=BIZ_T.lowlat.lv,LC_MOOD=3,LC_GRACE=15;
|
||||
// Once a day for each customer, from the mood check: a latency customer over its SLA after the provisioning grace is
|
||||
// credited that day's fee and loses patience faster than for a bandwidth problem alone. Returns that extra mood lost.
|
||||
function lcBreach(b,d){const T=BIZ_T[b.type];if(!T||!T.sla)return 0;
|
||||
if(d-(b.since||0)<LC_GRACE||!(b.latMax>0)||REQS.lat.ok(b)){delete b.lcB;return 0;}
|
||||
const cr=Math.round(bizMo(b)/monLen(d));S.cash-=cr;b.lcCr=(b.lcCr||0)+cr;
|
||||
if(!b.lcB){b.lcB=1;const v=R.l2lat[b.id];
|
||||
toast(tr('latency_contracts.over_sla',{name:esc(b.name),a:CITY[b.city].name,b:CITY[b.city2].name,ms:isFinite(v)?v.toFixed(1):'∞',max:b.latMax,price:fmt$(cr)}),'bad',[{l:tr('common.show_me'),act:'custGo',args:{id:b.id}}]);}
|
||||
return LC_MOOD;}
|
||||
// The contract, on its offer and customer rows (bRisk()).
|
||||
function lcNote(b){const T=BIZ_T[b.type];if(!T||!T.sla)return '';
|
||||
return `<div class="meta">⏱️ ${tr('latency_contracts.sla_terms',{ms:b.latMax,max:fmtG(T.max)})}${b.lcCr>0?' · '+tr('latency_contracts.credits_paid',{price:fmt$(b.lcCr)}):''}</div>`;}
|
||||
// Saves: credits paid and the breach flag are numbers and a flag; a contract is never bigger than its type allows.
|
||||
function lcSanitize(s){for(const b of [...s.biz,...s.offers]){const T=BIZ_T[b.type];
|
||||
if(b.lcCr!==undefined){const v=Math.round(+b.lcCr);if(Number.isFinite(v)&&v>0)b.lcCr=v;else delete b.lcCr;}
|
||||
if(b.lcB!==undefined){if(b.lcB)b.lcB=1;else delete b.lcB;}
|
||||
if(T&&T.max)b.bw=Math.min(T.max,Math.max(T.opts[0],b.bw));
|
||||
if(T&&T.sla&&Array.isArray(b.reqs)&&!b.reqs.includes('lat'))b.reqs.unshift('lat');
|
||||
if(T&&T.sla&&!(b.latMax>0)&&isCity(b.city)&&b.city2&&isCity(b.city2))b.latMax=latMaxOf(b.city,b.city2);}}
|
||||
|
|
@ -113,7 +113,7 @@ function sanitize(s){
|
|||
three Normal presets, unchanged (its validated mods kept). So an edited or imported save cannot stop the clock or print money. */
|
||||
{const r=s.rules&&typeof s.rules==='object'&&!Array.isArray(s.rules)?s.rules:{};
|
||||
const m={mods:r.mods};s.rules=s.scn&&typeof s.scn==='object'?makeRules('oncall',m):s.mode==='sandbox'?makeRules('sandbox',{...m,chaos:r.chaos}):makeRules(NORMAL_PRESETS.includes(r.preset)?r.preset:'oncall',m);}
|
||||
specSanitize(s);
|
||||
specSanitize(s);lcSanitize(s);
|
||||
cmFix(s);
|
||||
pieSanitize(s);pieIncFix(s);volFix(s);
|
||||
if(s.te){if(typeof s.te!=='object')s.te=null;else{s.te.on=!!s.te.on;s.te.script=typeof s.te.script==='string'?s.te.script.slice(0,4000):'';}}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ function bCities(o){return o.sites?o.sites.slice():[o.city,o.city2].filter(Boole
|
|||
function bHas(o){return !!BIZ_T[o.type].cap||!!BIZ_T[o.type].orbit||bCities(o).every(c=>S.pops[c]);}
|
||||
function eventLive(b){return BIZ_T[b.type].event&&S.day>=b.start&&S.day<b.start+b.dur;}
|
||||
// No warning where nobody attacks (Best Effort, Change Freeze, puzzles, the sandbox's calm).
|
||||
function bRisk(b){return BIZ_T[b.type]?.gaming&&!ddosOff()?`<div class="meta">⚠️ ${tr('customers_and_events.gaming_attracts_attacks')}</div>`:'';}
|
||||
function bRisk(b){return (BIZ_T[b.type]?.gaming&&!ddosOff()?`<div class="meta">⚠️ ${tr('customers_and_events.gaming_attracts_attacks')}</div>`:'')+lcNote(b);}
|
||||
function bTerms(o){const T=BIZ_T[o.type];if(T.cap)return capTerms(o);
|
||||
if(T.event){const live=S.day>=o.start;return tr('customers_and_events.bw_extra_for_d_days_when',{bw:fmtG(o.bw),d:o.dur,when:live?tr('customers_and_events.day_n_of_d',{n:S.day-o.start+1,d:o.dur}):tr('customers_and_events.starting_in_n_d',{n:o.start-S.day}),fee:fmt$(o.fee)});}
|
||||
if(T.sdwan)return tr('customers_and_events.n_sites_list_bw_per_site',{n:o.sites.length,list:o.sites.map(c=>CITY[c].name).join(', '),bw:fmtG(o.bw),price:fmt$(o.bw*o.rate)});
|
||||
|
|
|
|||
|
|
@ -59,7 +59,8 @@ function clGone(b,why){S.biz=S.biz.filter(x=>x!==b);clNote('lost',why);}
|
|||
const clWhere=b=>bCities(b).map(c=>CITY[c].name).join(' ⇄ ');
|
||||
|
||||
// Growing: the next size up their type sells, or twice the bandwidth past the top one. Fiber grows by renewing.
|
||||
function clGrow(b){const T=BIZ_T[b.type];if(T.fiber)return false;const up=(T.opts||[]).find(x=>x>b.bw);b.bw=up||b.bw*2;return true;}
|
||||
// A type with a most (max) never grows past it (#137).
|
||||
function clGrow(b){const T=BIZ_T[b.type];if(T.fiber||(T.max&&b.bw>=T.max))return false;const up=(T.opts||[]).find(x=>x>b.bw);b.bw=T.max?Math.min(T.max,up||b.bw*2):up||b.bw*2;return true;}
|
||||
// Leaving, or one of the not-your-fault turns that keeps them. Returns what the log says.
|
||||
function clLeave(b,d,out){const T=BIZ_T[b.type],v={name:esc(b.name),city:esc(clWhere(b))};
|
||||
if(b.mood<50){clGone(b,'sad');out.lost.push(tr('lifecycle.left_unhappy',v));return;}
|
||||
|
|
|
|||
|
|
@ -69,10 +69,10 @@ function* dayPost(d){
|
|||
(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(),frr=(coreFrr()&&S.links.some(l=>l.cut)?.5:1)*(rule('moods')==='patient'?.5:1);const bhT=new Set(ddosAll().filter(a=>a.bh).map(a=>a.tgt));let nb=0;TERR={S,gen:RW.gen,m:null};try{for(const b of S.biz.slice()){if(++nb%256===0)yield DAY_REST;if(eventTick(b,d)||capPendTick(b,d))continue;b.pm=b.mood;if(bhT.has(b.id))continue;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)*(rule('moods')==='patient'?.5:1);const bhT=new Set(ddosAll().filter(a=>a.bh).map(a=>a.tgt));let nb=0;TERR={S,gen:RW.gen,m:null};try{for(const b of S.biz.slice()){if(++nb%256===0)yield DAY_REST;if(eventTick(b,d)||capPendTick(b,d))continue;b.pm=b.mood;if(bhT.has(b.id))continue;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),lcX=lcBreach(b,d);
|
||||
if(sf>=0.95&&reachOk&&scrubOk&&divOk)b.mood=Math.min(100,b.mood+2);
|
||||
else if(S.day-(b.since||0)<15){}
|
||||
else{const dm=frr*(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0));b.mood-=BIZ_T[b.type].orbit?Math.min(dm,PIE_PATIENCE):dm;
|
||||
else{const dm=frr*(Math.max(0,0.95-sf)*45+(!reachOk?3:0)+(!scrubOk?4:0)+(!divOk?3:0)+lcX);b.mood-=BIZ_T[b.type].orbit?Math.min(dm,PIE_PATIENCE):dm;
|
||||
// An orbit customer served in full but promised more (the shark's full sky) grumbles, and never cancels over it.
|
||||
if(BIZ_T[b.type].orbit&&sf>=0.95&&reachOk)b.mood=Math.max(b.mood,Math.min(b.pm,PIE_GRUMBLE));
|
||||
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');}
|
||||
|
|
@ -134,7 +134,7 @@ function spawnOffer(){
|
|||
const bk=broker(),dfR=S.links.some(l=>l.kind==='df'&&l.ready<=S.day),dfO=S.links.some(l=>l.kind==='df'&&l.own&&l.ready<=S.day);
|
||||
if(dfR)types.push('wwave','wwave');if(dfO)types.push('dfpair');if(bk){if(dfR)types.push('wwave','wwave','wwave','wwave');if(dfO)types.push('dfpair','dfpair','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||bk)&&dfO)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');
|
||||
if(lv>=5)types.push('esport');if(lv>=6&&mine.length>=2)types.push('sov','sov');if(lv>=LC_LV&&mine.length>=2)types.push('lowlat','lowlat');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');
|
||||
// Countries with thousands of ASNs (Brazil's provedores, US regionals) are full of small ISPs shopping for transit.
|
||||
const dense=mine.filter(c=>(CITY_PDB[c]||[])[2]>=2000);if(lv>=2&&dense.length)types.push('isp');
|
||||
|
|
|
|||
|
|
@ -406,7 +406,6 @@
|
|||
"broker.win_text":"{name} (AS{asn}) laid its own cables onto {n} continents and sells {mo} a month of capacity to other carriers, in {days} days. The oceans are your trench now.",
|
||||
"broker.won_on_date":"Won on {date}: your own cables span the oceans, and carriers pay you to use them.",
|
||||
"broker.your_glass_gear_is_already_yours":"As a Cable broker, every fiber, line system, optic, subsea cable and the routers to light them are yours already, whatever the level says.",
|
||||
"businesses.a_free_pni_with_voda_phony":"A free PNI with Voda-Phony. Gear: Absolute Unit 3.2T routers, 3.2T ports and 12.8T waves.",
|
||||
"businesses.agi_lab_allegedly":"AGI lab (allegedly)",
|
||||
"businesses.agi_labs_allegedly_wanting_ai_wans":"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.",
|
||||
"businesses.ai_gpu_data_center":"AI GPU data center",
|
||||
|
|
@ -435,6 +434,8 @@
|
|||
"businesses.hundreds_of_fiber_pairs":"Hundreds of fiber pairs",
|
||||
"businesses.internet_weather_system":"Internet weather system",
|
||||
"businesses.it_s_not_dns_there_s":"It's not DNS. There's no way it's DNS. It was DNS.",
|
||||
"businesses.low_latency_routes_and_a_free_pni":"Low-latency wholesale routes (1.6T and up, with a latency SLA), and a free PNI with Voda-Phony. Gear: Absolute Unit 3.2T routers, 3.2T ports and 12.8T waves.",
|
||||
"businesses.low_latency_wholesale_route":"Low-latency wholesale route",
|
||||
"businesses.mars_mission_ground_station":"Mars mission ground station",
|
||||
"businesses.mars_mission_ground_stations_gear":"Mars mission ground stations. Gear: The Router at the End of the Universe.",
|
||||
"businesses.mars_mission_over_your_pies":"Mars mission over your pies",
|
||||
|
|
@ -2655,6 +2656,9 @@
|
|||
"keys.show_this_list":"Show this list",
|
||||
"keys.space":"Space",
|
||||
"keys.zoom_the_map_out_or":"Zoom the map out or in",
|
||||
"latency_contracts.credits_paid":"{price} paid in SLA credits",
|
||||
"latency_contracts.over_sla":"<b>{name}</b>: {a} ⇄ {b} runs at {ms} ms, over the {max} ms in its contract. Every day over costs you a day's fee in SLA credits ({price}).",
|
||||
"latency_contracts.sla_terms":"Latency SLA {ms} ms: a day's fee back for every day over it · never more than {max}",
|
||||
"lease_swaps.cap_fabric_circuit":"{cap} fabric circuit",
|
||||
"lease_swaps.cap_on_a_dark_fiber_iru":"{cap} on a dark fiber IRU",
|
||||
"lease_swaps.cap_wave":"{cap} wave",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue