About Rust GPT
Are you sick of playing Rust like a normal person? Yeah, us too. That's why we created the Rust GPT plugin, so you can chat with an AI while you wander aimlessly through the map, waiting to get shot out of nowhere. Who needs a game plan when you have an AI to talk to?
You should read this entire README if you are using this plugin for the first time.
Features
- Ask GPT questions directly from the game chat
- Get text-based answers from GPT
- Customizable cool down time
- Participate in the inevitable AI overlord takeover!
- Hooks for use in other plugins
Contributing
Contributions are always welcome! Reach out to Goo on Rust Haus' discord if you want. Otherwise do a pull request and get crackin.
Required OpenAI API Key
To run this project, you will need to get yourself a fancy OpenAI API key.
Installation
Copy the plugin RustGPT.cs into your Carbon or Oxide plugins folder.
When the plugin is first loaded it will generate a configuration file and the server console will say Please configure the plugin with the required OpenAI API key.
Configure the plugin in the RustGPT.json file located in you Oxide or Carbon configs folder.
As of ver 1.6.1 the config file looks like this:
{ "AIPromptParameters": { "System role": "You are a helpful assistant on Rust game server called Rust.Haus Testing Server.", "User Server Details": "Server wipes Thursdays at 2pm CST. Blueprints are wiped on forced wipes only. Gather rate is 5X. Available commands available by using /info. Server admin is Goo. The discord link is https://discord.gg/EQNPBxdjRu" }, "AIResponseParameters": { "Frequency Penalty": 0.0, "Max Tokens": 150, "Presence Penalty": 0.6, "Temperature": 0.9 }, "Broadcast Response to the server": false, "Chat cool down in seconds": 10, "OpenAI_Api_Key": { "OpenAI API Key": "your-api-key-here" // Get this API key here https://platform.openai.com/account/api-keys }, "OutboundAPIUrl": { "API URL": "https://api.openai.com/v1/chat/completions" }, "Plugin Version": "1.6.1", "Question Pattern": "!gpt", "Response Prefix": "[RustGPT]", "Response Prefix Color": "#55AAFF" }
To get movin' and groovin' make sure you API Key is in your config/RustGPT.json
Then assign permission to yourself or a group. This is how to grant permission to yourself.
In console for oxide:
o.grant user <player_name_or_steam_id> RustGPT.chat
In console for Carbon:
c.grant user <player_name_or_steam_id> RustGPT.chat
Restart the plugin.
Using Oxide? Do this:
o.reload RustGPT.cs
Using Carbon? Do this:
c.reload RustGPT.cs
Do yourself a favor and make a local copy of your RustGPT.json file in case something goes wonky in future updates.
Usage/Examples
Question Patterns
This setting is designed to validate the chat message so only specified text triggers the API call.
Currently the default question structure is like this:
"Question Pattern": "!gpt"
This is an old method to trigger commands in rust. Basically, any chat message that contains the text "!gpt" will send that chat message through the API and trigger a response. You can edit this in the configuration file. Since this is capable of accepting regex expressions you can get crazy with it. For example:
"Question Pattern": "(who|what|when|where|why|how|is|are|am|do|does|did|can|could|will|would|should|which|whom).*?$"
This will look for a chat message that contains one of the various keywords and ends with a question mark.
"Question Pattern": ""
And incase you were wondering this will full send everything. Not recommended. If you have a well populated server and a lot of chat enthusiasts, this will cost you some money.
Commands
For convenience there is the chat command /askgpt Where you can input directly to the AI without worrying about question validation. Don't try and train the AI this way it won't work...yet.
Planned Updates
- The main goal of this plugin is to eventually use it as a container for core AI functionality. The vision is to have the ability to use this as a way of implementing customized AI to your server. For example, a plugin that spawns in AI controlled player models that builds bases and raid others. However, before we get there we need to take care of some stuff...
-
Add the ability to switch between the Completions and the Chat endpoints. This will allow the use of GPT-3.5-Turbo. This will happen on the next update most likely.Abandoned for this plugin. This plugin will only use gpt-3.5-turbo. -
Throttling AI usage: Introduce a configurable cool down timer for the AI responses. This prevents players from spamming questions and makes the AI interaction feel more natural, as if they are communicating with another player. Oxide didn't like this when on the first attempt to make this happen.Implemented in 1.6.1 - Add token counting and alerts. Although the OpenAI API is fairly inexpensive it does have the ability to rack up some charges on a popular. (Will be added next update.)
Author
I'm not associated in any way with OpenAI or Facepunch but feel free to tell them how cool I am.
Huge thanks to Raul-Sorin Sorban for helping me getting this to work! He should be a co-author of the plugin but I am sparing him from the customer service requests.