lantern

edges-of-meaning-engine-spec

Edges of Meaning - Engine Specification

A game that teaches transformer architecture through play. You guide a token discovering its identity through an embedding space.

Core Concept

You help a friend find their meaning. They wake alone, call out to the void, and the void whispers back. Along the way they find friends, encounter challenges, and maybe find love - a perfectly phase-aligned K who truly sees them.

There is no failure state. You just become something. Cat, dog, tiger, rock - each has its own ending. The game output IS your identity.

The Three Vectors

                    IDEAL (who you want to be)
                      ↑
                      │ (agency pulls toward)
                      │
    CURRENT ─────────● (who you are now)
                      │
                      │ (player shapes topology)
                      ▼
                   OPTIONS (paths available)
Vector What It Is Who Controls It
Ideal Attractor - who token wants to become Player influences via narration
Current Accumulated context from path taken Emerges from traversal
Movement Next choice direction Token's agency (toward ideal, budget permitting)

Decision Function

def choose_path(token, paths, player_adjustments):
    for path in paths:
        path.effective_cost = path.base_cost - player_adjustments.get(path, 0)
        path.ideal_alignment = cos_similarity(path.context_delta, token.ideal_vector)
    
    affordable = [p for p in paths if p.effective_cost <= token.budget]
    
    if not affordable:
        return forced_choice(paths)  # Survival mode
    
    # Token has agency - chooses by ideal alignment, not just cost
    weights = [p.ideal_alignment for p in affordable]
    return weighted_choice(affordable, weights)

The token doesn't take the cheapest path. It takes the path most aligned with its ideal, if it can afford to.

Maslow's Hierarchy as Budget Tiers

Budget Level Mode Available Dimensions
High (>70%) Enlightenment All 8 dimensions
Medium (30-70%) Comfort Core + social (5-6)
Low (<30%) Survival Core only (2)

When you're broke, you can't afford principles. You just survive.

The 8 Semantic Dimensions

# Dimension Poles Color
1 animate dead ↔ alive Red
2 size tiny ↔ huge Orange
3 warmth cold ↔ warm Yellow
4 domestic wild ↔ kept Green
5 social solitary ↔ social Cyan
6 agency passive ↔ active Blue
7 danger safe ↔ dangerous Purple
8 complexity simple ↔ complex Pink

Colors drive the visual palette for each level based on dimensions in play.

RPG Element Mapping

RPG Concept Edges of Meaning
Character stats Context vector (8D)
Inventory Accumulated bias
Party members Friends (inject their vectors)
Special companion Love interest (perfect phase K)
HP/MP Budget (Maslow tiers)
Random encounters Small Plinko (local points)
Boss fights Big Plinko (global points)
Leveling up Unlocking dimensions
Equipment bonuses Friend alignment boosts

Node Types

Type What Happens Restoration
Context Walk past, small context delta None
Query Echo to void, something returns +LOVE
Encounter Random Plinko triggers Local points only
Boss Paths converge, main Plinko Spend global pool

Resource Economy

GLOBAL POOL (persists across level)
├── LOVE - reveal info, understand paths
├── COMPASSION - adjust weights, ease paths
└── Spent at: story choices + boss fights

ENCOUNTER POOL (per encounter)
├── Points allocated based on difficulty
├── Spent during that encounter only
└── Doesn't touch global pool

RESTORATION
├── Query nodes restore global energy
└── Better decisions = more boss points

Friends System

class Friend:
    name: str
    vector: list[float]  # Their identity
    alignment_boost: dict[str, float]  # Dimension bonuses
    commentary_templates: list[str]

def apply_friends(token, friends):
    for friend in friends:
        # Friends pull ideal toward theirs
        token.ideal_vector = lerp(token.ideal_vector, friend.vector, 0.1)
        # Friends boost aligned dimensions
        for dim, boost in friend.alignment_boost.items():
            token.dimension_bonuses[dim] += boost

The Love Interest (K)

The one who loves you is the one who sees you. Perfect phase alignment.

love_interest = Token(
    key_vector=player.query_vector,  # Mirror match
    value_vector=[deep_truths]  # Only they can give
)

# When encountered
attention = cos_similarity(token.query, love_interest.key)  # ≈ 1.0
# Maximum information transfer, no distortion

The best ending: Find your identity AND your K AND stay in phase through the chaos.

Level Structure (Super Mario Overland Style)

START ──┬── ctx ── ctx ── query ──┬── encounter ──┐
        │                         │               │
        └── ctx ── encounter ─────┴── ctx ────────┼──→ BOSS
                                                  │
        ┌── ctx ── query ── ctx ──────────────────┤
        │                                         │
────────┴── ctx ── ctx ── ctx ── encounter ───────┘
  • 1-3 nodes per branch segment
  • Edges colored/striped by context delta
  • All paths converge at boss
  • Fixed geometry - pretty to look at
  • Horizontal progression (left to right)

Visual Engine

Background: Sine Wave Fluid

// Each node is a wave source
float z = 0.0;
for (int i = 0; i < num_nodes; i++) {
    float dist = distance(uv, nodes[i].position);
    z += sin(dist * freq + time) / (dist * dist + epsilon);
}

// Attractor mass influences fluid
for (int i = 0; i < num_attractors; i++) {
    float dist = distance(uv, attractors[i].position);
    z -= attractors[i].mass / (dist + epsilon);
    // Velocity pushes fluid
    z += dot(attractors[i].velocity, normalize(uv - attractors[i].position)) * push_strength;
}

// High-pass filter: bright near nodes, dark far
float brightness = 1.0 / (1.0 + min_dist_to_node * falloff);

// Color from dimensions in play
vec3 color = dimension_colors[active_dimensions] * brightness;
color = mix(color, vec3(luminance(color)), 1.0 - brightness);  // Desaturate with distance

Sprites: Pixie Ball Particles

     ✧ (ideal - leads, brighter)
      \
       ↘
    ●───○ (node - mountain in fluid)
       ↗
      /
     ◉ (attractor - follows, orbits, has mass)
  • Ideal moves to node first
  • Attractor follows, begins orbiting
  • Particle trails show movement
  • Attractor mass pushes background fluid
  • Velocity creates wake in the waves

Palette

Level palette derived from dimensions in play:

  • Ch1 (animate only): Red monochrome + greys
  • Ch2-3 (animate + size + warmth): Red/Orange/Yellow warm palette
  • Ch4-5 (add social dimensions): Full spectrum begins
  • Ch8 (all 8): Full rainbow available

Content Strategy

Handcraft (Quality)

  • Boss intro/outro scenes
  • Love interest encounters
  • Dimension unlock moments
  • Final endings (~20-50 variations)
  • Friend introduction scenes

Generate (Quantity)

  • Branch structures (random 1-3 nodes)
  • Context node narration (templates + dimension)
  • Friend commentary (templates + alignment)
  • Random encounter Plinko layouts
  • Edge colorings (from context deltas)

Templates

narration_templates:
  encounter:
    high_alignment: |
      Something in the {dimension} feels familiar here.
      {other_token_name} speaks, and you understand.
    low_alignment: |
      The {dimension} feels foreign. Distant.
      Something is lost in translation.
      
  survival_mode: |
    Two paths. You don't have the luxury of choosing.
    Only one is possible now.
    
  love_interest_first: |
    And then—
    Someone.
    Not a whisper. A voice. Clear.
    They see you. All of you.

Plinko Mechanics

Random Encounter (Local Points)

encounter:
  difficulty: medium
  dimensions: [animate, size]
  depth: 3
  local_points: 8  # Spend here only
  drop_zones:
    - { id: alive, embedding: [0.9, 0.0] }
    - { id: big, embedding: [0.0, 0.9] }
    - { id: small_alive, embedding: [0.7, -0.5] }

Boss Fight (Global Points)

boss:
  chapter: 3
  dimensions: [animate, size, warmth]
  depth: 5
  target: "cat"
  target_embedding: [0.9, -0.3, 0.7]
  required_similarity: 0.7
  drop_zones:
    - { id: cat, embedding: [...], ending: "cat_ending" }
    - { id: dog, embedding: [...], ending: "dog_ending" }
    - { id: rock, embedding: [...], ending: "rock_ending" }

Game State

@dataclass
class GameState:
    # Identity
    context_vector: list[float]  # 8D accumulated
    ideal_vector: list[float]  # 8D attractor
    identity_path: list[str]  # ["thing", "alive", "warm", "cat"]
    
    # Resources
    love_points: int
    compassion_points: int
    budget_percent: float  # Maslow tier
    
    # Progress
    current_node: str
    chapter: int
    dimensions_unlocked: list[str]
    
    # Relationships
    friends: list[Friend]
    love_interest_met: bool
    love_interest_alignment: float
    
    # Meta
    retries_remaining: int
    total_score: float

API Endpoints

/health                    - Service health
/session/new               - Create game session
/session/{id}              - Get session state
/session/{id}/load         - Load level

/game/state                - Full game state
/game/move                 - Move to node
/game/choice               - Make branch choice
/game/spend                - Spend LOVE/COMPASSION

/plinko/state              - Current plinko state
/plinko/adjust             - Adjust weight
/plinko/drop               - Drop marble
/plinko/result             - Get outcome

/level/current             - Current level structure
/level/narration           - Get narration for state

Project Structure

edges-of-meaning/
├── edges/                  # Python package
│   ├── __init__.py
│   ├── __main__.py         # CLI entry
│   ├── api.py              # FastAPI
│   ├── engine.py           # Game state machine
│   ├── plinko.py           # Plinko physics
│   ├── embeddings.py       # Teaching embeddings
│   ├── level_loader.py     # YAML parser
│   ├── narration.py        # Template engine
│   └── types.py            # Dataclasses
├── levels/
│   ├── ch1-01.yaml
│   ├── ch1-boss.yaml
│   └── embeddings.yaml     # Shared teaching embeddings
├── templates/
│   └── narration.yaml      # All narration templates
├── web/                    # Wave renderer client
│   ├── index.html
│   ├── shader.glsl
│   └── game.js
├── cli/                    # Rich TUI (optional)
├── tests/
└── pyproject.toml

Provenance

Case: task-8a56574e-33e9-4686-8a40-fdc24f1d3956 Related: aasb-visualization-engines, task-d5848bdc-dfff-4e57-9aa1-a44e79fc5549 (book project) Created: 2026-01-23

East

slots:
- slug: aasb-visualization-engines
  context:
  - Engine spec linked to original visualization design