Rainflayer
(Experimental) LLM Integration for Risk of Rain 2 Player Control
模組介紹 作者原文
Rainflayer
LLM-controlled Risk of Rain 2 via BepInEx mod + Python brain
Early development — expect bugs, rough edges, and missing features.
Setup |
Protocol Reference |
Architecture |
Youtube Showcase
Rainflayer connects a large language model to Risk of Rain 2. A BepInEx mod exposes game state (enemies, inventory, objectives, interactables) over a local TCP socket. A Python brain queries that state every few seconds, feeds it to an LLM, and sends back strategic commands that the mod executes at 50 Hz — movement, aiming, skills, camera, all without simulating mouse or keyboard input.
Inspired by Mindcraft and Mineflayer.
Why Rainflayer?
vs. existing bot mods (PlayerBots, ImprovedSurvivorAI)
Mods like PlayerBots and ImprovedSurvivorAI use RoR2's native AISkillDriver system — static, hand-tuned rule sets baked into the mod at compile time. They work well as NPC teammates, but their behavior cannot be changed at runtime. You cannot tell them to play more aggressively, follow you to the teleporter, wait around and farm chests, or adapt to what's happening in the run.
Rainflayer exposes a reasoning layer. The LLM reads live game state every few seconds and issues commands that dynamically reshape behavior mid-run. Directives like play defensively or go open that chest are interpreted in context and translated into actual inputs. PlayerBots gives you a reliable NPC teammate, while Rainflayer is an experiment in giving an AI agency in a game.
Rainflayer runs entirely on consumer hardware using API calls — no local GPU or training involved. The goal is to explore what's achievable with foundation models and game-level APIs today.
Who this is for
- Developers building AI agents who want a real game environment as a testbed
- Content creators interested in AI + gaming crossover
- Hobbyists curious about what LLM-driven play actually looks like in practice
- Modded Risk of Rain 2 players looking for something new
This is not a drop-in replacement for a human co-op partner. It's experimental and proof-of-concept — if you want a reliable RoR2 teammate, the RoR2 community has no shortage of players. This exists because nothing quite like it exists yet, and because the broader vision of an AI that can play any game (not just RoR2) is worth exploring.
System requirements and RAM usage
A common concern with AI mods is RAM overhead. Here's what Rainflayer's expectage usage looks like:
| Component | RAM usage |
|-----------|-----------|
| BepInEx mod (C# plugin) | [!NOTE]
Rainflayer takes full control of your character. Set EnableAIControl = false in the mod config when you want to play normally without removing the mod.
How It Works
┌─ Python Brain (Strategic, ~0.25 Hz) ────────────────┐
│ Llama 4 Maverick 17B via Novita.ai │
│ Reads game state → LLM → commands │
└────────────────────── ↕ TCP:7777 ──────────────────┘
┌─ BepInEx Mod (Tactical, 50 Hz) ─────────────────────┐
│ Intercepts InputBank + CameraRigController │
│ Entity detection, pathfinding, skill execution │
└──────────────────── Risk of Rain 2 ─────────────────┘
While the brain plays, you can type natural-language goals to influence its decisions in real time:
directive> go activate the teleporter
directive> play more aggressively
directive> clear
directive> status
This is just the minimum usage case - connecting to your own custom LLMs / AI projects is intended as the broader use case.
Requirements
- Risk of Rain 2 (Steam)
- BepInEx 5.x — download or install via r2modman
- Python 3.10+
- Novita.ai API key — get one (~$0.10–0.50/hr for Llama 4 Maverick 17B)
Installation
- Install the mod
Via mod manager (recommended): Install with r2modman or Mod Manager page.
Manually: Download the latest release, and drop Rainflayer.dll into your BepInEx/plugins/ folder. Repeat for dependencies.
Launch RoR2 once to generate the config file, then close it.
- Set up the Python brain
python -m venv venv
source venv/bin/activate # Windows:
安裝與使用 安裝:BepInEx 外掛
- 本站下載的壓縮包就是模組本體,通常是 BepInEx 外掛(解壓後得到 .dll 或外掛資料夾)。
- 建議流程:用社群模組管理器(如 r2modman)選中本遊戲後匯入該模組,管理器會自動裝好 BepInEx 前置並處理依賴。
- 手動流程:先在遊戲目錄裝好 BepInEx 載入器,再把解壓出的 .dll 或外掛資料夾放進 BepInEx/plugins/。
- 啟動遊戲,BepInEx 控制台會列印載入日誌;確認這個模組出現在日誌裡即為安裝成功。
帶「前置依賴」的模組需要一併安裝,否則不會載入。功能開關通常在遊戲內或外掛自帶的設定檔裡調整。
下面這些內容需要先安裝,否則該模組不會生效: