Barotrauma

Barotrauma

196 ratings
AI NPCs
8
7
4
4
7
2
2
3
3
2
2
   
Award
Favorite
Favorited
Unfavorite
File Size
Posted
Updated
274.900 KB
Nov 5, 2023 @ 10:12pm
Dec 11, 2024 @ 4:36pm
8 Change Notes ( view )

Subscribe to download
AI NPCs

Description
Enhance Your Barotrauma Experience with AI-Enhanced NPCs
This mod integrates OpenAI's ChatGPT into Barotrauma, aiming to increase immersion by enabling NPCs to respond via an AI chat system.
Please note that this mod is currently a work-in-progress.

Requirements
  • Lua for Barotrauma
  • An API key from an AI chat provider (e.g., OpenAI)

Default Configuration
Uses OpenAI and the latest ChatGPT 4o mini model (note: this is a paid service).
Configuration can be adjusted to use free models like the 7b model from OpenRouter (Documentation Here[openrouter.ai]). Keep in mind that free models often have lower rate limits, which may be insufficient for extended gameplay.

Setup Instructions
General Setup:
Include Lua for Barotrauma and AI NPCs in your active mods list via Settings and click Apply.

Singleplayer:
  1. Install client-side Lua by following this guide: Lua Installation Guide.
  2. Start the game.
  3. Press ESC and use the AI NPCs Options menu to enter your API key. Click 'Done' when finished.

Multiplayer:
  1. Set the Server Executable to Lua for Barotrauma when starting your server.
  2. Press F3 to open the console.
  3. Use "ai_setconfig APIKey <key>" to set your API key.
  4. Use "ai_listconfig" to view all of the settings and their current values.

Optional - Using Alternative Model
To use an alternative model, modify the API endpoint and model configuration settings.
In Singleplayer, this can be done through the AI NPCs Options menu.
In Multiplayer, use the "ai_setconfig APIEndpoint <url>" and "ai_setconfig Model <name>" console commands.

For example, to use MythoMist 7b through OpenRouter:
  1. ai_setconfig APIEndpoint https://openrouter.ai/api/v1/chat/completions
  2. ai_setconfig Model gryphe/mythomist-7b:free

Usage
Compatible with Single Player and Multiplayer modes (Campaign, Mission, Sandbox).

In Multiplayer, only the server needs to set up the API information.

To interact with an NPC, type "!" followed by the NPC's name and your message. For example: !artie how are you doing?

Token usage ranges from 200 to 4000 per interaction. Adjust token usage with "ai_setconfig SessionTokenCap <amount>" to manage costs effectively.

All F3 console commands are viewable by running the "help" command. They are all prefixed with "ai_" and support TAB autofilling for certain parameters like configuration settings and NPC names. There are commands for modifying individual NPC's personalities, such as "ai_giverandomprofile <name>".
Popular Discussions View All (16)
2
5 hours ago
The AI insists that i am bald.
WidowedGalaxy
28
Apr 14 @ 5:08pm
PINNED: Current Features and Goals
RubbingMyAxe
6
Dec 17, 2024 @ 5:31pm
my mods list
Jim the Pilot #FixTf2
325 Comments
Silly cat Apr 25 @ 11:09am 
I just want to give orders to all of my crew you know? Like that would be really usefull.
RubbingMyAxe  [author] Apr 24 @ 3:15pm 
Currently the mod doesn't have a way to talk to all of the NPCs at the same time. I may do something where you can give orders without responses to groups of NPCs, but making them all respond at once would be a lot of API requests.
Silly cat Apr 24 @ 7:40am 
Just a question, how do give them all (speak to all of the NPCS at the same time) an command? Like "ALARM!!".
frost Apr 22 @ 10:30pm 
nah it was just using contextual orders like telling them to fix the hull or i think reporting a hull breach and having them go fix it bugged their responses completely, i dont think it had anything to do with what i said to them but idk. my friend tested them out in singleplayer with my exact same modlist and he had no issues.
RubbingMyAxe  [author] Apr 22 @ 9:24am 
Glad it fixed the problem. Do you remember what you said to them before it started happening? Did you type a % sign or something?
frost Apr 22 @ 9:09am 
the command works and the bots can respond freely again, thank you and take my steam points
RubbingMyAxe  [author] Apr 22 @ 8:11am 
@Trevorluck What issue are you having? You can add me on Steam or Discord and I can help walk you through it, if you need.
RubbingMyAxe  [author] Apr 22 @ 8:10am 
@frost I've not seen that error before, it looks like it has something to do with your conversation history with that bot. Did you use any special characters, or maybe a different language? Maybe you had a % in there and it's not being escaped properly...

Use the ai_clearconversationhistory <NPC NAME> console command and that should help.
frost Apr 21 @ 10:56am 
for the error message it states ai_npc (1918,1-88) invalid use of % in replacement string
frost Apr 21 @ 10:27am 
using contextual orders make the bot silent and they dont respond to any messages afterwards, any fix?