Better AI Mod

User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Better AI Mod

  • Quote

Post by NewMercies »

The mod is here: https://www.ageofempires.com/mods/details/19188/
You can also find it by searching "Better AI Mod" in the mod menu within the game itself.

The mod is a work in progress, and any feedback or comments about things that don't seem to work are appreciated.
Note: This mod is required for all players to function in Multiplayer. Do not run with other AI mods. This mod is not intended for use while playing the Campaign. If you want to play the Campaign, disable the mod first.

May all glory be to God.

Currently in Development/Plans:
  • Actively updating the mod to accommodate changes from the developers to the AI.
  • Forward building.
  • Better Explorer control/treasure hunting.
  • Walling -- provided the settlers do not glitch like when I first attempted to implement this.
----------------------------------------------------------------------------------------------------

Version 4.1: 21 January 2022.
  • Fixed a bug with my mod where the AI's villagers got stuck trying to gather depleted huntables or trees. (Sometimes too many villagers may try to work a specific resource and get stuck, and I am still working on a solution).
  • Fishing is restored. AI will now maintain up to 10 fishing boats if it has less.
  • Fixed a bug with my mod where the Dutch AI would sometimes fail to use its bank wagon even if the maximum number of banks had not been built.
  • Fixed a bug with my mod where the Haudenosaunee and Lakota AI were not researching upgrades at their estates.
  • Fixed a bug where African AI would sometimes fail to immediately task their livestock to the market when the game begins.
  • AI now properly respond to a Trade Monopoly and will try to attack a trading post (also an upcoming fix in the PUP).
  • African AI build more granaries, maintain their respective cattle, and sell cattle more frequently.
  • African AI now research certain beneficial upgrades from their Alliances.
  • Ethiopian AI now task Abuns to Mountain Monasteries or defend with them.
  • Other minor fixes.
On 23 January as seen on the mods page, I made a quick update to remove a chat message I used for debugging purposes and forgotten to remove. No other changes were made.

----------------------------------------------------------------------------------------------------

Version 4.0: 7 December 2021.
I have frequently made small changes that I so often forget to keep track of specifically, so I am sure I have changed very minor things that may not be so noticeable to the player. However, more specifically what I do remember for this update:
  • I have re-coded how the AI sends its cards. The card choices revolve more around the AI trying to build up and survive, rather than typical human build orders.
  • AI should more reliably garrison/ungarrison villagers.
  • AI should more reliably have sufficient Mills/Plantations/etc. from which to gather.
  • AI should research certain economic upgrades more reliably (much more work to be done in this area and upgrading in general).
  • The British, Swedish, Inca, and Japanese AI should try to boom a bit more by building multiple houses at once on higher difficulties, as well as prioritizing this more extensively early on.
  • The AI have more a generalist approach, rather than trying to "pick" a specific strategy, which often caused situations like too much wood being poured into outposts early.
  • I have also added most changes made by the developers to the AI, in one way or another.
----------------------------------------------------------------------------------------------------

Version 3.0: 21 August 2021.
  • I finally finished enough updating to release another iteration of my mod. I spent a lot of time working on villager control that should overall improve the way the AI gathers. I have also updated the mod to work with the African civilizations, although many features are still lacking (such as unique upgrades, strategized age-up choices, etc.). This is also still true for the USA. These I plan to continue to address with more updates.
  • Until I can optimize fishing, I have disabled the AI building fishing boats. They either built too many or not enough to be significant, as they weren't really doing it all that properly. I'd rather them focus on their land economy until I can fix it. That said, the AI will perform its best on non-naval maps.
  • A known issue that I am investigating is a strange case where villagers occasionally idle after finishing off a resource.
Also, I learned a lot from Panmaster's ZenMasterAI file for the base game, which is where I drew a lot of the methods for micro-ing the villagers. If you read this, Panmaster, thank you!

----------------------------------------------------------------------------------------------------

Version 2.1.1: 8 July 2021.
  • This small update comes from received feedback. It fixes an issue with some booming AI (British, Swedish, Japan, Inca) occasionally not building a military building early because they were prioritizing building their houses (too much). AI also now try to keep a small portion of their military as a defense force for their base.
----------------------------------------------------------------------------------------------------

Version 2.1: 4 July 2021.
  • I have not made several changes since the last version. The AI behavior is still quite similar to the previous update. I have primarily updated this mod to function with gameplay and AI changes by the developers. Overall, this is a quality-of-life mini-update. Ideally, I am going to spend more time trying to improve the AI during the rest of summer.
----------------------------------------------------------------------------------------------------

Version 2.0: 1 February 2021.
  • Overall I have made several changes in this update, many of them tiny tweaks to the original code, as well as improvements and additions from the last version of this mod. Now this mod has also been updated to accommodate changes made to the AI in the most recent patch, Update 13088, released on January 19, 2021. (Note after the Update 14825 on 2 February: The mod is still fine to use for this patch. The change the developers listed presumably dealt with AI Functions outside of the main file; they made a few changes within the file that did not pertain to their listed change or my own changes. Therefore there is no need for me to update the mod again until I make more of my own changes or the developers release more comprehensive AI changes in the next patch.)
A few of the bigger changes:
  • There is now a strategy system by which decisions are made to steer the course of the AI's gameplay (particularly in the earlier ages). This change aims for more distinct, defined strategies rather than the original values that were used to give AI personalities some flavor. The AI has a chance to pursue Rush, Boom, Turtle, or Fast Fortress strategies. If the game is a treaty game in which the treaty time is thirty or more minutes, the AI will pursue a Treaty strategy (mainly reflected in Deck construction).
  • Decks and Shipment choices have been polished for the AI, but more work should come in future updates. Shipment choices are a bit more flavored now based on the AI's strategy.
  • The AI handles training military better according to its strategy. Military buildings are more conveniently placed within its base. The AI will attack more consistently.
Other Notes:
  • Unfortunately, the AI still does not handle walls very well, so for the time being, I have disabled their construction. This will most certainly be a disadvantage for them in Treaty games. I hope to find a good solution to it in the future.
  • Future areas I intend to try to improve include Wall Construction, Forward Bases, Resource/Resource Gathering Management, and further Card and Shipment diversity, amongst other things.
Thank you for trying this mod and for the feedback I have received thus far. Feel free to comment and let me know if you encounter any issues or see areas that need improvement.

----------------------------------------------------------------------------------------------------

Version 1.1: 2 November 2020.
  • Priority for aging up increases after an elapsed amount of time.
  • Town Centers allowed to be a little closer to each other, and not quite as far out from the starting position.
  • Factories will produce wood exclusively.
  • AI should train units and follow through on attacking a bit more consistently now, including generally training more units earlier, especially on Hardest and Extreme difficulties. However, this still needs work.
----------------------------------------------------------------------------------------------------

Version 1.0: 26 October 2020. My general philosophy is to have Hard difficulty be the baseline, and Hardest and Extreme just be the handicapped versions of that. Thus, they should all behave the same in this mod, but Hardest and Extreme will just be doing things quicker.
  • Deck Construction and Age-up choices have been streamlined, given a deck based on the game type -- that is, Standard or Treaty. In the future I want to diversify it more based on strategy. Revolutions disabled.
  • AI will build more military buildings in its base.
  • AI refrains from building mercenaries, outlaws, and mortars.
  • AI will max out its Town Centers.
  • Aztec and Inca AI will maintain 10 Priests/Priestesses.
  • AI weighs attacking more frequently on Hard and above.
  • AI will no longer build forts on your front doorstep.
----------------------------------------------------------------------------------------------------

Known Bugs
  • Villagers occasionally idle strangely when building walls. Thus, wall building is currently not implemented. (To be tested further.)
  • In certain situations, the AI task too many villagers to a hunt or tree, and as a result the villagers may get stuck. This is an issue with my mod that I am working to fix.
  • Berber Nomads behaving randomly when the AI acquires them.
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
User avatar
Canada vividlyplain
Lancer
Posts: 751
Joined: Feb 10, 2019
ESO: vividlyplain

Re: Better AI Mod

Post by vividlyplain »

Cool! I know a lot of people are wanting better AI. I’ll try it out if I get my game to work :cry:
User avatar
Great Britain Panmaster
Skirmisher
Posts: 166
Joined: Jan 1, 2016

Re: Better AI Mod

Post by Panmaster »

Do you know how to get the debug output or all the new functions for DE?
The stock AI has added:
sine
cosine
aiTaskUnitSpecialPower()
repairPlan
TAD AI Reference Guide
"Better to remain silent and be thought a fool than to speak out and remove all doubt." - Abraham Lincoln
User avatar
Great Britain Donye
Musketeer
Posts: 80
Joined: Oct 16, 2020
ESO: Pink Charr

Re: Better AI Mod

Post by Donye »

I've been playing a lot of comp stomps with a RL buddy recently and we've been frustrated at how poor the AI is, so I shall certainly try this out!
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

Post by NewMercies »

Panmaster wrote:Do you know how to get the debug output or all the new functions for DE?
The stock AI has added:
sine
cosine
aiTaskUnitSpecialPower()
repairPlan
No, unfortunately not, I have been using a message function in the code to see if I am messing up with anything, of course, if the file doesn't fail to load. I am happy they added the unit powers though in addition to a repair function, but I am unsure how some of the others work or may affect their behavior in comparison to the original. Like 'aiPlanSetDesiredResourcePriority,' I did not know if this is somehow causing the AI to be unable to efficiently build a straight wall. I actually tried to teach myself a bit from your ZenMasterAI for the original game, and your logic was quite helpful. I don't know if you have experimented with the wall building for AI yet in this game, hopefully you can figure out something I haven't. I am not the best at programming but I just try to improve things where I can, and I am trying to learn more. Also, as you have probably noticed, there is a function called 'aiSetMicroFlags' which makes them herd and micro units more efficiently, which is quite good compared to the original AI. However, I still think it needs a lot of improvement. Do you know why the cBuildWallPlanWallTypeStraight is not working quite so well as in the original now, if you have tested it? Also, I am not sure why the AI seems to keep changing its base even if I disable the handler function that does so (or at least I think). Hopefully we can all figure this out -- I know you used a lot of vectors and I think that is probably more helpful anyway. Also, you may have already downloaded this but here is the link https://forums.ageofempires.com/t/v-0-4 ... ive/103349, I haven't looked much into this yet, but I used it to get the techtree file to confirm that cWallGate was still missing in some of the civs' data files.
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

Post by NewMercies »

Donye wrote:I've been playing a lot of comp stomps with a RL buddy recently and we've been frustrated at how poor the AI is, so I shall certainly try this out!
Sounds good, currently I think their attacking is going to need some work, and sometimes certain AI seem not to train enough units. It is a work in progress, but let me know if you have any feedback.
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
User avatar
Great Britain Panmaster
Skirmisher
Posts: 166
Joined: Jan 1, 2016

Re: Better AI Mod

  • Quote

Post by Panmaster »

NewMercies wrote: Do you know why the cBuildWallPlanWallTypeStraight is not working quite so well as in the original now, if you have tested it? Also, I am not sure why the AI seems to keep changing its base even if I disable the handler function that does so (or at least I think). Hopefully we can all figure this out -- I know you used a lot of vectors and I think that is probably more helpful anyway. Also, you may have already downloaded this but here is the link https://forums.ageofempires.com/t/v-0-4 ... ive/103349, I haven't looked much into this yet, but I used it to get the techtree file to confirm that cWallGate was still missing in some of the civs' data files.
Maybe they deleted it? Whoever made the modifications obviously was inept and clueless. Half the functions are adding nothing new like trade routes.
If they haven't even bothered to fix the CWallGate oversight, then there's no doubt they've not fixed the other XML oversights such as missing food types.

I extracted some of the functions with great difficulty to this .txt file:
Attachments
AOE3-DE-AI-Changes.txt
(60.71 KiB) Downloaded 55 times
TAD AI Reference Guide
"Better to remain silent and be thought a fool than to speak out and remove all doubt." - Abraham Lincoln
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: BetterAI Mod

Post by NewMercies »

I decided to create a new mod with this latest patch which will now be the mod itself, the one that is updated regularly. I also edited the original post to now include the correct link, which is also here. The old one will no longer be the one that is updated, and I have made it private so as to avoid confusion. My apologies for any inconveniences. The new mod here has no new changes from the last update, except that it is now been re-modded from the updated AI released by the developers in the last patch. I will be continuing to work on the mod to make further improvements.
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
Australia Peachrocks
Lancer
Posts: 506
Joined: Jul 11, 2019
ESO: Peachrocks

Re: Better AI Mod

Post by Peachrocks »

Alright. I really want better AI. Current one is just... so poor.

I'm not certain though about what can and cannot be changed so as a starting point I suppose that. Like decks I think yes. When they attack and with what? Is raiding possible or only the whole 'attack this location' thing they do. I guess another question is 'What are you hoping for the AI to do' or rather 'each AI' because naturally the AI is going to be a lot better at playing say, Portugal then Aztec.

Another thing on 'what they cannot do' is AIs basically never get the tech (depending on the civ) that increases villager health at the market. It's such a cheap tech and so useful, especially for the AI so is this something they just refuse to do no matter what?
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

Post by NewMercies »

Peachrocks wrote:Alright. I really want better AI. Current one is just... so poor.

I'm not certain though about what can and cannot be changed so as a starting point I suppose that. Like decks I think yes. When they attack and with what? Is raiding possible or only the whole 'attack this location' thing they do. I guess another question is 'What are you hoping for the AI to do' or rather 'each AI' because naturally the AI is going to be a lot better at playing say, Portugal then Aztec.

Another thing on 'what they cannot do' is AIs basically never get the tech (depending on the civ) that increases villager health at the market. It's such a cheap tech and so useful, especially for the AI so is this something they just refuse to do no matter what?
Sorry for the late reply. I think there is a good bit I would like to change, and that is possible to change, to make the AI more competitive. However, I am not the best at programming so it takes me time to test things and make sure the changes work. Since it is a large time investment I work rather slowly. I also try to re-update the mod with each patch that comes out, but I have not done so for the one today, yet. You are right about "each" AI, as some specific work needs to be done for all of them individually to make them better, and the easiest place for me to start was the decks along with making other rather general changes. I believe raiding is possible but I have not yet tested it myself. I saw a "More Aggressive AI" mod also on the workshop, and it looks like its author wrote a bunch of attack plan code for the first version, whereas the game's base AI (and mine as I haven't changed this) uses an Attack Goal that creates plans itself (I believe), so attacks are handled through it and scoring opportunities that seem lucrative, potential targets. What I changed were a few small numbers that make it consider attacks more frequently, but obviously it still needs work. It would be nice to try to get to specifics for individual civs but obviously the exactness with which many pros enact build orders and micro and such would be a very tedious thing to try to write well, for me at least, but it doesn't mean I won't try to continue to make improvements. I will try to look at the market tech issue also. My guess is from having looked at the rule that controls economic upgrades, it probably doesn't deem that upgrade as very worthy since it doesn't improve a gather rate, but that could be fixed by making a rule to research it (and other upgrades) specifically.
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
Australia Peachrocks
Lancer
Posts: 506
Joined: Jul 11, 2019
ESO: Peachrocks

Re: Better AI Mod

Post by Peachrocks »

NewMercies wrote:
Peachrocks wrote:Alright. I really want better AI. Current one is just... so poor.

I'm not certain though about what can and cannot be changed so as a starting point I suppose that. Like decks I think yes. When they attack and with what? Is raiding possible or only the whole 'attack this location' thing they do. I guess another question is 'What are you hoping for the AI to do' or rather 'each AI' because naturally the AI is going to be a lot better at playing say, Portugal then Aztec.

Another thing on 'what they cannot do' is AIs basically never get the tech (depending on the civ) that increases villager health at the market. It's such a cheap tech and so useful, especially for the AI so is this something they just refuse to do no matter what?
Sorry for the late reply. I think there is a good bit I would like to change, and that is possible to change, to make the AI more competitive. However, I am not the best at programming so it takes me time to test things and make sure the changes work. Since it is a large time investment I work rather slowly. I also try to re-update the mod with each patch that comes out, but I have not done so for the one today, yet. You are right about "each" AI, as some specific work needs to be done for all of them individually to make them better, and the easiest place for me to start was the decks along with making other rather general changes. I believe raiding is possible but I have not yet tested it myself. I saw a "More Aggressive AI" mod also on the workshop, and it looks like its author wrote a bunch of attack plan code for the first version, whereas the game's base AI (and mine as I haven't changed this) uses an Attack Goal that creates plans itself (I believe), so attacks are handled through it and scoring opportunities that seem lucrative, potential targets. What I changed were a few small numbers that make it consider attacks more frequently, but obviously it still needs work. It would be nice to try to get to specifics for individual civs but obviously the exactness with which many pros enact build orders and micro and such would be a very tedious thing to try to write well, for me at least, but it doesn't mean I won't try to continue to make improvements. I will try to look at the market tech issue also. My guess is from having looked at the rule that controls economic upgrades, it probably doesn't deem that upgrade as very worthy since it doesn't improve a gather rate, but that could be fixed by making a rule to research it (and other upgrades) specifically.
Quite honestly I think the AI needs to focus more on it's economy in the early part of the game. Attacking is usually its weakness because it will constantly attack inefficiently and pick poor targets. This matters less later on because buildings do not scale and artillery comes into play.

It should be capable of defending itself if attacked obviously, not complete full boom, but that's why I asked about raiding. Not the passiveness where it just doesn't do very much until it's attacked and when it does attack it always leaves a significant amount of troops behind.

Still having said this it shouldn't commit too much to early attacks because I think this is where the AI is weakest. Some AI's (Suleiman for example) spend a lot on defensive towers too which I think is a mistake because it doesn't place them well and it doesn't garrison villagers inside of them, so why does it spend resources on them? Granted, you could argue that about towers in general, but this is doubled down for the AI. Units at least can move to where needed.

Going back to early attacks maybe against mediocre players it'll catch them out, but in my experience players learn that the AI will attack whatever is put in front of them rather than targeting things efficiently. Whereas later on if it's got a solid economy? Units tear down buildings so fast that it doesn't matter if its attacking the wrong things and I doubt it'd be easy to make the AI attack the 'right' things because the context of that changes wildly, though having said that attacking a wall that blocks nothing is probably something it should avoid if at all possible.

Still if you REALLY want the AI to attack early how hard would it be to get Suleiman or Akbar to do a basic Janissary/Sepoy rush hitting around 7-8 minutes? I know it doesn't usually build forward barracks/agra or anything unless there's a forward fort already there so such a rush would be slow by good human standards but such an attack with say 20-30 units would be pretty effective against other AIs and mediocre human players.

I'd try mess with this myself but... yeah... such things in the past haven't gone well :D.
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

Post by NewMercies »

Finally released an update! Feel free to try and report issues or give feedback. Thanks!
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
Australia Peachrocks
Lancer
Posts: 506
Joined: Jul 11, 2019
ESO: Peachrocks

Re: Better AI Mod

Post by Peachrocks »

NewMercies wrote:Finally released an update! Feel free to try and report issues or give feedback. Thanks!
Alright... I've played a few games, recorded and watched them.

There are two major flaws with the AI, one of which I've brought up already. You may be powerless to change these things though.

1. You mention in the notes that 'the AI attacks more consistently' and the standard AI attacks fairly regularly. I believe this is not a good move. The AI should strike decisively or not at all. It can't pick it's targets very well and usually walks its units in the general direction of the opponent attacking whatever is in its way to the destination whether that be units, houses, manor houses, torps, walls, barracks, towers whatever, it's not usually picky. This is why I believe the AI should not attack unless it scouts or otherwise believes the opponent cannot adequately defend. The later the game goes the less this matters because buildings don't scale anywhere near as well as units do. Unless its specifically rushing hard (if it even can) it should not consider attacking until later.

2. Villagers in both your mod and standard AI often gather huge amounts of one resource at the expense of all others, sometimes using crates to compensate for what it's not gathering. It then drains an area of said resources, then moves on to whatever it needs. It loses so much efficiency due to all the moving around it does with it's villagers rather than steadily collecting what's necessary.

On a side note both standard AI and the mod AI often throws its hero away taking on treasure guardians either poorly or bites off way more than it can chew.

Is there anyway I can try mod some basic passive/economic strategies in or you can do it on my behalf? Even for just one civ? Just to see how it plays against others following more 'standard' builds.
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

Post by NewMercies »

Peachrocks wrote:
NewMercies wrote:Finally released an update! Feel free to try and report issues or give feedback. Thanks!
Alright... I've played a few games, recorded and watched them.

There are two major flaws with the AI, one of which I've brought up already. You may be powerless to change these things though.

1. You mention in the notes that 'the AI attacks more consistently' and the standard AI attacks fairly regularly. I believe this is not a good move. The AI should strike decisively or not at all. It can't pick it's targets very well and usually walks its units in the general direction of the opponent attacking whatever is in its way to the destination whether that be units, houses, manor houses, torps, walls, barracks, towers whatever, it's not usually picky. This is why I believe the AI should not attack unless it scouts or otherwise believes the opponent cannot adequately defend. The later the game goes the less this matters because buildings don't scale anywhere near as well as units do. Unless its specifically rushing hard (if it even can) it should not consider attacking until later.

2. Villagers in both your mod and standard AI often gather huge amounts of one resource at the expense of all others, sometimes using crates to compensate for what it's not gathering. It then drains an area of said resources, then moves on to whatever it needs. It loses so much efficiency due to all the moving around it does with it's villagers rather than steadily collecting what's necessary.

On a side note both standard AI and the mod AI often throws its hero away taking on treasure guardians either poorly or bites off way more than it can chew.

Is there anyway I can try mod some basic passive/economic strategies in or you can do it on my behalf? Even for just one civ? Just to see how it plays against others following more 'standard' builds.
Thank you for your feedback. Would you mind sharing your recorded games with me? My Discord ID is currently jameskick#8296.

Addressing point 1: attacks can be prohibited at will simply by not allowing the creation of an attack plan. Currently, I haven't changed much regarding how the AI weighs the opportunity cost of attacking an enemy base except when it assesses enemy military units at the base. Perhaps the discrepancy here you are finding is that if the unit is not at the base it is not considered in the calculations, so for instance your army could be on the way to attack it and it would not consider it. This is something I plan to try to address. As far as attack units/buildings go that may not be pertinent to the base: I am not sure the extent to which this is avoidable -- I know in attack plans you can set what type of unitType to attack, so I am not sure if trying to filter out less ideal targets in earlier ages would work. Specifically with DE the developers have added the external micro flags that control AI kiting and herding and such. I find the kiting is quite useful but in herding they practically slaughter all of the animals and then leave them on the ground, which kind of bleeds into point 2. Regardless I hope to improve the attacks of the AI somehow.

Regarding point 2 specifically, efficiency is definitely an AI shortfall, and the handicap helps make up for that I find, and puts the AI more on par with a more micro-intensive human player in terms of output of resources and units. Certainly some people don't like this as they regard it as cheating, but in my opinion it makes up for, at least in part, the lack of sufficient micro. I believe the way the settlers shift/hop around from one resource to the next can be mitigated somewhat via the rule that controls their distribution on resources. However, the specific plans that control the settlers are external to the main file (eg. hardcoded functions by the game), this is of course if you use the external functions the game has. It's possible through much effort to individually control each settler, but it would be a pain to implement as well as maintain throughout the course of the game. If you are finding the efficiency to be lacking and you weren't already playing on Hardest or Extreme, I would recommend that as opposed to a lower difficulty. However, I know that it still can be disadvantageous. I do want to take a look at the function within the file that controls resource distribution and try to improve it more and have settlers less bouncy, but I will have to study the way they implement the algorithm. Also, you mentioned sometimes they are gathering a lot of a specific resource while neglecting others. Ideally this shouldn't happen, but in the cases of crates (and age-up politicians/wonders delivering resources), the AI now considers these things when they are sending. So, if they are temporarily neglecting some of these resources early, it may be because they are soon going to be receiving some at their Town Center. I do realize though that at times the AI seems just to dive headfirst into one resource a bit contrary to what it actually needs, so hopefully this can be improved with some more additions to the function that controls this.

As for the explorers, the AI definitely sends them to their death quite often. I didn't really look at this much because it wasn't a priority for me, but I do want to improve the explore plan and treasure gathering more, as well as trying to gather herdables (at least for someone like Japan maybe).

Ideally, if the AI selects the "boom" strategy, then they are going to prioritize a stronger economy and not really attack as early. But because of the base calculations and weighing the advantages of an attack (considering only enemy units in the base they want to attack), the Booming AI may actually end up attacking in some cases. I am not sure which strategy AI you may have played against. The way I coded it, every civilization has a random chance to implement the strategy, but for the Spanish AI, for example, she is more likely to go for a Fast Fortress or Rush. In the rule managing attacks, I will work to implement more code that could be more restrictive for non-rush AI in Age 2, unless there is a clear advantage.

Thanks again,
James
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
Australia Peachrocks
Lancer
Posts: 506
Joined: Jul 11, 2019
ESO: Peachrocks

Re: Better AI Mod

Post by Peachrocks »

I added you on discord, that'll make things easier. Still had another game where the Russian AI refused to build blockhouses or artillery foundries making their unit choices... limited :D.
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

Post by NewMercies »

Hello all, I am working on an update so the mod will function with the African Royals DLC, and I am trying to introduce more improvements, specifically to optimize the AIs' gathering. (Rather than using the game's gather plans that I can't access, I am individually assigning villagers -- so far it is working well. This should squash most issues with villagers hopping around resources for no reason and the endless slaughter of hunts!) I am planning to hopefully release another update this week, but if I do not finish the update, then ideally it will be next week. For now if you have downloaded this mod, I'd recommend not using it if you encounter issues, especially with the African AI which are not accounted for in the current version of the mod.
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

Post by NewMercies »

I'm still hard at work trying to finish this update. I have begun university classes so that has impacted how much time I am able to spend on the mod. I have not experimented much with African civs, so for this update, outside of core abilities (training units, managing villagers, etc.), they will likely be a bit lackluster. The USA is still in the same boat, until I can improve them specifically, further. The hangup I am experiencing now is that I am trying to micromanage garrisoning villagers, but I cannot seem to make the game command aiTaskUnitEject work (yet). I hope to release it soon, so that the AI will be a bit more challenging!
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

  • Quote

Post by NewMercies »

Finally released an update! I will still be continuing to work on this and provided I make enough progress, I will release regular updates. Thank you and please let me know if you encounter any issues. :smile:
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
Australia Peachrocks
Lancer
Posts: 506
Joined: Jul 11, 2019
ESO: Peachrocks

Re: Better AI Mod

Post by Peachrocks »

I’ll give it another go. I don’t think we actually spoke on discord all those months ago. No matter, I’ll give more current feedback when I next play.
User avatar
Germany aligator92
Howdah
Posts: 1519
Joined: Feb 27, 2015
ESO: aligator92

Re: Better AI Mod

Post by aligator92 »

I gave it a try today and for the early game I didn't notice that much of a difference but in the later stages the AI was really hard to crack as it remassed and pushed back out instead of feeding a continous stream of 10 units into my army. It also made multiple raxes which I don't see too often from the AI
New Zealand akemi05
Crossbow
Posts: 7
Joined: Aug 23, 2021
ESO: JohnKwon05

Re: Better AI Mod

Post by akemi05 »

Just a question... dose this mod help on AI as an Allie? More often than not allied Ai will do nothing but gather.
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

Post by NewMercies »

akemi05 wrote:Just a question... dose this mod help on AI as an Allie? More often than not allied Ai will do nothing but gather.
The ally AI should train units the same as an enemy, yes. However, I have not edited the way the AI decides to attack, which I will be focusing on soon.
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan
Australia Peachrocks
Lancer
Posts: 506
Joined: Jul 11, 2019
ESO: Peachrocks

Re: Better AI Mod

Post by Peachrocks »

akemi05 wrote:Just a question... dose this mod help on AI as an Allie? More often than not allied Ai will do nothing but gather.
The core issue is that both the default AI and this one simply plays some civs better then others.

Though I did notice that the AIs who are allied are more likely to synchronise attacks, so allowing an attack order to be given by the human might help. Even by default in legacy the AI used to send chat to tell you it was attacking. Although it only seemed to do this once a game.
New Zealand akemi05
Crossbow
Posts: 7
Joined: Aug 23, 2021
ESO: JohnKwon05

Re: Better AI Mod

Post by akemi05 »

for some reason Ai will send civilians to my base more than troops from age 3 and onward and if I kill all civilians AI will surrender. There is hardly any battle from Age 3 and onward.
User avatar
United States of America NewMercies
Crossbow
Posts: 21
Joined: Oct 15, 2020
Location: USA

Re: Better AI Mod

Post by NewMercies »

akemi05 wrote:for some reason Ai will send civilians to my base more than troops from age 3 and onward and if I kill all civilians AI will surrender. There is hardly any battle from Age 3 and onward.
Do you mean the AI is sending its villagers to your base? If you have discord feel free to add me at jameskick#8296 and you can give me more details on the issue you experienced.
"The law commands but gives neither feet nor hands. Better news the gospel brings; it bids me fly and gives me wings." John Bunyan

Who is online

Users browsing this forum: No registered users and 1 guest

Which top 10 players do you wish to see listed?

All-time

Active last two weeks

Active last month

Supremacy

Treaty

Official

ESOC Patch

Treaty Patch

1v1 Elo

2v2 Elo

3v3 Elo

Power Rating

Which streams do you wish to see listed?

Twitch

Age of Empires III

Age of Empires IV