Inspiration

I love playing Dungeons and Dragons. In Dungeons and Dragons, you can be your favorite fantasy character, fight monsters, and go on exciting adventures with friends. In addition, the dungeon master is the one orchestrating the game, such as controlling the monsters the players fight against, acting as the characters the players meet, and the adventure itself. After playing in several games, I’ve always wanted to play as a dungeon master. On the other hand, the task of being the dungeon master can be overwhelming because you have to understand the game very well and think on the spot. Fortunately, Google Gemini can act as an assistant, which can help in many ways.

What it does

Atlas RPG is a real time interface and AI companion for tabletop RPG games. The dungeon master can create game sessions, which the players can join. The dungeon master can broadcast game events that the players can see in real-time with websocket. In addition, dungeon masters can utilize several tools equipped with Google Gemini to help them with their game sessions. First, the dungeon master can use Scene Painter to generate vivid descriptions of their surroundings. Each query made by the dungeon master in Scene Painter is prepended with a context before sent to Google Gemini, such as asking Google Gemini to act as a storyteller and using figurative language. Second, the dungeon master can use Persona Actor to simulate lifelike conversations with fantasy characters. To use Persona Actor, the dungeon master can describe the character in detail and interact with the character in Google Gemini’s Multi-turn conversations. For each generated response, the dungeon master states the scene at the moment and any desired behavior from the character. Finally, the dungeon master can use RPG Advisor to brainstorm ideas for their game session. In RPG Advisor, Google Gemini takes the role as an assistant to help dungeon masters work on any ideas for their adventures in multi-turn conversations. To make the responses more visually appealing, a context is prepended with each query to provide the response in markdown style. Overall, Atlas RPG provides a real-time interface where users can play virtually and equips the dungeon master with tools powered by Google Gemini.

How I built it

Atlas RPG is a full stack project. The front end is built with React, Redux, and JS and utilizes REST and websocket communication to send and receive messages from the backend. The backend utilizes Java Spring Boot. The backend communicates with the frontend with REST and websocket to provide bidirectional communication, so that players can receive game event updates in real-time. The backend also stores game session data to a Redis Docker container. Finally, the backend makes api requests to Google Gemini to provide text generated responses to the client. To avoid issues evaluating the project, the Java Spring application is containerized in Docker, so that developers can run the docker image and provide their Google Gemini API keys in the command line. I also incorporated several principles with Google Gemini. First, I incorporated prompt engineering to tailor the queries with contexts that would provide best responses for each task. Second, I also applied principles of Response AI to the project. For example, to ensure that the queries are appropriate for this application, I added Safety Settings which each request made to Google Gemini to avoid the following high and medium levels of the following content: harassment, hate speech, sexually explicit, and dangerous content. Applying principles of Response AI ensures that game sessions are safe and comfortable for all players.

Challenges I ran into

I faced two challenges when implementing the project. For example, I was trying to figure out how to make my fullstack application portable and easy to evaluate. My fullstack application has three important entities: the React client, the Java Spring server, and storage for the game session data. Even though I can easily run these three entities from the terminal, that would make my fullstack project difficult to test by other users. To make my fullstack project more portable, I decided to run Redis as a Docker container with the official Docker image and containerize my Java Spring app as a Docker image. On the other hand, I decided not to containerize my React application since it would affect its performance. In the end, I was able to make my Java Spring application more portable.
The next challenge was applying the Google Gemini API key to the Java Spring application. I realized that there would need to be a way for users to use their Google Gemini API keys if they wanted to use my project. After researching online, I incorporated the api key as an environmental variable in my Java Spring application. Fortunately, the api keys can be passed as parameters in the command line when running docker run. In conclusion, I was able to develop my Java Spring application in a way, so that other users can use their api keys.

Accomplishments that I am proud of

There is one main accomplishment I am most proud of. As part of my journey as a software engineer, I spent the past several months learning more about full stack technologies to build exciting projects, such as **Java Spring, Docker, Kubernetes, Redis, WebSocket, React,** and etc. In addition, it was very rewarding to develop a project with Google Gemini and incorporate **prompt engineering** and **Response AI**. Being able to work on this project and complete it within a few weeks is an accomplishment of my fullstack learning journey.

What I learned

From working on this project, I was able to learn more about the principles of LLMs, such as prompt engineering and responsible ai. For prompt engineering, I learned that tailoring each query with contexts can provide better responses for each different task. Second, I learned more about implementing Responsible AI. The safety settings for each query can make user experiences for any application more safe and approachable and reduce the need for content moderation. Ultimately, working on this project has sparked my curiosity into learning more about LLMs, such as fine-tuning models and incorporating RAG.

What's next for Atlas RPG

I was working on another feature to incorporate model tuning in the React app, so that players can create their own models and use them in their game sessions. Unfortunately, the deadline for the hackathon was around the corner, so I had to wrap up the development of my project. Ultimately, I look forward to learning more on how to implement features, so that users can create their models and use them for their tasks.

Built With

Share this project:

Updates