Before the story begins, The Beach Mystery asks you five questions. The answers you provide are stored as named variables in the game state and substituted directly into story text wherever a matchingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/apursley2012/the-beach-mystery/llms.txt
Use this file to discover all available pages before exploring further.
{placeholder} appears. This means the chest holds the exact jewel you named, the watch beside it shows your favorite cartoon character, and the island guardian takes the form of your favorite animal — the story speaks to you, not just about you.
How Substitution Works
When you complete the personalization questions, your five answers are saved into thevariables object inside the game state alongside a formatted_time value stamped at the moment you begin:
interpolate function before it is rendered on screen. The function replaces each {placeholder} token with the corresponding variable value (or a fallback if the value is missing):
The Five Questions
Each question has anid that maps to a variable key, a label shown on screen, a placeholder shown inside the text input, and a hint explaining how the answer will appear in the story.
1 · firstName — Your name
1 · firstName — Your name
| Field | Value |
|---|---|
| ID | firstName |
| Label | What is your first name? |
| Placeholder | Enter your name… |
| Hint | Used to greet you at the start of your adventure. |
| Fallback | traveler |
"Hello, {firstName}!") and is woven into narration throughout the adventure to address you directly.2 · favoriteColor — Colors the jewel
2 · favoriteColor — Colors the jewel
| Field | Value |
|---|---|
| ID | favoriteColor |
| Label | What is your favorite color? |
| Placeholder | A color that catches your eye… |
| Hint | Colors the jewel you may discover. |
| Fallback | blue |
"you find an old treasure map and one brilliant {favoriteColor} {favoriteJewel}." It also describes the jewel’s glow inside the cave and on the island.3 · favoriteAnimal — The cave and island guardian
3 · favoriteAnimal — The cave and island guardian
| Field | Value |
|---|---|
| ID | favoriteAnimal |
| Label | What is your favorite animal? |
| Placeholder | A creature you love… |
| Hint | May appear during your adventure. |
| Fallback | cat |
{favoriteAnimal} sleeps beside the treasure under the oak tree. In the cave’s right passage, a {favoriteAnimal} curled in a cozy den becomes the guardian that shows you the way out.4 · cartoonChar — On the watch face
4 · cartoonChar — On the watch face
| Field | Value |
|---|---|
| ID | cartoonChar |
| Label | Who is your favorite cartoon character? |
| Placeholder | A character you adore… |
| Hint | Featured on the watch you check beside the chest. |
| Fallback | Mickey |
"You brush the sand from its heavy lid and glance at your {cartoonChar} watch." It is a small, playful detail — but it grounds the moment in your world.5 · favoriteJewel — Inside the pirate's chest
5 · favoriteJewel — Inside the pirate's chest
| Field | Value |
|---|---|
| ID | favoriteJewel |
| Label | What is your favorite jewel? |
| Placeholder | A gemstone you treasure… |
| Hint | The jewel hidden inside the pirate chest. |
| Fallback | ruby |
Example Substitution
A raw story line before substitution:interpolate runs with favoriteColor = "crimson" and favoriteJewel = "ruby":
Fallback Values
Every placeholder has a fallback string used when the variable is empty or missing. This ensures the story remains grammatically complete even if a field was skipped or the game state was loaded from a partial save.| Variable | Fallback |
|---|---|
{firstName} | traveler |
{favoriteColor} | blue |
{favoriteAnimal} | cat |
{cartoonChar} | Mickey |
{favoriteJewel} | ruby |
{formatted_time} | 12:00 |
formatted_time is not a question — it is set automatically to the current HH:MM clock time at the moment you click Begin Adventure →. It appears in the chest discovery scene when you glance at your watch. There is no question for it and no user-facing input.Tips for Best Results
For Developers: Where Substitution Lives
The interpolation function is defined inline inside the/play page component (main.js) and called on every narration line as it is revealed during the typewriter animation:
data/story.js use the raw {placeholder} tokens and are never pre-interpolated. This keeps the story data clean and makes it straightforward to add new variables: add the question to PERSONALIZATION_QUESTIONS, add the variable to the startGame call in useGameState.js, add a .replace() call to interpolate, and use the new {placeholder} token anywhere in STORY_NODES.
Variable values are stored in
gameState.variables and are included in the localStorage save snapshot under beach-mystery-save. If a player saves mid-story and resumes later, all five personalization values are restored from the saved state and substitution continues exactly as before.