Inspiration
We've all played our fair share of video games and see the potential use of LLMs to generate content dynamically. In particular when interacting with NPCs, since their dialogue is scripted and might not always fit a certain situation.
What it does
At its core it is a simple game engine that allows the player to choose between two actions: Attack or Talk. Attack simply attacks the NPC (the enemy) and lowers its health pool. Talk, however, allows the player to write something they want to say. Either way the input is given to an LLM which generates a response for the NPC. It is instructed to keep track of its character's emotional state, which determines which attacks it can perform.
How we built it
Google provides an SDK for interacting with their Gemini model for multiple languages, we choose C#, which made the LLM integration quite easy. We used raylib as our GUI framework and utilized Gemini to code generate the majority of that code. The game engine is a relatively simple loop that switches between giving the user or NPC a turn. Gemini is given a written description of the game's rules, the NPC's personality and a list of attacks it can perform. The list of attacks changes depending on the NPC's emotional state.
Challenges we ran into
Ensuring the project's architecture is not too chaotic and coupled, due to time constraints. Getting Gemini to give a structured output we could parse to make the game engine keep going.
Accomplishments that we're proud of
We managed to get a working prototype in the short amount of time we had and got the LLM to behave in the way we wanted it to.
What we learned
- How an LLM is "manipulated" with system prompts
- How to integrate an LLM into a .NET application ## What's next for AdaptiveNPC Not sure yet.
Log in or sign up for Devpost to join the conversation.