• We have updated our Community Code of Conduct. Please read through the new rules for the forum that are an integral part of Paradox Interactive’s User Agreement.

AndrisN

Private
1 Badges
Feb 16, 2010
23
26
  • March of the Eagles
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
 
  • 2Like
Reactions:
Quick visual update on Katka's development. Working on creating the UI, but haven't put the skins in yet, so a little grey.


Diplomacy:

Diplomacy 1.jpg




Diplomacy 2 Alternate Ministers.jpg



Technology:

Technology 1 Infantry.jpg



Technology 2 Electronics.jpg



Technology 3 Nuclear.jpg



Technology 4 Subs.jpg



Technology 5 Land Doc.jpg



Technology 6 Naval Doc.jpg




Technology 7 Current Research.jpg



Import/Export Save File

Pic1.jpg
 

Attachments

  • Diplomacy 1.jpg
    Diplomacy 1.jpg
    177,9 KB · Views: 0
  • Diplomacy 2 Alternate Ministers.jpg
    Diplomacy 2 Alternate Ministers.jpg
    147,7 KB · Views: 0
  • Technology 1 Infantry.jpg
    Technology 1 Infantry.jpg
    220,5 KB · Views: 0
  • 2Like
Reactions:
This month has been work on the Diplomacy and Production view, and integrating the graphics into the UI.

Dipomacy is mostly complete at this point, including an updated Peace Treaty system, as well as most of the other diplomacy options available in HOI2. I haven't gotten to the Trade Agreements yet, but hope to soon.

In the Production tab, sliders are up and running and the unit creation work is mostly complete, incl. land/air/naval units. Katka is able to calculate current combat parameters for each unit, either from the Save File or through the summing of tech. effects. I should have the full list of unit models and brigades showing soon as well.

Here are some pics:

Diplomacy:


Diplomacy 1 Overall 1.jpg



Diplomacy 1 Overall 2.jpg



Diplomacy 1 Alternate Ministers.jpg


Diplomacy 2 Peace Treaty.jpg


Diplomacy 5 Declare War.jpg



Diplomacy 4 Influence Nation.jpg



Diplomacy 6 Send Exped Force.jpg



Diplomacy 7 NA Pact.jpg


Production View

Production 1 Land Units.jpg


Production 2 Air Units.jpg


Production 3 Escorts.jpg


Production 4 Naval Bases.jpg


Production 5 Units Produced.jpg
 
Update: Production tab is almost complete, and the Peace Treaty system should now work. Sample French production queue in 1938 (Most of the countries can now be loaded in)

Production 11 French Production 1938.jpg


French Army

Production 2 French Motorized 1938 w Artillery Brigade.jpg


Production 3 French Mountain 1938 w Engineer Brigade.jpg


Peace Treaty System

Diplomacy 1 Peace Treaty Screen.jpg


Production 1 French Infantry 1938 w Artillery Brigade.jpg


French Air

Production 4 French Fighter 1938 w Night Fighter Attach.jpg


Production 5 French Tac Bomber 1938.jpg


French Navy

Production 6 French Destroyer 1938 w ASW Attach.jpg


Production 7 French Battleship 1938.jpg


Production 8 French Carrier 1938.jpg


Brigades

Production 9 French AntiTank 1938.jpg



Production 10 French AntiAir 1938.jpg
 
Update: It has been 8 months since the last update. I haven't been able to work on this as much as I would like, however, some progress has been made.

Trade tab is almost complete, including world market, convoys, and supply depots.

UK Trade screen

UK Trade View.jpg


France Trade Screen:

France Trade View.jpg


I have started work on the Map View. This includes all province data as well as the units stationed in the province.

UK

UK London.jpg


UK Portsmouth.jpg


UK Singapore.jpg


France

France Chaumont.jpg


France Marseilles.jpg
France Paris.jpg
 
  • 2Like
Reactions: