How to Build a Text Adventure Game Powered by Claude and PartyRock

How to Build a Text Adventure Game Powered by Claude and PartyRock

My journey to build a text adventure game powered by LLM.

Published Feb 24, 2024

The Enchanted Grove


A text adventure game, or interactive fiction, relies on text for input and output. Players engage with the game by reading text descriptions and typing commands. These games lack graphics, encouraging players to use their imagination to visualize the environments and characters.
The genre emerged in the late 1970s and gained popularity in the 1980s due to limited computer capabilities. Despite the absence of elaborate visuals, text-based games thrived on players' imagination and logical thinking.
With improved graphics in gaming, text adventures declined in the late 1980s and were nearly forgotten in the 1990s. However, a revival occurred in the 2010s, driven by tools facilitating text-based game creation.
Text adventure games excel in storytelling, offering intricate plots, developed characters, and immersive worlds. The absence of graphics allows players to fully engage with the narrative, fostering deeper exploration of themes. The reliance on text descriptions encourages players to visualize the game world, resulting in personalized experiences.
Despite their storytelling prowess, text-based games face a drawback. Subsequent playthroughs may feel repetitive as the static narrative remains unchanged. The pre-written text descriptions, dialogues, and events limit long-term replayability, impacting some players.


Large Language Models (LLMs) exhibit the capability to generate varied text for a given prompt, making them non-deterministic. Repeatedly using the same prompt results in diverse outputs, a feature beneficial for obtaining varied responses in creative writing and idea generation.
This characteristic, while advantageous for creating distinct text descriptions, dialogues, and events in each game session, poses a challenge in maintaining narrative control. Ensuring a consistent storyline amid slight variations in scenes and guaranteeing the delivery of essential information to the player becomes a complex task.
Addressing this challenge became imperative during my work on the Enchanted Grove game, a text adventure powered by Claude, a Large Language Model (link). The game is hosted on the PartyRock platform by AWS (link). Managing the balance between dynamic storytelling and preserving key plot points presented a unique set of hurdles in this creative endeavor.


Excited about this challenge, I tackled the task in three stages.

Stage 1. Write the plot.

I envisioned a friendly game set in a fantasy world, drawing inspiration from the enchanting realms depicted in the works of Hayao Miyazaki (Link). His films often transport audiences to magical worlds filled with mythical creatures, spirits, and enchanting landscapes. The fantastical elements are blended seamlessly with real-world issues and emotions. His characters are not divided into good and bad forces. Rather they all have their own agenda and point of view. Miyazaki's characters are often multi-dimensional, with both positive and negative traits. He explores moral ambiguity and the complexities of human nature, avoiding simplistic portrayals of good versus evil. 
The story of Enchanted Grove unfolds as Aria discovers a mystical door in the forest. Players guide Aria's journey, meeting delightful creatures and facing the looming threat of the Shadow Weaver. Along the way, Aria discovers her own magical abilities. In a crucial moment, players decide whether to bring healing or consequences. The narrative beautifully culminates in a choice that either restores harmony or leads to a darker outcome. It's a captivating adventure where every decision shapes Aria's destiny in this enchanting world.

Stage 2. Write a prompt.

With the story in place, I delved into creating the prompt. Breaking down the narrative into a series of scenes, each scene received a well-structured description. For instance:

Lost in the Forest.
Aria got lost in the forest. The game is over. If the character comes to this scene do not give her new information and just keep repeating that the game is over.
The character can only go back to the first scene.

This made things clearer, helping me explain the plan to Claude. Once I nailed down the plot structure, I took some time to jot down casual instructions for Claude, telling it how to roll with the plot and chat with the users.

Stage 3. Testing and tweaking.

After getting the prompt ready, I started testing the game. At first, the LLM tended to stray from the plot and create its own story. While it was interesting, my goal was to ensure Aria follows the plot and encounters the Shadow Weaver, leading to her ultimate choice - either fighting or assisting the character for healing. Through a few iterations, adjusting scene descriptions and providing clear instructions to Claude, I managed to make sure that Claude consistently offered players options leading them in the intended direction.

Community impact

The Enchanted Grove isn't just a game; it's a journey that imparts crucial life lessons, notably focusing on friendship and compassion.
As players guide Aria through the magical realms of the Grove, they encounter characters and situations mirroring the complexities of human relationships. Friendship becomes a recurring theme, emphasizing the beauty of diverse connections formed with the Grove's delightful inhabitants.
Compassion is another key element, especially when facing the threat of the Shadow Weaver. Players must make moral choices, highlighting the game's exploration of empathy and ethical decision-making. The narrative subtly communicates that every choice matters, fostering a sense of empathy that transcends the digital realm.
In a gaming landscape often centered on competition, The Enchanted Grove stands out as a virtuous experience. It invites players to reflect on the impact of their choices, instilling values that extend beyond the screen. The game becomes a powerful tool for personal growth, offering more than just entertainment.
In essence, The Enchanted Grove is a compassionate odyssey, inviting players to embrace the transformative power of friendship and compassion. Through its enchanting narrative and meaningful choices, the game inspires players to carry these invaluable lessons into their own lives.

Final results and learnings

And there you have it – the thrilling journey of crafting an intriguing text adventure game! I'm thrilled with the result, and I can confidently say this game is far from your ordinary experience. It's designed to keep you coming back for more, with surprises and excitement waiting at every turn.
Through this creative challenge, I picked up some invaluable skills. I mastered the art of constructing extensive and complex prompts, each over 1000 words long. Wrangling the behavior of the Large Language Model became second nature, all while maintaining that perfect balance of flexibility in its responses.
I'm eager for you to jump in and enjoy the game. It's not just a conclusion – it's an invitation to embark on an adventure of your own. So, what are you waiting for? Let the gaming begin! 🎮✨
Try it here: Enchanted-Grove