This next part in the series was intended to cover the Europa Engine and amphibious invasions. However, I would like to take a detour and jump to what was originally intended to be last in the series: (My) general philosophy on a competent AI for Paradox games.
Short answer:
Contrary to forum conventional wisdom, I believe it to be not only possible, but also not requiring particularly advanced computer specs (i.e Win 7 machine with <4 GB RAM) for Europa Engine-based games. I have virtually no experience with newer games on the Clausewitz engine, but I suspect that some of the below applies there as well
Long answer:
A little bit about myself for perspective: I'm NOT affiliated with Paradox in any way, any insights have been acquired through trial and error. I've been playing their games since I found EU1 in a bargain bin at Best Buy, the day before my 1st day of college. I'm also NOT a programmer by profession; more of a weekend warrior really, who does small scripting in VBA for personal projects and to automate large-scale event creation for Paradox mods. I learned programming in a HS course on Pascal, then a 2nd one on C++ (but haven’t used either since).
That out of the way…There has been a general consensus on the forums that programming a competent AI is not currently feasible, unlike chess AI. It is too complex, too slow, too memory-intensive, or some combination. For a real-time strategy game, it is a non-starter, if the engine takes 10secs, much less 10 minutes to do something, right? What to do?
I believe the path forward is to approach the AI Problem differently.
You allow Paradox’s engine(s) to play the game real-time with no or limited patches to their existing engine. And then, Paradox/modders/some combo build an external engine above the current game-play engine. This external engine doesn’t have to be particularly complex, especially at 1st. IMO, it needs to have the following qualities:
1. Open and available source code, so the full power of the Paradox community can access and improve it
2. Written in a common, non-proprietary programming language capable of handling large datasets ‘relatively’ fast. Example languages could be Python, whatever the language is for R, possibly even VBA (which is what I’m currently doing), or any number of others used in big data analysis. Because IMO, this is what a Paradox game really is: big data and a map file.
3. Ability to interface/connect to the Europa (or Clausewitz) Engine in real-time to upload AI commands to Paradox’s engine
4. Frequent game saves (3-5 days during war, biweekly during peace)
In essence, AI play is then divided into 3 parts, similar to how HP plays:
a) sensory function/Save file
b) analysis function/External engine
c) motor function/ real-time interface with the Europa Engine
Part A, sensory function, is straightforward through either frequent manual saves or autosaves. Part B is a programming problem that does not have to be overly complex at first. It needs to be a practical, robust, and relatively dynamic solution (ie. heuristic), rather than an optimal solution.
I have taken the liberty of calling this external engine: Katka, and the development process for creating it: Project AI. More to follow on Katka in the coming months.
Finally, Part C, the motor function or Katka-Europa interface is also surprisingly simple. Paradox’s Europa Engine is organized, so that it reads all AI files (files with .ai extension) in run-time, instead of compiling during game start or scenario load. Based on what I have seen, from a 30K ft view, Europa Engine games are organized as follows:
Game start: Load province files, map files, buttons, etc.
Scenario load: Load event files, country creation files, most pics, etc.
Real-time gameplay: Load AI files when called by event, some pics, etc
As long as there is a pre-created daily event to switch to the most recent AI file (hidden as AI_EVENT to avoid hundreds of events in the ledger), Katka can dynamically control AI actions daily.
But you ask, who creates the daily changes to the AI file? That’s a lot of work, right? This is Katka’s job. She imports the most recent save file to look at all data, uses ML algorithms (combined with starter logic shortcuts) to make decisions, then creates a new AI text file for that day. And that gets read into the Europa Engine through the following day’s event.
Katka is also able to take apart and rebuild .eug files, making necessary changes to AI leader placements, force composition, etc. to improve AI efficiency, while completely ignoring the HP country. Just a big C+P really of the Save file, what people already do when frustrated with the AI. This unfortunately requires reloading, but a reload once every 6-12 months is not an unrealistic ask to improve gameplay experience.
In conclusion, the AI files in HOI1, HOI2, DH, AoD, Vic1, etc are quite detailed and allow for a lot of external control. Katka takes this control and runs with it, adding daily AI file switching and AI optimization. Imagine how much worse you would fare in your games, if you could only tweak your country once per year or less. That is the handicap the AI currently has to overcome in playing games
Short answer:
Contrary to forum conventional wisdom, I believe it to be not only possible, but also not requiring particularly advanced computer specs (i.e Win 7 machine with <4 GB RAM) for Europa Engine-based games. I have virtually no experience with newer games on the Clausewitz engine, but I suspect that some of the below applies there as well
Long answer:
A little bit about myself for perspective: I'm NOT affiliated with Paradox in any way, any insights have been acquired through trial and error. I've been playing their games since I found EU1 in a bargain bin at Best Buy, the day before my 1st day of college. I'm also NOT a programmer by profession; more of a weekend warrior really, who does small scripting in VBA for personal projects and to automate large-scale event creation for Paradox mods. I learned programming in a HS course on Pascal, then a 2nd one on C++ (but haven’t used either since).
That out of the way…There has been a general consensus on the forums that programming a competent AI is not currently feasible, unlike chess AI. It is too complex, too slow, too memory-intensive, or some combination. For a real-time strategy game, it is a non-starter, if the engine takes 10secs, much less 10 minutes to do something, right? What to do?
I believe the path forward is to approach the AI Problem differently.
You allow Paradox’s engine(s) to play the game real-time with no or limited patches to their existing engine. And then, Paradox/modders/some combo build an external engine above the current game-play engine. This external engine doesn’t have to be particularly complex, especially at 1st. IMO, it needs to have the following qualities:
1. Open and available source code, so the full power of the Paradox community can access and improve it
2. Written in a common, non-proprietary programming language capable of handling large datasets ‘relatively’ fast. Example languages could be Python, whatever the language is for R, possibly even VBA (which is what I’m currently doing), or any number of others used in big data analysis. Because IMO, this is what a Paradox game really is: big data and a map file.
3. Ability to interface/connect to the Europa (or Clausewitz) Engine in real-time to upload AI commands to Paradox’s engine
4. Frequent game saves (3-5 days during war, biweekly during peace)
In essence, AI play is then divided into 3 parts, similar to how HP plays:
a) sensory function/Save file
b) analysis function/External engine
c) motor function/ real-time interface with the Europa Engine
Part A, sensory function, is straightforward through either frequent manual saves or autosaves. Part B is a programming problem that does not have to be overly complex at first. It needs to be a practical, robust, and relatively dynamic solution (ie. heuristic), rather than an optimal solution.
I have taken the liberty of calling this external engine: Katka, and the development process for creating it: Project AI. More to follow on Katka in the coming months.
Finally, Part C, the motor function or Katka-Europa interface is also surprisingly simple. Paradox’s Europa Engine is organized, so that it reads all AI files (files with .ai extension) in run-time, instead of compiling during game start or scenario load. Based on what I have seen, from a 30K ft view, Europa Engine games are organized as follows:
Game start: Load province files, map files, buttons, etc.
Scenario load: Load event files, country creation files, most pics, etc.
Real-time gameplay: Load AI files when called by event, some pics, etc
As long as there is a pre-created daily event to switch to the most recent AI file (hidden as AI_EVENT to avoid hundreds of events in the ledger), Katka can dynamically control AI actions daily.
But you ask, who creates the daily changes to the AI file? That’s a lot of work, right? This is Katka’s job. She imports the most recent save file to look at all data, uses ML algorithms (combined with starter logic shortcuts) to make decisions, then creates a new AI text file for that day. And that gets read into the Europa Engine through the following day’s event.
Katka is also able to take apart and rebuild .eug files, making necessary changes to AI leader placements, force composition, etc. to improve AI efficiency, while completely ignoring the HP country. Just a big C+P really of the Save file, what people already do when frustrated with the AI. This unfortunately requires reloading, but a reload once every 6-12 months is not an unrealistic ask to improve gameplay experience.
In conclusion, the AI files in HOI1, HOI2, DH, AoD, Vic1, etc are quite detailed and allow for a lot of external control. Katka takes this control and runs with it, adding daily AI file switching and AI optimization. Imagine how much worse you would fare in your games, if you could only tweak your country once per year or less. That is the handicap the AI currently has to overcome in playing games
- 2