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

thanks Xevyr for pointing out my boo boo :stuck_out_tongue:



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

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

3 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

No, they dont. IT is just the “easiest way” to do it.

I have tinkered with using GPT to generate quests, and despite having to work on the prompting, it is possible to use some “work arounds” to use it even in solo games.

While that one require A LOT of workarounds, using a model that gives you images for the text is also a possibility. I had it done for tests http://esav.app.br/imgcom/

However I abandoned the use of GPT in mods altogether because the results are not really usefull, as the responses must be curated a lot to avoid the frequent errors and mistakes in understanding that might arise, if I want to develop stories or quests using it.

Then I replaced it with a simpler and more reliable aplication of tensor flow like libraries that can be incorporated in the mod itself. It requires that I feed the mod with the story and the flow, but it serves to generate dynamic quests with a better control and feeling than using GPT.

But being able to use GPT is not a problem that require RCON.

1 Like

I know it’s not the only way, I was using url’s over 5 years ago for my keyboard HUD :wink:

PS RCON works in all game modes too :+1: actually I don’t think I tested offline sp, but it works fine in listen servers.

Dont really know what is the relation with one thing to the other.

What I said is that you dont need rcon or even a middle man to make internet data exchange in a mod.

This is one briliant idea. :smiley:

I was thinking about Conan figure in the game before, and it’s pitty that he is only saying the same things all the time and although being important person in this universe, he has no other functions/options to interact with in the game.

This or something like this could make the game more fun. :+1:

I guess it would only be relevant if you were in the conan modding discord when I created it, it was the mod I used to demonstrate the use of URL nodes to the other modders around at that time, it also serves as an example that I know its not the only way.

When I said the mod required RCON, I meant this mod, not mods in general, this mod was developed to send/receive data to an exe using RCON, even then there are other ways like node js, httplistener etc, but those aren’t RCON which is also useful for other games so it’s nice to have my own RCON client code in VS =)

I thought you knew and meant that rcon is a protocol, not a software or design style, like nodejs or httplistener.
I thought you meant the only way to send and receive data to a mod was rcon. And once you mention the modding discrod, it is exactly the place I have seen everyone saying the only way to send and receive data from a mod was rcon (the protocol).
Since it is true that you cant open ports or do Internet open operations in a mod for obvious security reasons, that remains the only way natively supported by the devkit to achieve it.

You won’t have seen me in there talking about RCON, I left the modding discord about 4 years ago. :blush: