Hacker News new | ask | show | jobs
by __cayenne__ 1150 days ago
This weekend at the NYC GPT/LLM Hackathon, we built rpgGPT, a text-based RPG set in the world of Occidaria (think fall of the Western Roman Empire, with a slightly magical twist). System hooks allow the LLM to set persistant game state, and every NPC is powered by the LLM. As you discover other NPCs in the world they are created on the the fly along with an avatar image. We've seen interesting emergent game play. My favorite experience to date was a character, after living through a particularly dicey adventure, decided they deserved the moniker "the Brave". Because the game engine has a rename character hook, that was persisted to the game state. Hope you can try it you!
1 comments

What LLM are you using? How do you save and load the persistent state? And how do you deal with the limited context window of the LLM you are using?
Currently using gpt-3.5-turbo. All state has a json representation that gets based between the game engine and the LLM. In v0.2 not handling the context window super well, planning to use a "memory" management prompt + storing state in game engine in v0.3
That’s a clever way of doing state. For dndinfinity.com, I rendered the game state as natural language (e.g. “the players are engaged in the following quests”) in the prompt, under the theory that it would be able to reason better.

What issues (if any) did you have storing state in json and just plopping that in the context window?

The biggest trade off is you sometimes get invalid JSON. So I try repairing the JSON with some regex and also just retry a few times if it returns invalid JSON that can't be repaired.
I haven't got yet to use it myself but this might be useful for this?

https://github.com/juanignaciomolina/GPTyped

Really cool project! I want to make something similar I think if time and skills allow me to