AI NPCs
Добавить в игру через Steam
Нажмите «Подписаться»
На странице Steam войдите в аккаунт, если потребуется.
Подписаться
О материале
«AI NPCs» — материал мастерской Barotrauma. Моды, подлодки, предметы и новые задания для экипажа. Данные Steam, описание автора и ссылка для установки через подписку. Совместимость редакцией не проверена.
Описание автора
Integrates Generative AI Into Barotrauma
This mod integrates generative AI into Barotrauma for several purposes:
-
Chat - NPCs respond to messages using session context (conversation history, health, inventory, submarine state, etc.).
-
Orders - NPCs interpret natural-language commands from chat messages and can execute multi-step tasks (e.g., "go to the submarine, get a shotgun, and bring it to me").
-
Speech to Text - Use your microphone to issue commands; can also transcribe voice to text chat in multiplayer. Supports many languages.
-
Text to Speech - Gives NPCs voices so that they can speak through a simulated VOIP system.
-
Vision - NPCs can receive an image of their surroundings with the chat prompt, allowing them to read signs and comment on nearby objects.
-
More to come!
Requirements
-
Lua for Barotrauma (with CSharp Scriping enabled)
-
The necessary credentials (API key and/or endpoint URL) for your chosen AI provider(s).
How to Play for Free
Most AI providers charge for API usage. With appropriate models and local speech to text, typical sessions cost merely cents when using this mod. But if you want to use the mod completely free, the options below work with some limitations.
Player2
Simple and quick to set up. Requires you to install a desktop client and create an account, but gives many free uses daily.
-
Download and install Player2: https://player2.game
-
Launch it.
-
Create an account.
-
Select Player2 as your AI provider for Chat/Orders/Speech-to-Text.
OpenRouter
A bit more setup involved and a low number of free daily uses, but has many models to choose from.
-
Go to OpenRouter's website: https://openrouter.ai/
-
Create an account.
-
Create an API key.
-
Select OpenRouter as your AI provider for Chat/Orders.
-
Select your desired Model from the dropdown (the list is filtered to Free by default).
-
Enter your API key.
Local Hosting
Unlimited free uses, but requires a powerful PC, is much more complicated to set up, and requires several gigabytes of free space to download the AI model. Recommended for experienced users only.
-
Download and install a local LM system, for example: LM Studio
-
Further instructions can be found on this mod's Discord: Barotrauma AI NPCs Discord
Setup Instructions
General Setup
-
On the Main Menu, click the 'Mods' button.
-
Include Lua for Barotrauma and AI NPCs in your Enabled Packages list, and click Apply.
-
Install client-side Lua by following this guide: Lua Installation Guide.
-
On the main menu, click the 'Open LuaCs Settings' text at the top left of the screen.
-
Check 'Enable CSharp Scripting' and then click 'Close'.
-
Follow the additional steps below.
Singleplayer
-
Start a game.
-
Press ESC and click the 'AI NPCs Options' button.
-
Select your desired API provider(s) and enter any necessary information (endpoint, model, or API key).
-
Click the 'Apply' button at the bottom of the screen to save your changes.
Hosting a Multiplayer Server
-
Click the 'Host Server' button on the main menu.
-
Set the 'Server Executable' to 'Lua for Barotrauma' when starting your server.
-
Press ESC and click the 'AI NPCs Options' button.
-
Select your desired API provider(s) and enter any necessary information (endpoint, model, or API key). (As the server host, only you can change these settings for your server.)
-
Click the 'Apply' button at the bottom of the screen to save your changes.
Usage
Text Chat
To interact with an NPC, type "!" followed by the NPC's first or last name and your message. For example: !artie how are you doing?
With Orders enabled, your message can include commands that the NPCs will try to execute. For example: !artie bring me 5 bandages then repair the submarine
To give commands to a group of NPCs by role, you can specify all/every or one/any followed by the role. You can also use the singular or plural form of the role, or even some shorthand forms. Examples:
-
!mechanic bring me a wrench
-
!security officers operate the turrets
-
!medics heal the crew
-
!all assistants fix the submarine
-
!any engineer repair the reactor
Speech to Text
Check the Local checkbox in AI NPC Options to have the speech to text processed locally for free! This uses CPU, so it may be taxing on weaker computers. It's also not as accurate as most APIs.
If Speech to Text is enabled, you can press the Speech to Text hotkey (defaults to tilde, configurable in AI NPC Options) and speak when you see the green microphone icon above your character's head.
Use the same rules as above when speaking: say an NPC's first/last name or role followed by your message.
General Information
Compatible with Singleplayer and Multiplayer modes (Campaign, Mission, Sandbox).
In Multiplayer, only the server needs to have the AI providers selected. For the server host, the AI NPCs Options menu will update the server's settings. For clients, it will only update their local settings.
There is a F3 console command for modifying individual NPC personalities and voices: ai_customize . All console commands are viewable by running the "help" command. They are prefixed with "ai_" and support TAB auto-complete for certain parameters like configuration settings and NPC names.
If something doesn't work, check the F3 console for error messages! I'm available on Steam and Discord to help!
Disclaimers
AI provider selection is entirely up to you. Most providers that expose OpenAI-compatible endpoints can be configured to work. AI providers are third-party services; I do not operate or control them, and I’m not responsible for their pricing, availability, outputs, security controls, or privacy/data-handling practices.
*Player2 offers a revenue-sharing program. If you use Player2's client as your selected AI provider, a small revenue-share credit may be attributed to my creator account.
Как установить и запустить
Откройте оригинальную страницу в Steam Workshop, проверьте версию игры, зависимости и порядок загрузки в описании автора. Нажмите «Подписаться» и дождитесь загрузки Steam. Включите материал в меню модификаций или контента игры, если это требуется. Совместимость и запуск редакцией не проверены.