Simple proof of concept using the RCON protocol to integrate ChatGPT into CE for dialogue NPC’s, it’s still rough around the edges and has a few limitations but it adds a new dynamic to the dialogue NPC’s in CE, it also supports SP and dedicated servers =)
He is my current test version of the GPT rcon integration, I haven’t been able to do as much testing as I would have liked in this version and I’ve just rewrote the GPT prompt code to be more in line with OpenAI’s guidelines, added moderation calls etc, so…
Unfortunately my server seems to be suffering from the lag issues some people are talking about and the game becomes very hard to stomach after the server has been online for about 20/30 minutes, as a result work on this has been put on hold, hopefully we’ll get a speedy fix =)
single player/listen servers/dedicated servers.
OpenAI account, this application uses OpenAI GPT 3.5 turbo (ChatGPT) and therefore requires a valid OpenAI API key which can be setup at this link, I believe you get something like $15 free testing credits when you create an account, at least I did but that was along time ago.
locate your server Game.ini (or game client if using this in SP) and add these ini vars at the end of the file
Please refer to this link for a more detailed description
This is something you might want to do while running ConanGPT as it polls the server every 1000ms and every time the game receives an RCON request it will write a warning to the server log file, so there will be a lot of warnings if you skip this!
Locate your server Engine.ini and add this line to the Core.log section
- Download and extract ConanGPT_Client, locate “ConanGPT/config/config.ini”.
- Enter your OpenAI API key in the [ChatGPT] section of the ini.
- Setup your server ip, port and password in the [RCON] section (127.0.0.1 for local hosted games/sp games)
- Open RCON port if your routers settings if required, you can check if the port is open by using funcom’s dedicated server launcher
There is a description of what all the config settings do in the config.ini file =)
PS: To give the AI memory it actually requires sending multiple messages to the API, more ChatHistory = more token use = more cost!
Install ConanRCON.pak (mod) to the game, either start the server or load into your solo game (listen servers are also supported), once the game is running and the map has started, start ConanGPT.exe and if everything was setup correctly you should see something like this in the console
Copyright © Michael Craig. ConanGPT is provided ‘as is’ and is intended solely as a proof of concept
without any warranties or guarantees.
Initializing: sending data: Conan Braga Princess Petruso
If everything worked correctly the next time you speak to any of the configured NPC’s (config/profiles.xml) when you press the “Talk” button you should be presented with a new conversation dialogue where you can interact with the AI.
Currently only 4 NPC’s are setup in the provided files
Conan - you know who this guy is
Braga - a Scottish Cimmerian warrior
Princess - a spoiled little brat
Petruso the Sandstorm Maniac - Text based adventure game
PS: currently only one person can talk to the AI at any one time, this might change in the future if I decide to carry this mod on.
- Sometimes the the UI scrollbar can freak out when you receiving a message, I was going to fix this but my game runs a little trash after the update so this will be done at a later date.
- sometimes the app will throw an exception an exit the polling timer if a request times out or an http request fails, this will be addressed when I get around to refactoring the code.
- NPC’s sometimes give strange replies, this just requires the instruction param in profiles.xml to be tweaked.
- NPC’s will carry on the last conversation they were having, tell it your new and tell it your name, I plan on clearing the conversation history at the start of every conversation at some point.
- Request timeouts, currently ConanGPT Client (PC) does not account for timeouts or failed http requests and will throw an exception in these cases and closes application.
- Code refactoring, the current code is still in a state of draft and could use an optimise, this is also why I didn’t add timeouts yet, just one more thing to rewrite.
- Clear conversation history at the start of a conversation