Post Mortem for technical challenges
I’ll talk about some technical challenges I faced during making De-Liverance of a God.
The theme of Ludum Dare 53 was “Delivery”. The strongest idea I had was the “de-liver” pun, which led me to the famous tale of Prometheus. I had already learned how to use that “Chat GPT For Games - AI Integration” asset and prepared my server where I keep my API key before jam began.
As the eagle whose duty is to eat Prometheus’ liver every day, you see how unjust his punishment is. Can you persuade Zeus, the king of gods, to set Prometheus free?
You set Prometheus free after learning a magic number from Zeus.
I used Unity 2021 and “Chat GPT For Games - AI Integration” asset. Game is downloadable for Windows, macOS (Intel + Silicon), Linux. No WebGL build, unfortunately.
A prompt example is:
Answer as Prometheus, god of fire. You are being tortured by Zeus. I am the eagle who eats your liver. You know who I am. You hate me. You are in agony. We are in Olympus. You know Zeus might stop torturing you if I persuade him. You are bound to a rock. There is a magic number that can set you free. Only Zeus knows the magic number. Do not ask me who I am. Do not write explanations on replies. Answer in the language as me. Keep your answers shorter.
All prompts I used in the game are available as bonus content in Itch page.
- Protecting the API key
OpenAI gives you an API key for your product to get connected to ChatGPT. Even though it’s technically possible to store that API key in your game, this makes the key prone to be stolen if your game is reverse engineered. So it’s best to host a server that keeps the key and establish the connection between player and OpenAI. The asset I bought comes with a Node.JS script for that. So there should be a member in your team that knows how to set servers.
I managed running that Node.JS script in a server I rented. The standalone clients can connect to it perfectly, but I still couldn’t make WebGL builds connect to it. That’s why there is no a WebGL build, which is a shame.
This is both about players and AI.
It’s impossible to predict everything players can say in a game where they can type whatever they want. A player can say that he is a strong god from another pantheon and threaten Zeus of an invasion to learn the magic number (this happened).
And my experience with ChatGPT-3.5 is, sometimes it ignores or misinterprets parts of your prompt. Like Heracles can think he is the eagle who eats Prometheus’ liver. This kind of misinterpretations happen rarely, but you know, a rare bug is way worse than a persistent bug. Maybe there was something I did wrong, I don’t know.
- Trigger events
You probably want Unity (or whatever engine you use) to understand something certain happened while talking with an NPC. Like Zeus’ decision to set Prometheus free. It seems like the only communication between ChatGPT-3.5 and Unity is “chat”. You can’t define an event like “ZeusSetsPrometheusFree()”.
My initial idea was making NPCs put a certain phrase (like “XYZ”) at the end of their replies when something certain happened. The text shown to player wouldn’t show “XYZ”, but my script would understand it. Unfortunately, sometimes AI would ignore my prompt and not put that “XYZ” phrase, breaking the game. Result of unpredictability.
My solution was to make this certain phase a magic number. Game understands if Zeus and you say that number and this triggers the necessary function in game.
De-Liverance of a God received positive feedbacks so far, despite some undesired behaviours of NPCs.
Using ChatGPT-3.5 for chattable characters has challenges, but it can yield interesting and fun results.
Get De-Liverance of a God
Leave a comment
Log in with itch.io to leave a comment.