AI Improvement Alpha Testings.
Moderators: firepowerjohan, rkr1958, Happycat, Slitherine Core
AI Improvement Alpha Testings.
1. I’ve always had a desire to improve AI play to the point where even an experienced player could be challenged by an AI that followed sound strategic and tactical strategies. I’ve even held a deep down desire to include some learning and storage functions where the AI could “learn” from its mistakes and improve its play through experience as we humans do. I realize this latter desire is very ambitious and would be like trying to get an advance graduate degree before learning to read. I guess we better start off with, “Jack and Jill” before we start working on a doctorial dissertation.
2. For the past year or two I’ve been dabbling with the AI on a very low priority basis. I do have a day job and GS is not it. Playing and improving GS is a hobby and will always remain that way with me. Any AI improvement takes a back seat to GS beta testing and development. And, truthfully it takes a back seat to life and may go “untouched” for weeks at a time. With the upcoming and official release of GSv2.10, I have a desire to spend more time on the AI and focus on improving it.
3. To be fully honest, nothing may ever come from my plunge into the world of the GS AI. However; if I don’t take the plunge then nothing for sure will ever come. So, for now, I’m sticking my toes into the water. What does that mean?
4. I’ve have built a separate location for my AI improvement development and testing. I call this location a sandbox and it’s a separate install from the GSv2.10 beta and what will become the official GSv2.10 release. When and how this activity will ever be merged back into GS is a consideration far away down the road and isn’t a particular concern now.
5. Also, I’ve made no attempt to rewrite any AI code. My philosophy, so far, has been that the AI code “works” to some extent and so, as I work my way through it I’ve been tweaking it to try to improve play and also try to understand what it’s doing in order for some day to support actually rewriting it. However; for now, I’m sticking to the tweaking and probing because of both time limitations and my understanding of the AI logic/code. Hence, my plunge for now is only toe deep.
6. My GS-AI sandbox uses the same data, image and map files as GS; but a different set of class files. My plan is to always keep it that way; so if we ever decide to integrate this back into GS it can possibly be done by have separate class files for play against the AI. That is; expect for these files, it will use the same files as GS (non-AI) uses. Since a set of class files is only about 1-MB this will not really add to the size of a GS install, which is now at 400-MB.
7. All tweaks to the AI so far have been hardcoded; but eventually I would like to make the AI actions controlled through data files as much as possible. So, even in the near-term, I see the addition of an AI-centric data file. However; at worse, I see this data file only adding 1 or 2-MB more to the install. In the distance future and if I ever make the plunge into the deep, I envisage one or more additional data files containing what the AI has learned (i.e., it’s memory). These files could eventually reach 10’s of MB’s in size but if we every get there … wow …
8. Here are the tweaks I’ve made so far:
a. Make the AI focused on a minor country’s capital when it invades and stop attacking the minor forces when the capital falls.
b. Be more aggressive to advance after combat and to attack adjacent and depleted enemy units. For example, it was frustrating to see the AI repair a unit, say at 5 or 6-steps, when that unit was adjacent to Warsaw and could have finished off a 1 or 2-step Polish unit there and completed the conquest of Poland. The tweaks I’ve made have changed this in most cases, not only for Warsaw; but for attacking enemy units on any resource hex.
c. When on the defense have the AI review its defenses. It will try to rail/move garrisons to all cities; except the capital in which case it will deploy an infantry corps there. Only units not at the front are considered for this duty. Any unit assigned to this duty will (or should) defend their assigned city/resource until destroyed, their country is conquered or the game ends. My intention was to stop the game from moving corps back and forth to cities in the rear areas and to free them up for frontline action.
d. The axis AI will accept the French armistice 75% of the time and reject it 25% of the time. This decision is hardwired and is made independent of the situation at the time in France. This is a prime example of an AI decision logic point that needs to be significantly reworked and controlled by data in a soon to be built AI-data file. But; for now it is what it is and it there to add more dimension to the AI play and testing.
e. In order not to “punish” the AI for GS changes “it doesn’t know about” there have been a number of cheats so that the AI is not charge of transport or invasion overages. Also, I just make a code change to allow it to land troops in non-fair weather. The long-term goal would be to do away with all AI-cheats; but that a way off. These for now are needed to keep the AI somewhat competitive.
9. The GS-AI alpha version, for now, is only available for the PC and at times it’s undergoing constant tweaks/changes and at other times being ignored. I will make this GS-AI alpha version (i.e., class file set) available if folks would like to join in on the alpha testing. If you do, I’d strongly suggest that you too make a separate sandbox for this testing as games created and stored by this version will not work with GSv2.10. If there’s enough interest I’ll upload the GS-AI alpha class file set, and update them as they change, and make available instructions for how to create a separate install (or sandbox) on you PC. Basically, you’d create another copy of GSv2.10 and then copy the GS-AI class files over the top of that.
10. For now, I’d recommend play against the AI (both against the axis and allied AI) with fog of war off in order to see what the AI is doing. I run the GS-AI beta with the axis AI playing against the allied AI. That is, the game is playing itself and watching it (for the most part) is like watching paint dry. This is controlled by the variable DEBUG_AI_VS_AI 1 (1=AI vs AI, 0= player vs AI) in the GS210_settings.txt file. NOTE: This file, along with the game turns, scenarios and additional output logs are stored in a different folder than used by GSv2.10. This different folder is: *\My Documents\CEAW Grand Strategy 2.10AI. Also, a set of game logs for debugging and development purposes are now generated and stored in *:\My Documents\CEAW Grand Strategy 2.10AI\data\gamelogs. The files in these logs are appended to so if you stop and restart, or start a new game, the information will be added to any previous information in these files. So you need to make sure you clean these files out periodically so they don’t grow too large.
11. If you’re interesting in AIalpha testing, I’m NOT recommending that you run it with AI vs AI. You can if you wish; but again that’s like watching paint dry. I do it to see if both AI’s can play a game through to the end without code error and I usually start one of these games before I go to bed or work and let it play while I’m not there. What I’m looking for now in alpha testing is if the axis AI, or allied AI, play is better than in GSv2.10 and what needs to be done to make it play better both tactically and strategically.
12. After reading this are you a PC user that’s interesting in GS AI improvement alpha testing? The one caveat though is that I may stick my toe in the water and decide it’s too cold; but who knows … I may swim across the Atlantic with this.
2. For the past year or two I’ve been dabbling with the AI on a very low priority basis. I do have a day job and GS is not it. Playing and improving GS is a hobby and will always remain that way with me. Any AI improvement takes a back seat to GS beta testing and development. And, truthfully it takes a back seat to life and may go “untouched” for weeks at a time. With the upcoming and official release of GSv2.10, I have a desire to spend more time on the AI and focus on improving it.
3. To be fully honest, nothing may ever come from my plunge into the world of the GS AI. However; if I don’t take the plunge then nothing for sure will ever come. So, for now, I’m sticking my toes into the water. What does that mean?
4. I’ve have built a separate location for my AI improvement development and testing. I call this location a sandbox and it’s a separate install from the GSv2.10 beta and what will become the official GSv2.10 release. When and how this activity will ever be merged back into GS is a consideration far away down the road and isn’t a particular concern now.
5. Also, I’ve made no attempt to rewrite any AI code. My philosophy, so far, has been that the AI code “works” to some extent and so, as I work my way through it I’ve been tweaking it to try to improve play and also try to understand what it’s doing in order for some day to support actually rewriting it. However; for now, I’m sticking to the tweaking and probing because of both time limitations and my understanding of the AI logic/code. Hence, my plunge for now is only toe deep.
6. My GS-AI sandbox uses the same data, image and map files as GS; but a different set of class files. My plan is to always keep it that way; so if we ever decide to integrate this back into GS it can possibly be done by have separate class files for play against the AI. That is; expect for these files, it will use the same files as GS (non-AI) uses. Since a set of class files is only about 1-MB this will not really add to the size of a GS install, which is now at 400-MB.
7. All tweaks to the AI so far have been hardcoded; but eventually I would like to make the AI actions controlled through data files as much as possible. So, even in the near-term, I see the addition of an AI-centric data file. However; at worse, I see this data file only adding 1 or 2-MB more to the install. In the distance future and if I ever make the plunge into the deep, I envisage one or more additional data files containing what the AI has learned (i.e., it’s memory). These files could eventually reach 10’s of MB’s in size but if we every get there … wow …
8. Here are the tweaks I’ve made so far:
a. Make the AI focused on a minor country’s capital when it invades and stop attacking the minor forces when the capital falls.
b. Be more aggressive to advance after combat and to attack adjacent and depleted enemy units. For example, it was frustrating to see the AI repair a unit, say at 5 or 6-steps, when that unit was adjacent to Warsaw and could have finished off a 1 or 2-step Polish unit there and completed the conquest of Poland. The tweaks I’ve made have changed this in most cases, not only for Warsaw; but for attacking enemy units on any resource hex.
c. When on the defense have the AI review its defenses. It will try to rail/move garrisons to all cities; except the capital in which case it will deploy an infantry corps there. Only units not at the front are considered for this duty. Any unit assigned to this duty will (or should) defend their assigned city/resource until destroyed, their country is conquered or the game ends. My intention was to stop the game from moving corps back and forth to cities in the rear areas and to free them up for frontline action.
d. The axis AI will accept the French armistice 75% of the time and reject it 25% of the time. This decision is hardwired and is made independent of the situation at the time in France. This is a prime example of an AI decision logic point that needs to be significantly reworked and controlled by data in a soon to be built AI-data file. But; for now it is what it is and it there to add more dimension to the AI play and testing.
e. In order not to “punish” the AI for GS changes “it doesn’t know about” there have been a number of cheats so that the AI is not charge of transport or invasion overages. Also, I just make a code change to allow it to land troops in non-fair weather. The long-term goal would be to do away with all AI-cheats; but that a way off. These for now are needed to keep the AI somewhat competitive.
9. The GS-AI alpha version, for now, is only available for the PC and at times it’s undergoing constant tweaks/changes and at other times being ignored. I will make this GS-AI alpha version (i.e., class file set) available if folks would like to join in on the alpha testing. If you do, I’d strongly suggest that you too make a separate sandbox for this testing as games created and stored by this version will not work with GSv2.10. If there’s enough interest I’ll upload the GS-AI alpha class file set, and update them as they change, and make available instructions for how to create a separate install (or sandbox) on you PC. Basically, you’d create another copy of GSv2.10 and then copy the GS-AI class files over the top of that.
10. For now, I’d recommend play against the AI (both against the axis and allied AI) with fog of war off in order to see what the AI is doing. I run the GS-AI beta with the axis AI playing against the allied AI. That is, the game is playing itself and watching it (for the most part) is like watching paint dry. This is controlled by the variable DEBUG_AI_VS_AI 1 (1=AI vs AI, 0= player vs AI) in the GS210_settings.txt file. NOTE: This file, along with the game turns, scenarios and additional output logs are stored in a different folder than used by GSv2.10. This different folder is: *\My Documents\CEAW Grand Strategy 2.10AI. Also, a set of game logs for debugging and development purposes are now generated and stored in *:\My Documents\CEAW Grand Strategy 2.10AI\data\gamelogs. The files in these logs are appended to so if you stop and restart, or start a new game, the information will be added to any previous information in these files. So you need to make sure you clean these files out periodically so they don’t grow too large.
11. If you’re interesting in AIalpha testing, I’m NOT recommending that you run it with AI vs AI. You can if you wish; but again that’s like watching paint dry. I do it to see if both AI’s can play a game through to the end without code error and I usually start one of these games before I go to bed or work and let it play while I’m not there. What I’m looking for now in alpha testing is if the axis AI, or allied AI, play is better than in GSv2.10 and what needs to be done to make it play better both tactically and strategically.
12. After reading this are you a PC user that’s interesting in GS AI improvement alpha testing? The one caveat though is that I may stick my toe in the water and decide it’s too cold; but who knows … I may swim across the Atlantic with this.
Last edited by rkr1958 on Sun Jan 22, 2012 3:12 pm, edited 1 time in total.
GSvAI-B001
Username: GrandStrategyTeam@slithdata.net
Password: 1Kr35MazgsZR
PC B001: GSvAI-B001.zip
MAC B001: TBP (To be provided).
B001 Verification Game Logs: B001-AIvsAI-Game-Logs.zip
Disclaimer: This is alpha code and will very likely be buggy ... but we have to begin somewhere.
GS AI Improvement B001 Change Log.
1. Make the AI focused on a minor country’s capital when it invades and stop attacking the minor forces when the capital falls.
2. Be more aggressive to advance after combat and to attack adjacent and depleted enemy units. For example, it was frustrating to see the AI repair a unit, say at 5 or 6-steps, when that unit was adjacent to Warsaw and could have finished off 3 1 or 2-step Polish unit there and completed the conquest of Poland. The tweaks I’ve made have changed this in most cases, not only for Warsaw; but for attacking enemy units on any resource hex.
4. When on the defense have the AI review its defenses. It will try to rail/move garrisons to all cities; except the capital in which case it will deploy an infantry corps there. Only units not at the front are considered for this duty. Any unit assigned to this duty will (or should) defend their assigned city/resource until destroyed, their country is conquered or the game ends. My intention was to stop the game from moving corps back and forth to cities in the rear areas and to free them up for frontline action.
5. The axis AI will accept the French armistice 75% of the time and reject it 25% of the time. This decision is hardwired and is made independent of the situation at the time in France. This is a prime example of an AI decision logic point that needs to be significantly reworked and controlled by data in a soon to be built AI-data file. But; for now it is what it is and it there to add more dimension to the AI play and testing.
GS AI Improvement B001 Developer Notes.
The first GS-AI build (B001) has been made available. Also included are the run logs for an AI-vs-AI debug game that played all the way through without crashing. For these early releases this will be the standard to be used to release a build. These first changes to the AI are akin to trying to teach a wayward child. First, we need to learn that child and get him under control before we can teach him anything. This is what this first build is ... changes made to try to learn what's going on in order to make improvements.
For the next build I'm currently working on a new AI class (cmdOPS), that will generate an object for controlling an operation (e.g., invasion of a minor or attacks against a major). I plan to control both the objective and the number of forces assigned, such that; for example, the axis AI invades Greece and then a few turn later invades Russia doesn't over assign forces to Greece that are needed in Russia. My goal for the next release is just to get the framework of this class and use of the objects spawned by it in place. Eventually, I see a cmdOPS object as controlling an Army Group, or even an Army, with a specific objective, such as the conquest of a minor (e.g., capture Athens) or capture Leningrad (e.g., Army Group North).
I haven't though it through completely yet but I would either need to adapt this class for defense operations or generate an equivalent one for such. Also, I would eventually envision at least two higher level classes (i.e., cmdTHT and cmdCNIC), where cmdTHT is a theater command (e.g., France, Russia, Italy) and cmdCINC is the over commander in chief. It may be also that we would need command classes below the cmdOPS level; specifically at the army level for even finer distribution of objectives. Maybe we could call this class cmdOBJ and would have shot-term intermediate objectives in mind (e.g., capture Lvov). Of course, we need to get cmdOPS working and more generalized first.
With respect to getting cmdOPS more generalized I would like to have the ability to script operations to some level. For example, when Belgium/Holland are invaded and number of forces to be used against Yugoslavia and Greece. I know the changes that Borger made in GSv2.10 for the AI gives the axis AI Denmark and Norway. I would eventually like the AI to have the ability to successfully carry off these operations itself against a human player.
Now some thoughts on Multi-player play. Wouldn't be nice if we could have multi-player play that included 2 or more humans and 1 or more AI's. For example, wouldn't it be interesting if you (or I) as the allies played Borger who controlled the Germans and the AI controlled the Italians. Similarly, if we as the axis played Borger who controlled the UK and US but the AI controlled France and Russia. Now, wouldn't that be interesting!
Username: GrandStrategyTeam@slithdata.net
Password: 1Kr35MazgsZR
PC B001: GSvAI-B001.zip
MAC B001: TBP (To be provided).
B001 Verification Game Logs: B001-AIvsAI-Game-Logs.zip
Disclaimer: This is alpha code and will very likely be buggy ... but we have to begin somewhere.
GS AI Improvement B001 Change Log.
1. Make the AI focused on a minor country’s capital when it invades and stop attacking the minor forces when the capital falls.
2. Be more aggressive to advance after combat and to attack adjacent and depleted enemy units. For example, it was frustrating to see the AI repair a unit, say at 5 or 6-steps, when that unit was adjacent to Warsaw and could have finished off 3 1 or 2-step Polish unit there and completed the conquest of Poland. The tweaks I’ve made have changed this in most cases, not only for Warsaw; but for attacking enemy units on any resource hex.
4. When on the defense have the AI review its defenses. It will try to rail/move garrisons to all cities; except the capital in which case it will deploy an infantry corps there. Only units not at the front are considered for this duty. Any unit assigned to this duty will (or should) defend their assigned city/resource until destroyed, their country is conquered or the game ends. My intention was to stop the game from moving corps back and forth to cities in the rear areas and to free them up for frontline action.
5. The axis AI will accept the French armistice 75% of the time and reject it 25% of the time. This decision is hardwired and is made independent of the situation at the time in France. This is a prime example of an AI decision logic point that needs to be significantly reworked and controlled by data in a soon to be built AI-data file. But; for now it is what it is and it there to add more dimension to the AI play and testing.
GS AI Improvement B001 Developer Notes.
The first GS-AI build (B001) has been made available. Also included are the run logs for an AI-vs-AI debug game that played all the way through without crashing. For these early releases this will be the standard to be used to release a build. These first changes to the AI are akin to trying to teach a wayward child. First, we need to learn that child and get him under control before we can teach him anything. This is what this first build is ... changes made to try to learn what's going on in order to make improvements.
For the next build I'm currently working on a new AI class (cmdOPS), that will generate an object for controlling an operation (e.g., invasion of a minor or attacks against a major). I plan to control both the objective and the number of forces assigned, such that; for example, the axis AI invades Greece and then a few turn later invades Russia doesn't over assign forces to Greece that are needed in Russia. My goal for the next release is just to get the framework of this class and use of the objects spawned by it in place. Eventually, I see a cmdOPS object as controlling an Army Group, or even an Army, with a specific objective, such as the conquest of a minor (e.g., capture Athens) or capture Leningrad (e.g., Army Group North).
I haven't though it through completely yet but I would either need to adapt this class for defense operations or generate an equivalent one for such. Also, I would eventually envision at least two higher level classes (i.e., cmdTHT and cmdCNIC), where cmdTHT is a theater command (e.g., France, Russia, Italy) and cmdCINC is the over commander in chief. It may be also that we would need command classes below the cmdOPS level; specifically at the army level for even finer distribution of objectives. Maybe we could call this class cmdOBJ and would have shot-term intermediate objectives in mind (e.g., capture Lvov). Of course, we need to get cmdOPS working and more generalized first.
With respect to getting cmdOPS more generalized I would like to have the ability to script operations to some level. For example, when Belgium/Holland are invaded and number of forces to be used against Yugoslavia and Greece. I know the changes that Borger made in GSv2.10 for the AI gives the axis AI Denmark and Norway. I would eventually like the AI to have the ability to successfully carry off these operations itself against a human player.
Now some thoughts on Multi-player play. Wouldn't be nice if we could have multi-player play that included 2 or more humans and 1 or more AI's. For example, wouldn't it be interesting if you (or I) as the allies played Borger who controlled the Germans and the AI controlled the Italians. Similarly, if we as the axis played Borger who controlled the UK and US but the AI controlled France and Russia. Now, wouldn't that be interesting!
Through Fall of France (May) buggy behavior
1. French send a GAR to North America and they land in Labrador
2. French send INF unit to Tunis (all French GARs remain in Africa)
3. Turn after accepting armistice a Russian!! INF (6th Army) appears in Cherbourg - it is impossible to attack him.
4. Brit reinforcements stay in Canada
General bad play
French move around continually through Sitzkrieg but never take defensive posture - just keep moving, mostly to port cities. Units never build entrenchment.
No attempt to protect Paris. No INF or MECHs brought to Paris despite ARM penetration.
When subs attack transports the DD's surround the sub, hoping to be able to attack but can't.
2. French send INF unit to Tunis (all French GARs remain in Africa)
3. Turn after accepting armistice a Russian!! INF (6th Army) appears in Cherbourg - it is impossible to attack him.
4. Brit reinforcements stay in Canada
General bad play
French move around continually through Sitzkrieg but never take defensive posture - just keep moving, mostly to port cities. Units never build entrenchment.
No attempt to protect Paris. No INF or MECHs brought to Paris despite ARM penetration.
When subs attack transports the DD's surround the sub, hoping to be able to attack but can't.
Re: Through Fall of France (May) buggy behavior
Interesting. Certainty not intended. I'll take a look at that.Schnurri wrote:3. Turn after accepting armistice a Russian!! INF (6th Army) appears in Cherbourg - it is impossible to attack him.
I do expect play in some cases to get worse before it gets better. This first released was really focused on making the axis AI more aggressive in the early game. Unfortunately erratic and buggy will be expected at first. I do appreciate you giving it a go. If you don't mind how about giving it a go against the Axis AI and see what you think.Schnurri wrote:General bad play.
This truly is alpha testing ... but hang in there.
Axis AI
Stopped in November 1940 - French and Brits still control Brussels and there is no danger of France falling.
1. German GARs assault maginot fortresses to great loss.
2. AI wastes attacks against Soviet partition part. Poland holds til turn 3. More attacks against Maginot.
3. During middle of Allied turn message “convoy lend lease phase” – supposed to be at end of Axis turn.
4. Germans continue attacking through winter and mud
5. Somehow, in April, The Germans captured both Denmark and Norway, occupying all cities without fighting.
6. No attacks on transports by u boots - ever
7. In both games, land units attack ships at sea.
8. German sub ran into Brit sub and they fought.
9. Brit reinforcements in Canada never materialized – rescued pilots did.
10. Air attacks don't support land attacks.
11. Very rare that ARM or MECH would attack.
12. AI never seemed to consult odds when making attacks - this should be fixable? E.g. GAR attacks against fortresses, attacks across rivers, etc.
Too easy to stop AI - they will never take France.
1. German GARs assault maginot fortresses to great loss.
2. AI wastes attacks against Soviet partition part. Poland holds til turn 3. More attacks against Maginot.
3. During middle of Allied turn message “convoy lend lease phase” – supposed to be at end of Axis turn.
4. Germans continue attacking through winter and mud
5. Somehow, in April, The Germans captured both Denmark and Norway, occupying all cities without fighting.
6. No attacks on transports by u boots - ever
7. In both games, land units attack ships at sea.
8. German sub ran into Brit sub and they fought.
9. Brit reinforcements in Canada never materialized – rescued pilots did.
10. Air attacks don't support land attacks.
11. Very rare that ARM or MECH would attack.
12. AI never seemed to consult odds when making attacks - this should be fixable? E.g. GAR attacks against fortresses, attacks across rivers, etc.
Too easy to stop AI - they will never take France.
Last edited by Schnurri on Mon Jan 23, 2012 4:02 pm, edited 1 time in total.
Yes, it is too easy to stop the Axis attack to France , I played with AI ,usually make France alive until the Allies victory .
PLease try to make AI do not do the Stupid choice :
Do not Dow any country without following attack .
Do not let the troops in the city attack the troops which going to attack him . ie , If you encircle Moscow , the troop inside will probably attack you . It would make you quite easy to get the city .
But anyway , I think AI is only the beginner part of this game . Even if without any improvement of AI , This AI is almost perfect enough .
PLease try to make AI do not do the Stupid choice :
Do not Dow any country without following attack .
Do not let the troops in the city attack the troops which going to attack him . ie , If you encircle Moscow , the troop inside will probably attack you . It would make you quite easy to get the city .
But anyway , I think AI is only the beginner part of this game . Even if without any improvement of AI , This AI is almost perfect enough .
Re: Axis AI
Thanks for testing and the feedback. It looks like I haven't even found the water yet ... much less put a toe in it.Schnurri wrote:Stopped in November 1940 - French and Brits still control Brussels and there is no danger of France falling.
Too easy to stop AI - they will never take France.
I'm interested but leery of what can be accomplished without significant code changes. Full disclosure, I've been working my Advanced Third Reich mod with the Strategic Command series for years now. (AI scripting for both sides in the the Med has been a royal pain!) The game and editor have seen multiple updates, with each new version providing more features and capability regarding AI and event scripting. I think a limited scope effort to enhance the generic AI in CEAW to be a little more aggressive where possible and a little less stupid, as apparently is ongoing, would go a long way. And some effort to allow more user editable information in the scenario files and AI-data files would be helpful. Some way to toggle between the AI and non-AI class file sets would be nice, or just tie this in with player selection. However, without some serious code changes I question how far AI improvements could go with the current CEAW game engine. Regardless, any improvements would be a plus.

FWIW, I do this extensively with my A3R mod to verify strategies work for both sides and I find it very useful. But there are limitations, since normally a human player will play the AI on advanced difficulty settings. So some AI-AI game results need to be taken with a grain of salt.I run the GS-AI beta with the axis AI playing against the allied AI.
AI Alpha Development Status (January 27, 2012).
1. I guess this is as good a time as any to fill you in on the status of my AI alpha development activities. Since my last post I have had some time to immerse myself in the AI code and have done some significant rewrites of how the AI operates, which I’ll described later.
2. The reality is that the AI code in GS (or I should say CEaW) is not really that much code and, as many (if not all) of you already know, isn’t very good. I’ve decided to give rewriting the AI a shot. The approach I’m using is analogous to “rebuilding” a house from the inside one room at a time instead of completely tearing it down and rebuilding it from an empty lot. My objective is to keep the AI working and playing at some level in order to test each change as I make it. This does mean that some things I doing now will probably have to be redone a bit (i.e., remodeled) as I get futher along.
3. This brings me to the purpose of the AI alpha testing; especially in this early stage, and that’s to help test and stress the code and find where the bugs are. At this point, I’m not talking about strategic and tactical errors but where and under what conditions the code fails. It may be the AI plays worse than it does now for a time; however, if we can pull this off we could get an AI worthy of a decent game against most players. I’d like to see an AI good enough to teach new players how to play properly and one that experienced players could use to test out new strategies. If I could achieve my ultimate goal it would be an AI that could learn and remember and improve over time. But we’re a long ways away from that now.
4. So, far I have to say that I’m really enjoying this experience and I’m definitely building up my programming skills; especially with java and object oriented code. By the way for you programmers out there the CEaW AI code isn’t even serialized and it’s substantiated each AI turn. The key data that’s it needs to store and remember from turn to turn is stored primarily in the units and countries which are serialized (i.e., saved each time the game is saved). If I continue I’m looking at a complete rewrite of the AI such that it’s broken into separate axis and allied AI’s (or maybe even separate AI’s for each major country), serialized (i.e., saved when the game is saved) and is substantiated (i.e., initialized) only once and that’s at the start of a new game. If we could get a decent AI for each major country then this could be a mechanism for handicapping a better player by making them; for example, use an Italian AI as the axis or a Russian AI when they’re the allies. Wouldn’t that be fun!
5. My outline for AI operation is divided into commands, operations and tactics. Commands in decreasing level of authority would consist of CINC (The Commander in Chief and his staff), Theater or Front Commands (e.g., Russian front, North Africa, Italy, Western Front) and army group to army commands. Operations would include offensive, defensive and build ups for missions ranging from the capture of specific objective hexes (e.g., Warsaw, Belgium, Paris, Kiev), defense of specific objectives or area and declaration of war against certain countries. Operations would also include the management and execution of amphibious invasions and naval operations. I could even see naval battle group commands that are used to support specific operations; e.g., amphibious invasions or used to raid convoy lanes. The third area, tactics, is the specifics of how the AI moves, attacks or defends when given a specific hex or unit to move against (or to).
6. What I’ve focused on these past two weeks has been developing the operation classes (i.e., framework). Not to get that much into the programming part of it; I’ve developed an abstract class that’s called cmdOPS and I’m currently working on three extensions to that named offOPS, dowOPS and defOPS. As the name suggest, offOPS controls offensive operations against a specific objective. A offOPS object will be generated (i.e., substantiated) for each operation commanded and will persist until that operation is successfully completely or aborted due to failure or higher priority operations over take it. dowOPS controls the build up and decision to declare war against certain countries and a dowOPS object will be generated for each combination of aggressor and belligerent country. A dowOPS object will persist until war is declared against the target country or the invasion is canceled. defOPS will control the defense of a city or region and will persist until that defense is no longer possible or necessary. The three operations that I’ve listed are only (hopefully) a beginning and will grow as the AI becomes more sophisticated.
7. Now to command, I see the CNIC setting the overall strategy of the war as well as build and research priorities. CNIC will define and control the high level operations such as DOW and Front/Theater wide operations. CNIC will also allocate the resources (i.e., units, builds, upgrades, etc.) priorities to the next level of command, which at the Front/Theater level. The Front/Theater commands will then define operations and allocate resources to the Army Group/Army commands. These commands will then manage and execute the operations given to them by their Front/Theater commands. The AI also needs significant help with its tactics but that’s something I haven’t started to address (yet).
8. What I’ve looking at and focusing on for now is building the framework to accommodate all this. I’m looking for a framework that originally will rely on scripted AI inputs but eventually will employ more sophisticated algorithms. Below is. Below is a sample of the first script I’ve built for DOW decisions and control (i.e., used by the dowOPS objects).


1. I guess this is as good a time as any to fill you in on the status of my AI alpha development activities. Since my last post I have had some time to immerse myself in the AI code and have done some significant rewrites of how the AI operates, which I’ll described later.
2. The reality is that the AI code in GS (or I should say CEaW) is not really that much code and, as many (if not all) of you already know, isn’t very good. I’ve decided to give rewriting the AI a shot. The approach I’m using is analogous to “rebuilding” a house from the inside one room at a time instead of completely tearing it down and rebuilding it from an empty lot. My objective is to keep the AI working and playing at some level in order to test each change as I make it. This does mean that some things I doing now will probably have to be redone a bit (i.e., remodeled) as I get futher along.
3. This brings me to the purpose of the AI alpha testing; especially in this early stage, and that’s to help test and stress the code and find where the bugs are. At this point, I’m not talking about strategic and tactical errors but where and under what conditions the code fails. It may be the AI plays worse than it does now for a time; however, if we can pull this off we could get an AI worthy of a decent game against most players. I’d like to see an AI good enough to teach new players how to play properly and one that experienced players could use to test out new strategies. If I could achieve my ultimate goal it would be an AI that could learn and remember and improve over time. But we’re a long ways away from that now.
4. So, far I have to say that I’m really enjoying this experience and I’m definitely building up my programming skills; especially with java and object oriented code. By the way for you programmers out there the CEaW AI code isn’t even serialized and it’s substantiated each AI turn. The key data that’s it needs to store and remember from turn to turn is stored primarily in the units and countries which are serialized (i.e., saved each time the game is saved). If I continue I’m looking at a complete rewrite of the AI such that it’s broken into separate axis and allied AI’s (or maybe even separate AI’s for each major country), serialized (i.e., saved when the game is saved) and is substantiated (i.e., initialized) only once and that’s at the start of a new game. If we could get a decent AI for each major country then this could be a mechanism for handicapping a better player by making them; for example, use an Italian AI as the axis or a Russian AI when they’re the allies. Wouldn’t that be fun!
5. My outline for AI operation is divided into commands, operations and tactics. Commands in decreasing level of authority would consist of CINC (The Commander in Chief and his staff), Theater or Front Commands (e.g., Russian front, North Africa, Italy, Western Front) and army group to army commands. Operations would include offensive, defensive and build ups for missions ranging from the capture of specific objective hexes (e.g., Warsaw, Belgium, Paris, Kiev), defense of specific objectives or area and declaration of war against certain countries. Operations would also include the management and execution of amphibious invasions and naval operations. I could even see naval battle group commands that are used to support specific operations; e.g., amphibious invasions or used to raid convoy lanes. The third area, tactics, is the specifics of how the AI moves, attacks or defends when given a specific hex or unit to move against (or to).
6. What I’ve focused on these past two weeks has been developing the operation classes (i.e., framework). Not to get that much into the programming part of it; I’ve developed an abstract class that’s called cmdOPS and I’m currently working on three extensions to that named offOPS, dowOPS and defOPS. As the name suggest, offOPS controls offensive operations against a specific objective. A offOPS object will be generated (i.e., substantiated) for each operation commanded and will persist until that operation is successfully completely or aborted due to failure or higher priority operations over take it. dowOPS controls the build up and decision to declare war against certain countries and a dowOPS object will be generated for each combination of aggressor and belligerent country. A dowOPS object will persist until war is declared against the target country or the invasion is canceled. defOPS will control the defense of a city or region and will persist until that defense is no longer possible or necessary. The three operations that I’ve listed are only (hopefully) a beginning and will grow as the AI becomes more sophisticated.
7. Now to command, I see the CNIC setting the overall strategy of the war as well as build and research priorities. CNIC will define and control the high level operations such as DOW and Front/Theater wide operations. CNIC will also allocate the resources (i.e., units, builds, upgrades, etc.) priorities to the next level of command, which at the Front/Theater level. The Front/Theater commands will then define operations and allocate resources to the Army Group/Army commands. These commands will then manage and execute the operations given to them by their Front/Theater commands. The AI also needs significant help with its tactics but that’s something I haven’t started to address (yet).
8. What I’ve looking at and focusing on for now is building the framework to accommodate all this. I’m looking for a framework that originally will rely on scripted AI inputs but eventually will employ more sophisticated algorithms. Below is. Below is a sample of the first script I’ve built for DOW decisions and control (i.e., used by the dowOPS objects).


Re: AI Improvement Alpha Testings.
This should include AI assignment/reassignment of commanders. Johan supposedly updated the AI in CNAW to handle commanders and improve tactical operations, so perhaps you could get those updates from him and at least consider integrating those changes into CEAW GS?I’m currently working on three extensions to that named offOPS, dowOPS and defOPS
The other AI area that needs work is for transports and amphibious operations in the Med theater, for both sides. If you can develop new extensions to address this weakness then that would be very good.





