ChatMaster - Our agent, your story
An application capable of creating an RPG game from any type of scenario, reference, or context in seconds is only possible thanks to recent advances in LLM (Large Language Model).
And that was our challenge: to develop an RPG master ready to generate scenarios and adventures tailored to the player's suggestions, using a combination of a game engine and an LLM agent with short, medium, and long-term memory capabilities. For this first prototype, we relied on the OpenAI API and Chat-GPT 3.5 Turbo.
The RPG Game
As with any AI-related problem, we need to be meticulous and pay attention to details that optimize the process and facilitate the challenge of building something in a short time.
An RPG game has a simple structure but presents two complex challenges for LLMs: attention to details and progressive story building. In other words, the LLM cannot invent or hallucinate information that breaks the sense or linearity of the story being told.
A simple example is a battle that, if won, generates an item for the player. If at any point the battle does not seem natural to the story, or the use of the item does not make sense, the game quickly becomes uninteresting.
An RPG game has various elements that go beyond the capabilities of an LLM model. Long-term memory, dynamic contexts, calculations and mathematics, data, and careful attention to details are some of the many challenges to be overcome.
Which brings us to our first solution: gameplay.
How Does the Game Work?
We created the game in three different stages:
In each stage, the application receives user input, performs all calculations resulting from the move, and creates a prompt with the following elements:
From this prompt, the model generates the necessary elements for the continuation of the game, telling the story in small steps and allowing the user to participate in the plot, adapting to external inputs.
This organization allows the model to focus on creative challenges, control the narrative, and minimize errors and hallucinations.
LLM Model Parameters
Obviously, as it is a story, we want parameters with high standards of creativity and randomness in plot choices. Since we have functions for narrative control in the game engine, we can select high values for temperature and top-p:
Another important factor is the context window. We need this parameter to be adaptable to the game's moment and not allow the narrative to get out of control. Consequently, each scenario has its own prompt structure.
"Generate a full and detailed story new text based on the settings between <> bellow" <{game_settings_json}>"
领英推荐
“With the main goal of the game in mind, create an the exploration scenery for the user based on the settings of the RPG game between <> bellow <{game_settings_json}> Still following the main goal of the game, create a short description of the first iteration of the player in this exploration scenery you created and fill in the first_iteration parameter. This exploration plot and the first iteration must NOT include any battles or any items to collect, only paths and places. This exploration plot does not need to be peaceful, it can be dangerous and hard to pass through.”
“Using the main goal of the game and based on its properties between <> bellow <{game_settings_json}> And using the current situation of the game between <> bellow <{current_situation}> Create a text with a new situation where the user did not win or lost but remains in the battle.”
Finally, we control the number of tokens in the prompt and the model's output. In both cases, the challenge is to maximize performance (the best possible story) while saving tokens.
This is relevant not only to save resources, as the API charges per token, but also to minimize memory errors. The more concise the problem, the easier its correct resolution. Therefore, we limit the text output generation as follows:
This way, besides avoiding errors, we also make the game more dynamic and interactive.
Other parameters, such as frequency or repetition penalties, were set aside in this prototype. To learn more about LLM model parameters, [visit Learn More].
Structure
Given that this is a proof of concept, we used a simple structure capable of delivering a personalized text adventure on the web. One of the main elements used was the agent structure, in which prompts are customized according to the specifications and needs of the round.
Since, in general, LLM models have difficulty managing complex systems, we developed an engine capable of controlling all game variables, so that the LLM model receives only a personalized prompt, whose main purpose is creativity.
That way, user inputs, health points, dice rolls, attacks and defenses, items, and other elements are controlled by the game engine, leaving the LLM only with the creative and contextual tasks of the game, providing the user with all the natural elements of an RPG mastered by a human.
Monetization
LLMs are expensive. Even using our own model, offering the game for free would be a considerably high cost. This is not to mention the many features we are planning for the future, such as images, narrations, and different types of gameplay, which also depend on generative AIs and add to the high operational cost.
The solution? A "Freemium" model, where the game is free in its basic version and paid in its complete version. By providing a user base, it is possible to implement a viable and financially sustainable system, funded by loyal subscribers who pay for the complete experience we provide.
This way, it is possible not only to make the initiative viable as a whole but also to sustain continuous development, capable of effectively delivering a quality game, with incremental features and according to the state-of-the-art of generative models. Which leads us to the question: what else can be done to improve?
The Game and the Future
We are still working on it, and the next versions will advance in some features that we find interesting for an RPG game, such as:
The intention is to enrich the game to the fullest, creating immersion, fun, and entertainment. So, what would you suggest to improve this idea?
--
5 个月hi ??
Absolutely agree! ?? As Henry Ford once said, "Anyone who stops learning is old, whether at twenty or eighty." Continuous learning aids creativity, turning problems into opportunities.?? Loved reading about your internal hackathons to stimulate creativity. Excited to dive into Angelo Varella's article! ??????#Creativity #Innovation #Learning
Co-Founder of Altrosyn and DIrector at CDTECH | Inventor | Manufacturer
9 个月You talked about the importance of cultivating creativity and its connection to skill acquisition and improvement, which is indeed crucial. In the context of developing an AI-driven RPG Master using LLMs, have you encountered any specific challenges related to creativity and innovation in this project? How did your team overcome them, and what insights can you share about fostering creativity within technical endeavors like this one?