Pie in the Sky, the early game: a pace forecast on the Launch tab, patchy-sky customers before 40%, a hint to wait on dishes
- Launch tab: each crust being filled says when it is full at today's pace (piePace: the pads that reach it, one launch per leadDays(gap) each with the rocket last queued or the fastest available, capped by the factory with the shelf and the queue as a buffer). Past two years and pad-bound, one nudge for another pad at the coastal POP nearest the equator, with a build button (piePadTip). - Patchy-sky customers (60-features/99-pie-patchy.js): a revenue line in pieMoney, no flows, so routing is unchanged and games without a rocket company never see it. Up to $30M/mo for Shortcrust (scaled by crust size), ramping from 10% to 40% coverage with one working dish under the crust, then times (1 - pieCarry) so it hands over to regular orbit customers by 60%. Shown on the Traffic tab; booked in S.pie.book like all orbit income. - Dishes tab: under 30% coverage, a gentle note that dishes earn nothing yet and cost money every month. - Payback on the O7 run is unchanged at one decimal (seed 7: 7.2 years, seed 11: 8.2).
This commit is contained in:
parent
267f9efc72
commit
7001174d79
15 changed files with 272 additions and 5 deletions
|
|
@ -95,7 +95,7 @@ const API_STATE_DOC={
|
|||
};
|
||||
|
||||
const API_RESULTS_DOC={
|
||||
pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue, service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'},
|
||||
pie:{type:'map',doc:'Orbit this compute (only with a rocket company): revenue (rev, including patchy: {mo, cr} from patchy-sky customers who pay from 10% coverage, before a crust carries anything, and fade out between 40% and 60%), service per orbit customer, landing dishes, flows through the sky, backhaul for cut-off POPs (bh), crust and dish load, government money (gov).'},
|
||||
nt:{type:'map',doc:'Traffic per network through transit, by net id.'},
|
||||
tNet:{type:'map',doc:'Traffic per network you hand to each upstream, by "net@upstream".'},
|
||||
reachNT:{type:'number',doc:'Networks reachable without transit.'},
|
||||
|
|
|
|||
|
|
@ -73,6 +73,19 @@ function pieQuote(rk,cr,o={}){const P=S.pie;if(!P||!own(ROCKETS,rk)||!own(CRUSTS
|
|||
// The cheapest a crust can be filled from nothing (one-off costs only): rule O7.
|
||||
function pieFullCost(cr){const C=CRUSTS[cr],base=PIE_CO+PIE_FAC+PIE_PAD,pies=C.full*PIE_PIE;
|
||||
return base+pies+Math.min(...Object.keys(ROCKETS).map(rk=>{const R0=ROCKETS[rk],n=Math.ceil(C.full/R0.pies);return (R0.rd?PIE_RD[R0.rd].cost:0)+(n+(rk==='heavy'?PIE_HEAVY_TESTS:0))*R0.cost;}));}
|
||||
/* The Launch tab's forecast: how long until crust cr is full at today's pace, or null (no factory, no pad that reaches it,
|
||||
no rocket). The rocket is the one last queued for it, else the one that lifts most a day. Each pad flies one every
|
||||
leadDays(gap) (pieLaunch sets pad.next), so the pads lift pies/gap a day each; the factory adds PIE_FAC_MONTH a month,
|
||||
and pies on the shelf and in the queue let the pads outrun it until they are gone. Wear and failures are left out:
|
||||
it says "about". pad: true when the pads, not the factory, set the pace (another pad would help). */
|
||||
function piePace(cr){const P=S.pie;if(!P||!P.fac||!own(CRUSTS,cr))return null;const need=Math.max(0,CRUSTS[cr].full-pieLive(cr)),pads=P.pads.filter(p=>piePadOk(p.city,cr)).length;if(!pads)return null;
|
||||
const use=rk=>pieRkOk(rk)&&!(rk==='heavy'&&pieTests()<PIE_HEAVY_TESTS),rate=rk=>ROCKETS[rk].pies/leadDays(ROCKETS[rk].gap);
|
||||
const L=P.q.filter(x=>x.cr===cr&&!x.test).sort((a,b)=>b.day-a.day)[0],rk=L&&use(L.rk)?L.rk:Object.keys(ROCKETS).filter(use).sort((a,b)=>rate(b)-rate(a))[0];if(!rk)return null;
|
||||
const rp=pads*rate(rk),rf=PIE_FAC_MONTH/30,st=P.stock+P.crusts[cr].queued;let days;
|
||||
if(rp<=rf)days=need/rp;else{const t=st/(rp-rf);days=need<=rp*t?need/rp:t+(need-rp*t)/rf;}
|
||||
return {days:Math.ceil(days),rk,mo:Math.round(Math.min(rp,rf)*30),pad:rp<=rf};}
|
||||
// Where another pad would help crust cr most: the coastal POP nearest the equator that has none and reaches it.
|
||||
function piePadTip(cr){const P=S.pie;return Object.keys(S.pops).filter(c=>!P.pads.some(p=>p.city===c)&&piePadOk(c,cr)).sort((a,b)=>Math.abs(CITY[a].lat)-Math.abs(CITY[b].lat)).find(pieCoast)||null;}
|
||||
function pieCohort(cr,n,las){const c=S.pie.crusts[cr],m=Math.floor(S.day/30),k=c.cohorts.find(x=>x.las===las&&Math.floor(x.day/30)===m);if(k)k.n+=n;else c.cohorts.push({n,day:S.day,las});
|
||||
if(c.cohorts.length>PIE_COHORTS)c.cohorts.splice(0,c.cohorts.length-PIE_COHORTS);}
|
||||
// A launch: every one costs a party; a test always ends in a fireball; the rest fail by the rocket's odds and the chaos rule,
|
||||
|
|
|
|||
21
src/game/60-features/99-pie-patchy.js
Normal file
21
src/game/60-features/99-pie-patchy.js
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
/* ---------- Pie in the Sky: patchy-sky customers (docs/plans/pie-in-the-sky.md) ----------
|
||||
Before a crust carries anything (under PIE_RAW, rule O2), a few customers already pay for a sky with gaps: buoys, ships'
|
||||
mail, cattle tags and weather stations that store their data and send it when a pie passes. They need no routed capacity,
|
||||
so they are a revenue line in pieMoney(), never a flow: routing is unchanged, and so is every game without pies.
|
||||
A crust earns PIE_PATCHY_MO (scaled by its size, Shortcrust's g as 1) x a share that grows from PIE_PATCHY_LO to PIE_RAW
|
||||
coverage, with at least one working pie dish under it. From PIE_RAW they hand over to the real orbit customers: the
|
||||
line shrinks as pieCarry() grows and is gone at PIE_BAKED, so the two are never paid for the same sky in full. */
|
||||
const PIE_PATCHY_MO=30e6,PIE_PATCHY_LO=0.1;
|
||||
// The Dishes tab's hint shows while every crust is under PIE_DISH_WAIT; the Launch tab nudges for a pad past PIE_PACE_SLOW days.
|
||||
const PIE_DISH_WAIT=0.3,PIE_PACE_SLOW=720;
|
||||
// Names for the Traffic tab, shown as more of the sky fills (puns, never real companies).
|
||||
const PIE_PATCHY_NAMES=['Store and Forward Thinking','Buoy Meets Girl Telemetry','Ship Happens Mail','Moo-ving Target Cattle Tags','Whale Hello There Research','Weather or Not Stations','Better Late Than Never Post','Tide Me Over Buoys'];
|
||||
// The share of PIE_PATCHY_MO crust id earns today (0..1): a ramp up to PIE_RAW, then handed over to pieCarry().
|
||||
function piePatchyShare(id){return clamp((pieCov(id)-PIE_PATCHY_LO)/(PIE_RAW-PIE_PATCHY_LO),0,1)*(1-pieCarry(id));}
|
||||
// $/mo from patchy-sky customers, per crust and in total: {mo, cr:{id:$}}. ds: pieDishes() of this compute.
|
||||
function piePatchy(ds){const P=S.pie,o={mo:0,cr:{}};if(!P||P.safe||!ds.length)return o;
|
||||
for(const id in CRUSTS){if(P.crusts[id].down>S.day)continue;const f=piePatchyShare(id);if(!(f>0)||!ds.some(d=>pieCovers(id,d.city)))continue;
|
||||
const v=Math.round(PIE_PATCHY_MO*CRUSTS[id].g/CRUSTS.short.g*f);o.cr[id]=v;o.mo+=v;}
|
||||
return o;}
|
||||
// How many of the names to show for mo $/mo: one per few $M, at least one.
|
||||
const piePatchyN=mo=>clamp(Math.ceil(mo/4e6),1,PIE_PATCHY_NAMES.length);
|
||||
|
|
@ -96,7 +96,7 @@ function pieFast(X,fastSP,A,B,b,wLat){const Ai=CIDX[A],Bi=CIDX[B],nb=X.bh.length
|
|||
if(w.path.some(e=>e.sky&&bad(e)))w=walkI(dijkstra(X.adj,Ai,wLat,(v,e)=>!!e.sky&&bad(e)||!!nb&&nb(e),Bi).P,Ai,Bi);
|
||||
if(w.path.some(e=>e.sky)){X.l2o[b.id]=1;X.l2p[b.id]={w,A,B};}
|
||||
return [{...w,share:1}];}
|
||||
// After routing: what orbit earns (terminals, and a premium on circuits riding the sky) and what each dish carries.
|
||||
// After routing: what orbit earns (terminals, a premium on circuits riding the sky, patchy-sky customers) and what each dish carries.
|
||||
function pieMoney(X,R2,V){let rev=0;const sf={},flows=[];
|
||||
for(const b of S.biz){const T=BIZ_T[b.type];
|
||||
if(T.orbit){const a=X.term[b.id]||0,s=b.bw>0?a/b.bw*(X.gs[b.id]?sfOf(R2,X.gs[b.id]):0):0,v=b.bw*b.rate*Math.min(1,s/0.95);sf[b.id]=s;rev+=v;
|
||||
|
|
@ -107,7 +107,9 @@ function pieMoney(X,R2,V){let rev=0;const sf={},flows=[];
|
|||
const bh=[];for(const e of X.bh){const g=e.ld||0,b=e.bh;used[e.a]+=g;used[e.b]+=g;bhG[e.a]=(bhG[e.a]||0)+g;bhG[e.b]=(bhG[e.b]||0)+g;
|
||||
bh.push({city:e.a,land:e.b,g,cap:e.cap,ms:e.lat,cr:b.cr,las:b.las,km:e.km});flows.push({k:'b',id:'bh:'+e.a,city:e.a,dish:e.b,g,cap:e.cap,ms:e.lat,cr:b.cr,hops:pieBhHops(e,true)});}
|
||||
for(const o of X.bhNo)bh.push({city:o.city,land:null,g:0,cap:0,why:o.why});
|
||||
V.orbit=rev;R2.pie={rev,sf,gs:X.gs,isl:X.isl,used,term:X.gsBw,hubs:X.hubs,sky:X.up.length,flows,bh,...pieLoads(X,flows,used,term,bhG)};
|
||||
// Patchy-sky customers (99-pie-patchy.js): a revenue line before a crust carries anything, handed over as it does.
|
||||
const patchy=piePatchy(X.ds);rev+=patchy.mo;
|
||||
V.orbit=rev;R2.pie={rev,patchy,sf,gs:X.gs,isl:X.isl,used,term:X.gsBw,hubs:X.hubs,sky:X.up.length,flows,bh,...pieLoads(X,flows,used,term,bhG)};
|
||||
// For the lazy fiber comparison (pieFiberMs): the graph of this compute, kept out of JSON.
|
||||
Object.defineProperty(R2.pie,'_x',{value:{adj:X.adj,fm:{}}});}
|
||||
// A sky circuit for the Traffic tab and the traceroute: entry and exit, the dishes it lands at, and each hop through space.
|
||||
|
|
|
|||
|
|
@ -28,14 +28,25 @@ function pieModal(){if(!S||!pieOn())return;const P=S.pie||pieBlank(S.day),can=pi
|
|||
<div class="network-name" style="margin-top:6px"><input class="t" id="pieNm" maxlength="40" value="${esc(pieCoName())}" autocomplete="off" aria-label="${esc(tr('pie.name'))}"></div><div class="btns">${btn(tr('slots.rename'),'pieRename',{},'ghost sm')}</div></div>`;
|
||||
h+=`<div class="btns">${btn(P.safe?tr('pie.safe_on'):tr('pie.safe_off'),'pieSafe',{},P.safe?'red sm':'ghost sm')}</div><p class="meta">${tr('pie.safe_note')}</p>`;
|
||||
}else if(T==='fly'){
|
||||
let nudge=false;
|
||||
h+=Object.keys(CRUSTS).map(id=>{const C=CRUSTS[id],cv=pieCov(id);return `<div class="ops-o${pieUp(id)?' on':''}"><div class="nm">${tr(C.n)} ${pieTag(pieBaked(id)?tr('pie.baked'):tr('pie.half_baked'),pieBaked(id))}</div>
|
||||
<div class="meta">${tr('pie.crust_line',{alt:C.alt,n:pieLive(id),full:C.full,q:P.crusts[id].queued,p:pct(cv)})}</div><div class="bar ${cv>=PIE_BAKED?'':'warn'}"><i style="width:${Math.round(cv*100)}%"></i></div>
|
||||
${(()=>{const f=pieLive(id)+P.crusts[id].queued>0&&pieLive(id)<C.full?piePace(id):null;if(!f)return '';
|
||||
const m=Math.max(1,Math.round(f.days/30)),t=m<=24?trn('pie.pace_months',m,{mo:f.mo}):trn('pie.pace_years',Math.round(f.days/360),{mo:f.mo});
|
||||
let x=`<p class="meta pie-pace">${t}</p>`;
|
||||
if(!nudge&&f.pad&&f.days>PIE_PACE_SLOW&&P.pads.length<PIE_PAD_MAX){nudge=true;const c=piePadTip(id);
|
||||
x+=c?`<p class="note pie-nudge">${tr('pie.pace_pad',{city:esc(CITY[c].name),p:pct(pieEq(c))})}</p><div class="btns">${btn(tr('pie.build_pad_price',{city:esc(CITY[c].name),price:fmt$(piePrice(PIE_PAD))}),'piePad',{city:c},'ghost sm',!can)}</div>`
|
||||
:`<p class="note pie-nudge">${tr('pie.pace_pad_none')}</p>`;}
|
||||
return x;})()}
|
||||
<div class="ops-p">${Object.keys(ROCKETS).filter(pieRkOk).map(rk=>{const q=pieQuote(rk,id,{ins:!!UI.pieIns,las:!!UI.pieLas});return btn(`${tr(ROCKETS[rk].n)} <small>${q.ok?(q.test?tr('pie.test_flight')+' · ':'')+fmt$(q.cost):esc(q.why)}</small>`,'pieLaunch',{rk,cr:id},'ghost sm',!q.ok);}).join('')}</div></div>`;}).join('');
|
||||
h+=`<div class="ops-p">${btn(UI.pieIns?tr('pie.ins_on'):tr('pie.ins_off'),'pieIns',{},UI.pieIns?'green sm':'ghost sm')}${btn(UI.pieLas?tr('pie.las_on'):tr('pie.las_off'),'pieLas',{},UI.pieLas?'green sm':'ghost sm')}</div>`;
|
||||
h+=`<p class="meta">${tr('pie.stock_line',{n:Math.floor(P.stock)})}</p>`;
|
||||
if(P.q.length)h+=`<h3 style="font-size:15px;margin:10px 0 4px">${tr('pie.queue')}</h3>`+P.q.slice().sort((a,b)=>a.day-b.day).map(L=>`<div class="kv"><span>${esc(tr(ROCKETS[L.rk].n))} → ${esc(tr(CRUSTS[L.cr].n))}</span><b>${L.test?tr('pie.test_flight'):L.n} · ${esc(CITY[L.pad].name)} · ${dateStr(L.day)}</b></div>`).join('');
|
||||
}else if(T==='dish'){
|
||||
h+=`<p class="meta">${tr('pie.dish_note')}</p>`+P.dishes.map(x=>{const cc=CITY[x.city].cc,ok=pieLicOk(cc);return `<div class="kv"><span>📡 ${esc(CITY[x.city].name)} · ${trn('pie.n_antennas',x.ant)}${ok?'':' · '+tr('pie.no_rights')}</span>${btn(tr('pie.add_antenna',{price:fmt$(piePrice(PIE_ANT))}),'pieAnt',{id:x.id},'ghost sm',!can||x.ant>=PIE_ANT_MAX)}</div>`;}).join('');
|
||||
h+=`<p class="meta">${tr('pie.dish_note')}</p>`;
|
||||
// A gentle hint while the sky is nearly empty: dishes cost money every month and earn nothing yet. Building stays open.
|
||||
{const top=Math.max(...Object.keys(CRUSTS).map(pieCov));if(top<PIE_DISH_WAIT)h+=`<p class="note pie-wait">${tr('pie.dish_wait',{min:pct(PIE_RAW),p:pct(top),mo:fmt$(PIE_DISH_MO),lo:pct(PIE_PATCHY_LO)})}</p>`;}
|
||||
h+=P.dishes.map(x=>{const cc=CITY[x.city].cc,ok=pieLicOk(cc);return `<div class="kv"><span>📡 ${esc(CITY[x.city].name)} · ${trn('pie.n_antennas',x.ant)}${ok?'':' · '+tr('pie.no_rights')}</span>${btn(tr('pie.add_antenna',{price:fmt$(piePrice(PIE_ANT))}),'pieAnt',{id:x.id},'ghost sm',!can||x.ant>=PIE_ANT_MAX)}</div>`;}).join('');
|
||||
h+=sel+`<div class="btns">${btn(tr('pie.build_dish_price',{city:esc(CITY[c].name),price:fmt$(piePrice(PIE_DISH+PIE_ANT))}),'pieDish',{city:c},'ghost sm',!can||P.dishes.some(x=>x.city===c))}</div>`;
|
||||
const ccs=[...new Set([...P.dishes.map(x=>CITY[x.city].cc),CITY[c].cc,...Object.keys(P.lic)])];
|
||||
h+=`<h3 style="font-size:15px;margin:10px 0 4px">${tr('pie.landing_rights')}</h3>`+ccs.map(cc=>{const l=P.lic[cc],ok=pieLicOk(cc);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,9 @@ function pieBhRow(b){const id='bh:'+b.city,hi=UI.pieHi===id;
|
|||
function pieTrafficHtml(){const Q=R&&R.pie;if(!Q||!Q.flows)return `<p class="meta">${tr('pie_traffic.no_data')}</p>`;
|
||||
const bh=Q.bh||[],bg=bh.reduce((a,b)=>a+b.g,0),fl=Q.flows.filter(f=>f.k!=='b'&&(f.g>0||f.k==='t')).sort((a,b)=>b.g-a.g),g=fl.reduce((a,f)=>a+f.g,0),n=fl.filter(f=>f.g>0).length,B=new Map(S.biz.map(b=>[b.id,b]));
|
||||
let h=`<p class="pft-head">${trn('pie_traffic.headline',n,{g:fmtG(g),of:fmtG(pieMarket()),amt:fmt$(Q.rev)})}</p>`;
|
||||
// Patchy-sky customers (99-pie-patchy.js): money, no traffic, so a line of its own.
|
||||
if(Q.patchy&&Q.patchy.mo>0)h+=`<div class="ops-o pft-patchy"><div class="kv"><span>📶 ${tr('pie_traffic.patchy')}</span><b>${tr('common.price_mo',{price:fmt$(Q.patchy.mo)})}</b></div>
|
||||
<p class="meta">${esc(PIE_PATCHY_NAMES.slice(0,piePatchyN(Q.patchy.mo)).join(' · '))}</p><p class="meta">${tr('pie_traffic.patchy_hint',{lo:pct(PIE_PATCHY_LO),min:pct(PIE_RAW),max:pct(PIE_BAKED)})}</p></div>`;
|
||||
if(!(g>0)&&!(bg>0))h+=`<div class="ops-o pft-why"><div class="nm">${tr('pie_traffic.empty_title')}</div><ul class="pft-ck">${pieChecks(Q).map(c=>`<li class="${c.ok?'on':'off'}" data-k="${c.k}"><span aria-hidden="true">${c.ok?'✅':'⬜'}</span><span><b>${c.l}</b>${c.ok?'':`<small>${c.h}</small>`}</span></li>`).join('')}</ul></div>`;
|
||||
h+=`<h3 class="pft-h">${tr('pie_traffic.crusts')}</h3>`+(Q.crust.length?Q.crust.map(c=>{const why=pieCrustWhy(c);
|
||||
return `<div class="pft-cr"><div class="kv"><span>${tr(CRUSTS[c.id].n)} ${pieTag(c.st==='half'||c.st==='part'?tr('pie.half_baked'):tr('pie.baked'),c.st!=='half'&&c.st!=='part')}</span><b>${c.cap>0?tr('pie_traffic.used_of',{u:fmtG(c.used),cap:fmtG(c.cap)}):pct(c.cov)}</b></div>
|
||||
|
|
|
|||
|
|
@ -3412,6 +3412,7 @@
|
|||
"pie.cr_upper":"Upper Crust (1,100 km)",
|
||||
"pie.crust_line":"{alt} km · {n} of {full} pies · {q} on the way · {p} covered",
|
||||
"pie.dish_note":"A pie dish talks to the pies overhead. It needs a POP in its city and landing rights in its country.",
|
||||
"pie.dish_wait":"Dishes earn nothing until a crust is {min} covered, and your fullest is at {p}. Each one costs {mo} a month to run, so it pays to wait. Only buoys, ships and sensors pay earlier, from {lo}, and one dish is enough for them.",
|
||||
"pie.earned":"Earned from orbit",
|
||||
"pie.earned_mo":"Orbit earns {amt}/mo · {n} dishes off the backbone carry no transit",
|
||||
"pie.factory":"Pie factory",
|
||||
|
|
@ -3453,6 +3454,10 @@
|
|||
"pie.no_pads":"No launch pads yet. A pad needs a POP in a city on the coast.",
|
||||
"pie.no_rights":"no landing rights",
|
||||
"pie.open_pie_control":"Pie Control",
|
||||
"pie.pace_months":{"one":"At this pace ({mo} pies a month), this crust is full in about {n} month.","other":"At this pace ({mo} pies a month), this crust is full in about {n} months."},
|
||||
"pie.pace_pad":"Another pad would fill it faster. Your coastal POP nearest the equator is {city}, where a launch costs {p} less.",
|
||||
"pie.pace_pad_none":"Another pad would fill it faster: open a POP on a coast, ideally near the equator, where launches cost less.",
|
||||
"pie.pace_years":{"one":"At this pace ({mo} pies a month), this crust is full in about {n} year.","other":"At this pace ({mo} pies a month), this crust is full in about {n} years."},
|
||||
"pie.pad_busy":"busy until {d}",
|
||||
"pie.pad_free":"ready",
|
||||
"pie.pads":"Launch pads",
|
||||
|
|
@ -3693,6 +3698,8 @@
|
|||
"pie_traffic.no_landing":"{city} · no dish can land it",
|
||||
"pie_traffic.orbit_no_fiber":"orbit {o} ms, no fiber path",
|
||||
"pie_traffic.orbit_vs_fiber":"orbit {o} ms vs fiber {f} ms",
|
||||
"pie_traffic.patchy":"Patchy-sky customers",
|
||||
"pie_traffic.patchy_hint":"Buoys, ships' mail and sensors that can wait for the next pie. They pay from {lo} covered and hand over to regular orbit customers between {min} and {max}.",
|
||||
"pie_traffic.riding":"Who's riding",
|
||||
"pie_traffic.route_ab":"{a} → {b}",
|
||||
"pie_traffic.tab":"Traffic",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue