undef-dice
2026-01-10
Monolithic HTML dice roller decomposed into a modular TypeScript project with full engine architecture
87 files · 20,348+ · 5,596-
TypeScript module architecture
18 files changed
loop.tsThree.js animation render loopindex.tsAnimation module exportscamera-orbit.tsCamera orbit controlsdie-zoom.tsDie zoom controlspanel-interaction.tsPanel interaction handlerindex.tsControls module exportsscene.tsThree.js scene setuplighting.tsScene lighting configurationfloor.tsChamber floor renderingindex.tsChamber module exportsindex.tsRendering module exportstemp-objects.tsTemporary rendering objectsworld.tsCannon.js physics worlddie-bodies.tsPhysics bodies for diceindex.tsPhysics module exportsmain.tsTypeScript entry pointindex.tsBarrel exportsmain.cssApplication stylesheet (~300 lines)
- Decomposed the single-file
index.htmlapp into ~80 TypeScript source files undersrc/instantiate architectural4 files
loop.tsscene.tsworld.tsmain.ts
- Created module structure:
animation/,config/,controls/,debug/,dice/,events/,game/,integration/,physics/,rendering/,state/,types/,ui/,utils/instantiate architectural4 files
index.tsindex.tsindex.tsindex.ts
- Migrated from JavaScript (
vite.config.js) to TypeScript (vite.config.ts,tsconfig.json,vitest.config.ts) baseline internal3 files
vite.config.tstsconfig.jsonvitest.config.ts
- Added Playwright E2E test configuration and initial test specs
qualify
internal
4 files
playwright.config.tsbutton-mash.spec.tsdice-roller.spec.tsfull-session.spec.ts
Core features
21 files changed
notation-parser.tsRPG dice notation parser (e.g. 2d6+3)notation-parser.test.tsNotation parser unit testsnotation-parser.edge-cases.test.tsNotation parser edge case testsseeded-rng.tsSeeded RNG for deterministic dice rollsseeded-rng.test.tsSeeded RNG testsseeded-rng.edge-cases.test.tsSeeded RNG edge case testsmessaging.tspostMessage-based messaging for iframe embeddingmessaging.test.tsMessaging integration testsdeterminism.test.tsDeterminism integration testsroll.tsDice rolling game logicsettling.tsDie settling detectionhistory.tsRoll history trackingresults.tsRoll results displayhighlight.tsDie highlight effectstimer.tsGame timer systemdice-buttons.tsDice button UI controlsmodifiers.tsModifier system UImodifiers.test.tsModifier UI testspresets.tsPreset management UIpresets.test.tsPreset UI testssliders.tsSlider UI controls
- Implemented dice notation parser (
src/dice/notation-parser.ts) supporting standard RPG notation (e.g.,2d6+3) instantiate behavioral1 file
notation-parser.ts
- Added seeded RNG system (
src/integration/seeded-rng.ts) for deterministic dice rolls instantiate behavioral1 file
seeded-rng.ts
- Added postMessage-based messaging integration (
src/integration/messaging.ts) for iframe embedding instantiate behavioral1 file
messaging.ts
- Created camera orbit controls, die zoom controls, and panel interaction system
instantiate
behavioral
3 files
camera-orbit.tsdie-zoom.tspanel-interaction.ts
- Built game settling detection, timer system, and history tracking
instantiate
behavioral
3 files
settling.tstimer.tshistory.ts
- Added modifier system and preset management UI
instantiate
behavioral
2 files
modifiers.tspresets.ts
Dice geometry and configuration
10 files changed
face-reader.tsFace normal detection for reading die resultsgeometry-data.tsVertex/face geometry data for dice polyhedramesh-factory.tsThree.js mesh factory for dicenumbers-overlay.tsNumber texture overlay for die facestextures.tsDie texture managementindex.tsDice module exportsdefaults.tsDefault configuration valuesdice-configs.tsPer-die-type configurationindex.tsConfig module exportsfps-counter.tsFPS counter debug overlay
- Added dddice scraper tools (
tools/dddice/) for fetching dice skin manifests and converting theme data instantiate internal2 files
dddice_scraper.pydddice_theme_viewer.html
- Added
CLAUDE.md,docs/SYSTEM_PROMPT.md,docs/TESTING_NOTES.md, anddocs/FEATURE_REQUESTS.mdspecify internal4 files
CLAUDE.mdSYSTEM_PROMPT.mdTESTING_NOTES.mdFEATURE_REQUESTS.md
Test infrastructure
11 files changed
modifiers.test.tsModifier UI testspresets.test.tsPreset UI testsseeded-rng.test.tsSeeded RNG testsseeded-rng.edge-cases.test.tsEdge case tests for seeded RNGdeterminism.test.tsDeterminism testsmessaging.test.tsMessaging integration testsnotation-parser.test.tsNotation parser testsnotation-parser.edge-cases.test.tsNotation parser edge case testsbutton-mash.spec.tsButton-mash E2E testdice-roller.spec.tsDice roller E2E testfull-session.spec.tsFull session E2E test
- Added unit tests for notation parser, seeded RNG (including edge cases), determinism, messaging, modifiers, and presets
qualify
internal
4 files
notation-parser.test.tsseeded-rng.test.tsdeterminism.test.tsmessaging.test.ts
- Added E2E tests:
button-mash.spec.ts,dice-roller.spec.ts,full-session.spec.tsqualify internal3 files
button-mash.spec.tsdice-roller.spec.tsfull-session.spec.ts