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: 23703
Joined: Sun Dec 04, 2005 6:25 pm

Re: roguedjack's AI overhaul mod

Post by rbodleyscott » Tue Nov 21, 2017 8:00 am

peter01 wrote:
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?
Yes. There are in fact two version of the mod - custom battles and sandbox campaigns. In each case you need to select the "Rise of AI" module.
Richard Bodley Scott

Image

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 » Tue Nov 21, 2017 9:11 pm

rbodleyscott wrote:
peter01 wrote:
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?
Yes. There are in fact two version of the mod - custom battles and sandbox campaigns. In each case you need to select the "Rise of AI" module.
Thanks for the clarification, and its great having that additional choice with the new AI.

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

Re: roguedjack's AI overhaul mod

Post by stockwellpete » Tue Nov 21, 2017 11:39 pm

roguedjack wrote: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.
How difficult, in terms of programming/coding or whatever, is it going to be to add forward planning over, say, 3-4 turns for an army? Because that would represent a major breakthrough, I guess. In terms of difficult terrain, if there are areas of terrain on the map that are difficult for my army I usually just don't go there, even if that means deploying on my baseline and waiting 3-4 turns before moving. Can the AI be programmed to recognise those sorts of situations?

roguedjack
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 92
Joined: Wed Oct 18, 2017 1:40 pm

Re: roguedjack's AI overhaul mod

Post by roguedjack » Wed Nov 22, 2017 2:03 pm

Good questions!
stockwellpete wrote:How difficult, in terms of programming/coding or whatever, is it going to be to add forward planning over, say, 3-4 turns for an army? Because that would represent a major breakthrough, I guess.
The short answer is that it is not really possible, and the results would probably be not as good as you might think. There is a reason no wargame AI I know of does this. For a computer, planning is searching. The search space is too large to use a search algorithm (too many possibilities) and if you try to make it smaller by pruning/culling or abstraction (say you only plan team moves not individual units actions), you end up with a search where the computer judgement will be wrong 90% of the time because it will be blind to important tactical details (the game is very chaotic, one unit action can make all the difference between winning and losing) and end up playing worse than a more simple AI and taking more time to do it. You will also have to resolve conflicting behaviours between the tactical AI ("I want to attack this unit! It looks good!") and the planner ("No! stick to the plan dude! Move to that bush there!"), both who are probably equally wrong!
In terms of difficult terrain, if there are areas of terrain on the map that are difficult for my army I usually just don't go there, even if that means deploying on my baseline and waiting 3-4 turns before moving. Can the AI be programmed to recognise those sorts of situations?
I agree terrain is very important, I have a couple of ideas on this but it could take some time and I'm not confident at all my solutions will actually make the AI better. I will try if I have the time, its fun!

Those are only my opinions of course and I'm not an AI expert by far!
"Rise Of AI" AI mod for Field Of Glory II

hjc
Senior Corporal - Destroyer
Senior Corporal - Destroyer
Posts: 114
Joined: Mon Apr 30, 2012 6:05 am

Re: roguedjack's AI overhaul mod

Post by hjc » Sat Nov 25, 2017 1:42 am

Thanks for this module, Roguedjack.

I've played only one custom battle, but can offer some feedback.

I played Ancient Britons against Romans, AI level 3, northern european wooded, medium sized battle.
The Romans, it turned out, had a flanking force, which could have hampered the AI in the early stages of the battle. I had a good advantage on my right flank, with many slingers, chariots and light horse, to swing around to the back lines and get some free rout percentage by taking out two artillery, and a cavalry unit (see below).

The AI initially used its skirmishers well - but then when they retreated, the majority of the AI skirmishers spent the rest of their turns milling about in a wood in the back lines, frequently "retreating", and so were hors de combat - which was an advantage for me, as my skirmishers were left unmolested to roam around the back-lines creating mischief. I don't recall the base game AI having so many skirmishers idle, so this could be something to look at.

The AI used one unit of Theuropherei, on my left flank, very well. They were held back and then committed late in the battle, launching a series of flanking attacks upon pre-existing melees to break and (almost) roll up my left flank, although this was helped by my my left flank anchor, my best warband, having pursued a routing roman unit off into the distance.

The AI early on allowed its sole unit of cavalry to be detained by my light horse. They did not charge me, but sat immobile and were decimated by missile fire, (my slingers joined the party) and eventually they auto-broke. Later on the AI made effective use of its flanking force cavalry by catching and routing one of my chariots and some light horse.

I took a narrow victory, Romans 67% vs me 56%. The game was very close, at first I thought I had it easily won, then it looked like I would lose, until a few romans finally auto-broke. I felt that the AI was close to reversing the result, had its skirmishers been better handled, there seems to be some hesitancy or test that keeps being triggered, causing them to be stuck away from the fight. On the whole it handled other infantry well.

I have different thoughts about the potential for wargame AI. Having been involved with chess engine development, I understand the limitations of search trees and exponentially expanding permutations of future moves and results. But just as in chess, positional evaluation in wargame AI is important. If, in an ideal world, the same effort that Chess AI has enjoyed were to be spent on wargame AI, we would see real improvement. Obviously this won't happen, and I agree that the most improvement can be had by picking the low-hanging fruit - that is, optimising the current move AI as best we can. Thanks for your work :)

nikgaukroger
Field of Glory Moderator
Field of Glory Moderator
Posts: 10287
Joined: Tue Aug 22, 2006 9:30 am
Location: LarryWorld

Re: roguedjack's AI overhaul mod

Post by nikgaukroger » Sat Nov 25, 2017 7:16 am

Played just one game, however, here is some feedback.

The revised AI seemed rather keen to move Fragmented units closer to the enemy, and inevitably to other of their own troops, putting them in positions where they could be charged and be easily broken causing cohesion tests (and overall army casualties of course). Gave me some rather easy kills and tactical advantages that, to be honest, in this particular game rather outweighed any overall improvement - but it just a sample of 1 :lol:
Nik Gaukroger

"Never ask a man if he comes from Yorkshire. If he does, he will tell you.
If he does not, why humiliate him?" - Canon Sydney Smith

nikgaukroger@blueyonder.co.uk

rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 23703
Joined: Sun Dec 04, 2005 6:25 pm

Re: roguedjack's AI overhaul mod

Post by rbodleyscott » Sat Nov 25, 2017 2:09 pm

hjc wrote:The AI initially used its skirmishers well - but then when they retreated, the majority of the AI skirmishers spent the rest of their turns milling about in a wood in the back lines, frequently "retreating", and so were hors de combat
The vanilla AI puts them into Bug Out mode out for a turn to get them out of the way of the heavy foot whn the main battle lines are close to each other, then halts them for a turn or two, then advances them again.

If this isn't happening with the Mod, something may need adjusting.

LF who are fragged or close to auto-breaking stay on BugOut mode.
Richard Bodley Scott

Image

roguedjack
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 92
Joined: Wed Oct 18, 2017 1:40 pm

Re: roguedjack's AI overhaul mod

Post by roguedjack » Sat Nov 25, 2017 3:26 pm

Thanks for the feedback.

I did not modify the trigger for bugout, those retreating skirmishers were probably close to autobreak, but my mod might over-estimate the distance they need to stay away from the enemy. If they are close to autobreak, they cannot do anything to recover from that. But if it happens too often, I'll try to find a way to make them more active but not suicidal.
nikgaukroger wrote:Played just one game, however, here is some feedback.
The revised AI seemed rather keen to move Fragmented units closer to the enemy, and inevitably to other of their own troops, putting them in positions where they could be charged and be easily broken causing cohesion tests (and overall army casualties of course). Gave me some rather easy kills and tactical advantages that, to be honest, in this particular game rather outweighed any overall improvement - but it just a sample of 1 :lol:
What would have been a better move for those fragmented units in your game? Would it have been ok for them to just stay idle where they were and wait to recover? Fragmented units cannot really do anything usefull.
"Rise Of AI" AI mod for Field Of Glory II

nikgaukroger
Field of Glory Moderator
Field of Glory Moderator
Posts: 10287
Joined: Tue Aug 22, 2006 9:30 am
Location: LarryWorld

Re: roguedjack's AI overhaul mod

Post by nikgaukroger » Sat Nov 25, 2017 3:31 pm

roguedjack wrote:Thanks for the feedback.

I did not modify the trigger for bugout, those retreating skirmishers were probably close to autobreak, but my mod might over-estimate the distance they need to stay away from the enemy. If they are close to autobreak, they cannot do anything to recover from that. But if it happens too often, I'll try to find a way to make them more active but not suicidal.
nikgaukroger wrote:Played just one game, however, here is some feedback.
The revised AI seemed rather keen to move Fragmented units closer to the enemy, and inevitably to other of their own troops, putting them in positions where they could be charged and be easily broken causing cohesion tests (and overall army casualties of course). Gave me some rather easy kills and tactical advantages that, to be honest, in this particular game rather outweighed any overall improvement - but it just a sample of 1 :lol:
What would have been a better move for those fragmented units in your game? Would it have been ok for them to just stay idle where they were and wait to recover? Fragmented units cannot really do anything usefull.
For one sitting tight was probably the best bet. They were MF and realistically unable to get away, but by moving closer to my troops they moved closer to friends and so when they broke more tested for seeing it that otherwise would have done.

The other was cavalry just over a move from my troops. They may have been able to turn and move away the following turn. Once again moving towards my troops brought them (a) within my move and (b) close to friends who then had to test for the break.
Nik Gaukroger

"Never ask a man if he comes from Yorkshire. If he does, he will tell you.
If he does not, why humiliate him?" - Canon Sydney Smith

nikgaukroger@blueyonder.co.uk

roguedjack
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 92
Joined: Wed Oct 18, 2017 1:40 pm

Re: roguedjack's AI overhaul mod

Post by roguedjack » Sat Nov 25, 2017 4:46 pm

Thanks nikgaukroger that's helpful.
hjc wrote: I have different thoughts about the potential for wargame AI. Having been involved with chess engine development, I understand the limitations of search trees and exponentially expanding permutations of future moves and results. But just as in chess, positional evaluation in wargame AI is important.
I more of the school that search is much more important than evaluation when games are dominated by tactics (such as chess and fog2). From what I can gather, in chess, fast dumb searchers dominate good slow evaluators most of the time, and most of the effort on engines is spent on finding algorithms that make the search tree narrower and deeper (nullmove, late move reductions, singular extensions etc...) not really on improving evaluation. Evaluation is still material and relatively simple positional heuristics like 30 years ago. Those algorithms are very specific to both alphabeta search and chess itself. Good static evaluators need good pattern detection and computers are awful at that on complex games, unless you can afford to spend millions on computing hours to grow a neural network like AlphaGO. And even there, AlphaGO also use and need a search algorithm (some sort of MCTS) running on an insanely powerful hardware. I'm not sure MCTS search and nn evaluators would work on chess, chess is much more chaotic than go (dominated by tactics that can end the game at any time, MCTS would miss a lot of them).
Fog2 search space is really huge, even with a very selective search, you can't really apply alpha-beta since most of the space is generated by the AI own moves with no opposition, and a good evaluation would need good pattern detection which is very very hard. I'm not sure researchers can find a good algorithm to solve that, its just a pure combination problem.
If, in an ideal world, the same effort that Chess AI has enjoyed were to be spent on wargame AI, we would see real improvement.
I can see that but I'm pessimistic. I've read some AI papers on wargame over the years, but they are often very specific to the particular game they are developped for and the game is often very simple compared to commercial wargames. You'll find everything from super selective searchers, to logic programming, to genetic algorithms applied to build queues or moves lists, to "bags of tricks" kinda architecture. The results are often disapointing and at best marginally better than simple hand-crafted solutions. "New" stuff like MCTS can work only because we now have the computing power for it. It is just a guided brute force algorithm really.
So I'm not convinced the problem is the lack of effort. To me it's just that the "wargame ai" problem cannot be solved by clever algorithms. Commercial wargame AIs in 20 years will be stronger not because of new algorithms that are yet to be invented, but because everyone will have a super computer equivalent on their desktop and we will be able to run some sort of search algorithm. We more or less already have the algorithms, we just need more CPU and memory.

Sorry for the rant! I'm derailing the thread!
"Rise Of AI" AI mod for Field Of Glory II

redrum68
Lance Corporal - Panzer IA
Lance Corporal - Panzer IA
Posts: 17
Joined: Sat Nov 25, 2017 9:05 pm

Re: roguedjack's AI overhaul mod

Post by redrum68 » Sat Nov 25, 2017 9:21 pm

@roguedjack My experience is similar. I'd also add that most strategy/tactical TBS games don't even play the immediate turn well let alone consider planning out a few turns. The search space often even within the current turn can be very large for many games that have 100s or 1000s of units. That being said I think there is some potential for a kind of second level AI layer that considers "group of units" and "overall battle field/map" strategy to address concepts like overall formation and flanking. But this type of AI is very difficult to write in a generic sense to be able to handle the multitude of situations and then integrate with the immediate turn AI layer.

Depending on the particular game, it actually helps out significantly to have CPUs that have more cores since often finding and evaluating the search space can be done in parallel for a large portion of it. Unfortunately since most of applications/programs can't utilize more than 1 core, most PCs have only 2-8 cores.

Anyways, just adding my 2 cents as strategy game AI is one of my interests and I developed the AI for a open source gaming engine called TripleA (plays games with rules similar to Axis and Allies).

Temple
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 128
Joined: Wed Oct 09, 2013 6:23 pm

Re: roguedjack's AI overhaul mod

Post by Temple » Fri Dec 01, 2017 11:14 pm

I have used the mod a couple of times. I'm not a super good, observant player like a lot of you, so I'm not sure what I saw on the first play-through that was different. However, I'm currently on my second battle with the mod and yup, I'm seeing a difference.

The forces are Roman 219 - 200 BC (me) versus Apulian 420 - 203 BC, small armies, open field. This is the third open field battle I've played with these two forces. On the first two (with no AI mod), the enemy line started moving forward right away. In this third battle, with roguedjack's AI overhaul mod enabled, well, it's turn 8 and the AI still hasn't moved its battle line forward. It has deployed their skirmishers, half trying to go to my battle line, the other half to attack my Velites which are annoying his Italian Foot. And it wasn't till the previous turn that the AI move its cavalry forward in response to me moving my cavalry closer.

And what has really freaked me out is that for the first time playing against the AI in an open field battle, the AI has launched an off map flanking attack :shock:. It's only two units, but that was still a surprise.

I finally got his battle line to move forward after my light troops had tossed javelins for three turns. Now we'll see how things go.

SteveD64
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 125
Joined: Mon Oct 20, 2014 2:46 pm

Re: roguedjack's AI overhaul mod

Post by SteveD64 » Sat Dec 02, 2017 7:16 pm

Will this new AI (or parts of it) be incorporated into the main game via a patch? From what I understand you can't play pre-made campaigns or epic battles using it?

rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 23703
Joined: Sun Dec 04, 2005 6:25 pm

Re: roguedjack's AI overhaul mod

Post by rbodleyscott » Sun Dec 03, 2017 7:57 am

SteveD64 wrote:Will this new AI (or parts of it) be incorporated into the main game via a patch? From what I understand you can't play pre-made campaigns or epic battles using it?
Eventually it will be available as a global mod - which means it will work for those, although we cannot vouch for the results. It has given us some ideas which we are implementing in the main game, but the mod will remain separate.
Richard Bodley Scott

Image

Temple
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 128
Joined: Wed Oct 09, 2013 6:23 pm

Re: roguedjack's AI overhaul mod

Post by Temple » Sun Dec 03, 2017 5:54 pm

I just used roguedjack's AI overhaul mod in the first battle of a campaign, which I documented in the thread Battle AAR: Roman 219 - 200 BC versus Apulian 420 - 203 BC

roguedjack
Senior Corporal - Ju 87G
Senior Corporal - Ju 87G
Posts: 92
Joined: Wed Oct 18, 2017 1:40 pm

Re: roguedjack's AI overhaul mod

Post by roguedjack » Tue Dec 05, 2017 2:51 pm

Hi all,

I'll release a minor update very soon to upgrade to Fog2 latest patch and address a couple of issues from user feedback.
Hopefully I should have more time to work on the mod soon.
"Rise Of AI" AI mod for Field Of Glory II

Temple
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 128
Joined: Wed Oct 09, 2013 6:23 pm

Re: roguedjack's AI overhaul mod

Post by Temple » Tue Dec 05, 2017 4:19 pm

roguedjack wrote:Hi all,

I'll release a minor update very soon to upgrade to Fog2 latest patch and address a couple of issues from user feedback.
Hopefully I should have more time to work on the mod soon.
Thanks for your work, I'm looking forward to the update. :D. I completed my five battle Custom Campaign using your mod and it seems to me that the AI is doing a better job of maintaining line cohesion and supporting each other.

SteveD64
Administrative Corporal - SdKfz 251/1
Administrative Corporal - SdKfz  251/1
Posts: 125
Joined: Mon Oct 20, 2014 2:46 pm

Re: roguedjack's AI overhaul mod

Post by SteveD64 » Tue Dec 05, 2017 7:37 pm

Yes, thanks!

Lysimachos
Lieutenant Colonel - Fw 190A
Lieutenant Colonel - Fw 190A
Posts: 1182
Joined: Tue Dec 08, 2009 9:38 am
Location: Italy

Re: roguedjack's AI overhaul mod

Post by Lysimachos » Tue Dec 05, 2017 11:18 pm

I haven't really understood how to use the roguedjack's module in the campaigns.
I just don't find it in the box ...
"Audentis fortuna iuvat"
- Virgilius

(Good luck favours the brave)

rbodleyscott
Field of Glory 2
Field of Glory 2
Posts: 23703
Joined: Sun Dec 04, 2005 6:25 pm

Re: roguedjack's AI overhaul mod

Post by rbodleyscott » Wed Dec 06, 2017 12:15 am

Lysimachos wrote:I haven't really understood how to use the roguedjack's module in the campaigns.
I just don't find it in the box ...
You need to download it first, using the "download Community Scenarios" button in the top left of the main menu, epic battles and campaign screens.

There are two versions you should see listed if you have not already downloaded them:

Rise of AI Custom Battles
Rise of AI Sandbox Campaigns

When you have downloaded them, you should find the Campaign version in the box that opens when you click the Campaigns button. (It is called "Rise of AI")

The Custom Battle module you find by clicking Battles > Custom Battles > Select another module, and you will see it in the listbox that opens. (It is called "Rise of AI - Custom Battles")
Richard Bodley Scott

Image

Locked

Return to “Field of Glory II”