perf: reduce mobile rendering and cull offscreen characters and building tiles

This commit is contained in:
2026-11-03 10:43:01 +09:00
parent 4b27a8c209
commit e234baa4aa
17 changed files with 1689 additions and 109 deletions
+24
View File
@@ -0,0 +1,24 @@
import { test } from 'node:test';
import assert from 'node:assert/strict';
import { createFrameClock } from '../src/scene/frameClock.ts';
test('30 fps pacing retains elapsed simulation time on 60 and 120 Hz displays', () => {
for (const hz of [60, 120]) {
const clock = createFrameClock(30);
let frames = 0, elapsed = 0;
for (let i = 0; i <= hz * 10; i++) {
const delta = clock.tick(i * 1000 / hz);
if (delta !== undefined) { frames++; elapsed += delta; }
}
assert.equal(frames, 301);
assert.ok(Math.abs(elapsed - 10) < 1e-8);
}
});
test('resume resets elapsed time instead of simulating the hidden interval', () => {
const clock = createFrameClock(30);
clock.tick(0); clock.tick(100);
clock.reset();
assert.equal(clock.tick(60000), 0);
assert.equal(clock.tick(60001), undefined);
});