Skip to content

core/universe/pack.ts ​

Generated from the exports of core/universe/pack.ts · npm run docs:gen

The universe pack (alta.universe/0.1, PLAN-V2 §2.4): a whole world as data, never code. A generated world (the world creator, lot W) or a store item gives words, colours, texts, a guide, scenes and an art direction; one parametric renderer (universes/_kit/parametric.ts, lot W) draws it. No TypeScript, no CSS, no address in a pack.

Standards that cite this file: alta.universe/0.1: universe packs

Exports ​

Fill type ​

ts
type Fill = keyof Palette | `#${string}`;

GLYPH_SHAPES const ​

ts
const GLYPH_SHAPES = ["orb", "ring", "poly", "star", "crystal", "blob", "spire", "shell", "leaf", "flame", "drop", "gear"] as const

Glyph interface ​

ts
interface Glyph {
  shape: (typeof GLYPH_SHAPES)[number];
  size: number;                          // 8 to 120
  fill: Fill; stroke?: Fill; sides?: number /* 3 to 12 */; glow?: number /* 0 to 1 */;
  spin?: number; wobble?: number;        // -1 to 1
  layers?: Glyph[];                      // at most 3, one level
}

GROUND_STYLES const ​

ts
const GROUND_STYLES = ["void", "gradient", "bands", "grid", "noise"] as const

PARTICLES const ​

ts
const PARTICLES = ["dot", "streak", "flake", "bubble", "leaf", "ember"] as const
ts
const LINK_STYLES = ["line", "dash", "dots", "wave"] as const

ArtDirection interface ​

ts
interface ArtDirection {
  schema: "alta.art/0.1";
  ground: { style: (typeof GROUND_STYLES)[number]; colors: Fill[];
            particles?: { shape: (typeof PARTICLES)[number]; count: number; drift: [number, number]; twinkle?: boolean } };
  core: Glyph; avatar: Glyph;
  agents: Record<Exclude<AgentRole, "daemon">, Glyph>;
  kinds: Record<Exclude<EntityKind, "core" | "agent">, Glyph>;
  links: Record<"flow" | "cycle" | "control", { style: (typeof LINK_STYLES)[number]; width: number; color: Fill }>;
  light?: { vignette?: number; fog?: number };
}

FONTS const ​

ts
const FONTS = ["grotesk", "serif", "mono", "rounded"] as const

SkinTokens interface ​

ts
interface SkinTokens { radius: number; border: number; panelAlpha: number; font: (typeof FONTS)[number]; caps?: boolean }

UniversePack interface ​

ts
interface UniversePack {
  schema: "alta.universe/0.1";
  manifest: UniverseManifest & { generated?: { by: string; at: string; forge: string; promptSha256: string } };
  vocabulary: Vocabulary;
  palette: Palette;
  copy: { en: Copy; fr?: Copy };
  art: ArtDirection;
  skin?: SkinTokens;
  onboarding: Onboarding;
  cinematics?: Cinematics;
}

MAX_PACK_BYTES const ​

ts
const MAX_PACK_BYTES = 256 * 1024

checkArt function ​

Problems of an art direction (empty = drawable).

ts
function checkArt(a: ArtDirection | undefined): string[]

words const ​

Lower-case words of a text (letters and digits, accents kept).

ts
const words = (s: string) => …

checkPack function ​

Problems of a pack (empty = it can be loaded). env.questUids: the game's quests; env.neutralTokens: every word of the neutral layers (core/, content/, client/): a distinctive word of the pack must not be one of them; env.otherNames: names and ids of the universes already there; env.denylist: refused names (games, studios, characters).

ts
function checkPack(pk: unknown, env: { questUids: Set<string>; neutralTokens: Set<string>; otherNames: string[]; denylist: string[] }): string[]

universeFromPack function ​

A pack as a universe: its art is drawn by the renderer the caller makes (the parametric renderer of lot W).

ts
function universeFromPack(pk: UniversePack, makeRenderer: (art: ArtDirection) => Renderer): Universe

Alta OS is open source (MIT).