roguedjack's AI overhaul mod

Field of Glory II is a turn-based tactical game set during the Rise of Rome from 280 BC to 25 BC.
rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 28014
Joined: Sun Dec 04, 2005 6:25 pm

roguedjack's AI overhaul mod

Post by rbodleyscott »

(See stickied thread re Global version - this thread has been locked to avoid confusion)

The very clever roguedjack has written an AI overhaul mod in the form of a Custom Battles module and a Sandbox Campaigns module.

These are available for in-game download from the Community Downloads button (Main menu, Campaigns or Epic Battles screens).

We are very interested in feedback on how the modded AI performs, and whether there are any occasions where odd behaviour occurs.

Here are the contents of the Read.Me file
RISE OF AI 1.0
by roguedjack
for FOG2 1.0.2


WHAT IS IT?
A modded "Rise Of Rome Campaigns" campaign with a modified battle AI.
Modifies only the AI files and for this campaign only. You can still play all other campaigns and scenarios with vanilla AI.
It does not modify in any way anything else in the game.
It does not cheat or break rules intentionally in any way.
The AI will play differently, which could be good in some situations and bad in others.
Just consider this as a new AI opponent you can play with.


WHAT TO EXPECT
It will try to do things like :
- generally be more active
- try to not have units getting stuck behind their friends, bumping in the wrong enemy or too timid to attack
- not using too many units on the same target or chasing stuff around and ignoring other targets
- preparing charges with shooting and concentrating fire
- ...and other stuff.
Deployment is tweaked a bit.
It does not modify force composition or teams objectives.
Be warned that the AI turns will be a bit longer. In particular there is a bit of a freeze at the beginning of AI turns and lags at the end.
Note that the AI will now resolve mandatory melees during its turn when it feels like it, like the player would. It will not wait the end of turn autoresolve.


OVERVIEW
Overview of changes from vanilla AI.
- Rewrote the unit list ordering algorithm.
- Rewrote the target rating and selection algorithm.
- Rewrote the threat map algorithm.
- Modified behaviours of missile units.
- Modified some route/pathing behaviours.
- Modified charge chance.
- Modified flank threat evaluation and reaction.
- Tweaked deployment to move back lines closer to 1st line.
- Tweaked master plan reaction distances and positioning.
- Minor tweaks to other stuff.


CODING
Modified AI.bsf and AITools.bsf
Modified MoreScenarioTools.bsf (needed for deployment changes).
New rjai_XXX files.
If you are interested in looking at the scripts all added or modified code is wrapped in commented blocks where possible:
// RJ AI
// END RJ AI
New functions/types/globals are prefixed with RJAI_
Vanilla code is left in comments where possible.
Richard Bodley Scott

Image
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14500
Joined: Fri Oct 01, 2010 2:50 pm

Re: roguedjack's AI overhaul mod

Post by stockwellpete »

I would say that this is very much worth testing out. My first reaction is very positive. I have just played a battle as Hannibal's Carthaginians versus the Romans on Governor level. I noticed the following . . .

a) I deliberately deployed in a very narrow formation with nothing where my left flank might normally be. And I set up my army with my elephants on the right to deliver a "right hook" on the Roman lines. In battles against the original AI the Roman army would have come at me in a straight line for 3-4 turns before trying to shift some of the units from its right flank into the centre. This time the AI immediately changed the orientation of its units to face mine so although I was still able to deliver the "right hook" I did not get any element of overlap in my attack.

b) the Roman cavalry (with generals) played a very active part in the battle and did not sit at the back well away from the action.

c) I attacked the Roman cavalry (with general) with both foot and horse skirmishers and eventually "fragmented" it. Instead of just standing there awaiting for the inevitable next turn it did try to save itself with a "fall back" move. It still routed however on that turn, but later it rallied and was still in the battle at the end of the game.

d) Roman legionaries and Roman cavalry did mount a combined attack on Carthaginian scutari holding a large area of rough ground in the centre after a couple of turns of softening up with velites units. They still lost in that part of the battlefield but at least they didn't just stand there looking at the enemy for 4/5 turns. This suggests to me that the AI would also attack isolated enemy units holding smaller areas of rough ground, which I regard as a positive.

e) I might be imagining this but the Roman velites units seemed to be a bit more aggressive than usual and were taking up positions to throw their missiles right in the thick of the fighting. I was unable to trap any of them.

f) there was just one slightly unusual event. At the beginning two velites units were exchanging javelins with two Carthaginian skirmisher units and one of the velites got disrupted. Next turn both velites units RETREATED but the Carthaginian skirmishers were then attacked by new velites units. Why the steady velites unit RETREATED was a bit puzzling, but this is only a very minor point. The two velites units returned to action later in the battle.

Unfortunately the Romans had three units in a flanking force that arrived too late to take part in the action and they eventually succumbed 44-7.
Lysimachos
Lieutenant Colonel - Panther D
Lieutenant Colonel - Panther D
Posts: 1234
Joined: Tue Dec 08, 2009 9:38 am
Location: Italy

Re: roguedjack's AI overhaul mod

Post by Lysimachos »

My first impression is really very good.
In the last four games against the AI I played with an 869 pts. army vs an 1300 AI army and always won, sometimes with a little margin of 6%, others with wider up to 25%.
Using this size of the armies means that you're playing on a large map and the AI, having much greater numbers, always deploys with one flank greatly overlapping one of my wings. The problem was that the AI units on this part of the fields reacted very slowly to the situation and were able to turn and reach the melee only after 10-12 turns, when the battle was already decided.
Moreover, in other battles, the AI was very slow in making his first moves and in several occasions I had the chance of securing some hills or other terrain features that where favourable for me.

This time the AI units promptly turned and ran towards the actions, while skirmishers buzzed in front and all around my units, softening them with javelins and arrows.
Due to the quick response of the AI I wasn't able to secure a wooded slope where I could have nested some of my units in order to delay the arrival of overlapping enemy forces, while trying to force a victory in the centre.
Here the enemy heavy infantry, unlike it happened before, refused to attack my medium infantry on rough terrain, leaving the skirmishers do their job and probably waiting to see if any chances of a better attack arose.
Unfortunately, still at the beginning of the battle, when I was heading 10% vs 2%, my Commander in Chief, after a victorious charge (!!) just in the centre of the line, was killed, disrupting not only his his unit but also other three adjacent to it.
This quickly sealed the fate of the encounter, that after the collapse of my centre ended with a dismal 52% vs 14% result.
I would have liked to have a fight not affected by this particular accident, just in order to see which would be the outcome, but I'm quite sure that this time the AI should have won anyway, on the arrival on my right wing, already engaged in battle, of the overlapping units of the enemy left flank.

So it really seems, finally, that the AI is now working much better than before, handling his units with great care and in a very sound manner.
Great job Roguedjack!
"Audentis fortuna iuvat"
- Virgilius

(Good luck favours the brave)
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: roguedjack's AI overhaul mod

Post by NikiforosFokas »

Downloaded this morning. In the afternoon with a coffe in front of my pc. Let's try it i said. Custom battle put luck for both sides. This is the amazing - and embarrassing for me- result. Really amazing job. Thanks roguedjack :) .
Attachments
20171118205302_1.jpg
20171118205302_1.jpg (334.43 KiB) Viewed 12154 times
For Byzantium!!
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14500
Joined: Fri Oct 01, 2010 2:50 pm

Re: roguedjack's AI overhaul mod

Post by stockwellpete »

Lysimachos wrote:This time the AI units promptly turned and ran towards the actions, while skirmishers buzzed in front and all around my units, softening them with javelins and arrows.
Yes, so I wasn't imagining that the behaviour of the AI skirmishers had improved somewhat. :wink:
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Oct 18, 2017 1:40 pm

Re: roguedjack's AI overhaul mod

Post by roguedjack »

Thanks for the feedback everyone!
Most of behaviours reported so far are what my mod tries to do so that's cool!
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
ahuyton
1st Lieutenant - 15 cm sFH 18
1st Lieutenant - 15 cm sFH 18
Posts: 833
Joined: Sun Jun 17, 2007 4:31 pm

Re: roguedjack's AI overhaul mod

Post by ahuyton »

I played with Romans against Macedonians, circa 200BC at the 2nd level of difficulty. Whereas before I could manouevre around the AI at this level and win comfortably this was a fight to the finish. The AI(Macedonian) played aggressively, advancing his huge pike phalanx quickly down the field to engage. He would chase away my skirmishers with diagonal moves by the pikes, catching a couple in the process. However in doing so he lost formation and ended up with half dozen blocks in a small area. Nevertheless, I was impressed by how the AI extracted itself from this and built new battle line that behaved aggressively and well. In the end I managed to scrape a win by isolating some of his units, but it was 63% v 55% at the end so not a glorious outcome for me.

So thanks for this, it makes for a much better game.
Aryaman
1st Lieutenant - 15 cm sFH 18
1st Lieutenant - 15 cm sFH 18
Posts: 833
Joined: Mon Nov 16, 2009 3:12 pm

Re: roguedjack's AI overhaul mod

Post by Aryaman »

I tried the Hannibal in Italy army against the Roman army, first battle I tried the classical one flank envelope massing all my cavalry in one flank,but the AI counter with Triarii in a very clever way and in the end I lost the battle after suffering several flank attacks.

I tried the same armies again and I got my revenge, beating the AI 54/0 in routing points. I ambushed some units in the woods and the AI sent half its army there, then 4 units remained passively in front of the woods while receiving the javelins of my lights, while the rest of the army was routing in succesion.
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Oct 18, 2017 1:40 pm

Re: roguedjack's AI overhaul mod

Post by roguedjack »

Aryaman wrote:I ambushed some units in the woods and the AI sent half its army there, then 4 units remained passively in front of the woods while receiving the javelins of my lights, while the rest of the army was routing in succesion.
Did some heavy/cav units entered the woods or did they all stayed outside and sent only their light units? Do you remember what were those passive AI units (heavy inf? cav?). Did you have other units that could threaten their flanks if the romans moved into the woods to engage your lights?
Thanks for the feedback!
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
Aryaman
1st Lieutenant - 15 cm sFH 18
1st Lieutenant - 15 cm sFH 18
Posts: 833
Joined: Mon Nov 16, 2009 3:12 pm

Re: roguedjack's AI overhaul mod

Post by Aryaman »

I forgot to add it was a campaign game, governor level.
The AI had only one cavalry unit, in the other flank facing my cavalry.
The AI started by sending some velites, but then it sounded the retreat and sent Hastati, the first unit charged the lights, but behind them I had a scutarii that charged him in the flank and routed it, after that othe 4 Hastati units remained passively outside the woods, other units did charged my scutarii in the woods and those 4 units had only lights units around
jamespcrowley
Staff Sergeant - StuG IIIF
Staff Sergeant - StuG IIIF
Posts: 254
Joined: Thu Nov 26, 2009 12:51 pm
Location: Arundel, U.K.

Re: roguedjack's AI overhaul mod

Post by jamespcrowley »

Downloaded both modules within the game.

The campaign one worked fine and a quick trial battle on level3 (ancient Brits v Romans) proved very tough, with the Roman AI noticeably improved and giving a very good account of itself.

The custom battle module, although technically available, simply will not work - select it and nothing happens.
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Oct 18, 2017 1:40 pm

Re: roguedjack's AI overhaul mod

Post by roguedjack »

Thanks for the details Aryaman.
jamespcrowley wrote:The custom battle module, although technically available, simply will not work - select it and nothing happens.
Maybe a corrupted download. Delete the custom battle module and download it again. I don't think you can delete custom battles modules ingame you have to do it manually : delete the folder RISEOFAI_CB in C:\Users\[your user name]\Documents\My Games\FieldOfGlory2\CAMPAIGNS
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
stockwellpete
Field of Glory Moderator
Field of Glory Moderator
Posts: 14500
Joined: Fri Oct 01, 2010 2:50 pm

Re: roguedjack's AI overhaul mod

Post by stockwellpete »

Just to say that the AI really struggles if it has to fight where there is dense terrain so this very good overhaul mod fight struggle to make a noticeable difference. The problem with the original AI as I understand it is that it calculates what is best for individual units in that turn only. It has no conception of a plan really. So it was intriguing in the game I played that the AI skirmishers softened up my scutari on rough ground before the legionaries and heavy cavalry charged in. So there certainly was an element of looking beyond the current turn in that part of the battle.
jamespcrowley
Staff Sergeant - StuG IIIF
Staff Sergeant - StuG IIIF
Posts: 254
Joined: Thu Nov 26, 2009 12:51 pm
Location: Arundel, U.K.

Re: roguedjack's AI overhaul mod

Post by jamespcrowley »

jamespcrowley wrote:The custom battle module, although technically available, simply will not work - select it and nothing happens.
Maybe a corrupted download. Delete the custom battle module and download it again. I don't think you can delete custom battles modules ingame you have to do it manually : delete the folder RISEOFAI_CB in C:\Users\[your user name]\Documents\My Games\FieldOfGlory2\CAMPAIGNS[/quote]

I have a Steam installation on my G drive.

I have searched for your two modules but cannot find them in the 'Campaigns' folder even though they both show up within game.

You can delete the module, Rise of AI - custom battles, within 'Epic Battles' and I have done so and re-downloaded several times but to no avail.

Not sure what else to try other than punt this over to tech support.

Cheers
stefankollers
Corporal - Strongpoint
Corporal - Strongpoint
Posts: 58
Joined: Wed Jun 10, 2015 8:41 am

Re: roguedjack's AI overhaul mod

Post by stefankollers »

I'm having the same problem. The mod will load up the Campaigns but not the custom battles. I have done as the above post several times but with no luck. Any help would be appreciated. Looking forward to using this mod in custom battles...After all the praise it has recieved.
peter01
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 11
Joined: Thu Oct 12, 2017 9:14 pm

Re: roguedjack's AI overhaul mod

Post by peter01 »

jamespcrowley wrote:Downloaded both modules within the game.

The campaign one worked fine and a quick trial battle on level3 (ancient Brits v Romans) proved very tough, with the Roman AI noticeably improved and giving a very good account of itself.

The custom battle module, although technically available, simply will not work - select it and nothing happens.
Same here. The "Campaign" menu selection of the new AI game starts fine, but selecting the changes via the "Epic Battles" menu doesn't work at all. Have tried deleting and downloading several times.

OTOH, the AI changes seem very good so far. Good work, and thanks.
Jafele
Lance Corporal - SdKfz 222
Lance Corporal - SdKfz 222
Posts: 26
Joined: Mon Jul 21, 2014 7:18 pm

Re: roguedjack's AI overhaul mod

Post by Jafele »

stefankollers wrote: Looking forward to using this mod in custom battles...After all the praise it has recieved.
That would be so GREAT... :wink:
roguedjack
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 127
Joined: Wed Oct 18, 2017 1:40 pm

Re: roguedjack's AI overhaul mod

Post by roguedjack »

I might have found the problem some people are reporting. Its not really a bug.
You have to play the custom battle module as a CUSTOM BATTLE only, not EPIC BATTLES.
Make sure you launch a "Custom Battle" and select the mod by clicking on the button that says "Select another module".
"Epic Battles" will do nothing because my custom battle module has no scenarios.
Sorry for the confusion!
If this doesnt help, then I dont know.
stockwellpete wrote:Just to say that the AI really struggles if it has to fight where there is dense terrain so this very good overhaul mod fight struggle to make a noticeable difference.
Yes it does not handle terrain well, especially with a heavy units army.
The problem with the original AI as I understand it is that it calculates what is best for individual units in that turn only. It has no conception of a plan really. So it was intriguing in the game I played that the AI skirmishers softened up my scutari on rough ground before the legionaries and heavy cavalry charged in. So there certainly was an element of looking beyond the current turn in that part of the battle.
To be honest I didn't add planning over several turns, but it does more to organize the actions of its units within the same turn. As reported in your example, shooting at enemies before charging them is one of the things it tries to do. You could say it does some very short term planning within a turn.
"Rise Of AI" AI mod for Field Of Glory II
http://www.slitherine.com/forum/viewtopic.php?f=477&t=102040
peter01
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 11
Joined: Thu Oct 12, 2017 9:14 pm

Re: roguedjack's AI overhaul mod

Post by peter01 »

roguedjack wrote:I might have found the problem some people are reporting. Its not really a bug.
You have to play the custom battle module as a CUSTOM BATTLE only, not EPIC BATTLES.
Make sure you launch a "Custom Battle" and select the mod by clicking on the button that says "Select another module".
"Epic Battles" will do nothing because my custom battle module has no scenarios.
Sorry for the confusion!
If this doesnt help, then I dont know.
Yes, that works fine. Thanks.

Also seems like you can play via CAMPAIGNS too, is that correct?
jamespcrowley
Staff Sergeant - StuG IIIF
Staff Sergeant - StuG IIIF
Posts: 254
Joined: Thu Nov 26, 2009 12:51 pm
Location: Arundel, U.K.

Re: roguedjack's AI overhaul mod

Post by jamespcrowley »

Yes that is the solution - thanks roguedjack.
Locked

Return to “Field of Glory II”