Skip to main content
Make the king laugh. With your voice. You are a jester on a trapdoor, with one minute and a microphone. The king hears you, answers, and is not amused. Fill his laughter meter and you are pardoned; run out of time and the trapdoor opens. It is a Godot game with one conversation in it, and shows a structure that works for many: the model acts, the game keeps score. This page is its architecture. The code samples are cut down to the idea.
Play it in your browser at lokutor.com/games/not-amused, with no key and no download: a Godot web export, made as Games in a web browser explains.

The pieces

Only the king is a session, and only while a round is being played.

The king

The persona says who he is, how short to be (one or two sentences, twenty words at most), and one rule: call react first, then answer aloud.
react is the hinge of the whole game. The model is a good judge of jokes and a bad accountant, so it gives an opinion and the game turns it into points:
  • The action and its rules are given to him after his greeting, with add_action and set_persona: before, his persona has only who he is and how he opens.
  • The names of the reactions are not words he could take for a tag. With bored and snort among them he sometimes wrote [bored], and a bracket that is not one of the expression tags is read aloud.
  • unfinished_joke is for a joke that is not over (Three men walk into a castle…). It gives no points, and the answer is a word or two: And?
  • speak_before_actions is off: with an action that comes before any word, what the model writes first can be its plan (so I call react first).
  • It is called before he speaks, so the snort, the guards trying not to laugh and the points appear while his answer is still being made.
  • What it returns directs the next sentence. The king laughs because the game told him to, at the moment the meter is full.
  • A value that makes no sense is clamped. An action that does not apply any more says so (The lever is stuck.).

Facts of the moment

Two facts change during a round, and both go in context: how close he is to laughing, and, when the clock is nearly out, that he should hurry the jester. He used to know the seconds left, and said them in every answer.

The clock is the jester’s

The minute runs only while it is the player’s turn: not while the king speaks or thinks, and not while a guard whispers. Latency costs the player nothing, and a long answer from the king is not a punishment.
When it runs out, the game waits until nobody is talking, and the king’s written line closes the round.

States move the body

state_changed drives the stage and nothing else does: On top go the layers: a mood from react, eased by a spring, whose mouth fades to 30% while he speaks; blinks and glances; springs on belly and crown; visemes. The squash of each reaction is one line.

The guards

They say written lines, fetched while the title screen is up, so a hint starts the moment it is needed:
A hint comes when the player has been silent for several seconds and the king is waiting. It is also how the game teaches itself, without a tutorial.

The player on screen

The jester’s mouth opens with the microphone’s level, and so do a meter on screen and the energy of the body. Seeing yourself heard answers the first question of every voice game.
The bubble with what was understood comes from player_said, and the king’s from character_said.

Echo

With headphones the microphone stays open while the king talks; with speakers he would hear himself and stop. The game finds out which: while he greets the jester, mute_mic_while_speaking is on, and the loudness of the microphone is compared with agent.voice_level() at every delay up to half a second. If they rise and fall together, it is his own voice, and the microphone keeps closing while he talks. A key says it by hand.

Interrupting a king

character_interrupted says that the player cut the character off, and what was heard of the reply. The king takes it badly: his face and body at once, and his words when he answers, because the game tells him what happened.
The fact is taken out with null once he has said it. A player who answers on the last word has not cut anybody off: compare what was heard with the whole reply (transcript_truncated of agent.client has both). Nor has one who goes on in his first second and a half: they had only paused in the middle of a joke, and it was the king who spoke too early. He is told that what comes is the rest of it.

Nine languages

A prompt in one language and a conversation in another leak into each other. When the player chooses a language, everything that the king reads changes with it: the persona, what his actions say and answer, the facts of the moment (set_context) and the line above them (context_heading). Names of actions, values of enums and tags are code, and stay.

Assets

Every character is built by code and exported as GLB with the 15 visemes and the same set of expressions; contact sheets of every shape are drawn after each build. See Asset pipeline.

Testing it

A round is played from a script in the game’s own code path: lines for the jester, and what the king does with each (react with a number, then a sentence). Played against a mock server it is a test; played in front of the camera, it is how a trailer is recorded.

Make your own

The same structure, with other words: a suspect who cracks (react is suspicion), a bouncer to talk past (react is patience), a date (react is interest). One agent, one action that gives an opinion, one number the game owns, and an ending the game decides.