Hi, I would like to share with you my* AI.
The aim is to somewhat resemble my favorite playstyle.
While I've been interested in AI's for a long time, I've hesitated to sink in the time to try scripting my self.
MrElephant set me up with something to start and I went from there. Thank you
Some parts were initially generated by Jan1302's and Hawk_Ruralist's AI Builder.
The AI has some snippets* from FireBall included and ideally will include more at some point.
Bandit helped me much with how to assign the desired enemy players as targets in a teamgame.
Thank you and all other scripters for helping
* FireBall's Script Snippets: viewtopic.php?f=8&t=4174
I haven't yet looked too much into other AI's and how they are set up, but occasionally I find it quite insightful to search my AI collection for commands and SN's to see how those are used by others. VS Code is great for doing so.
I hope to improve it when I'm able to take the time, however, learning and scripting is a slow process for me (maybe others are more talented).
So I'm not sure how significant any updates will come in, or if it maybe needs to wait until I retire from work some time in the distant future
Game version: AoC+UP or AoE2:DE
Civ: Mongols
Map: Tested on Arabia. Played in Prince of Arena tourney. Doesn't build docks.
Played Yucatan on Leif's Ladder and showed issues with pathing the Mangudais around stretched rivers or around forests on bigger maps. Can likely get stuck there.
Played Goldrush on the Ladder. The more open map fits it rather well. Won't deliberately protect the later placed MC on the middle gold.
Difficulty: Hard (AoC+UP) / Extreme (DE) (has no difficulty scaling)
Teamgames: Does not trade yet. Same strategy for all. No support for suffering teammates.
Resources: tested with Standard
Population: 200 (aims for 50 vills, so probably should work with reasonably lower pop)
Starting Age: Dark Age (Standard)
Viktory: Conquest (does not collect relics or build wonders)
Strategy: "Fast" castle, one TC, rush up a castle (main defense), go for Mangudai and push, while prioritize upgrades at the cost of a small eco.
(I hate too many Villagers, which mostly stress me to keep them occupied, so this AI goes only for 50 Vills for now)
Potentially important note: Apparently it can happen, that the Mangudais won't fire, when microd with the DUC-code. (thx Esty for the report)
According to Bandit enabling V-Sync on DE could help. I imagine limiting FPS to 60 could help as well.
I assume, if your PC is rather slow it might also lead to an issue with the micro-code.
Same probably applies, if game-speed is 4x or faster, or if the game is speed up with CheatEngine.
(Some issues and todos are listed in the script)
My first two versions of MangudAI-all-in (v0.1.1 & v0.1.2): MangudAI-all-in_0.1.zip
-----------------------------------------------------------------------------------------------------------------------------------------
No military-micro version of MangudAI 11.11.2022 | Attachement MangudAI-all-in_0.1c no-military-micro.zip
A no-(military)-DUC version of MangudAI-all-in. Intended to be used for Kimberly Azula's AI ladder for weaker AIs.
-----------------------------------------------------------------------------------------------------------------------------------------
Update 0.2c 03.07.2022 | Attachement MangudAI-all-in_0.2c.zip
Main difference is FireBalls ranged micro code, with some adjustments by MrElephant (not sure which).
Update 0.2d 24.07.2022 | Attachement MangudAI-all-in_0.2d.zip
Mainly fixed something in the ranged-micro script, which was not properly adjusted for the Mangudai play.
Update 0.3 05.09.2022 | Attachement MangudAI-all-in_0.3.zip
Added FireBalls deer luring/pushing snippet. Very much appreciated.
Use up-build place-control for a compact base.
Update 0.3a 11.09.2022 | Attachement MangudAI-all-in_0.3a.zip
Mainly some fixes and changes in the hope for the better. Adjusted some stuff for better Arena playability.
Update 0.3b ~Nov 2022 | Attachement MangudAI-all-in_0.3b.zip
iirc one notable change is from the old "TSA"-code to attack-now to not interfere with FireBalls ranged-micro. Switches to TSA when > 20 or so MangudAI.
Update 0.3c 01.05.2023 (PoA submit) | Attachement MangudAI-all-in_0.3c.zip (atm not UP-compatible)
Main difference should be improved target choice for the mangudai-micro and additional castle-builders, if enemy units are in town.
Update 0.4 02.08.2023 (DC7 update) | Attachement MangudAI-all-in_0.4.zip (atm not UP-compatible)
Target-player handling by Bandit. Retreat from superior knight groups. Ignore towers, instead focus on shooting enemy units.
Update 0.4a/b 23.08.2023 (DC7 update) | Attachement MangudAI-all-in_0.4b.zip (atm not UP-compatible)
My target-player code. Fixed running Mangudais to left corner bug. Vill attack rams (improvable). Prioritize ballistics or rams vs towers.
Update 0.4c 09.09.2023 (DC7 update) | Attachement MangudAI-all-in_0.4c.zip (atm not UP-compatible)
Retreats from castles and circles around them. Buy stone for castle in emergency. Build a feudal-tower under attack.
Update Post 0.5/0.5a 28.01.2024 (joins AI Ladder) | 0.5b 02.05.2024 (PoArena update) | 0.5c 10.09.2024
• Limited DUC Mill and MC placement. DUC tower on stone with a few protecting palisades next to it, if feudal-rushed. (v0.5)
• Retreats if enemy has several monks nearby. (yes, that's all) (v0.5b)
• Mangudais should now reliably micro vs wolfs. Thanks Leif for the workaround. (v0.5c)
Attachement MangudAI-all-in_0.5a.zip | MangudAI-all-in_0.5b.zip | MangudAI-all-in_0.5c.zip (atm not UP-compatible)
Attachements
You can download the latest (or older) version from the links in this post or go to the linked update-post and download there.
I like to keep the download track of an uploaded version (just out of interest), hence no files directly attached to this post.
(you have to eventually replace the old attachments, if you keep updating the original post)
MangudAI-all-in
- wattle
- Swami
- Posts: 212
- Joined: Fri Aug 15, 2014 1:06 pm
- Location: Germany
MangudAI-all-in
Last edited by wattle on Wed Sep 18, 2024 2:28 pm, edited 98 times in total.
MangudAI-all-in (wip, to be continued, when I retire from work )
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
-
- Forumer
- Posts: 97
- Joined: Fri Jun 02, 2017 11:00 pm
- Location: Australia
Re: MangudAI-all-in
Wasn't expecting this Its quite good for a first attempt. I tried a few games vs. Bambi. It kept up alright in castle age but eventually gets out-boomed. The main reason being because it stops vill production when it reaches 50 villagers.
Some suggestions:
Some suggestions:
- Keep training villagers until they make up half the pop limit.
- Drop of resources in dark age to maintain vill production (especially from boar). To do this simply use up-drop-resources. You can use dropsite-min-distance to check that they are under the TC if you are worried about a bad boar lure.
- Drop resources to get feudal/castle age more quickly (this will save over 100 seconds in some cases).
- Only 2 villagers were used to build the castle. I suggest using 4 and also building it closer. You can use up-assign-builders for this. Go back to 1 builder if you are under attack to prevent suicide.
- With only 1 castle it tends to fall behind in military numbers. I would suggest adding a second castle as soon as you can.
- It builds the university and some upgrades too quickly. Would be better focus on getting Manguadai numbers up first and building another castle.
- The siege workshop and rams are made too quickly when it only has a low military population.
- It tends to go imperial age too early. By the time it gets to imp the enemy will already have far more villagers and military.
- MrElephant
- Swami
- Posts: 121
- Joined: Sun Dec 20, 2020 6:28 am
Re: MangudAI-all-in
First- congrats, Wattle, on uploading your AI. This is great. Now you have an AI for competitions as well.
A couple of notes. A few individuals are taking note of the number of builders. In your "first houses.per" file
;###################### CODE
(defrule ;first house
(can-build house)
=>
(up-set-placement-data my-player-number villager-class c: 0) ;set first house near two villagers
(up-build place-control 0 c: house) ;place control goes with up-set-placement-data
(up-assign-builders c: house c: 2) ;two vills to the foundation
(disable-self)
)
The up-assign-builders c: house c:2. This is how many builders you are actually assigning. When I was first helping work on this code- I assigned four builders to the castle here, so it is odd that less than 4 builders are being used.
The distance the castle is away from the town is set by (up-set-placement-data my-player-number -1 c: 6)
(defrule
(current-age == castle-age)
(current-age-time < 180)
(building-type-count-total castle < 1)
(can-build-with-escrow castle)
(up-can-build 0 c: castle)
=>
(release-escrow stone)
(up-assign-builders c: castle c: 4)
(up-set-placement-data my-player-number -1 c: 6)
(up-build place-control 0 c: castle)
)
Other than that- it looks like you have done some fantastic work since the earlier versions of the code. Great work.
A couple of notes. A few individuals are taking note of the number of builders. In your "first houses.per" file
;###################### CODE
(defrule ;first house
(can-build house)
=>
(up-set-placement-data my-player-number villager-class c: 0) ;set first house near two villagers
(up-build place-control 0 c: house) ;place control goes with up-set-placement-data
(up-assign-builders c: house c: 2) ;two vills to the foundation
(disable-self)
)
The up-assign-builders c: house c:2. This is how many builders you are actually assigning. When I was first helping work on this code- I assigned four builders to the castle here, so it is odd that less than 4 builders are being used.
The distance the castle is away from the town is set by (up-set-placement-data my-player-number -1 c: 6)
(defrule
(current-age == castle-age)
(current-age-time < 180)
(building-type-count-total castle < 1)
(can-build-with-escrow castle)
(up-can-build 0 c: castle)
=>
(release-escrow stone)
(up-assign-builders c: castle c: 4)
(up-set-placement-data my-player-number -1 c: 6)
(up-build place-control 0 c: castle)
)
Other than that- it looks like you have done some fantastic work since the earlier versions of the code. Great work.
Author of Charon, Reactionary, Ahulane, and BlackKnight!
- wattle
- Swami
- Posts: 212
- Joined: Fri Aug 15, 2014 1:06 pm
- Location: Germany
Re: MangudAI-all-in
Thanks for your feedback
About the castle builders, Leif Ericson hinted at sn-cap-civilian-builders, which wasn't set and capped the builders to the default 2. I set it higher and the intended 4 builders finally do their job
I agree about the rams.
About the university I personally highly value ballistics. Not sure about that.
The stone gathering for the second castle may be beneficial to be increased.
Maybe I might increase the villager limit at some point. I would assume it will how ever come with the trade off of getting elite Mangudai and other important techs later. Even though I'm aware that this time-window is quite narrow.
After all, I like to beat 2 Barbies in my own games with 35-40 vills, but some fully upgraded elite Mangudais
edit: I attache my oldest version here
About the castle builders, Leif Ericson hinted at sn-cap-civilian-builders, which wasn't set and capped the builders to the default 2. I set it higher and the intended 4 builders finally do their job
I agree about the rams.
About the university I personally highly value ballistics. Not sure about that.
The stone gathering for the second castle may be beneficial to be increased.
Maybe I might increase the villager limit at some point. I would assume it will how ever come with the trade off of getting elite Mangudai and other important techs later. Even though I'm aware that this time-window is quite narrow.
After all, I like to beat 2 Barbies in my own games with 35-40 vills, but some fully upgraded elite Mangudais
edit: I attache my oldest version here
- Attachments
-
- Mangudai-all-in_0.1.zip
- (30 KiB) Downloaded 309 times
Last edited by wattle on Tue Aug 29, 2023 3:17 pm, edited 1 time in total.
MangudAI-all-in (wip, to be continued, when I retire from work )
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
- wattle
- Swami
- Posts: 212
- Joined: Fri Aug 15, 2014 1:06 pm
- Location: Germany
Re: MangudAI-all-in
Update 0.2c 03.07.2022
Main difference is FireBalls ranged micro code, with some adjustments by MrElephant (not sure which).
Also it now builds the castle with 4 builders.
I love the ranged micro. Thank you a lot, FireBall and also MrElephant.
Main difference is FireBalls ranged micro code, with some adjustments by MrElephant (not sure which).
Also it now builds the castle with 4 builders.
I love the ranged micro. Thank you a lot, FireBall and also MrElephant.
- Attachments
-
- MangudAI-all-in_0.2c.zip
- (25.19 KiB) Downloaded 313 times
Last edited by wattle on Tue Aug 29, 2023 3:07 pm, edited 1 time in total.
MangudAI-all-in (wip, to be continued, when I retire from work )
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
- wattle
- Swami
- Posts: 212
- Joined: Fri Aug 15, 2014 1:06 pm
- Location: Germany
Re: MangudAI-all-in
Update 0.2d
Mainly fixed something in the ranged-micro script, which was not properly adjusted for the Mangudai play and make them retreat to the castle, instead to TC.
Added a hard limit for camps for now, to prevent spamming those in late game.
Mainly fixed something in the ranged-micro script, which was not properly adjusted for the Mangudai play and make them retreat to the castle, instead to TC.
Added a hard limit for camps for now, to prevent spamming those in late game.
- Attachments
-
- MangudAI-all-in_0.2d.zip
- (25.88 KiB) Downloaded 321 times
Last edited by wattle on Tue Aug 29, 2023 2:58 pm, edited 1 time in total.
MangudAI-all-in (wip, to be continued, when I retire from work )
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
-
- Forumer
- Posts: 98
- Joined: Tue May 03, 2022 2:38 am
Re: MangudAI-all-in
Hi!
So I have to admit when I first saw the name of this AI I read Mangudai but my brain then interpreted that as Mangonel so I imagined an AI that spammed mangonels causing carnage across the map!
I finally got around to testing it and that micro Those mangudai raids are so satisfying to watch and of late I’ve been really surprised at how much you can do with 50 villagers.
It’s vulnerable to early attack but when it gets going it’s a treat to spectate.
One thing I did notice which I hope is a real quick fix for you is to do with mining camps. In one of the games I tested (vs Bambi) MangudAI’s stone mine got destroyed and it never built another one for the rest of the game so it never gathered enough stone to build a castle. I was wondering if you had a rule that only builds its first mining camp if the current age is equal to feudal or something?
I’m loving this AI already and am excited to see it evolve, thanks for putting the work in on making a really fun AI
So I have to admit when I first saw the name of this AI I read Mangudai but my brain then interpreted that as Mangonel so I imagined an AI that spammed mangonels causing carnage across the map!
I finally got around to testing it and that micro Those mangudai raids are so satisfying to watch and of late I’ve been really surprised at how much you can do with 50 villagers.
It’s vulnerable to early attack but when it gets going it’s a treat to spectate.
One thing I did notice which I hope is a real quick fix for you is to do with mining camps. In one of the games I tested (vs Bambi) MangudAI’s stone mine got destroyed and it never built another one for the rest of the game so it never gathered enough stone to build a castle. I was wondering if you had a rule that only builds its first mining camp if the current age is equal to feudal or something?
I’m loving this AI already and am excited to see it evolve, thanks for putting the work in on making a really fun AI
- wattle
- Swami
- Posts: 212
- Joined: Fri Aug 15, 2014 1:06 pm
- Location: Germany
Re: MangudAI-all-in
Hi Bandit, thank you for your reply. Yes I'm really happy to use FireBall's RangedMicro snippet *). He did a great job. At some point I hope to have the Mangudais also retreat from Castles, since that is not in the snippet yet and does leave it open to potentially significant losses to castles.Bandit1990 wrote: ↑Thu Aug 18, 2022 9:13 amI finally got around to testing it and that micro Those mangudai raids are so satisfying to watch and of late I’ve been really surprised at how much you can do with 50 villagers.
It’s vulnerable to early attack but when it gets going it’s a treat to spectate.
One thing I did notice which I hope is a real quick fix for you is to do with mining camps. In one of the games I tested (vs Bambi) MangudAI’s stone mine got destroyed and it never built another one for the rest of the game so it never gathered enough stone to build a castle. I was wondering if you had a rule that only builds its first mining camp if the current age is equal to feudal or something?
I also love his sheep claim snippet, to make the scout run to visible sheep instead of passing by like an idiot
I'm lacking a lot of knowledge and thus this AI is pretty limited in many aspects, despite it being already limited by intention, since it's goal is only to play this strategy with mongols.
Regarding the stonemining camp, this is the code.
Code: Select all
(defrule
(resource-found stone)
(current-age >= feudal-age)
(building-type-count lumber-camp >= 1)
(building-type-count mill >= 1)
(building-type-count-total blacksmith >= 1)
(building-type-count-total market >= 1)
(building-type-count-total mining-camp < 10)
(dropsite-min-distance stone > 3)
(can-build mining-camp)
=>
(build mining-camp)
)
On the other hand you said it had build it already, so I'm not sure.
Regarding the townsize I want it to have a compact base. I've been looking into up-build and related stuff, but are not there yet and couldn't find too much time lately. Also I would rate me a rather slow learner.
Looking forward to the next version of Bright Spark , as well as to some more free time when my colleagues return from holiday
*) FireBall's Script Snippets: viewtopic.php?f=8&t=4174
MangudAI-all-in (wip, to be continued, when I retire from work )
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
- Leif Ericson
- Waheguru
- Posts: 1434
- Joined: Wed Dec 09, 2009 8:15 pm
- Location: United States
Re: MangudAI-all-in
Regarding mining camp placement, dropsites actually use sn-mining-camp-max-distance, sn-lumber-camp-max-distance, and sn-mill-max-distance SNs to set the max distance the dropsites will be placed from the starting town center, rather than the sn-maximum-town-size SN that is used for most other buildings. It might be worth looking into your settings for these SNs.
- wattle
- Swami
- Posts: 212
- Joined: Fri Aug 15, 2014 1:06 pm
- Location: Germany
Re: MangudAI-all-in
Not sure if I understood you completely, or you me, I would say I'm generally aware of dropsite-max-distance SN. What I mentioned was, that the townsize might be in some cases to small to place the market or blacksmith and since both are a condition for the miningcamp, that rule might never fire.Leif Ericson wrote: ↑Sat Aug 20, 2022 8:52 amRegarding mining camp placement, dropsites actually use sn-mining-camp-max-distance, sn-lumber-camp-max-distance, and sn-mill-max-distance SNs to set the max distance the dropsites will be placed from the starting town center, rather than the sn-maximum-town-size SN that is used for most other buildings. It might be worth looking into your settings for these SNs.
MangudAI-all-in (wip, to be continued, when I retire from work )
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.
Btw, thank you s64 for your effort. Was a pleasure to cross your way. Have a good time.