Smart AI

DarkPhoton

Chieftain
Joined
Jul 15, 2021
Messages
9
Hi,

I would like to know if anybody who is good at modding could help me make a smart AI mod.

My plan is to create a deep learning model that can play the AIs rather than modifying the official AI. The AI can run on the computer in parallel to civilization or in the cloud. For that, I would need help extracting the information and sending the moves. Also, it would be good if other people can run the scripts to train the model too once it is ready since it will have to play a very large number of games before being ready.

I'm working professionally with deep learning and have good competencies for that, but I've never modded before so it would be nice to have help if anybody else is interested.

Also, to get a reasonable speed, the AI will have to play simultaneously as the player rather than playing as fast as possible between the player's moves.

I expect this AI's performance will be at first less good than an expert player, but it should be significantly stronger than the official AI. We can use handicaps to make this smarter AI even more challenging.
 
I don't know much about modding or deep learning but this is certainly a fascinating topic for this game.

Looks like you need a UI mod to change all the game so that your DL AI can read all of it at once and then give it inputs so once it makes a decision, it can execute it as fast as possible without all the animations and menus ect.

Once you have that would you just make an online game with your DL AI against civ diety AI? Looks like a gargantuan task considering how complicated this game is. Even if you keep the settings and civ same, the map is different every time and rules somewhat change with eras. (flying units and nukes) The amount of time going into it to train an AI seems insane, I hope you have a supercomputer at hand.

Even after finishing a some sort of version of it then playing against a human with simultaneous turns enabled would totally change the game. Diety AI is still "gamey" in a sence that you can build diplomacy, get alliance and then it will just let you win and not declare war on you.

If you figure all that out I'd love to watch some YouTube videos of good players tackling your DL AI!
 
Yes, I will show examples of games between my DL AI and civ official AI, and release it so anybody can play with it. The first step is to get a mod that makes that we can get the information and send orders as efficiently as possible so it can run fast.

Mastering civ is certainly a hard task, but the initial goal is to beat the official AI not to beat the best player in the world like it has been done for many simpler games, and I think that should be doable for civ.

Let me know if you want to help and know enough about modding to help.
 
Tbh, I don't know how you can make an AI beside the Game's AI and integrate it within the Game without access to the DLL, so I'm curious to know if that's possible, and how it can be achieved.

You have to know that we don't have access to Civ6's DLL, so we don't know neither how the Game's AI exactly works (it's behaviour), nor do we have access to all the Game's functions (also no Lua API). Most of Modders' knowledge about Civ6's modding comes from oodles and oodles of tests, which are just like groping in the dark till you hit something, even now after nearly 5 years existence of the Game.

tbh, I'm not exactly sure what your goal with the AI is. Do you want to make a custom AI that plays the Game in the place of the Human Player, aka. against civ's AI, or do you want it to play in place of the Game's AI?

For the first, and that depends on how you want to achieve this (again, I don't have knowledge about DL AI. If you had success with your methode with games that didn't have a released DLL, then it might work), I think it might be possible (there are some mods that automate things for the Player, but those are hardcoded, not AI. But if your DL AI can have access to the Lua files of the Game (or vise versa, maybe through Python?), then it should actually work). It can be achieved through the UI context which only the Human Player has access to, but you can also make use of the Lua Gameplay context (if that can help your AI - in the game, apart from mods, this is mainly used for map generation and game set-up purpuses (like new in-game rules for scenarios)).

For the latter, considering the lack of DLL, I don't think that's possible. You can maybe try the Local network/Hotseat/Multiplayer so you can give the DL AI control of one of the Human Players, but that isn't like taking control of the AI.
 
The goal is to create my own AI which will play through its own API (possibly using Local network/Hotseat/Multiplayer depending if the AI runs in the cloud or locally) which I would like help with so let me know if you can help. The API used by the DL AI needs to be fast and only includes useful information, it must not transfer any graphics.

I will not touch the official AI (which can only be done superficially anyway without DLL files), but my AI will be available through the mod so that anyone can use it rather than using the official AI. The AI will probably appear as a human to the game, but I don't see how this is an issue. It's an AI, so anyone can play with it at their pace. A lot of people play single-player even though they think the AI is too weak because there are a lot of inconveniences to play multiplayer including that you need to block a big chunk of time and you need to play pretty fast.
 
@devolution I am planning to try to do it on civ 6. I think it should be possible without DLL since I can have the deep learning AI runs separately and I won't base my AI on the official AI (which is most likely an expert system) so I don't need to see what they've done. Civ 4 and 5 have already improved AI, I think improving the AI is more of a priority for civ 6.
 
sounds possible, but maybe not easy to implement.

how do you plan to get the data and send the commands ?
 
the only way I can think of to output something is the Lua.log file using the "print" command from a Lua script.

to send the commands, I think the game re-load modified Lua files (in the UI context of the game) when they are saved from an external program, you could write them in such a file coded to execute them on re-load.
 
  • Like
Reactions: uhu
Is there a simple way to print all the information about the state of the game in the lua.log file?
 
no simple way AFAIK, you'll have to iterate everything (units, cities, map tiles, ...) manually I suppose.
 
Can I modify a lua file so that the game interprets that as commands (to move units, select productions, change city focus or lock citizens, select research, etc.)? How should I do that if possible?
 
Back
Top Bottom