Pie in the Sky: traffic on the globe, load rings on dishes

The globe draws sky circuits as glowing arcs through the crust and
terminals as hops to their dish, width by Gbps, with packets moving
along; the highlighted flow goes on top. Dishes on the globe and the
map badge get a green/amber/red load ring.
This commit is contained in:
Frederic Jung 2026-11-01 21:10:03 +01:00
parent ad8d036913
commit df6e0e0964
No known key found for this signature in database
4 changed files with 57 additions and 18 deletions

View file

@ -12,8 +12,8 @@
- S.pie.spat[id] with PIE_SPATS[id]={fix(o,s),day?(o,d),end?(o)}: a spat's state, repaired by pieSanitize(), ticked and
dropped when o.until<=d by pieSpatDay(d)
- S.pie.crusts[id].down: day a crust is out until (a solar storm); S.pie.dishes[i].down likewise (a backhoe)
- pieGlobeData() -> {crusts:[{id,alt,inc,n,las}],dishes:[{city,lat,lon}],pads:[{city,lat,lon,next}],
launches:[{id,rk,cr,n,day,pad}]}
- pieGlobeData() -> {crusts:[{id,alt,inc,n,las}],dishes:[{city,lat,lon,up,u}],pads:[{city,lat,lon,next}],
launches:[{id,rk,cr,n,day,pad}],flows:[{id,k,g,pts:[city,city],alt?}],hi}
- pieFounder(k,{n,c}) -> a Founder post (k from FOUNDER_POSTS); pieCharge(v) bills a cost (book kept)
- book.earned: revenue from orbit, for the customers that come with routing. */
function pieBlank(day){const crusts={};for(const id in CRUSTS)crusts[id]={cohorts:[],queued:0};
@ -35,9 +35,13 @@ const pieLiveLas=id=>{const c=S.pie&&S.pie.crusts[id];let n=0;if(pieLasCut(id))r
const pieLicOk=cc=>{const l=S.pie&&S.pie.lic[cc];return !!l&&l.state==='ok'&&l.until>S.day;};
function pieDishes(){const P=S&&S.pie;if(!P)return [];const o=[];for(const x of P.dishes){if(!S.pops[x.city]||x.down>S.day)continue;const cc=CITY[x.city].cc;if(pieLicOk(cc))o.push({id:x.id,city:x.city,cc,ant:x.ant,g:x.ant*PIE_ANT_G*pieDishMul(x)});}return o;}
function pieHubs(){return S&&S.pie?Object.keys(CRUSTS).filter(pieUp):[];}
function pieGlobeData(){const P=S&&S.pie;if(!P)return {crusts:[],dishes:[],pads:[],launches:[]};const ll=c=>({city:c,lat:CITY[c].lat,lon:CITY[c].lon});
function pieGlobeData(){const P=S&&S.pie;if(!P)return {crusts:[],dishes:[],pads:[],launches:[]};const ll=c=>({city:c,lat:CITY[c].lat,lon:CITY[c].lon}),Q=R&&R.pie,ld=Q&&Q.load||{};
// Traffic from the last compute: sky circuits dish to dish (k 'c'), terminals from their city to their dish (k 't').
const flows=[];if(Q&&Q.flows)for(const f of Q.flows){if(!(f.g>0))continue;if(f.k==='c'&&f.via.length>1)flows.push({id:f.id,k:'c',g:f.g,pts:[f.via[0],f.via[f.via.length-1]],alt:f.cr?CRUSTS[f.cr].alt:550});
else if(f.k==='t'&&f.dish)flows.push({id:f.id,k:'t',g:f.g,pts:[f.city,f.dish]});}
return {crusts:Object.keys(CRUSTS).map(id=>({id,alt:CRUSTS[id].alt,inc:CRUSTS[id].inc,n:pieLive(id),las:pieLiveLas(id)})),
dishes:P.dishes.map(x=>ll(x.city)),pads:P.pads.map(p=>({...ll(p.city),next:p.next})),launches:P.q.map(L=>({id:L.id,rk:L.rk,cr:L.cr,n:L.n,day:L.day,pad:L.pad}))};}
dishes:P.dishes.map(x=>({...ll(x.city),up:!(x.down>S.day),u:ld[x.city]})),pads:P.pads.map(p=>({...ll(p.city),next:p.next})),launches:P.q.map(L=>({id:L.id,rk:L.rk,cr:L.cr,n:L.n,day:L.day,pad:L.pad})),
flows:flows.sort((a,b)=>b.g-a.g),hi:UI.pieHi||null};}
// Spats (geopolitics) register in PIE_SPATS and keep their state in S.pie.spat; this ticks and ends them.
function pieSpatDay(d){const sp=S.pie.spat;for(const k of Object.keys(sp)){const o=sp[k],D=PIE_SPATS[k];if(!D||o.until<=d){delete sp[k];if(D&&D.end)D.end(o);continue;}if(D.day)D.day(o,d);}}
const pieYear=d=>1+Math.floor(d/360);