Commit Graph
105 Commits
Author SHA1 Message Date
hypercross ee7e73c798 style(web): use 3:4 aspect ratio for viewers 2026-08-14 09:54:52 +08:00
hypercross dd08f901ae feat: add inline PDF viewer for Custom_PDF objects
Add a /pdf proxy route that forces Content-Disposition inline so PDFs render instead of downloading, and a web viewer that embeds the document in an iframe with a standalone open-in-new-tab link.
2026-08-14 09:51:11 +08:00
hypercross 8bd186df54 refactor(engine): unify commands and orchestrators
Replace the CommandHost with a handler registry keyed by message type.
Message is a permissive base type the host extends; CommandResult is a
discriminated union on the type suffix. Commands and orchestrators are
the same async shape taking a RunContext with an AbortSignal; runCommand
emits :done/:cancel/:error.
2026-08-10 18:40:35 +08:00
hypercross 81c115cb4d docs: unify commands and orchestrators in bgm-engine
Messages are a discriminated union with generic command/result types;
the command host is dropped for a handler registry; commands and
orchestrators are the same async shape taking a cancellable RunContext.
2026-08-10 18:40:30 +08:00
hypercross 3167d26bd6 feat(engine): add message queue, triggers, and orchestrators
New @tts/engine package: the pure message layer that drives bgm games.
MessageQueue snapshots and drains on tick; TriggerRegistry matches by
type/id with runtime enable/disable; runOrchestrator suspends on wait
until a matching message is processed. Engine ties them together behind
the CommandHost contract that @tts/tabletop will implement.
2026-08-10 18:26:23 +08:00
hypercross 91cd3a16d7 docs: add bgm-engine message layer design
Define the message/queue/tick model, the three handler kinds (trigger,
orchestrator, command host), and the @tts/engine package split. Cross-link
from bgm-commands and bgm-tabletop, and add the engine to the architecture
package table.
2026-08-10 18:26:19 +08:00
hypercross 13b3eaed78 feat(bgm): derive definition names from role.type
A definition is identified by role.type and named role.type.lang
(package.lang for packages). Code blocks declare it via role= on the
info string; real files by their filename. Blocks and files without a
matching role.type are ignored. file= still overrides the auto-name.

Relative asset and $variants paths now resolve against the markdown
file's directory (baseDir) rather than the virtual name. Same role.type
with different ids groups under one name; duplicate type#id still
errors. Migrate fixtures and example games to role=.
2026-08-10 16:36:57 +08:00
hypercross 23332ab786 docs(bgm): derive definition names from role.type 2026-08-10 16:27:45 +08:00
hypercross aab0b66ee8 feat(bgm): support role= on code block info strings
Parse role.type#id from the fence info string and merge it into each
parsed object, erroring on conflicts with the content. id on the info
string can't combine with $variants. Auto-named blocks now hash their
content instead of the info string, so identical blocks dedupe.
2026-08-10 16:09:12 +08:00
hypercross c41c266ac1 docs(bgm): document role= on code block info strings 2026-08-10 16:07:17 +08:00
hypercross 634a99dd25 docs: design command execution for tabletop scripts
Add bgm-commands.md covering async commands with ok/cancel/error
results, per-invocation run contexts, fire-and-forget vs self-managed
waiting, and tap interaction with part-local trigger points. Link it
from the tabletop design and plan docs, and record the decisions in
decisions.md.
2026-08-10 15:41:43 +08:00
hypercross 9b5223686e feat(bgm): allow $variants to take multiple csv sources
Expand $variants to accept an array of csv paths, concatenating their
rows. Detect a path by a .csv suffix on the first line instead of a
newline, so inline csv and paths are self-documenting and the rule
applies uniformly to single values and array elements.
2026-08-10 14:06:36 +08:00
hypercross 3aa48058f7 fix(tabletop): render surface outline without depth test 2026-08-10 12:24:46 +08:00
hypercross 812b4640e2 feat(web): clamp tabletop camera to the horizon
Add a maxPolarAngle prop to Scene and use it in the tabletop view so the
camera can't dip below the table and peek under face-down cards.
2026-08-10 12:24:43 +08:00
hypercross 9d776771b1 feat: showcase facing states in poker setup
Deal the deck facedown and stand two drawn cards on their bottom edge,
exercising the back and standing facings alongside the face-up flop.
2026-08-10 12:24:40 +08:00
hypercross d663f4afea feat: add facing orientation to parts
Replace the face/back boolean with a three-state facing (face, back,
standing) seeded from setup placements. Parts now orient about the
anchor at the resting face/edge, so back-down parts sit on the table
instead of below it and standing parts rest on their bottom edge.
2026-08-10 11:47:58 +08:00
hypercross aa23e93b3f docs: add commit conventions skill 2026-08-10 11:47:35 +08:00
hypercross 77e0751554 docs: describe ordered setup placements
Document that setup is an ordered list of placements, each moving its parts to a path, in the format reference and the tabletop plan.
2026-08-10 11:27:56 +08:00
hypercross dc721d5c2d refactor(games): use ordered setup placements
Convert poker and carcassonne setups to the ordered placement list. Deal the deck/draw first, then move the flop cards and opening tiles out onto their paths.
2026-08-10 11:27:53 +08:00
hypercross 96c299e498 feat(tabletop): seed state from ordered setup placements
Apply each setup placement in order, moving its parts to its path, then index each path's parts contiguously so stacking stays valid.
2026-08-10 11:27:50 +08:00
hypercross c2693277ac feat(bgm): model setup as ordered placements
Replace the path->parts setup map with an ordered list of placements, each moving its parts to a path. Entries apply in order, so a part listed in a later placement ends up on that placement's path.
2026-08-10 11:27:46 +08:00
hypercross bc418b2c73 Model part face in tabletop state
Replace the path->part-list store with a per-part map keyed by part id, so each placed part carries its path, stack index, and face. Derive each path's ordered children for stacking, and flip face-down parts in PartPlacement.
2026-08-10 11:10:16 +08:00
hypercross 6502fdae4f refactor(web): code-split the three.js stack out of the main bundle 2026-08-10 09:12:38 +08:00
hypercross 45bf362fbc refactor(tts): derive save filename from URL path only 2026-08-10 09:12:34 +08:00
hypercross 82caa9bb9c fix(shared): accept local asset paths in trace schema 2026-08-10 09:12:31 +08:00
hypercross dfe49bad0c refactor(bgm): use doc-relative include in games and fixtures
The default include is now resolved relative to the package
declaration's directory, so the explicit root-relative patterns are
redundant. Drop them in favor of the default.
2026-08-10 08:52:54 +08:00
hypercross 2001616d9e fix(bgm): resolve include patterns relative to package dir
The default include matched every yaml across the games root, so a
package could absorb a sibling game's defs (e.g. two game#main setups).
Resolve patterns against the package declaration's directory instead;
a leading slash marks a pattern as root-relative.
2026-08-10 08:52:51 +08:00
hypercross 77ffd8ff00 feat(carcassonne): add base game manifest
A 24-tile base game: one part per tile image (A-X), a board with a
draw pile and an 11x11 grid, and a setup seeding the tile supply.
2026-08-10 08:52:48 +08:00
hypercross 5a3a9c1fcc feat(web): lighten tabletop scene and tune contact shadows
Replace the dark surface plane with a grey background and a spotlight,
size the contact shadow to the table, and scale its blur and fade with
the shadow plane. Disable depth test on the stacking curve overlay.
2026-08-10 00:57:32 +08:00
hypercross 50c6df48b5 fix(tabletop): align cards to the stacking curve
Fix the tangent angle at the curve's start and rotate cards to follow
the curve direction. Add a stacking curve visualization shown with
surface debug.
2026-08-10 00:40:56 +08:00
hypercross f12b40e82b fix(tabletop): default tilt to 1 degree for all parts
Apply the default 1 degree tilt even when a route has no stacking
strategy, so every placed part is tilted consistently.
2026-08-10 00:29:23 +08:00
hypercross 8d0e393100 feat(tabletop): let candidates inherit and override route stacking
Candidates now carry their own stacking strategy, inheriting the route's
when absent, so the default tilt applies consistently. Drop the now
redundant explicit tilt from the poker deck.
2026-08-10 00:27:01 +08:00
hypercross 43c6334413 fix(tabletop): tilt cards uniformly about the y axis
Apply the same tilt to every stacked part and rotate it about its local
Y axis instead of Z. Default tilt to 1 degree when a stacking strategy
is present, and arc the poker deck along the surface's bottom edge.
2026-08-10 00:23:08 +08:00
hypercross b312bf4f1f feat(tabletop): author rotation and tilt angles in degrees
Convert bgm rotation and tilt values to radians only at the three.js
boundary, so the format's angles are authored in degrees.
2026-08-10 00:11:13 +08:00
hypercross 90baa35c7c fix(bgm): hot-reload markdown definition edits
Normalize the games root to POSIX separators so the HMR path guard
matches on Windows, and watch the real on-disk markdown files (which
defMap.files omits in favor of their virtual code blocks) so edits
trigger a re-collect instead of a manual restart.
2026-08-10 00:06:43 +08:00
hypercross c5d6dff12d feat(tabletop): add tilt and zStart/zEnd stacking options
Replace the per-part lift with a local Y-axis tilt that fans the stack,
and add zStart/zEnd to ramp the stack's height across the curve so it
arches in 3D. Update the poker deck and docs accordingly.
2026-08-09 23:36:42 +08:00
hypercross 2da04940c2 fix(poker): use a realistic card thickness
A standard playing card is about 0.3mm thick, not 3mm.
2026-08-09 23:13:08 +08:00
hypercross 4727a00e26 fix(bgm): hot-reload game definition edits
Invalidate the virtual bgm module on changes under the games root so
editing a definition reloads the page instead of requiring a manual
refresh.
2026-08-09 23:13:04 +08:00
hypercross 5808e15c45 feat(tabletop): show surface bounds and lay parts flat
Add a toggleable surface plane, bounds outline, and constant-size HTML
label. Scale placement and mount anchors to world units so parts land on
the surface, and rotate parts to face up.
2026-08-09 23:04:51 +08:00
hypercross abf901418b feat(web): add tabletop scene controls
Disable auto-rotate and enable panning on the setup view, add a
fullscreen toggle, and convert the controls to iconify icon buttons.
2026-08-09 23:04:47 +08:00
hypercross d9d38c2bee fix(tabletop): key placements by surface, path, and piece
A piece can appear on more than one path of the same surface (e.g. the
poker deck expands to every card while the flop also places the ace), so
the render key must include the path to stay unique.
2026-08-09 22:46:06 +08:00
hypercross f494a6f9be feat(web): render bgm setups as a 3D table
Wire the tabletop library into the setup detail route: seed the store
from the setup, resolve the surface mount tree, and render world and HUD
surfaces. Add serializedToPackage to convert the vite-emitted package.
2026-08-09 22:46:03 +08:00
hypercross cd08e6af04 feat(tabletop): add state, setup, mounting, and stacking
Implement the tabletop library's game state store, setup seeding with
bare-type expansion, surface mount tree resolution, part placement, and
the stacking positioning process with a dependency-free SVG path helper.
Wire the public API and add unit plus vite integration tests.
2026-08-09 22:34:18 +08:00
hypercross ef0695ed04 refactor: update file paths in poker documentation
Remove the `parts/` and `setup/` prefixes from file references in
`games/poker/poker.md` to match the updated file structure.
2026-08-09 22:22:43 +08:00
hypercross 15c45e7106 refactor: share trace, error boundary, and proxy http helpers
Lift the trace-to-shape geometry into @tts/mesh (traceToShape/
traceToUvBounds), parameterized by scale so the web token viewer and
@tts/tabletop share one implementation. Move the CORS proxy HTTP helpers
(assetUrl, resolveAssetUrl, traceImage) into a new @tts/http package, and
make @tts/tabletop's ErrorBoundary the single source used by the web app.

This removes the duplicated ErrorBoundary, assetUrl, tabletopHttp, and
trace-to-shape code from apps/web and packages/tabletop.
2026-08-09 22:17:24 +08:00
hypercross b4cdcdeb42 fix(bgm): pass options arg to buildStart in unit test
Vite 8 (rolldown) changed buildStart to take (this, options), so the
test's one-arg call failed typecheck. Add an ambient declaration for the
fixture's virtual bgm modules so its entry typechecks in the editor.
2026-08-09 22:17:19 +08:00
hypercross 87e6eee9fe docs: update bgm loader status 2026-08-09 21:48:46 +08:00
hypercross 521519ce3d feat(tabletop): inject proxy handlers from web app 2026-08-09 21:46:36 +08:00
hypercross eefce5487d feat(poker): add card assets and wire them up 2026-08-09 21:46:30 +08:00
hypercross 4d14120d54 fix(proxy): wire games root into asset routes 2026-08-09 21:44:07 +08:00