From 6812638a5b8243483df04bcdae6797b8ae08f280 Mon Sep 17 00:00:00 2001 From: Frederic Jung Date: Sun, 1 Nov 2026 19:28:46 +0100 Subject: [PATCH] Pie in the Sky: orbit prices, rules O2-O4 and both bounds of O7 Terminal customers are priced so that a full lasered Shortcrust on the big-network save pays back in about 9.6 years, and no crust pays back in under 5 even with the whole sellable sky sold at the dearest prices (Shortcrust 5.3, Flaky 7.4, Upper 9.2, Frozen 40). O2, O3 and O4 get rules and tests. --- .claude/skills/gameplay-rules/SKILL.md | 5 +- CHANGELOG.md | 1 + src/game/40-progress/10-businesses.js | 11 ++-- tests/gameplay-rules.test.js | 79 ++++++++++++++++++++++++++ 4 files changed, 90 insertions(+), 6 deletions(-) diff --git a/.claude/skills/gameplay-rules/SKILL.md b/.claude/skills/gameplay-rules/SKILL.md index b2ccd25..ea15dc6 100644 --- a/.claude/skills/gameplay-rules/SKILL.md +++ b/.claude/skills/gameplay-rules/SKILL.md @@ -84,6 +84,9 @@ These are what the game promises, held up by `tests/gameplay-rules.test.js` (one | Id | Rule | Why | | --- | --- | --- | | O1 | The rocket company unlocks only on the Tier 1 win of a save started on its version (`S.pieV>=1`, set by `newGame()`; a save without it loads as 0), or from day 0 with open gates (sandbox). Never in puzzles, the Architect or scenarios. Losing Tier 1 keeps everything flying but builds nothing new. | An endgame for people who earned it; old won saves must not change under their players. | +| O2 | A half-baked crust (under 60% coverage) carries nothing, and orbit never carries more than the pie dishes' antennas (x rain, jamming): terminals and sky paths share each dish. | Satellites are not magic bandwidth; the ground segment is the bottleneck, as in real life. | +| O3 | A pie dish whose POP the backbone does not reach (an island of its own) carries no transit: no sky path starts or ends there, only terminals next to it land on it. | Orbit extends your network; it does not replace building one. | +| O4 | Through space with lasers, light travels at c in vacuum (about 1.47 times glass), up and down at the shell's height; orbit never carries traffic between cities under 3,000 km apart and only latency-routed circuits fly: IP traffic, bulk and scenic circuits stay on fiber. | Real constellations win only on long routes, and their capacity is small. | | O5 | Launches fail only with chaos on (`rule('chaos')`), and never in the first 90 days after the unlock; heavy test flights explode by design, not by chance. Orbit incidents and geopolitical spats (`pieChaos()`) follow the same rule. | Like F1: learn the thing before it punishes you. | -| O7 | A fresh Tier 1 cannot afford a full Shortcrust from its first year's money: even a big network's yearly profit plus the largest loan a bank would offer stays below the cheapest full build (`pieFullCost('short')`). | Obscenely expensive is the joke and the goal; a constellation in year one would be a cheat code. | +| O7 | A fresh Tier 1 cannot afford a full Shortcrust from its first year's money: even a big network's yearly profit plus the largest loan a bank would offer stays below the cheapest full build (`pieFullCost('short')`). And a full crust never pays back in under 5 years, even with every Gbps the sky can sell sold at the dearest prices; on the big-network save, a full lasered Shortcrust with the customers the market offers pays back in 5 to 10. | Obscenely expensive is the joke and the goal; a constellation in year one would be a cheat code. | diff --git a/CHANGELOG.md b/CHANGELOG.md index 73ec661..f3979aa 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project are documented here. The project follows - Pressing Space to play again after a pause now picks up at the speed you were playing, not always at 1× (#299). - Become a Tier 1 in a new game and you can found your own rocket company: build a pie factory and launch pads, fly rockets, and fill four crusts of satellites (pies) around the planet, with pie dishes at your POPs and landing rights country by country. It costs billions, every launch has a party, and the Founder posts about all of it. Sandbox games have it from day 0. Games already won before this version stay as they are. - Space is not quiet for long: three months after your rocket company starts, solar storms, food fights in orbit, rain over tropical pie dishes, backhoes, astronomers and the Founder's 3 a.m. posts come for your satellites. Countries join in too, with landing rights refused for a while, data that has to stay home, two neighbours claiming the same band, a kill switch for exam week, a jammed border, a rival filing for orbits first, a launch pad on offer and traffic that must avoid the neighbour's dishes. Each one asks you to pick one of two answers. A ruleset with no chaos keeps the sky calm. +- Your pies now carry traffic and earn money: homes and boats in the remotest places (Pitcairn, the Arctic, the outer islands), airlines, cruise ships and the Mars mission sign up once a baked crust and a pie dish can serve them. With laser links, trading circuits between cities more than 3,000 km apart take the faster path through space, where light runs about half again as fast as in glass; everything else stays on your fiber. A dish whose POP is cut off from your backbone serves only the customers next to it, and a full constellation takes years to pay for itself. - Your own subsea cables now land right on the city's dot, also in Fujairah, Dubai, Karachi, Barcelona, Osaka and other cities the map shifts slightly so they do not overlap (#305). - Starting a new network no longer leaves the last one's "New POP!" and money pop-ups frozen all over the map until a reload. diff --git a/src/game/40-progress/10-businesses.js b/src/game/40-progress/10-businesses.js index e0027aa..ef5fb53 100644 --- a/src/game/40-progress/10-businesses.js +++ b/src/game/40-progress/10-businesses.js @@ -31,12 +31,13 @@ const BIZ_T={ 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']}, mars:{l:tr('businesses.mars_mission_ground_station'),opts:[100,200,400],rate:0,l2:true,lat:true,km:4,lv:13,names:['Red Planet Relay','Ares Ground Segment','Olympus Mons Uplink','Mars or Bust Mission Control','Interplanetary Ping Society','Light-Minute Logistics','RFC 1149 Avian Carriers (Mars Division)']}, // Orbit terminals (35-pie-paths.js): no POP of theirs, landed on a pie dish. Priced per Gbps of busy-hour capacity, which a - // satellite operator oversubscribes a hundred times (a hundred homes at $100 a month share one Gbps). + // satellite operator oversubscribes two hundredfold (two hundred homes at $100 a month share one Gbps). The prices set + // the payback of a full crust (rule O7: never under 5 years, 6 to 10 for a strong network). // share: the most of the sky's market (pieMarket()) that kind may hold; there are only so many airlines. - pizza:{l:tr('businesses.pizza_homes_and_boats_on_orbit'),opts:[50,100,200,400],rate:14000,orbit:true,lv:1,names:['Deep Dish Rural Broadband','Crust Mile Connect','Topping Off Telecom','Extra Cheese Islands Net','Slice of Life Homesteads','Calzone Ranch Wi-Fi','Thin Crust Tundra Net','Margherita Marina Moorings','Anchovy Atoll Online','Stuffed Crust Station Hands']}, - flywifi:{l:tr('businesses.flywifi_airline_wi_fi'),opts:[20,50,100,200],rate:24000,orbit:true,las:true,share:0.2,lv:1,names:['Jet Lag Wi-Fi','Wi-Fly Away','Seatback Streaming Co.','Tray Table Upright Telecom','Cabin Pressure Networks','Mile High Megabits','Overhead Bin Broadband','Turbulence Tolerant Transit']}, - boat:{l:tr('businesses.cruise_ship_connectivity'),opts:[100,200,400,800],rate:18000,orbit:true,lv:1,names:['Buffet Overboard Cruises','The Love Bandwidth','Poop Deck Packets','Midnight Buffet Mbps','Shuffleboard Shipping Lines','All-You-Can-Stream Cruises','Iceberg Ahead Voyages']}, - marsorb:{l:tr('businesses.mars_mission_over_your_pies'),opts:[50,100,200],rate:30000,orbit:true,las:true,share:0.05,lv:13,names:['Red Planet Relay (Orbital)','Olympus Mons Uplink (Orbital)','Light-Minute Logistics (Orbital)','Interplanetary Ping Society (Orbital)','Rover Over Pies']}, + pizza:{l:tr('businesses.pizza_homes_and_boats_on_orbit'),opts:[50,100,200,400],rate:20000,orbit:true,lv:1,names:['Deep Dish Rural Broadband','Crust Mile Connect','Topping Off Telecom','Extra Cheese Islands Net','Slice of Life Homesteads','Calzone Ranch Wi-Fi','Thin Crust Tundra Net','Margherita Marina Moorings','Anchovy Atoll Online','Stuffed Crust Station Hands']}, + flywifi:{l:tr('businesses.flywifi_airline_wi_fi'),opts:[20,50,100,200],rate:29000,orbit:true,las:true,share:0.2,lv:1,names:['Jet Lag Wi-Fi','Wi-Fly Away','Seatback Streaming Co.','Tray Table Upright Telecom','Cabin Pressure Networks','Mile High Megabits','Overhead Bin Broadband','Turbulence Tolerant Transit']}, + boat:{l:tr('businesses.cruise_ship_connectivity'),opts:[100,200,400,800],rate:22000,orbit:true,lv:1,names:['Buffet Overboard Cruises','The Love Bandwidth','Poop Deck Packets','Midnight Buffet Mbps','Shuffleboard Shipping Lines','All-You-Can-Stream Cruises','Iceberg Ahead Voyages']}, + marsorb:{l:tr('businesses.mars_mission_over_your_pies'),opts:[50,100,200],rate:35000,orbit:true,las:true,share:0.05,lv:13,names:['Red Planet Relay (Orbital)','Olympus Mons Uplink (Orbital)','Light-Minute Logistics (Orbital)','Interplanetary Ping Society (Orbital)','Rover Over Pies']}, provedor:{l:tr('businesses.provedor_small_regional_isp'),opts:[5,10,20,40],rate:20,br:true,names:['Provedor Capivara Net','Fibra do Sertão','Rapidinho Telecom','Net Jabuticaba','Caipirinha Online','Wi-Fi do Zé','Pão de Queijo Fibra','Açaí Net','Tucano Telecom','Forró Fibra','Saci Net','Brigadeiro Banda Larga','Mandioca Online','Churrasco Connect']}, }; const LEVELS=[ diff --git a/tests/gameplay-rules.test.js b/tests/gameplay-rules.test.js index d23ce5f..d8d3ea6 100644 --- a/tests/gameplay-rules.test.js +++ b/tests/gameplay-rules.test.js @@ -541,6 +541,52 @@ test('O1: the rocket company unlocks only on a Tier 1 win of its version, or in assert.deepEqual([...g.errors, ...sb.errors, ...won.errors], []); }); +// A sandbox with London and New York (a transatlantic wave), Frankfurt, transit, a full dish at each, and a full Shortcrust. +const orbit = (las = true, n = 'CRUSTS.short.full') => { const g = load(); + g.ev("ACT.modeSet({m:'sandbox'});ACT.start({});if(UI.pendGame)ACT.pitchSkip();S.nextFail=1e9;S.nextEvent=1e9;for(const c of ['lon','nyc','fra'])if(!S.pops[c])ACT.buildPop({city:c});S.links=[]"); + g.ev("S.links.push({id:'ln',a:'lon',b:'nyc',kind:'wave',tier:3,km:5818,sub:true,cable:'grace',cut:0,mo:1},{id:'lf',a:'lon',b:'fra',kind:'wave',tier:3,km:640,sub:false,cut:0,mo:1});for(const c of ['lon','nyc','fra'])ACT.buyTransit({city:c,net:'cog',tier:1})"); + g.ev(`ACT.pieFound();for(const c of ['lon','nyc','fra']){ACT.pieDish({city:c});S.pie.lic[CITY[c].cc]={state:'ok',until:1e6};}for(const x of S.pie.dishes)x.ant=PIE_ANT_MAX;S.pie.crusts.short.cohorts=[{n:${n},day:S.day,las:${las}}];compute()`); + g.c = (id, a, b, t = 'hft', bw = 5) => g.ev(`S.biz.push({id:'${id}',type:'${t}',city:'${a}',city2:${b ? `'${b}'` : 'null'},bw:${bw},rate:1,reqs:[],latMax:null,route:'${b ? 'fast' : 'normal'}',name:'${id}',mood:100,since:0,sites:null});compute()`); + g.sky = (id) => g.ev(`Object.keys(R.ef).some(k=>k.startsWith('pie:')&&R.ef[k].eg['l2:${id}']>0)`); + return g; }; + +test('O2: a half-baked crust carries nothing; orbit never carries more than the dishes', () => { + const g = orbit(true, 'Math.floor(CRUSTS.short.full*0.59)'); + g.c('h', 'lon', 'nyc'); g.c('p', 'pcn', null, 'pizza', 50); + assert.equal(g.sky('h'), false, 'O2: a half-baked crust carried a circuit'); + assert.equal(g.ev('R.pie.sf.p'), 0, 'O2: a half-baked crust served a terminal'); + g.ev("S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full,day:S.day,las:true}];for(let i=0;i<20;i++)S.biz.push({id:'b'+i,type:'boat',city:'pcn',city2:null,bw:800,rate:1,reqs:[],route:'normal',name:'b'+i,mood:100,since:0,sites:null});compute()"); + for (const d of JSON.parse(g.ev('JSON.stringify(pieDishes())'))) assert.ok(g.ev(`R.pie.used.${d.city}`) <= d.g + 1e-6, `O2: the ${d.city} dish carries ${g.ev(`R.pie.used.${d.city}`)} G on ${d.g} G of antennas`); + assert.deepEqual(g.errors, []); +}); + +test('O3: a dish off the backbone carries no transit', () => { + const g = orbit(); + g.ev("ACT.buildPop({city:'syd'});ACT.pieDish({city:'syd'});S.pie.lic.AU={state:'ok',until:1e6};compute()"); + assert.ok(g.ev("R.pie.isl.includes('syd')"), 'O3: the island dish is flagged'); + g.c('h', 'lon', 'syd'); + assert.equal(g.ev('R.l2.h||0'), 0, 'O3: traffic crossed an island dish'); + assert.equal(g.ev("Object.keys(R.ef).some(k=>k.includes('syd'))"), false); + assert.deepEqual(g.errors, []); +}); + +test('O4: vacuum latency, and orbit never beats fiber under 3,000 km or carries bulk', () => { + const g = orbit(); + g.c('h', 'lon', 'nyc'); + const km = g.ev("pieKm('lon','nyc')"); + assert.equal(g.sky('h'), true, 'O4: a long latency circuit takes the lasers'); + assert.ok(Math.abs(g.ev('R.l2lat.h') - g.ev(`pieSkyMs(${km},CRUSTS.short.alt)`)) < 1.5, 'O4: priced at c in vacuum along the great circle'); + assert.ok(Math.abs(g.ev('PIE_C') / 200 - 1.47) < 0.05, 'O4: vacuum (km/ms) is ~1.47x the glass the links are priced at (200 km/ms)'); + g.c('n', 'lon', 'fra'); + assert.equal(g.sky('n'), false, 'O4: orbit carried a route under 3,000 km'); + g.c('b', 'lon', 'nyc', 'l2vpn', 10); + assert.equal(g.sky('b'), false, 'O4: orbit carried a circuit that does not need the latency'); + assert.equal(g.ev("Object.keys(R.ef).filter(k=>k.startsWith('pie:')).every(k=>Object.keys(R.ef[k].eg).every(e=>e.startsWith('l2:')))"), true, 'O4: IP traffic crossed orbit'); + g.ev("S.pie.crusts.short.cohorts=[{n:CRUSTS.short.full,day:S.day,las:false}];compute()"); + assert.equal(g.sky('h'), false, 'O4: no lasers, no space path'); + assert.deepEqual(g.errors, []); +}); + test('O5: launches fail only with chaos on, never in the first 90 days after the unlock', () => { const fly = (setup, after) => { const g = load(); @@ -580,6 +626,39 @@ test('O7: a fresh Tier 1 cannot afford a full Shortcrust in its first year', () assert.deepEqual(g.errors, []); }); +// Years a full crust takes to pay for itself: the build (company, factory, pad, rockets, lasered pies, the dishes it needs +// and landing rights) over a year's orbit income less running costs, licences and replacing the pies as they age out. +const PAYBACK = `((cr,rev,dishes,lic)=>{const C=CRUSTS[cr],ndish=dishes??Math.ceil(C.g*PIE_SELL/(PIE_ANT_MAX*PIE_ANT_G)); + const build=pieFullCost(cr)+C.full*PIE_LAS+ndish*piePrice(PIE_DISH+PIE_ANT*PIE_ANT_MAX)+lic; + const renew=(C.full*(PIE_PIE+PIE_LAS)+Math.ceil(C.full/ROCKETS.heavy.pies)*ROCKETS.heavy.cost)/(C.life/360); + return build/(12*rev-12*(PIE_CO_MO+PIE_FAC_MO+PIE_PAD_MO+ndish*PIE_DISH_MO)-lic-renew);})`; + +test('O7: a full constellation never pays back in under 5 years, and a strong network’s pays back in 5 to 10', () => { + const g = load(); + // (A negative answer: it never pays back.) The best case for every crust: every Gbps the sky can sell is sold, the capped kinds at their cap, the rest at the + // dearest rate, all served. A dish needs a city of its own (one per POP), so the dishes it takes pay the cheapest + // landing rights any set of that many covered cities in the world could have. + const best = JSON.parse(g.ev(`JSON.stringify(Object.keys(CRUSTS).map(cr=>{const T=Object.values(BIZ_T).filter(t=>t.orbit);let left=1,r=0; + for(const t of T.filter(t=>t.share)){r+=t.share*t.rate;left-=t.share;}r+=left*Math.max(...T.filter(t=>!t.share).map(t=>t.rate)); + const nd=Math.ceil(CRUSTS[cr].g*PIE_SELL/(PIE_ANT_MAX*PIE_ANT_G)),n={};for(const c of CITIES)if(pieCovers(cr,c.id))n[c.cc]=(n[c.cc]||0)+1; + let k=0,lic=0;for(const cc of Object.keys(n).sort((a,b)=>pieLicPrice(a)/n[a]-pieLicPrice(b)/n[b])){if(k>=nd)break;k+=n[cc];lic+=pieLicPrice(cc);} + return [cr,${PAYBACK}(cr,CRUSTS[cr].g*PIE_SELL*r,nd,lic)];}))`)); + for (const [cr, y] of best) assert.ok(y < 0 || y >= 5, `O7: a full ${cr} pays back in ${y.toFixed(1)} years at best; make orbit dearer or its customers cheaper`); + // The seeded reference: the big-network save, a full lasered Shortcrust, 32 full dishes in the cheapest countries to + // license, and every orbit customer the market offers signed (the real offers, routed by compute()). + const save = fs.readFileSync(path.join(__dirname, 'fixtures', 'big-network.json'), 'utf8'); + g.ev(`S=migrate(JSON.parse(${JSON.stringify(save)}));S.pieV=1;S.nextFail=1e9;S.nextEvent=1e9;__reseed(7);compute()`); + const ref = JSON.parse(g.ev(`(()=>{pieInit();const P=S.pie;P.co={name:PIE_NAMES[0]};P.fac=true;P.pads=[{city:'mia',next:0,boosters:[]}]; + const pops=Object.keys(S.pops).filter(c=>pieCovers('short',c)),n={};for(const c of pops)n[CITY[c].cc]=(n[CITY[c].cc]||0)+1; + const top=pops.sort((a,b)=>pieLicPrice(CITY[a].cc)/n[CITY[a].cc]-pieLicPrice(CITY[b].cc)/n[CITY[b].cc]||CITY[b].P-CITY[a].P).slice(0,32); + for(const c of top){P.dishes.push({id:'d'+c,city:c,ant:PIE_ANT_MAX,down:0});P.lic[CITY[c].cc]={state:'ok',until:1e6};} + P.crusts.short.cohorts=[{n:CRUSTS.short.full,day:S.day,las:true}];compute(); + for(let i=0;i<4000&&pieSold()!BIZ_T[o.type].orbit);const t=pieOfferTypes();if(!t.length)break;pieSpawn(pick(t));const o=S.offers.find(o=>BIZ_T[o.type].orbit);if(o)ACT.accept({id:o.id});} + compute();const lic=Object.keys(P.lic).reduce((a,cc)=>a+pieLicPrice(cc),0);return JSON.stringify({rev:R.pie.rev,y:${PAYBACK}('short',R.pie.rev,top.length,lic)});})()`)); + assert.ok(ref.y >= 5 && ref.y <= 10, `O7: the reference Shortcrust pays back in ${ref.y.toFixed(1)} years on ${Math.round(ref.rev / 1e6)}M/mo from orbit; aim for 6 to 10`); + assert.deepEqual(g.errors, []); +}); + test('no page errors while checking the rules', () => { assert.deepEqual(errors, []); });