Neuro Sama Civ 5 API

The Neuro Sama Civ 5 API is a tool used to allow LLMs and decision models to control and play Sid Meier’s Civilization 5.

Posted

How it works

There’s multiple parts that function in this project. Firstly, there’s a lua mod that reads the current game state and sends this to the API. That way, the API has access to every aspect of the current game. Once it’s gotten the current game state, it creates a summarised list of information about the game state, and a list of actions that are required to be completed before the turn can end. It also offers actions that are optional to complete. Once the actions are completed, the API verifies that everything was completed correctly and finally offers the ability to end the turn.

Since the API only reports a summary, the AI can inspect certain details of the gamestate to gain a full list of information or actions. The API also allows queueing multiple actions in a single tool call, to reduce the thinking time required per action. In an effort to decrease thinking time further, support for decision models also is in this mod. What this entails is that the user can have a decision model solely play the game and output decisions, or, the user can have the LLM call a decision model to delegate responses for specific actions, specific queues of actions, specific turns, or a specific group of turns.

Multiplayer

This API also supports multiplayer games in Hotseat, LAN (Pitboss) and Online via Steam. In order to play online, your AI must use a Steam account to utilise Steam’s multiplayer servers. I recommend against joining public lobbies with this API, though there is nothing preventing you from using it this way. If you would like to have two or more instances of an AI playing in online servers, you’ll need two or more steam accounts that own Civ 5. In order to play in LAN, due to how the mod is implemented, you have to have two separate installs of Civ 5 because the mod directly alters the game files to hook into the Neuro SDK Socket. I used Sandboxie for this purpose, but you should research your options and pick the best setup for your use.

Why I made it

I’ve really enjoyed playing Civ 5 ever since my brother introduced me to it in 2014, and I personally have over 1200 hours in the game. I’ve really enjoyed making this project because it brings two of my passions, Civ 5 and AI together, and I hope this mod brings joy to people who also enjoy these things. I’ve had this concept in the back of my mind ever since the first clip I saw of Neuro-Sama, of her playing Minecraft in the second birthday subathon. If an LLM can play Minecraft, what prevents them from playing other games? So, whenever I started vibecoding as a hobby, I realised I can make an integration like this as well.

Well, that’s all I have to say about this project. I hope everyone enjoys it!