Late joiners: a network that joins a server session late starts on its date, with a head start

One calendar for a server session (the user's answer to Q1): a network that joins begins on the session's date, and
one that joins after day 180, when the shared market starts to move, gets a head start (answered 2026-11-11).
Dormant until the host (T3) passes a start day: in the plain build and in single-device play S.day0 is 0 and the
game is as before.

- S.day0, the calendar day a network began: 0 in newGame(), repaired in sanitize() (at most S.day), so old saves load.
  netAge() is the network's age; the first-days rules count it: the charter window (and specSanitize), the tutorial's
  five days, the DDoS grace and early size cap, route leaks, RPKI, the world's bad news, shortages and control-plane
  events, sold-out routes, the scrubbing customers, loan offers, the broker's first calls, the Speedrun and Blitz
  badges and the day counts in the win, lose and Glass Baron windows. The market, the calendar and world events stay
  on the session's date.
- beginState() takes o.day for a session network in Normal mode (lateStart()): the day, the first outage and event,
  the home POP and the first IPv4 block are stamped with it, so the block cannot be sold on day one at the session's
  price.
- The head start (60-features/81-late-joiners.js): starting cash topped up by the rise in hardware prices (START_CASH
  x (hwTrend - 1), to $1,000, at most $60k, with the market rule only) and the first 365 days of home broadband
  matched (R.rev.late: what homes pay after the Australian wholesale cut or levy; outside investors' share, inside
  revMo). A second welcome with a button to the bank, a Goals card, a bank section, a line in a city's broadband pitch
  and a toast when the year is over; every label in all six dictionaries.
- The "since you started" lines (supply chain, bandwidth market, wave prices) measure from the network's own start.
- Server-run engine: srvBegin takes begin.day (an integer from 0, else the begin fails), the fake engine begins there
  and keeps day0 in its saves, CLOCK.off leaves the shape checker and the contract test, and the fixtures' network
  begins on day 473 (written again with tests/lib/mp-sim-fixtures.js; a second run changes nothing).
- Gameplay rule F11, the agent's day0 doc and status age, ARCHITECTURE and the plans (Q1's game side built, open
  question 1 answered).
- tests/late-joiners.test.js; F11 in tests/gameplay-rules.test.js; a late begin in tests/mp-sim-engine.test.js; one
  calendar in tests/mp-sim-contract.test.js.

Merged onto Starblink and Island Wi-Fi: revMo counts both the islands (V.wisp) and the match (V.late), the revenue
share base keeps V.wisp and leaves V.late out; F11 sits before F12 in the gameplay rules and their test; the mp-sim
fixtures were written again with tests/lib/mp-sim-fixtures.js (a second run changes nothing).
This commit is contained in:
jvanvik 2026-11-12 01:30:22 +01:00
parent 9067bae1ce
commit dcdb501f16
51 changed files with 476 additions and 76 deletions

View file

@ -563,6 +563,29 @@ test('F10: growth goes sideways, plus one paid way up (#61, #323)', () => {
fail('F10', J("MEGA.filter(m=>!CITY[m.c]).map(m=>m.c)"), 'campuses sit in real cities');
});
test('F11: a late joiner starts on the session\'s date with F1\'s gentle start, a hardware top-up and a year of home broadband matched', () => {
const g = load();
const D = 1868, MP = { code: 'K7Q2XD', pid: 'abcd1234', asn: 201234, seed: 424242, preset: 'oncall', color: '#3a86ff', title: 'Friday' };
g.ev(`UI.pitched=true;beginState('Late','fra',{mode:'normal',preset:'oncall',mp:${lit(MP)},day:${D}});S.mp.sim=1;compute()`);
// The session's date, F1's start counted from its own first day.
assert.deepEqual(JSON.parse(g.ev('JSON.stringify([S.day,S.day0,S.nextFail-S.day0,S.nextEvent-S.day0])')), [D, D, 45, 40], 'F11: the session\'s date, and F1\'s first outage and event');
const opts = JSON.parse(g.ev(`(()=>{let o=null;const f=eval('('+fireEvent.toString().replace('const e=pick(opts);','o=opts.slice();return;')+')');S.day=S.day0+45;f();S.day=S.day0;return JSON.stringify(o);})()`));
fail('F11', opts.filter((e) => !['viral', 'price', 'grant'].includes(e)), 'no bad events before its day 50 (count S.day-S.day0: netAge())');
assert.equal(g.ev("(()=>{for(let a=0;a<90;a++){S.day=S.day0+a;if(CITIES.some(c=>soldOut('fra',c.id,1)))return true;}S.day=S.day0;return false;})()"), false, 'F11: nothing sold out in its first 90 days');
// The top-up: the rise in hardware prices on START_CASH, at most $60k; the market stays on the session's date.
const top = g.ev('S.cash-START_CASH');
assert.ok(top === Math.round(g.ev(`START_CASH*(hwTrend(${D})-1)`) / 1000) * 1000 && top > 0 && top <= 60000, `F11: a top-up of ${top}`);
assert.equal(g.ev('lateCash(1e6)'), 60000, 'F11: never more than $60k');
assert.equal(g.ev('hwMul("rt")'), g.ev(`hwTrend(${D})`), 'F11: hardware at the session\'s price');
// The match: what homes pay after wholesale, for 365 days, outside investors' share.
g.ev("S.cash=1e7;ACT.launchBB({city:'fra'});ACT.buyTransit({city:'fra',net:'cog',tier:1});S.loans.push({id:'v',bank:'vult',start:S.day,amount:1,got:1,bal:0,share:0.1,covs:[]});compute()");
const r = JSON.parse(g.ev('JSON.stringify([R.rev.eyeballs,R.rev.late,R.cost.revshare])'));
assert.ok(r[0] > 0 && r[1] === r[0], 'F11: home broadband matched');
assert.ok(Math.abs(r[2] - 0.1 * r[0]) < 1e-6, 'F11: investors take no share of the match');
assert.equal(g.ev('(()=>{S.day=S.day0+366;compute();const v=R.rev.late;S.day=S.day0;compute();return v===undefined;})()'), true, 'F11: for one year');
assert.deepEqual(g.errors, []);
});
test('F12: island Wi-Fi pays on its own books on some way in; a spur beats every satellite, and pays back within 5 years up to 250 km, 10 up to 1,000 km', () => {
// The zone's own books at full take-up, era 1: its homes at island prices, less the towers' upkeep and the backhaul
// rent. The teleport, tracking antennas and a Starblink gateway serve more than one zone and are left out. Each way in