Civilization V AI Reference and Stuff

Velasti

Warlord
Joined
Sep 26, 2014
Messages
103
As a matter of interest, could anyone provide an insight as to the current state of the AI in Civ V, with regards to its overall structure, how much ability players have to mod it, what references there are with how it works, and so on?

How accessible is modding the AI?

Is there transparency, or is most of the AI hidden in the engine, and so the most you can do is minor tweaks?
 
There are two ways of modding the AI: XML modding and DLL modding.

XML modding is relatively easy and accessible, but extremely limiting. You're essentially tweaking number values used by the AI in its machinery. This means you are limited to modifying values the developers decided to load from XML files (versus hardcoding them), and you cannot modify the actual logic behind said values.

Anything more extensive requires modding the DLL. You'll need a strong programming background (or be both extremely patient and willing to learn), the necessary tools to work with C++ source code, and the DLL's source code (available in Civ5 SDK's folder). All AI routines can be modified via DLL modding, so your only two limitations are how much you can understand the original source code and how far your hardware can take you performance-wise (complicated AI routines can be quite CPU-intensive).

To my knowledge, there are no real references out there of how the AI works simply because routines are so intertwined. Of the two months I spent working on my AI mod, Artificial Unintelligence, at least a month was spent just looking at the source code and trying to understand how the various AI pieces worked together.
 
Eh, forgot about Lua modding: you can inject algorithms into certain AI functions via Lua hooks, but you're still fairly limited, as you cannot change or remove anything. You'll have to ask someone else about how to do this sort of stuff if you're interested though, as I know almost nothing about Civ5/BE Lua modding.

BE's DLL source code hasn't been released, so I couldn't really work on it even if I wanted to (which I don't, seeing how rife the game is with design issues).
The only "work" I've done is port my mod's lite version to BE; this took a grand total of 5 minutes, most of which was spent renaming "Gold" and "Happiness" tags to "Energy" and "Health" tags, because that's how much the AI was changed from Civ5 to BE. Firaxis didn't even bother to remove the entries for religions, ideologies, and city states from their XML files...
Anywho, since I don't own BE, I can't upload it to the workshop, but I've made the files available for anyone to use over at this thread; my only request is to give credit where credit is due if you upload it anywhere.
 
Eh, forgot about Lua modding: you can inject algorithms into certain AI functions via Lua hooks, but you're still fairly limited, as you cannot change or remove anything. You'll have to ask someone else about how to do this sort of stuff if you're interested though, as I know almost nothing about Civ5/BE Lua modding.

BE's DLL source code hasn't been released, so I couldn't really work on it even if I wanted to (which I don't, seeing how rife the game is with design issues).
The only "work" I've done is port my mod's lite version to BE; this took a grand total of 5 minutes, most of which was spent renaming "Gold" and "Happiness" tags to "Energy" and "Health" tags, because that's how much the AI was changed from Civ5 to BE. Firaxis didn't even bother to remove the entries for religions, ideologies, and city states from their XML files...
Anywho, since I don't own BE, I can't upload it to the workshop, but I've made the files available for anyone to use over at this thread; my only request is to give credit where credit is due if you upload it anywhere.
Cheers thank you.

Have you ever contacted 2K/Firaxis, the devs etc. about being nicer about opening up these elements to modding?
 
Top Bottom