Sid Meier's Civilization V

Sid Meier's Civilization V

44 ratings
Faster AI Turn Processing
Tags: Other
File Size
0.181 MB
Oct 10, 2021 @ 6:06pm
Oct 16, 2021 @ 9:01pm
4 Change Notes ( view )

Subscribe to download
Faster AI Turn Processing

haha ai turn processing go brrrrrr

hosted on discord CDN[] or nexusmods[]

Install by either unzipping to your Civilization V folder
or copying file from zip to your civilization folder

will overwrite or be overwritten by any mod that replaces lua51_Win32.dll

More Information

Wait, how does this work?
from my topic over at BoingBoing's BBS[]:
wait, what the heck?
Civilization V, like Civilization IV before it, uses a Lua interpreter to load information into the game, to build, and execute AI decision trees, and to execute routines. the diplomacy system? controlled by a .Lua file. the menu system? controlled by Lua. this allowed development of the game to occur very quickly in a collaborative setting without having to constantly build and deploy new versions of the game -- a Lua file is a plain-text file, easily shared.
Lua interfaces are not exactly uncommon. It's a very powerful scripting language, one that open source projects like Minetest use to enable users to create and distribute modifications. An entire game-making engine, LOVE2D, is built on it.
Lua is somewhere between Javascript and Python in terms of ubiquity, ease of development, and features. Created and maintained by a team at the catholic university PUC-Rio, Lua has been around for as long as the World Wide Web. It’s probably older than your children, and definitely older than your car. Like other programming languages, it routinely gets extended with newer updates and new features. Not all Lua functions are always integrated into games; some games only expose a narrow set of commands and data structures to a Lua API - reserving the real calculations for the meatier and faster native program binary.

Interpreted languages like Lua can be performant, but not nearly as fast in executing instructions as native programs. Enter the JIT. Just-in-Time compilers/interpreters convert script into machine language, making the exact same script execute dozens if not hundreds of times more quickly. JITs sometimes omit or rewrite how functions work; some JITs keep variables in memory after a function is completed, for example.

What this mod is and how it works
This mod is a customized, Just-In-Time Lua interpreter/compiler.

Specifically, this mod is a pre-compiled binary of moonJIT 2.2.

What it does is compiles .Lua files into machine-compatible low-level programming code. It keeps this code in memory so it can be executed very quickly when the game executes any functions that require reading a Lua file. Since the game can call a Lua file multiple times per turn, this mod essentially reduces the file read-> cache -> interpretation cycle to 0 milliseconds by doing it instantly.

Since text files don't use that much space, the amount of additional RAM consumed is around 50 megabytes. That's two mp3 podcast files. Or less than a single minute of video. Your music-streaming tab of spotify or youtube consumes 200x more RAM than this mod does.

moonJIT team, for moonJIT 2.2
moonJIT based on luaJIT 2.1

Source Code:
moonJIT @
luaJIT @
lua created and maintained by lua team

forever free icon based on jokerine's icon, and bigcman123's vault girl hud HD

also viewable on Nexus Mods
< >
Lash [fof_bb]  [author] Apr 5 @ 3:37pm 
hi, Falling564, MPPatch already includes its own LuaJIT/moonJIT build -- version 2.0. I don't think this would break anything in MPPatch, but I don't think you would see much performance change vs standard MPPatch
Falling564 Mar 22 @ 9:03am 
Does this work with MPPatch?
NETLIGH7 Dec 26, 2021 @ 3:24am 
Could you put some stats on this. What mods will it speed up? It would be nice to actually try it out in a setting where a difference is visibly noticable.
Lash [fof_bb]  [author] Dec 23, 2021 @ 6:33pm 
[resubscribing to the thread because steam is a big weird system]
Lash [fof_bb]  [author] Dec 23, 2021 @ 6:33pm 
glad it worked for you, Anatolian Gizzard Slayer!
Mackintosh Dec 23, 2021 @ 5:16pm 
Tried this with a big modpack and it works very well. Great mod!
NETLIGH7 Dec 8, 2021 @ 3:54pm 
Tried it, but cannot really say I see any kind of speed up. It might be there, but perhaps is not in every case as substantial that it is noticeable.
Lash [fof_bb]  [author] Nov 15, 2021 @ 8:14pm 
hi, sean! sorry for the late response:

yes, it should work just fine.

the last time a just-in-time lua interpreter was tested with Vox Populi was four years ago, but it should work; since nothing major has changed with regards to Vox Populi's architecture.
YaBoiSeanSean Nov 13, 2021 @ 5:54am 
hello, does this work with vox populi
Dragonxxx Nov 9, 2021 @ 3:32pm 
Thanks for this gem, Lash.