Conan Exiles meets ChatGPT [MOD]

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 =)



Supported Modes:

single player/listen servers/dedicated servers.



Requirements:

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.



Enabling RCON:

locate your server Game.ini (or game client if using this in SP) and add these ini vars at the end of the file

[RconPlugin]
RconEnabled=True
RconPort=25575
RconPassword=YourRconPassword
RconMaxKarma=60

Please refer to this link for a more detailed description



Disabling RCON log messages:

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

[Core.Log]
LogRcon=Warning off



Setting up ConanGPT Client (PC):

  • 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!



Using the mod:

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
Initializing Complete

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.



Known Issues:

Mod

  • 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.

ConanGPT Client

  • 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.


TODO’s:

  • 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


Files:

https://drive.google.com/drive/folders/1tZoytE715pEYwnCNJaGuwIOMXxemwErY

7 Likes

I run a server on Xbox One for Conan exiles and I’m really quite Limited to the things that I can do and even more limited to what I know how to do I know I can change files on the configuration file but I’ve never seen any how to or examples or anything like that I’m just envious that you guys can use mods on PC I think I went the wrong route when it came to gaming LOL keep up the good work though that looks awesome

This is pretty cool , pair it with the voice side of things it would be a welcome addition … i wonder if you can add it to like player thralls , thus when you take them out onto adventure they would add little comment about the environment , you … and crack jokes about the adventure.

Combine this with patroling you can have a lively like places.

Mmm not bad, I see great potential here! This might be a great step forward for the game

Dragoonduneman
This is pretty cool , pair it with the voice side of things it would be a welcome addition … i wonder if you can add it to like player thralls , thus when you take them out onto adventure they would add little
comment about the environment , you … and crack jokes about the adventure.
Combine this with patroling you can have a lively like places.

The main issue with these features is that the mod requires a separate PC client to communicate with the game using the RCON protocol and then act as a middleman between the game and the OpenAI API.

I’m currently recording around 400/500ms between RCON calls which limits the use case, taking the packet size into account (4096) and multiple players it can become quite limiting (at least in a multiplayer setting).

PS: there’s no reason other modders couldn’t relay messages to and from ChatGPT using the ConanGPT client I’ve developed and messing around with GPT themselves :melting_face: although I don’t plan on setting up an API to use it so only 1 mod at a time.

Paolo1977
Mmm not bad, I see great potential here! This might be a great step forward for the game

To be honest I don’t really plan on taking this very far, for now the mod is simply a proof of concept as the OpenAI API is not free to use so it’s actually costing money to develop and set up the NPC profiles so development time is limited for this one.

I should have enough API credits left to get ConanGPT and the mod in a usable state to release for anyone that wants to use it with their own API key.

1 Like

Well it’s a fascinating experiment and should at least be a part of Conan’s future pathway in idea at least.

Cheers

Hello EZee

So first of all I’d like to offer a congrats on this idea and mod. Utterly fascinating.

So, I’d like to ask more questions about what’s going on with the whole thing. You see I’m studying Artificial Intelligence at the moment and I would love to obtain further information.

Can you contact me directly?

Thanks

Sure, if you head over to the Better Builders Bureau discord and look for “hazes aka hades”, I’m easy to find you should see my name on the right in the “Community Team” group.

I’m not exactly sure how much help I’ll be though, I don’t write the AI, I’m just using the OpenAI API, if all your interested in doing is using ChatGPT as an assistant for things you can use it for free by going here https://chat.openai.com/ or if you plan on developing your own program that uses the API like I’ve done you’ll need to sign up for it here https://openai.com/ the API does require tokens to make requests to it but I think you get a few free for testing when you first sign up.

PS: for anyone interested in what state the current mod is in, I’ve finally added a profiles.xml to ConanGPT client so you can configure it to work with “any” of the dialogue NPC’s by editing that file (it will only come with Conan and Braga profiles configured), I’m currently in the middle of setting up OpenAI’s “moderation” feature to give API key owners some protection over their API key in case any users ask the AI anything that breaches OpenAI’s usage policy, that’s 98% complete I just want to add a leniency value so you can allow some messages through, then I just need to add a timeout to the message calls and it should be ready for proper testing/beta version =)

2 Likes

Hi thanks for replying

I’ll be in contact tomorrow. I’ll explain what I’m intending then

Thanks again

I’ve updated the original post with the first test version of the mod, it’s still very rough around the edges with a bug or two here and there.

I do want to work on this more but since the new update my server is running really bad so I don’t know how often I will be working on it, but I will update the mod (.pak) in the next few days with a fix for the UI as it sometimes freaks out when receiving long replies, this is more noticeable when talking to “Petruso the Sandstorm Maniac” as he is set up as an old classic text adventure game like E.O.B on the old amiga’s computers.

Anyway I hope someone finds this fun, and hopefully the game will get some performance patches soon and I’ll start working on it again =)

1 Like