Title: Modding Videogames with AI Agents
Slug: modding-videogames-with-ai-agents
Date: 2026-11-25 18:25:00
Author: Diego
Lang: en
Tags: Development, AI & ML, Game Dev, Testing, C#, C++, Reverse Engineering
og_image: https://images.kartones.net/posts/kartonesblog/all_your_engine_are_belong_to_us_meme.jpeg
Description: Experimenting with AI agents to reverse-engineer and mod commercial Unity and Unreal Engine games, with surprisingly little game-specific knowledge.


In [my previous post](https://blog.kartones.net/post/porting-1989-game-and-watch-to-javascript-with-ai/), I mentioned three game development workflows that I think AI will drastically change in the near term. I deliberately omitted a fourth one: modding. Not because it is less interesting, but because this one might not actually be under the game creators' control...

### The Background

In the early nineties, [game modding](https://en.wikipedia.org/wiki/Video_game_modding#id_Software,_Doom_(1993)) became increasingly accepted by the industry, and some companies began to provide documentation, mod-friendly game asset file formats, and even official modding tools. Over time, however, this openness again became infrequent. My personal suspicion is that user-generated content doesn't align well with business models built around selling additional content like expansions and [microtransactions](https://en.wikipedia.org/wiki/Microtransaction). Thankfully, videogame modding is still quite active these days [^1], but reverse-engineering game file formats and other data structures is often tedious and hard work (it was already so [with older games](https://github.com/Kartones/syndicate-map-viewer)!).

Last year, I combined manual reverse engineering with AI-assisted efforts to extract and potentially modify assets from one of my favourite games, [Baldur's Gate: Dark Alliance](https://www.gog.com/en/game/baldurs_gate_dark_alliance). Reading about previous efforts and some tooling, I was able to reuse information on asset-extraction from the PlayStation 2 version, to instead get PC version assets. It is not a complete project, but I've been able to extract textures, sounds, and potentially 3D meshes (including those from the levels). But manually reviewing textures and custom-made JSON files is a slow and sometimes exhausting process. An example monster texture:

![Baldur's Gate Dark Alliance Beholder monster texture](https://images.kartones.net/posts/screenshots/bgda_beholder_texture.png)

### The Experiment(s)

So, in between my experiments, I decided to check how well an AI agent could do against a commercial videogame engine's assets. After all, if LLMs are trained on most of the internet and many books and videos... they should be pretty darn good with "mainstream" technologies, right? But knowing the engine is one thing, and figuring out how a particular game uses it is another. That's what I wanted to test, how well that knowledge generalizes to individual games.

I made tests with the two best-known engines, [Unity](https://unity.com/) and [Unreal Engine](https://www.unrealengine.com/). While both succeeded, the Unreal Engine one was performed on a demo version of a yet unreleased title, so I'll wait for the proper retail release until I release any mod.

As a spoiler, what surprised me the most was how little game-specific knowledge I needed to give agents to create game mods. Both tests were done with Claude Sonnet 5.5, by the way.

### Unreal Engine

About Unreal Engine modding with AI, let's just say that models are quite skilled at using [UE4SS (Unreal Engine 4/5 Scripting System)](https://docs.ue4ss.com/). The game mod was fully built by the agent; I only did the testing in-game. We had to go back and forth a bit, partially because the game demo I picked apparently had some stubbed methods (empty, and apparently not called), confusing my agent at first when it wired logic to them but the patched methods were not being called. Still, it was less than 30 minutes, probably half if I used a full game instead.

It patched a few methods and was able to "generate wood from hitting a log with a club" (it is a first-person 3D survival game). No new assets yet (I want to have a proper axe), just spawning existing items and adapting existing game logic. The fact that the log object had no impact logic was very fun to work around. In the end, at the agent's suggestion, we faked hitting the item: if you're looking at it, and you attack with the club, and the log body is inside a certain radius distance from you, it will register as a hit and spawn either sticks or another log. Smart trick!

UE4SS itself is quite spectacular, enabling a debug GUI from which you can tinker with game objects, then log and dump data, which then the agent can parse and extract information from. And despite the `4` in the name, it also supports Unreal Engine 5.

### Unity

As for Unity, my AI agent suggested using [BepInEx (Bepis Injector Extensible)](https://github.com/BepInEx/BepInEx), as it supports both C#/Mono and `IL2CPP` (C# compiled to native code via C++). Alongside the `Ildasm.exe` and `ILSpy` tools [^2], in no time we had a pretty interesting decompilation of the main game DLL into readable C# (I miss that language...). 

The game is [Cozy Game Restoration](https://store.steampowered.com/app/3581230/Cozy_Game_Restoration/), and your job is to clean old videogames with some tools. I first wanted to see how hard it would be to replace the fake game cartridges with real equivalents. I asked Claude Code to see how to obtain the image assets and game titles, and quickly I had all of them extracted. If you want details you can simply check this repository: [https://github.com/Kartones/cozy-cart-art-plugin](https://github.com/Kartones/cozy-cart-art-plugin), but the TL;DR is that you get one cover image per cartridge/disk, plus some consoles have a rear sticker simulating the trademarks, safety recommendations and the like, plus a nice CSV list of all the game names.

I defined and partially coded the format to patch in replacement images (by following the same naming pattern, which is quite intuitive) and to optionally rename the game title also, and let the AI agent come up with the hooks and bits to plug it into BepInEx and the specific game methods. For example, it searched when and where to replace the textures, and found that there was a texture cache and a way to modify the titles, both in-memory instead of having to patch Unity resource files.

Building the plugin took less than 30 minutes. Here is an in-game screenshot of the Donkey Kong Country cartridge "restored" to an approximation of the original cover:

![Cozy Game Restoration modded cartridge in-game screenshot](https://images.kartones.net/posts/screenshots/cozy_game_restoration_mod_screenshot.jpg)

Seeing how easily the agent could modify Unity titles, I decided to also build a "tool boost plugin", to test if it could convert game-specific asks into valid patches, without prior knowledge of this videogame's internals. My prompts were along the lines of "I want the UV light to last 3 times longer", "I want to be able to specify the radius of toothbrush cleaning" or "make the tools absorb more dirt".

In this case, I let it code everything on its own, and even created a BepInEx configuration file, so anybody can adjust each value without needing to recompile the source code. Best of all? It one-shotted the implementation on its own on the first try. In less than 15 minutes, including me asking for more features in a second and third round. It took more time to boot up the game to test than to come up with the changes.

The repository containing the plugin is [https://github.com/Kartones/cozy-cart-boost-plugin](https://github.com/Kartones/cozy-cart-boost-plugin). Tiny and clean, it could perfectly pass as human-generated code. It might break in the future if the game developers rename the methods I've patched, but it would become a cat-and-mouse scenario. Plus my intention was just to experiment, not to actively maintain this plugin.

### Conclusion

![All your engine are belong to us meme](https://images.kartones.net/posts/kartonesblog/all_your_engine_are_belong_to_us_meme.jpeg)

This old gaming meme summarizes perfectly my point of view: I believe that we are going to enter into an era of insane game personalization, whether the creators originally intended to allow it or not. And, as videogame development is becoming increasingly more expensive, and more studios tend to rely on a shrinking group of game engines, it will be harder to avoid a flood of mods and reverse-engineer efforts than if you built your own thing from scratch (as in the old times). And why not allow modding? After all, we paid for the game, and we want to extend our enjoyment of it by moulding and expanding it in new ways, which is proof of the success in creating an entertaining piece of software.

Of course, games with server-side logic, online asset streaming, anti-cheat systems, and locked-down platforms are a different story, but for PC offline single-player games and older platforms, I think that the barriers are going to keep falling. And, in any case, we already have decades of existing games at our disposal.


And all of this, without needing to understand the game's internals yourself: Agents can perfectly probe and identify which engine a game uses, suggest tools (and install them on your behalf, if you allow them), and go all the way until you have the mod ready to test, complete with step-by-step instructions on how to set it up. Videogame modding is becoming accessible to almost anyone.


[^1]: [ModDB](https://www.moddb.com/) and [NexusMods](https://www.nexusmods.com/) are among the biggest and most active communities as of late 2026.

[^2]: When C++ is involved, you'll need additional tools like `Il2CppDumper` or `Cpp2IL`. For this game, I didn't have to use them, as the title does not use IL2CPP.
