Inspiration
I have been recently looking at making games with C++ and SFML and was curious if AI could be used to being life to non player characters (NPCs) in the world.
What it does
It gives infinite dialogue options for NPCs and allows them to tell the player about other NPCs and about the world while remaining in character.
How I built it
Using Visual Studio Code, installed requirements such as SFML 3.0.0, used MSVC to compile the SFML frontend and create main.exe. Started with a basic SFML frontend where the player can type and send a message then created a backend server using Python and Flask that could send a response, later connecting it to gpt-oss to be able to get AI responses.
Challenges I ran into
An issue with responses from the AI not being compatible with the font, had to tell the AI not to use certain characters when responding. Displaying text in a satisfying way, needed to add a function to get text to wrap if it was too long and have text in a speech bubble to make it clear and easy to read as well as get text to appear higher above NPCs the taller the text/speech bubble is so it doesn't cover the NPC, also instructed the AI to keep responses short (15 words max) so that text responses are not too long.
Accomplishments that I'm proud of
Having NPCs with distinct personalities that can be seen by the way they communicate. NPCs being able to have knowledge of the world or other NPCs and give their opinions on them.
What I learned
How to use an open AI API such as gpt-oss-20b to be able to get responses and play a character. How to create interesting NPCs with personalities using AI.
What's next for NPC Chatbot
Potential future features for the chatbot would include: Shop functionality allowing shopkeepers to be able to complete transactions with the player and sell items but only if the player as enough money. Save NPC histories to database so that NPCs will not forget past conversations if the backend server is reset. Basic fall back dialogue for if the server cannot connect.
Once these are implemented the chatbot could be used within a game to give life to the NPCs in it.
Log in or sign up for Devpost to join the conversation.