Dear Developers:
packageId = OpenRimWorldAI.Base
Use '[b]await OpenRimWorldAI.AI.SendPromptAsync(prompt,[rules,identity,instructions,showAlert:True])[/b]' to send prompts. Outputs will be returned as string and create an alert. (showAlert is False by default)
Character Limitation: 128,000 characters max (About 32,000 Tokens)
public static async Task<string> SendPromptAsync(string prompt, string promptRules = "Do not repeat sentences. Don't explain yourself. Never break character. ", string identity = "", string promptInstruction = "Include your name in a subject/header. Respond to the following and wrap your subject/header in tildes(~): ")
//You can use these for data dumps:
string itemList = AI_Information.GetStorageItems();
string completedResearchList = AI_Information.GetCompletedResearch();
string allpawnStatsList = AI_Information.GetAllPawnStats();
string pawnStatsList = AI_Information.GetPawnStats(pawn);
string colony = AI_Information.GetColonyInfo();
OpenRimWorldAI.AskAPawn
was created to provide a simple example: [url=https://steamcommunity.com/sharedfiles/filedetails/?id=3412825218]https://steamcommunity.com/sharedfiles/filedetails/?id=3412825218[/url]
[u]
OpenRimWorldAI
[/u]
What is it?
Originally posted by [b]Developer[/b]:
OpenRimWorldAI is a RimWorld mod that adds AI using OpenRouter's API. OpenRouter offers both free & paid services.
What does it add to the game?
Originally posted by [b]Developer[/b]:
OpenRimWorldAI will act as my base for future AI work. With base, you will get a daily report from one of your pawns regarding the status of your colony.[u]Things you can do: [/u]
[list]
[*] Receive Daily Reports from a random Pawn
[*] Pre-loaded with Free API keys (Recommend getting your own due to quotas)
[*] Chose your own model!
[/list]
Any Setup Required?
Originally posted by [b]Developer[/b]:
No, it'll work out of the box. I do recommend applying your own API Key. Each key has a 200 request per day limit. Optionally with your own key, you can can add funds to use paid models.
What's the recommended LLM/Model?
Originally posted by [b]Developer[/b]:
Everything has been tested to work with "google/gemini-2.0-flash-exp:free" with "OpenRouter". Gemini already has context that relates to RimWorld which greatly compliments this mod.
OpenRouter (Recommended) vs Ollama (Not Recommended)
Originally posted by [b]Developer[/b]:
OpenRouter offers API services to some of the best LLMs out there. They offer both free & paid services. This mod has been tested to work with OpenRouter using the "gemini-2.0-flash-exp:free" model. It requires no additional hardware constraints to the user. It also accepts up to 128,000 characters.
Ollama is a locally ran server. For top models, it requires some serious hardware and due to my own hardware constraints testing has been limited. In testing I've tried a few models:
Deepseek yielding poor results
LLama3.3 requires more memory than I can afford
LLama3.2 3b was similiar to Deepseek in the sense that neither were trained with RimWorld knowledge.
Updates
v.1.1:
Updates to support "AskAPawn" Updates:
- Mirrored "FindPawnByName()" from Overlord to "AI_Information" to support "AskAPawn"
- Added new parameters, "includePawnDetails" & "internalThoughts", for SendPromptAsync():
includePawnDetails: Attempts to find pawn based name in header/subject if possible and includes additional details.
internalThoughts: If true, looks for a semi-colon and parses that part of the response as internal thoughts.
public static async Task<string> SendPromptAsync(
string prompt,
string promptRules = "useDefaultDef",
string identity = "useDefaultDef",
string promptInstruction = "useDefaultDef",
bool showAlert=false,
LetterDef letterType = null,
bool includePawnDetails=false,
bool internalThoughts=false
)
v.1.0:
- Added Ollama as an option for AI. I do not recommend it especially if your computer can not process large amounts of data. For Daily Reports the character length is usually around 4000 characters.
- Added a new setting "RimWorld Background" which will front-load "What RimWorld Is" to the AI. Adds ~1200 characters. (This is useful for models that do not have RimWorld as part of their training data)
- RimWorld_Background can also be modified in the Defs.
(Historical updates move to "Change Notes")