Skip to content

armgit / raea

Public Imported from GitHub
0

Render Anything Engine: tell your AI what to make. Videos, motion graphics, 3D and games as React and TypeScript, rendered on your own GPU. Rust + Bevy, macOS, Linux and Windows.

ST7b: the launch lens: trouble in the viewer's words, the name, the product doing its job, a named proof, how to start; LAUNCH_PRIORS measured on 156 pairs (length by bucket, a voice), said as notes, never as causes

shinyobjectz5879f67686a0
diff --git a/sdk/story/src/index.ts b/sdk/story/src/index.ts
index e18dfec0..456803e3 100644
--- a/sdk/story/src/index.ts
+++ b/sdk/story/src/index.ts
@@ -11,7 +11,7 @@ export { tension } from "./systems/tension.ts";
export { analyze, derive, checkStory, checkWorld, unmeant, type Finding, type Level } from "./checks.ts";
export { mutants, sampleMutants, type Mutant, type Label, type Kind } from "./mutate.ts";
export { lens, readThrough, structure, labelled, type Lens, type LensResult, type Proposal, type Reading, type StageMap, type Structure } from "./lens.ts";
-export { LENSES, bernays, campbell, harmon, kishotenketsu, mckee, pas, pixar, propp, saveTheCat, storynomics, vogler } from "./lenses/index.ts";
+export { LENSES, LAUNCH_PRIORS, bernays, campbell, harmon, kishotenketsu, launch as launchLens, mckee, pas, pixar, propp, saveTheCat, storynomics, vogler } from "./lenses/index.ts";
export { sample, samples, matrix, judge, type Sampled, type SampleOptions, type MatrixResult, type MatrixRow } from "./sample.ts";
export { compileScript, compileStorylets, dramaManager, toInk, toYarn, onScreenOf, type Storylet } from "./compile.ts";
export { resolved, type RStory } from "./load.ts";
diff --git a/sdk/story/src/lenses/index.ts b/sdk/story/src/lenses/index.ts
index 9fb34553..8d74a3ee 100644
--- a/sdk/story/src/lenses/index.ts
+++ b/sdk/story/src/lenses/index.ts
@@ -4,6 +4,7 @@ import { bernays } from "./bernays.ts";
import { campbell } from "./campbell.ts";
import { harmon } from "./harmon.ts";
import { kishotenketsu } from "./kishotenketsu.ts";
+import { launch, LAUNCH_PRIORS } from "./launch.ts";
import { mckee } from "./mckee.ts";
import { pas } from "./pas.ts";
import { pixar } from "./pixar.ts";
@@ -12,5 +13,5 @@ import { saveTheCat } from "./save-the-cat.ts";
import { storynomics } from "./storynomics.ts";
import { vogler } from "./vogler.ts";
-export { bernays, campbell, harmon, kishotenketsu, mckee, pas, pixar, propp, saveTheCat, storynomics, vogler };
-export const LENSES: Record<string, Lens> = { mckee, pixar, storynomics, pas, campbell, vogler, harmon, "save-the-cat": saveTheCat, kishotenketsu, propp, bernays };
+export { bernays, campbell, harmon, kishotenketsu, launch, LAUNCH_PRIORS, mckee, pas, pixar, propp, saveTheCat, storynomics, vogler };
+export const LENSES: Record<string, Lens> = { mckee, pixar, storynomics, pas, campbell, vogler, harmon, "save-the-cat": saveTheCat, kishotenketsu, propp, bernays, launch };
diff --git a/sdk/story/src/lenses/launch.ts b/sdk/story/src/lenses/launch.ts
new file mode 100644
index 00000000..ee659aec
--- /dev/null
+++ b/sdk/story/src/lenses/launch.ts
@@ -0,0 +1,62 @@
+// The launch film: the trouble in the viewer's own words, the name, the product doing its job, a named proof, how to
+// start. Its priors are measured (docs/story.md, "What it found"): 156 same-account pairs of launch films on X, the
+// better of each pair against the worse. Only length held up there, and length goes with the size of the news, so the
+// priors are norms of the films that won, said as notes, never as causes or errors.
+import { finding, lens, type Proposal } from "../lens.ts";
+import type { Finding } from "../checks.ts";
+import { beatsWith } from "./common.ts";
+
+/** What the launch pairs measured (11-22, ~/.vd/launch, tools/compare.py and the blind read). */
+export const LAUNCH_PRIORS = {
+ pairs: 156,
+ seconds: { better: { q1: 30.5, median: 50.5, q3: 80.3 }, worse: { q1: 24, median: 33.1, q3: 56 } },
+ /** how often a film of this length was the better of its pair */
+ betterByLength: [
+ { upTo: 20, share: 0.39 },
+ { upTo: 40, share: 0.35 },
+ { upTo: 60, share: 0.55 },
+ { upTo: 90, share: 0.64 },
+ { upTo: Infinity, share: 0.73 },
+ ],
+ voice: { better: 0.4, worse: 0.29, p: 0.043 },
+ lengthSignTest: { higher: 104, of: 155, p: 0.0001 },
+} as const;
+
+export const launch = lens({
+ name: "launch",
+ about: "The trouble in the viewer's words, the name, the product doing its job, a named proof, how to start; priors measured on 156 launch pairs.",
+ stages: ["trouble", "name", "works", "proof", "start"],
+ read: (_w, s) => {
+ const f: Finding[] = [];
+ const p: Proposal[] = [];
+ const n = s.beats.length;
+ const down = (t: Record<string, number>) => Object.values(t).some((d) => d < 0);
+ const branded = beatsWith(s, s.brand);
+ const trouble = s.beats.find((b) => down(b.turns) && !branded.includes(b));
+ const name = branded[0];
+ const works = branded.find((b) => s.focusTurn(b.turns) > 0);
+ const proof = s.beats.find((b) => b.beat.shows.some((e) => (s.events.find((x) => x.key === e)?.ev.proof ?? []).length > 0));
+ const start = n > 1 && s.beats[n - 1] !== trouble ? s.beats[n - 1] : undefined;
+ const map = { trouble: trouble ? [trouble.key] : [], name: name ? [name.key] : [], works: works ? [works.key] : [], proof: proof ? [proof.key] : [], start: start ? [start.key] : [] };
+
+ if (!trouble) {
+ f.push(finding("launch:trouble", "warn", "story", "no trouble: nothing goes wrong for the viewer before the product", "open on the problem in the viewer's own words"));
+ p.push({ stage: "trouble", onScreen: `${s.hero ?? "the viewer"} stuck on the problem today`, feel: "recognition", why: "a launch is read as an answer only after the question" });
+ } else if (trouble.index > Math.floor(n / 3)) f.push(finding("launch:trouble", "note", trouble.key, `the trouble comes at beat ${trouble.index + 1} of ${n}`, "say it in the first third"));
+ if (!s.brand) f.push(finding("launch:name", "note", "story", "no agent has the brand role, so the product is never named", "give the product's agent role: brand"));
+ else if (!works) f.push(finding("launch:works", "warn", name?.key ?? "story", "the product never does its job on screen", "show it working on the viewer's problem"));
+ if (!proof) {
+ f.push(finding("launch:proof", "note", works?.key ?? "story", "no named proof: no claim the story makes true (a number, a benchmark, a customer)", "back the claim with a fact the story shows"));
+ p.push({ stage: "proof", after: works?.key, onScreen: "the number that proves it", feel: "trust", why: "the better launches named their proof" });
+ }
+
+ // the measured priors, as notes: length (when every beat says how long it is) and a voice
+ const secs = s.beats.every((b) => typeof b.beat.seconds === "number") ? s.beats.reduce((a, b) => a + (b.beat.seconds as number), 0) : null;
+ if (secs !== null) {
+ const L = LAUNCH_PRIORS.seconds.better, at = LAUNCH_PRIORS.betterByLength.find((x) => secs <= x.upTo)!;
+ if (secs < L.q1) f.push(finding("launch:length", "note", "story", `${secs.toFixed(0)} s: shorter than three in four of the launches that did better (median ${L.median} s); films this long were the better of their pair ${Math.round(at.share * 100)}% of the time`, "length goes with the size of the news; cut nothing to fit and pad nothing to reach it"));
+ }
+ if (!s.beats.some((b) => (b.beat.says ?? []).length > 0)) f.push(finding("launch:voice", "note", "story", `nobody speaks: ${LAUNCH_PRIORS.voice.better * 100}% of the better launches had a voice, ${LAUNCH_PRIORS.voice.worse * 100}% of the worse (p = ${LAUNCH_PRIORS.voice.p}, not significant across 23 measures)`, "a founder or a voice saying why can help; it's not required"));
+ return { map, findings: f, proposals: p };
+ },
+});
diff --git a/sdk/story/test/lenses.test.ts b/sdk/story/test/lenses.test.ts
index c471ed90..9b701044 100644
--- a/sdk/story/test/lenses.test.ts
+++ b/sdk/story/test/lenses.test.ts
@@ -80,3 +80,10 @@ test("a beat can mean a finding: a breather the journey wants", () => {
const meant = { ...launch, world, tellings: { "30s": [t[0], t[1], { ...t[2], meant: before.map((f) => f.check) }, t[3]] } };
expect(checkStory(meant as typeof launch, "30s").filter((f) => f.about === "b2")).toEqual([]);
});
+
+test("the launch lens reads the launch fixture and says its priors as notes", () => {
+ const [r] = readThrough(launch, [LENSES.launch], "30s");
+ expect(r.passes).toBe(true);
+ expect(r.map.trouble.length + r.map.works.length).toBeGreaterThan(0);
+ expect(r.findings.every((f) => f.level !== "error")).toBe(true);
+});