AI NPCs

If you liked this item, please rate it up on Steam Workshop page.

Author: RubbingMyAxe

Last revision: 15 Aug, 2025 at 21:53 UTC (1)

File size: 176.7 MB

On Steam Workshop

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. Install client-side Lua by following this guide: Lua Installation Guide.
  2. Set the Server Executable to Lua for Barotrauma when starting your server.
  3. Press F3 to open the console.
  4. Press ESC and use the AI NPCs Options menu to enter your API key. Click ‘Done’ when finished.

Optional – Using Alternative Model

To use an alternative model, modify the API endpoint and model configuration settings.

For a free model through OpenRouter, open the AI NPCs Options menu, go to the Chat Model section, and click the Refresh button to populate the Model dropdown. Make sure the "Free models only" checkbox is checked, then you can select any model from the list. The API Endpoint will be automatically updated to OpenRouter, so all you need to do is enter an API Key and click Apply.

Usage

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

In Multiplayer, only the server needs to set up the API information. For the server host, the AI NPCs Options menu will update the server’s settings. For clients, it only will update their local settings.

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 5000 per interaction.

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

Download
Required items:

Click the title to search on this site.


Lua For BarotraumaSteam Workshop
Revisions:

Old revisions of this mod are available below. Click the link to download.