Rainflayer

v1.1.1·Updated 2026-03-10

(Experimental) LLM Integration for Risk of Rain 2 Player Control

About this mod Author’s original text

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:

Install & use Install: BepInEx plugin

  1. The archive from playbuff is the mod itself — usually a BepInEx plugin (a .dll or a plugin folder once unzipped).
  2. Recommended: use a community mod manager (such as r2modman) — pick this game, import the mod, and the manager sets up BepInEx and its dependencies for you.
  3. Manual route: install the BepInEx loader in the game folder, then drop the unzipped .dll or plugin folder into BepInEx/plugins/.
  4. Launch the game — the BepInEx console logs every plugin it loads; seeing this mod in the log means it is installed.

Mods with listed dependencies need those installed too, or they will not load. Options are usually changed in-game or in the plugin's config file.

Dependencies

Install these first, or the mod will not work:

bbepis-BepInExPackRiskofThunder-HookGenPatcherRiskofThunder-R2API_Core

File & checksum

Filename
Rainflayer-1.1.1.zip
File size
166.9 KiB