DEV Community

Zugzwangstudios
Zugzwangstudios

Posted on Originally published at Medium

The Next Step for Reactive Media

Originally published on Medium.

Every medium is defined in part by how much it can respond to its audience. A book responds not at all. A film responds not at all. A game responds to what the player does, and that single property separated games from every medium before them.

Yet even the most reactive program is limited in a way that is easy to overlook. Its responses were all written in advance. A programmer anticipated a set of situations, wrote a function for each, and the program varies only in the data that flows through those functions. The function itself never changes. When the player does something nobody anticipated, the program has nothing to say.

Language models suggest a different arrangement: a program in which part of the logic is not written in advance but composed at the moment it is needed, from the context of that moment. I believe this is the next step for reactive media, and possibly for software more broadly. But the idea is easy to state carelessly, and most of its value depends on stating it precisely. This article sets out how I think such programs should be built.

The question that has to come first

If a model can produce some content while a program runs, why not produce it before release, review it, and ship it?

This question is less trivial than it sounds. Suppose a program asks a model what happens when two elements combine, and then remembers the answer so that the combination always behaves the same way afterwards. If the possible combinations can be listed, then one could ask the same model about every combination in advance, have a person review the results, and ship a table. I call this baking. Under these conditions, generating lazily while the program runs and baking everything beforehand produce the same results. They differ only in when the work is done, and baking is better in every practical respect: there is no waiting, a larger model can be used, and a person can check every entry.

So the first principle is a restriction. Wherever the situations a program will face can be listed and enumerated at reasonable cost, runtime generation adds nothing that could not have been shipped.

Runtime generation becomes genuinely necessary in only three cases:

  • The situation cannot be listed. It contains something the user makes: their own words, a drawing, a plan.
  • The situation could be listed in principle but is far too numerous. This happens when results feed back as ingredients for further results, or when what matters is the particular history of one session.
  • The situation is new since release. It refers to something that did not exist when the program was made.

A second test belongs beside the first. Programs have generated content from rules for decades without any model. A model is needed only where the right response depends on meaning: on what names, intentions and words signify, which no table of numbers captures. Only where both conditions hold (the situation cannot be baked, and the response depends on meaning) does a model give a program something it could not have had before.

The change is on the input side

The common picture is that models enlarge what a program can say: more dialogue, more variations, more content. But anything composed from a fixed set of building blocks can, in principle, be listed in advance, whoever does the composing.

What a model genuinely adds is on the other side. It enlarges what a program can hear and judge. It can accept an action nobody listed, interpret it, and translate it into terms the program's fixed systems can act on. It can assess open-ended things a person does or says: a plan, an argument, a promise.

The clearest human model for this is the game master at a tabletop game. A game master accepts any action, interprets it, and rules on it fairly under fixed rules. Computer programs have never been able to do this. Programs that accepted free input without understanding could interpret only what their parser foresaw. Systems that use a model without fixed rules can answer anything, but nothing they say has reliable consequences. The promising combination is open input, a model that interprets it, and fixed laws that decide what follows.

A prepared part and a dynamic part

The proposal is to split every system in such a program into two parts.

The prepared part is written by people in advance: the core logic, the laws of the world, the actions available, the checks every generated piece must pass, the authored beginning and endings. It is ordinary code and ordinary design.

The dynamic part both assembles and expands. It assembles by composing existing building blocks into new combinations fitted to the moment. It expands by adding new building blocks over time.

Three mechanisms hold the two together.

Typed slots. The prepared part leaves defined places where the dynamic part may act, each with a contract: what form the output must take, from which vocabulary, under which constraints. The model does not write freely into the program. It fills a typed form, and the form limits what it can say.

Laws as checkers. Everything the model proposes is checked against the program's laws before it takes effect. A proposal that contradicts what has already happened, or that would leave the user with no way forward, is rejected and repaired or replaced by a prepared fallback. Safety comes from the checker, not from trusting the model.

A write-once record. Once the program has decided how something behaves, that decision is kept. This turns generated content into a law: something the user can learn, rely on and plan around, rather than a dice roll that changes each time.

A vocabulary that grows centrally

There are two kinds of novelty, and it helps to keep them apart.

The first is a new fact expressed in the existing vocabulary: a new combination of building blocks the program already has. Small models running on the user's own machine can compose such facts quickly and cheaply, and the program can check them.

The second is new vocabulary: a new building block that extends what the program can express at all. Only this second kind truly enlarges the space of possibilities. Everything composed from existing blocks was, in a strict sense, already latent in them.

The proposal is to separate the two. A strong model runs centrally. Every copy of the program reports, from ordinary use, where its vocabulary fell short: an action that had no meaning, a combination the checker rejected, a request the local model could not express. The central system builds new vocabulary from these reports, certifies it (in a sandbox, against everything already established, and with human review) and distributes it to every copy. Facts are still composed locally, so each copy continues to develop in its own way.

Which new vocabulary should survive? Raw usage is a poor guide. The most used feature is often simply the most overpowered one, and whatever is shown most is used most. Selection should instead follow a fitness function written by the designer, built from signals the user initiates: deliberate reuse, use across many different situations, whether people return, with a penalty when one item crowds out every alternative. Selection should act on how often an item is offered, never on deleting it, so that what has already happened stays valid.

Readers who know Andrej Karpathy's description of "Software 2.0" (programs as learned weights) and "Software 3.0" (programs written as natural-language prompts) may see a resemblance. This proposal differs from both. The program remains ordinary, reviewable code, and the model never replaces it. The closest connection is the selected vocabulary, where a program's building blocks are proposed by a model and kept or set aside according to a measured objective. What is selected, however, are readable and certified pieces of a program, not weights.

The limit on such growth is not generation. A strong model can propose new building blocks quickly. The limit is certification: how fast new pieces can be checked and reviewed. That is the right place for the limit to sit.

Show, don't tell

A program of this kind should not ask its user to give instructions to an AI. Typing "make me a ladder that breathes fire" breaks the experience; it feels like watching a magician from backstage.

The proposal is therefore to read intent from what the user does, never from instructions addressed to the system. Speech is welcome only where it is itself an act within the experience: questioning a suspect, bargaining with a guard, writing a letter.

This has a consequence. A world that bends to what it thinks the user wants stops being believable; the solution should not appear wherever one looks. Inferred intent should therefore never answer the user directly. Actions receive faithful consequences from the world's laws. What the user seems to be after only decides what the world prepares next.

A program that asks without words

A reactive program need not be a passive observer. It can probe, through situations rather than questions. If you have food and someone is starving, do you share it? If you are handed a weapon, what do you aim it at? How far will you go for someone you are responsible for?

Branching stories in games have long struggled here. Authoring every path is unaffordable, so the branches converge back to the same scenes, and players notice. The proposal approaches this differently.

  • Open branching, held together by fixed structure. Coherence comes from the world's laws, a record of what has actually happened, and a fixed central problem whose resolution remains open, not from forcing every path back to the same scene.
  • The record, not only a profile. A few trait scores (compassion, ruthlessness) amount to a morality meter, and a morality meter needs no model. What a model adds is the ability to respond to the particular history: that it was this dog, which belonged to the girl you meet later; that you stole bread from the woman who now refuses you shelter. A revisable profile chooses what kind of situation comes next; the record supplies the specifics.
  • Probes never feel like tests. There is no visible meter and no labelled choice. Once people see that they are being scored, they play the score rather than themselves.
  • Two loops. A fast loop of ordinary activity keeps the experience flowing; a slow loop of considered dilemmas gives the user reason to stop and think. Deliberate choices carry more weight in what the program concludes about its user than a reflex or a slip does, although every act still has its consequence.
  • Dilemmas come from mechanics and are checked. One apple and three people who need it: scarcity produces the dilemma. Before it is shown, a checker confirms that every option is the best one for some reasonable person. If one option is obviously right, it is not a dilemma, and it is sent back.
  • Few choices, and they return. An important choice earns its pause only if its consequence visibly comes back later.
  • An authored frame. The beginning, the shapes of the endings and a few key moments are written by an author. A director decides when each moment arrives and whom it concerns. Endings are authored as theme and shape (redemption, bitter success, loss with meaning), while the specifics come from the record of what this person did. How much of the outer layer is fixed depends on the genre: a detective story fixes the crime; a survival journey fixes far less.

Where this does not help

The idea has limits, and they should be stated plainly. Where everything that matters can be listed, it should be baked. Where precise numerical balance carries the experience, a model adds risk rather than value. And an interpretation that is visibly wrong does more harm than a limited menu does: being misunderstood is more frustrating than having fewer options, so any interpretation must be shown and must be easy to correct.

Beyond games

Games are the natural starting point, because they are among the most content-rich and most reactive programs we have. But the structure is general: a prepared core of laws and checks, typed places where a model may compose, a record that turns its decisions into stable rules, and a vocabulary that grows from what users actually do, selected by goals that people write. Many kinds of software could be built this way: programs that grow through the interactions of their users, without surrendering the reliability of code written and reviewed by people.

Games moved beyond film by responding to what the player does. The next step for reactive media may be programs that respond to who their user has shown themselves to be, inside a world whose laws stay fixed and fair.

I would welcome responses from designers, programmers and researchers working on related questions.

A more detailed technical note on this architecture, including the mechanisms behind each principle, is available on Zenodo: https://doi.org/10.5281/zenodo.24729177.

Top comments (0)