Early-level build discount (B4) and start stock 1000 (B5)
Playtest on the live world: first hour feels a bit slow. B4: levels 1-3 of any building take x0.5/x0.67/x0.83 of the time (FORMULAS.earlyLevels/earlyTimeFactor, off at earlyLevels 0). Builds at 1 h (4 sittings/day) 8.9 -> 11.4, at 24 h 16.5 -> 20.4; mid game moves ~1 day head start (default mix), more for 2 sittings/day. B5: start stock 750 -> 1000 (measured separately: mid game unchanged, 60-min first sitting 12.1 -> 15.4 builds at 1 h). Numbers in docs/BALANCE.md. Tested: npm test 208/208, openapi check, npm run e2e 61/61 (before B5), 50x30-day bot run INVARIANTS OK after B5. NOT tested: humans (bots only, 2 seeds), B4+B5 combined beyond one run, e2e does not exercise the discount (runs at 4000x speed). Not claimed: balanced. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
parent
cc0524de5e
commit
bf7af0679c
10 changed files with 194 additions and 12 deletions
|
|
@ -47,6 +47,7 @@ function render(s, opts) {
|
|||
Object.keys(u).sort().map((k) => k.replace(/_.*/, '') + ':' + fmt(u[k], 0)).join(' ')]);
|
||||
}
|
||||
out.push(table(prow, ['day', 'field avg', 'core p10/50/90', 'footprint p10/50/90', 'operators >=2 POPs', 'over gate', 'units alive']));
|
||||
if (s.early) out.push('first hours after signing up, capital, mean (p10/50/90) over operators at least that old: ' + Object.keys(s.early).map((k) => { const e = s.early[k]; return k + ': ' + e.builds + ' builds (' + e.buildsP.p10 + '/' + e.buildsP.p50 + '/' + e.buildsP.p90 + '), Core router ' + e.core + ' (n=' + e.n + ')'; }).join('; '));
|
||||
const f = s.final;
|
||||
out.push('time to Core router 10 (days after joining): ' + pc(f.core10Days, 'p10') + '/' + pc(f.core10Days, 'p50') + '/' + pc(f.core10Days, 'p90') + ' (reached by ' + f.core10Reached + ' of ' + m.players + ')');
|
||||
out.push('time to first expansion (days after joining): ' + pc(f.firstExpansionDays, 'p10') + '/' + pc(f.firstExpansionDays, 'p50') + '/' + pc(f.firstExpansionDays, 'p90') + ' (reached by ' + f.firstExpansionReached + ' of ' + m.players + ')');
|
||||
|
|
|
|||
|
|
@ -76,6 +76,26 @@ function build(x) {
|
|||
};
|
||||
}
|
||||
|
||||
// ---- first hours: what an operator had built N hours after signing up (only operators that are at least that old at the end).
|
||||
// Counted from the buildDone events of the capital, so it needs no extra sampling. Builds = levels gained (one level per build).
|
||||
const early = {};
|
||||
const capOf = new Map(db.all('SELECT owner_id AS oid, MIN(id) AS tid FROM towns GROUP BY owner_id').map((r) => [r.oid, r.tid]));
|
||||
const doneByTown = new Map();
|
||||
for (const r of db.all("SELECT town_id AS tid, due_at AS at, json_extract(payload, '$.type') AS type, json_extract(payload, '$.toLevel') AS lvl FROM events WHERE type = 'buildDone' AND status = 'done' ORDER BY due_at, id")) {
|
||||
(doneByTown.get(r.tid) || doneByTown.set(r.tid, []).get(r.tid)).push(r);
|
||||
}
|
||||
for (const h of [1, 6, 24]) {
|
||||
const builds = [], cores = [], fieldBuilds = [];
|
||||
for (const op of ops) {
|
||||
if (op.created_at + h * 3600000 > now || !capOf.has(op.id)) continue;
|
||||
const list = (doneByTown.get(capOf.get(op.id)) || []).filter((e) => e.at <= op.created_at + h * 3600000);
|
||||
builds.push(list.length);
|
||||
fieldBuilds.push(list.filter((e) => D.BUILDINGS[e.type] && D.BUILDINGS[e.type].kind === 'field').length);
|
||||
cores.push(Math.max(D.START.infra.core_router || 1, ...list.filter((e) => e.type === 'core_router').map((e) => e.lvl)));
|
||||
}
|
||||
early[h + 'h'] = { n: builds.length, builds: round(mean(builds), 1), buildsP: percentiles(builds, [10, 50, 90]), fieldBuilds: round(mean(fieldBuilds), 1), core: round(mean(cores), 2), coreP: percentiles(cores, [10, 50, 90]) };
|
||||
}
|
||||
|
||||
// ---- combat summary
|
||||
const raid = col.battles.raid;
|
||||
const samples = col.raidSamples;
|
||||
|
|
@ -157,7 +177,7 @@ function build(x) {
|
|||
};
|
||||
|
||||
return {
|
||||
meta, invariants, days,
|
||||
meta, invariants, days, early,
|
||||
final: { levels: Object.fromEntries(Object.keys(levels).map((k) => [k, { mean: round(mean(levels[k]), 2), hist: histogram(levels[k], 20) }])), fieldMin: percentiles(fieldMins, [10, 50, 90]),
|
||||
pops: popsDist, footprint: percentiles(footprints, [10, 50, 90]), core10Days: percentiles(core10, [10, 50, 90]), core10Reached: core10.length, firstExpansionDays: percentiles(expand1, [10, 50, 90]), firstExpansionReached: expand1.length,
|
||||
milestones: Object.fromEntries(Object.entries(milestones).map(([k, v]) => [k, { core10Days: percentiles(v.core10, [10, 50, 90]), firstExpansionDays: percentiles(v.exp1, [10, 50, 90]) }])),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue