feat(cellular): energy cycles back through the spent pool (ADR-0182 section 14)
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m42s
Foundation / checks (checks) (push) Successful in 6s
Foundation / checks (client) (push) Successful in 5s
Foundation / postgres-tools (push) Successful in 31s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / server-image (push) Successful in 4m45s
Foundation / checks (network) (push) Successful in 4s
Foundation / image (push) Successful in 5m31s
Foundation / checks (postgres) (push) Successful in 5s
Foundation / checks (tsan) (push) Successful in 5s
Foundation / checks (deploy) (push) Successful in 4m42s
Foundation / checks (checks) (push) Successful in 6s
Foundation / checks (client) (push) Successful in 5s
Foundation / postgres-tools (push) Successful in 31s
Foundation / checks (ecs) (push) Successful in 4s
Foundation / server-image (push) Successful in 4m45s
Foundation / checks (network) (push) Successful in 4s
Foundation / image (push) Successful in 5m31s
Energy cells used went to the region's heat store and never returned, so a region without photosynthesizers drained: region 16's wildlife ate its energy and starved, and its matter-only drip filled the deposit limit. Two optional rules-13 tuning keys, adoptable live: spent.heat_recycle_per_mille moves that share of the heat store to the spent pool at the end of every tick, before the drip (1,000 closes the loop and returns heat built up before), and spent.drip_absorb lets a drip at the deposit limit join the first existing bubble at or after its spot. Both use the reserved word after the offer interval, so rules without them keep their bytes, digests, checkpoints and replays. The DEV revamp file turns both on. The region view reports heat and the cycle; the portal counts heat in the region's energy and ledger. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -630,23 +630,26 @@ function windowBadge(r) {
|
||||
// listed cells and deposits.
|
||||
function regionLedger(view) {
|
||||
const zero = () => [0, 0, 0, 0, 0];
|
||||
// Heat: energy the cells used that has not (yet) returned to the spent pool.
|
||||
const heat = view.heat === undefined ? null : [Number(view.heat), 0, 0, 0, 0];
|
||||
if (view.totals) {
|
||||
const t = view.totals;
|
||||
return { complete: true, reserve: t.reserve, body: t.body, bubbles: t.bubbles, pools: t.pools, patches: t.patches, spent: view.spent };
|
||||
return { complete: true, reserve: t.reserve, body: t.body, bubbles: t.bubbles, pools: t.pools, patches: t.patches, spent: view.spent, heat };
|
||||
}
|
||||
const reserve = zero(), bubbles = zero(), pools = zero(), patches = zero();
|
||||
for (const c of view.cells) addTo(reserve, c.reserve);
|
||||
for (const d of view.deps) addTo(d.kind === 2 ? bubbles : d.kind === 1 ? pools : patches, d.stock);
|
||||
return { complete: false, reserve, body: null, bubbles, pools, patches, spent: view.spent };
|
||||
return { complete: false, reserve, body: null, bubbles, pools, patches, spent: view.spent, heat };
|
||||
}
|
||||
// The rules-13 drip: every `interval` ticks, one bubble per non-empty channel of at most the cap.
|
||||
// The rules-13 drip: every `interval` ticks, one bubble per non-empty channel of at most the cap;
|
||||
// the energy cycle (ADR-0182 section 14): heat recycled per mille each tick, absorbing drip.
|
||||
function dripPlan(view) {
|
||||
if (!view.drip) return null;
|
||||
const [interval, capE, capM] = view.drip.map(Number);
|
||||
const [interval, capE, capM, recycle = 0, absorb = 0] = view.drip.map(Number);
|
||||
const caps = [capE, capM, capM, capM, capM];
|
||||
const spent = view.spent.map(Number);
|
||||
return {
|
||||
interval, caps,
|
||||
interval, caps, recycle, absorb: absorb === 1,
|
||||
next: spent.map((v, i) => Math.min(v, caps[i])),
|
||||
drips: spent.map((v, i) => (caps[i] ? Math.ceil(v / caps[i]) : 0)),
|
||||
};
|
||||
@@ -1116,13 +1119,15 @@ async function regionPage(region, params) {
|
||||
const rows = [
|
||||
['Cell reserves', L.reserve], ['Cell bodies', L.body], ['Bubbles', L.bubbles], ['Liquid pools', L.pools],
|
||||
...(sum(L.patches) ? [['Patches', L.patches]] : []), ['Spent pool', L.spent],
|
||||
...(L.heat ? [['Heat (used energy)', L.heat]] : []),
|
||||
];
|
||||
const total = rows.reduce((t, [, v]) => (v ? addTo(t, v) : t), [0, 0, 0, 0, 0]);
|
||||
const held = [0, 0, 0, 0, 0], free = [0, 0, 0, 0, 0];
|
||||
if (L.reserve) addTo(held, L.reserve);
|
||||
if (L.body) addTo(held, L.body);
|
||||
for (const v of [L.bubbles, L.pools, L.patches]) addTo(free, v);
|
||||
const parts = [['In cells', held, 'var(--wildlife)'], ['Bubbles and pools', free, 'var(--accent)'], ['Spent pool', L.spent.map(Number), 'var(--warn)']];
|
||||
const parts = [['In cells', held, 'var(--wildlife)'], ['Bubbles and pools', free, 'var(--accent)'], ['Spent pool', L.spent.map(Number), 'var(--warn)'],
|
||||
...(L.heat ? [['Heat', L.heat, 'var(--bad)']] : [])];
|
||||
fill(ledgerBox,
|
||||
h('table', { class: 'ledger' },
|
||||
h('thead', {}, h('tr', {}, h('th', {}, ''), channels.map((c) => h('th', { class: 'num' }, swatch(c.key), c.short)))),
|
||||
@@ -1139,7 +1144,12 @@ async function regionPage(region, params) {
|
||||
const plan = dripPlan(view);
|
||||
const notes = [];
|
||||
const deposits = Number(view.deposits_total);
|
||||
if (deposits >= depositLimit) notes.push(`The region holds ${fmtInt(deposits)} deposits, its limit: the drip waits and new bubbles are refused until cells eat some.`);
|
||||
const absorbing = plan && plan.absorb;
|
||||
if (deposits >= depositLimit) {
|
||||
notes.push(absorbing
|
||||
? `The region holds ${fmtInt(deposits)} deposits, its limit: drips join existing bubbles, and Add bubbles is refused until cells eat some.`
|
||||
: `The region holds ${fmtInt(deposits)} deposits, its limit: the drip waits and new bubbles are refused until cells eat some.`);
|
||||
}
|
||||
else if (deposits >= depositLimit * 0.95) notes.push(`${fmtInt(depositLimit - deposits)} deposit places left before the limit of ${fmtInt(depositLimit)}.`);
|
||||
if (pace.stalled) notes.push('The tick is not advancing, so nothing drips until the region ticks again.');
|
||||
if (!plan) {
|
||||
@@ -1149,6 +1159,7 @@ async function regionPage(region, params) {
|
||||
}
|
||||
dripEvery.textContent = plan.interval ? `every ${(plan.interval * tickSeconds).toLocaleString()} s (${plan.interval} ticks)` : 'off';
|
||||
if (!sum(plan.next)) notes.push('The spent pool is empty: drips release nothing.');
|
||||
if (!plan.recycle && L.heat && L.heat[0]) notes.push(`Energy cells use is lost as heat (${fmtEnergy(L.heat[0])} so far): set spent.heat_recycle_per_mille to return it through the drip.`);
|
||||
const dryIn = (i) => (!Number(view.spent[i]) ? h('span', { class: 'faint' }, 'empty') : plan.interval ? fmtDuration(plan.drips[i] * plan.interval * tickSeconds) : '—');
|
||||
fill(dripBox,
|
||||
h('table', { class: 'ledger', style: { marginTop: '12px' } },
|
||||
@@ -1158,7 +1169,10 @@ async function regionPage(region, params) {
|
||||
h('td', { class: 'num' }, c.fmt(view.spent[i])),
|
||||
h('td', { class: 'num' }, Number(plan.next[i]) ? c.fmt(plan.next[i]) : h('span', { class: 'faint' }, '—')),
|
||||
h('td', { class: 'num' }, dryIn(i)))))),
|
||||
h('div', { class: 'muted small', style: { marginTop: '8px' } }, `Each drip makes one bubble per non-empty channel, at most ${fmtEnergy(plan.caps[0])} of energy or ${fmtMass(plan.caps[1])} of one matter, at random spots.`),
|
||||
h('div', { class: 'muted small', style: { marginTop: '8px' } }, `Each drip makes one bubble per non-empty channel, at most ${fmtEnergy(plan.caps[0])} of energy or ${fmtMass(plan.caps[1])} of one matter, at random spots${plan.absorb ? '; at the deposit limit it joins an existing bubble instead' : ''}.`),
|
||||
h('div', { class: 'muted small', style: { marginTop: '4px' } }, plan.recycle
|
||||
? `Energy cycle: ${(plan.recycle / 10).toLocaleString()}% of the region's heat returns to the spent pool every tick.`
|
||||
: 'Energy cycle: off. Energy cells use stays as heat.'),
|
||||
notes.length ? h('div', { style: { marginTop: '12px' } }, notes.map((n) => h('div', { class: 'callout' }, n))) : null);
|
||||
}
|
||||
|
||||
@@ -1255,7 +1269,7 @@ async function regionPage(region, params) {
|
||||
channels.forEach((c, i) => { chips[c.key].count.textContent = fmtInt(byChannel[i]); });
|
||||
|
||||
const L = regionLedger(view);
|
||||
const totalOf = (i) => [L.reserve, L.body, L.bubbles, L.pools, L.patches, L.spent].reduce((s, v) => s + (v ? Number(v[i]) : 0), 0);
|
||||
const totalOf = (i) => [L.reserve, L.body, L.bubbles, L.pools, L.patches, L.spent, L.heat].reduce((s, v) => s + (v ? Number(v[i]) : 0), 0);
|
||||
const freeOf = (i) => [L.bubbles, L.pools, L.patches].reduce((s, v) => s + Number(v[i]), 0);
|
||||
const energy = totalOf(0), matter = [1, 2, 3, 4].reduce((s, i) => s + totalOf(i), 0);
|
||||
const freeMatter = [1, 2, 3, 4].reduce((s, i) => s + freeOf(i), 0);
|
||||
|
||||
Reference in New Issue
Block a user