Put the player's own name into the story without ugly surprises
Letting the player type a name makes the story feel personal, until someone enters nothing, a very long string, curly brackets or a name that ends in s. Here is how to clean the input, fill the text once, and fail loudly when a placeholder has no value.
Why this works
Whatever a person types is a stranger walking into your text. Cleaning it once at the door and filling the text in a single pass means nothing the player enters can be mistaken for an instruction or fill itself in again.
When not to use it
Skip it when the hero has a fixed name, or when the language bends names heavily, as many do. Forcing a possessive rule onto those reads badly. Then phrase around the name, or let the player pick from a short list of names.
In the full entry
- What to build, step by step
- Starting values and the reason for each
- 3 common mistakes and the fix
- A diagram of every state
- 29 lines of example code with 4 checks that pass
- How your AI shows you that it works
Say this to your AI
Use the Spielerando entry "Put the player's own name into the story without ugly surprises" (read_entry player-name-in-text-without-surprises) in my game. Build it step by step, and show me how you checked that it works.Or skip this and connect the MCP: your AI then finds all of this by itself.Connect the MCP