Rise of AI Global Mod v3.12

Field of Glory II is a turn-based tactical game set during the Rise of Rome from 280 BC to 25 BC.
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 128
Joined: Wed Oct 18, 2017 1:40 pm

Rise of AI Global Mod v3.12

Post by roguedjack »

UPDATED TO 3.12
v3.12 for Fog2 1.6.6/1.6.7 is now available for in-game download.
If you don't know how to download the mod follow these steps :
- In the game main menu click on the "Download community scenarios" button in the top left corner.
- The mod should appear in the list of available scenarios/mods.
- If it doesn't appear, tick and/or untick the buttons "Single Player" and "Multiplayer" until it appears. You might have to exit and re-enter this screen.
- Then enable the mod as described in the readme below section "HOW TO ENABLE AND USE AS GLOBAL MOD"
Here's the readme :
RISE OF AI 3.12 GLOBAL MOD
by roguedjack
for FOG2 1.6.6/1.6.7

Rise Of AI changes the way the AI deploys its units and use them in battle. It does not change the units bought by the AI.


WHAT'S NEW
Compatibility for Fog2 1.6.6/1.6.7 and minor changes.

- Deployment: Tweaked deployment on map with lots of difficult terrain. Less focused on avoiding bad terrain and deploying dispersed, more likely to deploy in formation.
- Deployment: Don't deploy cavalry on the wings at all if terrain is really bad on both wings but ok in the centre, assign them to centre/reserve instead.
- Deployment: Fixed cavalry not being deployed correctly on wings in some cases and being left undeployed on the bottom row (RoAI bug)
- Masterplan: Fixed outflanking cavalry wings sometimes appearing to be lost and moving around aimlessly (RoAI bug)
- Masterplan: Fixed flank march teams not behaving as expected after their arrival (RoAI bug)


HOW TO ENABLE AND USE AS GLOBAL MOD
Ingame, click on the icon on the bottom left of the main screen to go the "Global Mods" screen, select "Rise Of AI 3.12 Global" then click "Accept". To disable, select "No Mod Set" or any other global mod you might have installed.
If enabled correctly it will say "Using mod: Rise Of AI v3.12 Global" on the main screen.
While enabled, all battles you play (custom, campaign battles, epic battles, quick battles...) will use Rise Of AI for the AI opponent.
Epic Battles and some other user contents might cause some problems, see below in the compatibility section.
You don't need to keep or use the previous versions of Rise Of AI (campaign and custom battles). You can delete them.


COMPATIBILITY
* DLCs
Fully compatible with Immortal Fire, Legions Triumphant, Age Of Belisarius, Rise Of Persia, Wolves at the Gates and Swifter than Eagles DLCs.

* Field Of Glory Empires
Compatible with exported battles from Field Of Glory Empires.

* User content
Compatible with all campaigns and custom battles content that do not modify the same files as this mod. This means it should be compatible with the vast majority of them.

* Epic Battles
I advise not to enable Rise Of AI when playing Epic Battles.
Some Epic Battles have scripted strategies for the AI or exotic deployments that will overrule, conflict with or confuse Rise Of AI.

* Multiplayer
Do not enable Rise Of AI while playing multiplayer. It may cause bugs and crashes.


KNOWN ISSUES
- AI turns can take significantly longer to process than vanilla AI, and might seem to freeze.
Might be an issue for some players who don't want to wait several seconds to a minute for the AI to play.
The AI is processing more stuff, especially using pathfinding more intensively for tactics, and it takes time.
This is more noticable when the AI has many units with missile capabilities.

- It is recommended to not switch between enabling & disabling the mod during a battle
The AI might behave oddly if you start a battle without the mod and later resume the battle with the mod enabled.
This is because the mod records and saves some information about its units when starting a new battle and make use of it later for its manoeuvres. This information is missing in the save file if you did not start the battle with the mod enabled, hence the bugs.
Either play the entire battle with the mod, or play it without.
If you want to compare vanilla and RoAI ais on the same battle, save the game during your deployment phase and take it from here. The AI you started the game with is the one who deployed the AI army. This can have an impact on the game as RoAI use different deployment logic than vanilla.

- Sometimes when the AI turns a unit the camera will not move to focus on the unit.
This happens when the AI wants to tidy up a formation and change its facing. It will turn several units of the same formation one by one, but the camera won't move to show you that. This might be a bit annoying for players that play zoomed in but its no big issue.
3.11 was just a compatibility release. Condensed readme for the previous versions 3.1 & 3.0 :
v3.1 WHAT'S NEW
Stuttering fix and some optimizations that in some cases slightly decrease AI turn time.

- Fixed most cases of AI movement animation stuttering (this was a problem of the mod, not the game).
- Optimization : AI will end its turn early when it thinks it has nothing to do anymore instead of going through all the remaining passes.
- Optimization : When building the list of AI units for the pass the AI will skip units that have nothing to do anymore.

v3.0 WHAT'S NEW

New "Fix and Flank" offensive tactic, "Gap/Overlap" and "Outflanking Threat" detections, that along with other changes makes the AI more likely to create and exploit flanking charges as well as defend from them.

Most important changes from 2.4:

- New tactic "Fix and Flank" : The AI is now more likely to coordinate units to create flanking charge opportunities. A unit is used to engage a target from the front, while another moves to prepare a flanking charge next turn. Previously it would always attack frontaly with both units.

- New targeting pattern "Gap/Overlap" : Detect enemies that are threatening to immediatly push into a gap of the line, or to flank an end of the line when they are overlapping it. The AI is more likely to target these enemies to prevent them from creating flanking charges.

- New targeting pattern "Outflanking Threat" : Detect enemies that are probably manoeuvring to outflank before they are in an actual flanking position and it would be too late to react. The AI is more likely to target these enemies.

- Shooting : The ranged units tactical pathfinding feature (finding the "best" tile to shoot at their target from) that was introduced several versions ago now works correctly.

Other changes:
- Deployment : Improved deployment logic on maps with impassable terrain.
- Masterplan : A defensive infantry centre may switch to offensive if you are manoeuvring your centre around theirs to outflank it or are pilling up units at an end of the line to overwhelm it.
- Masterplan : A defensive infantry centre will switch to offensive if enough units of its team are eager to charge non-lights.
- Masterplan : An offensive infantry centre will not pause just to reform facing (no more advance, stop to turn, advance, stop to turn... when advancing diagonally).
- Masterplan : Reserve cavalry may move to cover centre infantry from the most threatening enemy cavalry wing.
- Masterplan : When a cavalry wing decides to attack, the light wing will try to move in support.
- Masterplan : Adjusted teams x destination for teams width so they won't pile up on a map border when their line is long and their destination is near a map border.
- Ordering : New target declaration phase algorithm "Target Bidding". Improves target selection coordination in some situations.
- Chance of Charging : Units with good impact phase chances and that would breakoff from losing melee are more likely to charge.
- Chance Of Charging : Much more chance of charging if flank charge will cause cohesion drop.
- Targeting : Shock Medium Cavalry (non-Cataphracts lancers) more likely to target mounted and medium foot.
- Targeting : More likely to target potential flankers.
- Targeting : Unmanoeuvrable units more likely to stay focused on the same target, especially when they are already facing it.
- Targeting : More likely to target fragmented units to finish them off.
- Targeting : More incentive for ranged light units to concentrate fire on enemy lights to win the skirmishing battles.
- Pathing : AI units are a bit less afraid of going through bad terrain to reach their target if they think no enemy may be able to intercept them there to force a fight at a terrain disadvantage.
- Movement : Improved logic of retreating units. More likely to seek cover behind friends, won't move if not necessary and will turn to face danger or target when finished their retreat movement. Note that retreating units will sometimes say "retreating" but stay in place, they are retreating but found the best spot is where they are.
- Movement : AI units will ignore blocking a friendly unit fallback square when that friend is likely to win its melees and so unlikely to be forced to fallback, or if the blocking tile is adjacent to the unit own target.
- Movement : AI units will try to avoid ending their move next to a friend in melee that is about to rout and would cause them to pass a cohesion check when routing.
- Movement : AI units that are not willing to charge their targets will try to avoid ending their move on a square that would have a blocked fallback square if an adjacent enemy charged them there.
- Fixed : When loading an ongoing game that was started without the mod enabled, a defensive AI would do crazy manoeuvres like turning its back to the enemy. See related "Known Issue" below.
- Tweaks & Fixes.
Last edited by roguedjack on Mon Feb 20, 2023 10:50 am, edited 5 times in total.
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
NikiforosFokas
Sergeant Major - SdKfz 234/2 8Rad
Sergeant Major - SdKfz 234/2 8Rad
Posts: 627
Joined: Fri Apr 22, 2016 4:59 pm
Location: Greece

Re: Rise of AI Global Mod v3.0

Post by NikiforosFokas »

Thanks!!!
For Byzantium!!
MarkShot
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Dec 28, 2010 7:15 pm

Re: Rise of AI Global Mod v3.0

Post by MarkShot »

Thanks a lot. Adding to my config now.
Karvon
Sr. Colonel - Wirbelwind
Sr. Colonel - Wirbelwind
Posts: 1754
Joined: Fri Jan 27, 2012 12:36 pm
Location: Osaka, Japan

Re: Rise of AI Global Mod v3.0

Post by Karvon »

Nice! Have always enjoyed playing against this AI.
MarkShot
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Dec 28, 2010 7:15 pm

Re: Rise of AI Global Mod v3.0

Post by MarkShot »

I feel the need for a Rome vs Macedonia fight coming on! :)
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2582
Joined: Wed May 29, 2019 3:23 pm

Re: Rise of AI Global Mod v3.0

Post by Athos1660 »

@roguedjack : Great mod. Will you consider making a future one for FoG2: Medieval ?
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 128
Joined: Wed Oct 18, 2017 1:40 pm

Re: Rise of AI Global Mod v3.0

Post by roguedjack »

Athos1660 wrote: Sun Nov 01, 2020 4:30 pm @roguedjack : Great mod. Will you consider making a future one for FoG2: Medieval ?
Thanks. I'm not sure I'll get FoG2M, I'm not really interested in wargaming the time period.
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
Athos1660
Major-General - Elite Tiger I
Major-General - Elite Tiger I
Posts: 2582
Joined: Wed May 29, 2019 3:23 pm

Re: Rise of AI Global Mod v3.0

Post by Athos1660 »

roguedjack wrote: Sun Nov 01, 2020 4:59 pm
Athos1660 wrote: Sun Nov 01, 2020 4:30 pm @roguedjack : Great mod. Will you consider making a future one for FoG2: Medieval ?
Thanks. I'm not sure I'll get FoG2M, I'm not really interested in wargaming the time period.
I quite understand.
pinwolf
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 82
Joined: Fri Jan 27, 2017 9:32 pm
Location: Thuringia

Re: Rise of AI Global Mod v3.0

Post by pinwolf »

@roguedjack: Thank you very much.
MarkShot
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Dec 28, 2010 7:15 pm

Re: Rise of AI Global Mod v3.0

Post by MarkShot »

Jack,

I am on my 6th. turn, but just beautiful!!!

I was playing on Governor (+2), but I dropped it to Legate (+1) knowing what you are capable of.

I love the aggression right out of the gate. The stock AI feels like at the right advantage level, you feel it is going to wear you down. But your army marches like it is out for blood.

As you noted, there is a noticeable pause after confirming, but this seems better than scattered pauses. Given that it is a TBS game, I don't think it is much of an issue, even if I had 3X the wait.

I realize you probably don't have much systems level control (like thread creation and destruction). I am not sure if you are familiar with how standard (non-neural net) chess engines are coded:

* You use the player's think time to keep processing. So, if done as a low priority thread, it should not impact the UI or the player's turn.

* You keep transposition tables (as there a multiple ways to arrive at the same board). You need to interrupt and restart the walk through the solution space each time the player moves. But ultimately 50% of calculations done on the player's turn may yield valid moves.

* As the player get closer to his last move, and may even stare at the board a while after the last move (as there are no clocks), you do have a final state.

Applying the above techniques, you might be able to bury much of your increased computational overhead into the player's own turn.
nikossaiz
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 100
Joined: Tue Sep 01, 2020 9:26 am

Re: Rise of AI Global Mod v3.0

Post by nikossaiz »

hello and thank you for your efforts, i mainly exporting battles from empires so here is my very early feedback
AI turns can take significantly longer to process than vanilla AI, and might seem to freeze
I have a quite high end pc and used to have the same issue also with the 2.4 version
after i verify/repair the game files ( i play on gog version ) and reanable yuor mod the statter reduced significantly till the state that i rearly have an issue ( smaller delays still happen ). since it worked for me may work for other players also. I will do it again with the 3.0 version to see if this is the case.
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 128
Joined: Wed Oct 18, 2017 1:40 pm

Re: Rise of AI Global Mod v3.0

Post by roguedjack »

Thanks for the feedback.
MarkShot wrote: I realize you probably don't have much systems level control (like thread creation and destruction). I am not sure if you are familiar with how standard (non-neural net) chess engines are coded:
* You use the player's think time to keep processing. So, if done as a low priority thread, it should not impact the UI or the player's turn.
* You keep transposition tables (as there a multiple ways to arrive at the same board). You need to interrupt and restart the walk through the solution space each time the player moves. But ultimately 50% of calculations done on the player's turn may yield valid moves.
* As the player get closer to his last move, and may even stare at the board a while after the last move (as there are no clocks), you do have a final state.
Applying the above techniques, you might be able to bury much of your increased computational overhead into the player's own turn.
I'm famliar with chess engines and I'm afraid we can't do that. As you said we can't create thread from script, so thinking on player time as in chess engines is not possible.
The AI engine is not search based, It is utility function/heuristics based so TTs wouldn't be useful. Right now the only things ressembling search are things like scanning around targets for the best shooting spots/flanking position using the game engine pathfinding (basicaly a depth=1 search limited in space and scope). In general caching results is not as useful as in TB classic games as the game state is too volatile even during the AI own turn and that invalidates like 99% of cached results.
I do a bit of optimizations though. I cache the threatmap for the current AI unit so it doesn't always get recomputed when the AI needs it again (not very useful as noted previously but it is here).
I also avoid some computations when the AI found out it has nothing to do anymore, but I can't make the AI end its turn when it wants to. It has to go through the number of passes it requested at the start of its turn even when not making any use of it. So a lot of the AI time near the end of its turn is spent in basically saying "i don't want to do anything anymore with this unit" for each units. Talking about it gave me a couple of ideas to shorten the AI turns, I'll see.
nikossaiz wrote: I have a quite high end pc and used to have the same issue also with the 2.4 version
after i verify/repair the game files ( i play on gog version ) and reanable yuor mod the statter reduced significantly till the state that i rearly have an issue ( smaller delays still happen ). since it worked for me may work for other players also. I will do it again with the 3.0 version to see if this is the case.
Cool if that helps other people.
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
MarkShot
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Dec 28, 2010 7:15 pm

Re: Rise of AI Global Mod v3.0

Post by MarkShot »

Jack,

I lost on turn 18. You know I have every turn checkpointed. So, if you want to see how your baby played, just let me know.

First, I should note that I was winning 95% of my games at Legate. But not this one.

I attempted to buy time with my medium foot and turn the flank with my heavies. I think I could have pulled it off in the stock AI. Your AI moves very fast, but reasonably coordinated.

Your AI adds incredible value to the game. I personally was not all that thrilled of being servely outnumber in every game I played. Now, it looks like I won't need to be to get a good fight.

Richard, I could actually see including this AI in with this game or the new one, but not as user content, but off of options as a setting like: AI: Basic or Advanced. There are good reasons not to just make such AI the standard:

* It is not nood friendly. For some one who hasn't really learned the fine point, it is going tear them up.

* It is noticeably slower. "too slow" is very much a matter of perception, but obviously as a business person, you want the biggest market you can get. (As I wrote above, I think it can be tuned. However before I would try to do what I suggested above, I might try an efficient implementation in C or C++ {as know that you are running the game on top Archon} and link the AI in as a DLL module. You would be amazed how fast good compiled code can run compared to script. Perhaps, you might pick up one to two orders of magnitude.)

Here is a screen shot which was the best it looked for me. I did managed to flank and roll up the phalanx line, but not fast enough. Again Jack, thank you. You have tremendously added to value of the game. I play Rome 1 (RS3 mod) and Rome 2 (DEI mod), but when it comes to battle there isn't much that can be done as TW BAI is hard coded. But you have made FOG2, as we say in the USA, a whole new ball game.
Attachments
2020-11-02 22-14-30.jpg
2020-11-02 22-14-30.jpg (370.39 KiB) Viewed 7482 times
Last edited by MarkShot on Mon Nov 02, 2020 2:59 pm, edited 1 time in total.
MarkShot
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Dec 28, 2010 7:15 pm

Re: Rise of AI Global Mod v3.0

Post by MarkShot »

Oh, the set up ...
2020-11-02 17-56-22.jpg
2020-11-02 17-56-22.jpg (233.8 KiB) Viewed 7481 times
2020-11-02 17-58-47.jpg
2020-11-02 17-58-47.jpg (226 KiB) Viewed 7480 times
MarkShot
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Dec 28, 2010 7:15 pm

Re: Rise of AI Global Mod v3.0

Post by MarkShot »

Richard,

Why do I say include it as a menu/screen option, even thought mod installs are so easy? You have many customers like me: who check out mod quality even before they buy a game, but another class of customers are not inclined to use mods ... for them, it is all about the "out of the box" experience. So, a sticky at the top of Steam or the Developer Forum won't necessarily get people to load it up.

Finally, reviewers often get alphas ... not mature versions with mods. If you want a reviewer on YouTube saying how challenging and non-cheating the AI is, then it should be part of the product itself.

PS: I probably won't buy the new game either. The ancient world is where my interests lie.
Jagger2002
Master Sergeant - Bf 109E
Master Sergeant - Bf 109E
Posts: 491
Joined: Sun Dec 07, 2014 7:31 pm

Re: Rise of AI Global Mod v3.0

Post by Jagger2002 »

Rouge Jack, does the improved AI work with Pauls mod?
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 128
Joined: Wed Oct 18, 2017 1:40 pm

Re: Rise of AI Global Mod v3.0

Post by roguedjack »

Jagger2002 wrote: Wed Nov 04, 2020 5:52 pm Rouge Jack, does the improved AI work with Pauls mod?
TT mod : viewtopic.php?f=477&t=101538 ?
I just tried with the campaign version and it works fine. Will work with the custom battle version too.
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
Jagger2002
Master Sergeant - Bf 109E
Master Sergeant - Bf 109E
Posts: 491
Joined: Sun Dec 07, 2014 7:31 pm

Re: Rise of AI Global Mod v3.0

Post by Jagger2002 »

I just tried it myself in a custom game and just finished. It appears to work fine and the AI put up a pretty good battle. I really like that the AI doesn't wait for me to occupy the good terrain before moving. Two thumbs up!
MarkShot
Sergeant First Class - Panzer IIIL
Sergeant First Class - Panzer IIIL
Posts: 399
Joined: Tue Dec 28, 2010 7:15 pm

Re: Rise of AI Global Mod v3.0

Post by MarkShot »

Jack,

Your units are moving diagonally very nicely.

Do you know what the OODA loop is? It is basically a doctrine that say armies and commands take time to observe and respond. The point is that that if your command and forces can go through this cycle quicker, you have an advantage over the enemy. As you will be calling the shots, he will be dancing to your actions.

Well, I see that here. I expect your army to set up in the middle which it did. I planned to fight behind a stream and on partially elevated ground. Your army immediately pivoted and headed towards the close bend in the stream which should allow it flank my line on the stream.

Your army is now inside my OODA loop. I lack another good terrain option. I am still at Legate, but a loss here may have me playing at even points.

Very nicely done!!!
2020-11-05 16-12-15.jpg
2020-11-05 16-12-15.jpg (312.9 KiB) Viewed 7262 times
2020-11-05 16-14-01.jpg
2020-11-05 16-14-01.jpg (309.08 KiB) Viewed 7262 times
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 128
Joined: Wed Oct 18, 2017 1:40 pm

Re: Rise of AI Global Mod v3.0

Post by roguedjack »

@MarkShot
Thansk for the feedback.
RoAI does indeed evaluate terrain when evaluating the armies positions and the groups manoeuvring. To be honest I'm not sure it did for the specific reason you mentioned though but that's possible, depends how far it looked ahead. Its easy to over-estimate its cleverness :) Do you have the save I'd like to take a look at its evaluation. You can PM me with a link.
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
Post Reply

Return to “Field of Glory II”