3D engine that AI agents drive
JavaScript 3d3d-engineagentic-aiai-agentsblenderclaude-codegame-enginegaussian-splattinggltfjavascriptmcpmcp-servermodel-context-protocolpath-tracerpath-tracingpbrrenderingthreejs-alternativewebgl2webgpu
import test from 'node:test';
import assert from 'node:assert/strict';
import { readFileSync } from 'node:fs';
import { DEFAULT_RESULTS_PATH } from '../bench/tiers/make-tier-page-data.mjs';
import { HOME_PAGE_PATH, REGENERATE_COMMAND, buildHomeTierFigures, renderTierCards, replaceTierCards } from '../bench/tiers/make-home-tiers.mjs';
const matrix = JSON.parse(readFileSync(DEFAULT_RESULTS_PATH, 'utf8'));
const homePage = readFileSync(HOME_PAGE_PATH, 'utf8');
test('the tier cards of the home page are what the generator writes from the committed matrix', () => {
assert.equal(replaceTierCards(homePage, renderTierCards(matrix)), homePage, `site/index.html has tier-card figures that differ from bench/tiers/results/matrix-960.json; run: ${REGENERATE_COMMAND}`);
});
test('the figures are the lowest and highest per-scene median over all six scenes', () => {
const figures = buildHomeTierFigures(matrix);
assert.deepEqual(figures.draft.glazeMilliseconds, { low: 0.54, high: 1.04 });
assert.deepEqual(figures.realtime.blenderMilliseconds, { low: 288, high: 363 });
assert.deepEqual(figures.final.cookMilliseconds, { low: 1.73, high: 4.24 });
assert.deepEqual([figures.final.noise.low, figures.final.noise.high, figures.final.noise.reachedCount], [1.05, 4.02, 3]);
});
test('a slower run in the matrix reaches the cards, and a contended run stays out', () => {
const changed = structuredClone(matrix);
const draftRuns = changed.cells.filter(cell => cell.engine === 'glaze-draft' && cell.scene === 'metal');
draftRuns.forEach((cell, index) => { cell.metrics.primaryMilliseconds = [2, 3, 900][index]; });
draftRuns[2].contended = true;
assert.match(renderTierCards(changed), /data-glaze-ms="0.54-2.50"/);
});
test('a figure past the bar axis stops the generator and names the constant to raise', () => {
const worse = structuredClone(matrix);
for (const cell of worse.cells.filter(item => item.engine === 'eevee-default')) cell.score.flip = 0.9;
assert.throws(() => renderTierCards(worse), /raise FLIP_AXIS_MAXIMUM/);
});
test('a page without the markers is refused with the markers to add', () => {
assert.throws(() => replaceTierCards('<ol></ol>', 'x'), /tier-cards:start/);
});