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.ts Three.js animation render loop
  • index.ts Animation module exports
  • camera-orbit.ts Camera orbit controls
  • die-zoom.ts Die zoom controls
  • panel-interaction.ts Panel interaction handler
  • index.ts Controls module exports
  • scene.ts Three.js scene setup
  • lighting.ts Scene lighting configuration
  • floor.ts Chamber floor rendering
  • index.ts Chamber module exports
  • index.ts Rendering module exports
  • temp-objects.ts Temporary rendering objects
  • world.ts Cannon.js physics world
  • die-bodies.ts Physics bodies for dice
  • index.ts Physics module exports
  • main.ts TypeScript entry point
  • index.ts Barrel exports
  • main.css Application stylesheet (~300 lines)
  • Decomposed the single-file index.html app into ~80 TypeScript source files under src/ instantiate architectural
    4 files
    • loop.ts
    • scene.ts
    • world.ts
    • main.ts
  • Created module structure: animation/, config/, controls/, debug/, dice/, events/, game/, integration/, physics/, rendering/, state/, types/, ui/, utils/ instantiate architectural
    4 files
    • index.ts
    • index.ts
    • index.ts
    • index.ts
  • Migrated from JavaScript (vite.config.js) to TypeScript (vite.config.ts, tsconfig.json, vitest.config.ts) baseline internal
    3 files
    • vite.config.ts
    • tsconfig.json
    • vitest.config.ts
  • Added Playwright E2E test configuration and initial test specs qualify internal
    4 files
    • playwright.config.ts
    • button-mash.spec.ts
    • dice-roller.spec.ts
    • full-session.spec.ts

Core features

21 files changed
  • notation-parser.ts RPG dice notation parser (e.g. 2d6+3)
  • notation-parser.test.ts Notation parser unit tests
  • notation-parser.edge-cases.test.ts Notation parser edge case tests
  • seeded-rng.ts Seeded RNG for deterministic dice rolls
  • seeded-rng.test.ts Seeded RNG tests
  • seeded-rng.edge-cases.test.ts Seeded RNG edge case tests
  • messaging.ts postMessage-based messaging for iframe embedding
  • messaging.test.ts Messaging integration tests
  • determinism.test.ts Determinism integration tests
  • roll.ts Dice rolling game logic
  • settling.ts Die settling detection
  • history.ts Roll history tracking
  • results.ts Roll results display
  • highlight.ts Die highlight effects
  • timer.ts Game timer system
  • dice-buttons.ts Dice button UI controls
  • modifiers.ts Modifier system UI
  • modifiers.test.ts Modifier UI tests
  • presets.ts Preset management UI
  • presets.test.ts Preset UI tests
  • sliders.ts Slider UI controls
  • Implemented dice notation parser (src/dice/notation-parser.ts) supporting standard RPG notation (e.g., 2d6+3) instantiate behavioral
    1 file
    • notation-parser.ts
  • Added seeded RNG system (src/integration/seeded-rng.ts) for deterministic dice rolls instantiate behavioral
    1 file
    • seeded-rng.ts
  • Added postMessage-based messaging integration (src/integration/messaging.ts) for iframe embedding instantiate behavioral
    1 file
    • messaging.ts
  • Created camera orbit controls, die zoom controls, and panel interaction system instantiate behavioral
    3 files
    • camera-orbit.ts
    • die-zoom.ts
    • panel-interaction.ts
  • Built game settling detection, timer system, and history tracking instantiate behavioral
    3 files
    • settling.ts
    • timer.ts
    • history.ts
  • Added modifier system and preset management UI instantiate behavioral
    2 files
    • modifiers.ts
    • presets.ts

Dice geometry and configuration

10 files changed
  • face-reader.ts Face normal detection for reading die results
  • geometry-data.ts Vertex/face geometry data for dice polyhedra
  • mesh-factory.ts Three.js mesh factory for dice
  • numbers-overlay.ts Number texture overlay for die faces
  • textures.ts Die texture management
  • index.ts Dice module exports
  • defaults.ts Default configuration values
  • dice-configs.ts Per-die-type configuration
  • index.ts Config module exports
  • fps-counter.ts FPS counter debug overlay
  • Added dddice scraper tools (tools/dddice/) for fetching dice skin manifests and converting theme data instantiate internal
    2 files
    • dddice_scraper.py
    • dddice_theme_viewer.html
  • Added CLAUDE.md, docs/SYSTEM_PROMPT.md, docs/TESTING_NOTES.md, and docs/FEATURE_REQUESTS.md specify internal
    4 files
    • CLAUDE.md
    • SYSTEM_PROMPT.md
    • TESTING_NOTES.md
    • FEATURE_REQUESTS.md

Test infrastructure

11 files changed
  • modifiers.test.ts Modifier UI tests
  • presets.test.ts Preset UI tests
  • seeded-rng.test.ts Seeded RNG tests
  • seeded-rng.edge-cases.test.ts Edge case tests for seeded RNG
  • determinism.test.ts Determinism tests
  • messaging.test.ts Messaging integration tests
  • notation-parser.test.ts Notation parser tests
  • notation-parser.edge-cases.test.ts Notation parser edge case tests
  • button-mash.spec.ts Button-mash E2E test
  • dice-roller.spec.ts Dice roller E2E test
  • full-session.spec.ts Full 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.ts
    • seeded-rng.test.ts
    • determinism.test.ts
    • messaging.test.ts
  • Added E2E tests: button-mash.spec.ts, dice-roller.spec.ts, full-session.spec.ts qualify internal
    3 files
    • button-mash.spec.ts
    • dice-roller.spec.ts
    • full-session.spec.ts