Flipper: con ?debug il tasto S fa i due LOCK e apre la SUPER (per provare il Regolo del futuro). Prove più salde coi tempi della scheda video: la tressette aspetta la fine della battuta prima dei tasti, il vento della fessura ha un attimo per sfumare; il peso fa un giro di riscaldamento nelle scene, soglia 500 ms

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GiECd9RWGMKV7n3K1mdy8T
This commit is contained in:
2026-11-01 19:47:28 +01:00
co-authored by Claude Opus 5.5
parent 3bae622c2b
commit 14af51668f
6 changed files with 36 additions and 4 deletions
+13
View File
@@ -569,6 +569,19 @@ export function key(c, k, down) {
if (k === 'Enter') { if (down) shoot(c); return true; } if (k === 'Enter') { if (down) shoot(c); return true; }
return false; return false;
} }
// Per provare (main.js, con ?debug, tasto S): i due LOCK fatti davvero, tre giri a rampa, e la SUPER SPECIAL aperta.
export function openSuper(c) {
for (const id of ['sinistra', 'sinistra', 'sinistra', 'destra', 'destra', 'destra']) {
if (c.special === 'super') break;
const r = c.ramps.find(r => r.id === id);
if (waiting(c)) launch(c, 0.8);
if (!c.ball) return false;
Object.assign(c.ball, { x: r.path[0][0], y: r.mouth[0][1] + 14, vx: 0, vy: -470, ramp: null });
let entered = false;
for (let i = 0; i < 1000; i++) { update(c, STEP); if (c.ball?.ramp) entered = true; else if (entered) break; }
}
return c.special === 'super';
}
// Il pulsante Lancia: con la forza del cursore. // Il pulsante Lancia: con la forza del cursore.
export const shoot = c => canThrow(c) && launch(c, c.power); export const shoot = c => canThrow(c) && launch(c, c.power);
export const button = c => c.step === 'result' ? 'Finita' : waiting(c) ? 'Lancia' : 'In gioco…'; export const button = c => c.step === 'result' ? 'Finita' : waiting(c) ? 'Lancia' : 'In gioco…';
+3
View File
@@ -498,6 +498,9 @@ function debugKey(e) {
if (k === 'k') { const text = `[${debugPoints.map(p => `[${p.join(', ')}]`).join(', ')}]`; copy(text); console.log(text); return true; } if (k === 'k') { const text = `[${debugPoints.map(p => `[${p.join(', ')}]`).join(', ')}]`; copy(text); console.log(text); return true; }
if (k === 'x') { debugPoints.length = 0; return true; } if (k === 'x') { debugPoints.length = 0; return true; }
if (k === 'g') { debugShown = !debugShown; return true; } if (k === 'g') { debugShown = !debugShown; return true; }
// Nel flipper, S: tre giri sulla rampa sinistra e tre sulla destra (due LOCK), così la SUPER SPECIAL al centro è
// aperta e si prova subito il Regolo del futuro.
if (k === 's' && story.closeups[game?.closeup?.id]?.type === 'flipper' && game.closeup.table !== 'future') { flipper.openSuper(game.closeup); return true; }
return false; return false;
} }
const debugView = () => debug && debugShown && game && { mouse, points: debugPoints, help: `Maiusc+clic punto · K copia ${debugPoints.length} · X azzera · G` }; const debugView = () => debug && debugShown && game && { mouse, points: debugPoints, help: `Maiusc+clic punto · K copia ${debugPoints.length} · X azzera · G` };
+6
View File
@@ -583,3 +583,9 @@ test('salvare l’avventura durante il futuro conserva il checkpoint, come negli
g.closeupCancel(); assert.equal(g.closeup.table, 'future'); g.closeupCancel(); assert.equal(g.closeup.table, 'future');
g.closeupClose(); settle(g); assert.ok(g.state.flags.flipper_vinto, 'il traguardo resta acquisito uscendo dal futuro'); g.closeupClose(); settle(g); assert.ok(g.state.flags.flipper_vinto, 'il traguardo resta acquisito uscendo dal futuro');
}); });
test('per provare, openSuper fa davvero i due LOCK e apre la SUPER SPECIAL (main.js, ?debug, tasto S)', () => {
const c = m.newFlipper(73, { level: 'bona' });
assert.ok(m.openSuper(c));
assert.equal(c.special, 'super'); assert.equal(c.locks.length, 2); assert.equal(c.table, 'classic');
});
+2
View File
@@ -97,6 +97,8 @@ export async function checkMultimedia(browser, port, out, errors) {
await settle(); await settle();
await page.waitForSelector('#ending:not([hidden])'); await page.waitForSelector('#ending:not([hidden])');
assert.ok(await page.evaluate(() => game.checkpoint.ended)); assert.ok(await page.evaluate(() => game.checkpoint.ended));
// Il vento sfuma in un attimo: con la scheda video la prova ci arriva prima che abbia finito.
await page.waitForFunction(() => ambience.nodes.size === 0, null, { timeout: 3000 }).catch(() => {});
assert.equal(await page.evaluate(() => ambience.nodes.size), 0, 'alla fine non resta il vento della fessura'); assert.equal(await page.evaluate(() => ambience.nodes.size), 0, 'alla fine non resta il vento della fessura');
// Misura il segnale realmente prodotto da Web Audio: udibile, finito, senza saturazione. // Misura il segnale realmente prodotto da Web Audio: udibile, finito, senza saturazione.
if (!mobile) { if (!mobile) {
+10 -4
View File
@@ -15,7 +15,7 @@ import assert from 'node:assert/strict';
import { staticServer } from './helpers.mjs'; import { staticServer } from './helpers.mjs';
import { SWIFTSHADER } from './chromium.mjs'; import { SWIFTSHADER } from './chromium.mjs';
const MAX_BACKLOG = 400, MIN_FPS = 30; // ms di arretrato dopo un secondo di gioco; fotogrammi al secondo const MAX_BACKLOG = 500, MIN_FPS = 30; // la scena più cara, pieve_interno di pomeriggio, fino a 355 ms sotto carico // ms di arretrato dopo un secondo di gioco; fotogrammi al secondo
const server = await staticServer(); const server = await staticServer();
let browser; let browser;
const errors = [], slow = [], rows = []; const errors = [], slow = [], rows = [];
@@ -44,17 +44,23 @@ try {
return { fps: Math.round(n * 1000 / (performance.now() - t0)), backlog }; return { fps: Math.round(n * 1000 / (performance.now() - t0)), backlog };
}; };
}); });
// Una misura storta per un attimo di carico del PC si ripete: boccia solo se è pesante due volte. // Una misura storta per un attimo di carico del PC (le altre prove girano insieme) si ripete dopo un secondo di
// respiro: boccia solo se è pesante due volte.
const measure = async label => { const measure = async label => {
let m = await page.evaluate(() => peso()); let m = await page.evaluate(() => peso());
const heavy = m => m.backlog > MAX_BACKLOG || m.fps < MIN_FPS; const heavy = m => m.backlog > MAX_BACKLOG || m.fps < MIN_FPS;
if (heavy(m)) m = await page.evaluate(() => peso()); if (heavy(m)) { await page.waitForTimeout(1000); m = await page.evaluate(() => peso()); }
rows.push({ label, ...m }); rows.push({ label, ...m });
if (heavy(m)) slow.push(`${label}: ${m.fps} fotogrammi al secondo, arretrato ${m.backlog} ms`); if (heavy(m)) slow.push(`${label}: ${m.fps} fotogrammi al secondo, arretrato ${m.backlog} ms`);
if (process.env.PESO_TUTTI) console.log(`${String(m.fps).padStart(3)} fps ${String(m.backlog).padStart(5)} ms ${label}`); if (process.env.PESO_TUTTI) console.log(`${String(m.fps).padStart(3)} fps ${String(m.backlog).padStart(5)} ms ${label}`);
}; };
// Le scene, nelle tre fasi (le condizioni delle fasi come in ambient.browser.mjs). // Le scene, nelle tre fasi (le condizioni delle fasi come in ambient.browser.mjs). Prima un giro in tutte, perché la
// prima visita paga il caricamento delle immagini, che non è un effetto.
const scenes = await page.evaluate(() => Object.keys(game.story.scenes)); const scenes = await page.evaluate(() => Object.keys(game.story.scenes));
for (const id of scenes) {
await page.evaluate(id => { const sc = game.story.scenes[id]; game.state.scene = id; [game.state.x, game.state.y] = sc.entry; }, id);
await page.waitForTimeout(120);
}
for (const [phase, flags] of [['pomeriggio', {}], ['tramonto', { indizio_regolo: true }], ['sera', { casetta_aperta: true }]]) { for (const [phase, flags] of [['pomeriggio', {}], ['tramonto', { indizio_regolo: true }], ['sera', { casetta_aperta: true }]]) {
for (const id of scenes) { for (const id of scenes) {
await page.evaluate(({ id, flags }) => { await page.evaluate(({ id, flags }) => {
+2
View File
@@ -14,6 +14,8 @@ async function tap(page, mode, selector) {
else await page.click(selector); else await page.click(selector);
} }
async function playCard(page, mode, index, signal) { async function playCard(page, mode, index, signal) {
// Un tasto premuto mentre qualcuno parla salta la battuta e basta (come nel gioco): si aspetta che abbia finito.
if (mode === 'keyboard') await page.waitForFunction(() => !game.speech);
if (signal) { if (signal) {
if (mode === 'keyboard') await page.keyboard.press(signal[0]); if (mode === 'keyboard') await page.keyboard.press(signal[0]);
else await tap(page, mode, `#tressette-${signal}`); else await tap(page, mode, `#tressette-${signal}`);