Storylet Engine Unity 0.1.0
·
7 commits
to main
since this release
Added
- Shared scarcity (design/shared-scarcity.md):
SharedonDeckandCardplus
SharedCopies, so a pile (or one card) is scarce across flows rather than
one each per participant. Claims count every live flow's board; a shared
redraw: neveris spent for everyone on the first play; a finiteredraw
stays personal, because a cooldown is an absolute turn of a per-flow clock.
Two new trace verdicts,ClaimedElsewhereandTaken, because "claimed"
and "cooldown" would point a participant at their own board and their own
clock, neither of which has anything to do with it. Engine.Log()/ClearLog(): the RUN's log, every flow's events in one
order with each entry naming itsFlow. A flow's own log cannot show a
story action in another flow moving shared state. The Runtime State window
draws it under the engine's name, above the per-flow sections.- The save's shared half is now
{ props, spent }rather than a bare
PropsPartition, carrying what a shared one-shot took out of the world. - Flows (design/flows.md):
Engineowns the bundle, the shared state and
@world; aFlowis one playthrough across it, and every play verb lives
there.OpenFlow/GetFlow/Flows/CloseFlow/Resetmanage them,
re-opening a name replaces that flow, and a closed handle is inert. Named
after Patter'sEngine/Flowso a project running both engines reads the
same.StoryletBundleAsset.CreateSessionis nowCreateEngine, and
StoryletDebugkeys on the ENGINE (Register(engine, label)): the Runtime
State window asks each engine for its open flows, so a flow opened or closed
later appears and disappears without a registry call.
This REPLACES thesessionof the entries below, which was engine and
single flow in one object: everything they say about a "session" is now
split between the two, with the play verbs on the flow and the bundle,
shared state and save on the engine. - The pure C# runtime layer, transliterated from the TS reference runtime:
StoryletValue,Mulberry32(+ the contractual shuffle), the state kernel
(PropertyBag,ScopeRegistry), expression AST + evaluator + storylets
dialect + matched-constraint specificity, the compiled bundle model and
save envelope, and the fullSession(deal / dealMany with the dealt
slice, peek, play, outcomes, board, per-box turns, cooldowns, claims and
copies, the home group, hand templates with holes and the composed @hand
environment with write-back routing, ranking with stable sorts and seeded
tie shuffles, save/load with the drifted-content contract, retained log +
trace events, property rows and path-addressed get/set). - The Newtonsoft JSON layer (
StoryletEngine.Runtime.Json): compiled-bundle
loading into the pure model. - The dotnet TestHost (repo-side, never ships): replays the whole
conformance corpus (expressions, specificity, peek, scripted) through the
C# runtime. StoryletSavein the Json layer: the.storyletsavestring boundary over
the runtime's own save envelope (SerializeState/
DeserializeState/LoadState; foreign or malformed blobs throw),
mirroring the play-helpers save API.- The UnityEngine-touching runtime layer (
StoryletEngine.Runtime.Unity):
StoryletBundleAsset(raw.storyletscJSON persisted verbatim, compiled
bundle rebuilt lazily, parse failures readable onLoadError,
CreateSession(seed)), and theStoryletDebugsession registry (weakly
held,OnChangedevent) the examiner reads. - The editor layer (
StoryletEngine.Editor):StoryletBundleImporter
(ScriptedImporter for.storyletsc; a broken bundle still imports with
the error readable on the asset) and the Runtime State window
(Window > Storylet Engine > Runtime State): per-session Save/Load of
.storyletsavefiles, the type-aware property examiner / editor with
per-row reset and a ~4 Hz refresh that spares the focused control, and
read-only per-box turns + board contents. - The Board demo, as a committed Unity project beside this package
(../StoryletEngineDemo): open it and press Play, no package install and no
sample import, because its manifest references this folder by relative path.
The exported Hamlet bundle dealt onto a playable board (hands as groups,
cards as buttons, outcomes beneath their card, a transcript of every deal,
play and turn), registered withStoryletDebug. The same demo ships for
Godot, Unreal and JavaScript. It replaces theSamples~/BoardDemoUPM
sample, which is retired: one home for the demo, so the two copies cannot
drift. .metafiles for every shipped file and folder (generated by Unity
6000.4.6f1 against an embedded checkout of this package).- Live Link went to protocol v2 (design/live-link.md): a client now
attaches to the ENGINE, not to one flow.hellocarriesflows, new
flowOpen/flowCloseframes announce participants joining and leaving,
and everytraceandboardframe names itsflow. The client discovers
flows itself by diffing the engine's list before each forwarded event, so a
multi-participant run needs nothing extra from the host. The editor's Board
follows one flow at a time and remembers the last board per flow. Held to
the shared fixture inpackages/conformance/live-link/, which now scripts a
second participant opening, playing and closing. - Live Link:
StoryletLiveLink(Runtime) joins a running game to
Storyletter over a loopback WebSocket on a worker thread:Attach(engine)
streams the session's trace and board snapshots to the editor's Board,
TryReceive(drained fromUpdate()) hands back pushed bundles, which
StoryletLiveBundle.TryParsePush+Apply(Json layer) swap in under the
run, state kept;SetBuildre-hellos.StoryletDebug.RegisterLinklets
the Runtime State window show the link's state. The demo wires it behind
#if UNITY_EDITOR || DEVELOPMENT_BUILD; the TestHost replays the shared
fixture (packages/conformance/live-link/) against it. Trace events now
fire after the state they report has landed (deal, evict, play, turns), as
the reference runtime does.