MangudAI-all-in

Upload your latest creations here.
Please note that by posting comments to posts in this forum you forfeit your personal copyright on whatever you post. AI Scripters reserves the right to re-use objective comments in script reviews without requiring the posting author's permission. Credit, where appropriate will be given in such cases.
User avatar
wattle
Swami
Posts: 133
Joined: Fri Aug 15, 2014 1:06 pm
Location: Germany

MangudAI-all-in

Post by wattle »

Hi, I would like to share with you a new 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 :rolleyes:
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. Thank you :rolleyes:
Thanks as well to all other scripters for helping :rolleyes:
* FireBall's Script Snippets: viewtopic.php?f=8&t=4174

I try to somewhat tidy up the code. My knowledge is still quite limited. I've looked a bit into other AI's, but not too much.
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 :lol:


Game version: AoC+UP or AoE2:DE
Civ: Mongols
Map: Tested on Arabia, can somewhat play Arena, doesn't build docks.
Difficulty: Hard (AoC+UP) / Extreme (DE) (has no difficulty scaling)
Teamgames: Not really tested. Does not trade yet. Has no proper focus-player management.
Resources: tested with Standard
Population: 200 (aims for 50 vills for now, 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 Bandit1990 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)

Update 0.2c 03.07.2022
Main difference is FireBalls ranged micro code, with some adjustments by MrElephant (not sure which).

Update 0.2d 24.07.2022
Mainly fixed something in the ranged-micro script, which was not properly adjusted for the Mangudai play.

Update 0.3 05.09.2022
Added FireBalls deer luring/pushing snippet. Very much appreciated.
Use up-build place-control for a compact base.

Update 0.3a 11.09.2022
Mainly some fixes and changes in the hope for the better. Adjusted some stuff for better Arena playability.
Attachments
MangudAI-all-in_0.3a.zip
(38.64 KiB) Downloaded 12 times
MangudAI-all-in_0.1c no-military-micro.zip
(35.6 KiB) Downloaded 9 times
MangudAI-all-in older versions.zip
(103.87 KiB) Downloaded 5 times
Last edited by wattle on Sun Nov 13, 2022 3:57 pm, edited 20 times in total.

TheMaximalBeing
Forumer
Posts: 56
Joined: Fri Jun 02, 2017 11:00 pm
Location: Australia

Re: MangudAI-all-in

Post by TheMaximalBeing »

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:
  • 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.

User avatar
MrElephant
Forumer
Posts: 70
Joined: Sun Dec 20, 2020 6:28 am

Re: MangudAI-all-in

Post by MrElephant »

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.

User avatar
wattle
Swami
Posts: 133
Joined: Fri Aug 15, 2014 1:06 pm
Location: Germany

Re: MangudAI-all-in

Post by wattle »

Thanks for your feedback :rolleyes:
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 :lol:

User avatar
wattle
Swami
Posts: 133
Joined: Fri Aug 15, 2014 1:06 pm
Location: Germany

Re: MangudAI-all-in

Post by wattle »

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 :rolleyes: and also MrElephant.

User avatar
wattle
Swami
Posts: 133
Joined: Fri Aug 15, 2014 1:06 pm
Location: Germany

Re: MangudAI-all-in

Post by wattle »

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.

Bandit1990
Forumer
Posts: 22
Joined: Tue May 03, 2022 2:38 am

Re: MangudAI-all-in

Post by Bandit1990 »

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 :)

User avatar
wattle
Swami
Posts: 133
Joined: Fri Aug 15, 2014 1:06 pm
Location: Germany

Re: MangudAI-all-in

Post by wattle »

Bandit1990 wrote:
Thu Aug 18, 2022 9:13 am
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?
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.
I also love his sheep claim snippet, to make the scout run to visible sheep instead of passing by like an idiot :lol:

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)
)
I could imagine, that it got denied to build the blacksmith or market, or maybe even more likely, it has issues with townsize. If there isn't to much space around it might not fit in the market or blacksmith, therefore not go up to castle and not build a miningcamp.
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 :rolleyes:, as well as to some more free time when my colleagues return from holiday :lol:

*) FireBall's Script Snippets: viewtopic.php?f=8&t=4174

User avatar
Leif Ericson
Waheguru
Posts: 1385
Joined: Wed Dec 09, 2009 8:15 pm
Location: United States

Re: MangudAI-all-in

Post by Leif Ericson »

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.

User avatar
wattle
Swami
Posts: 133
Joined: Fri Aug 15, 2014 1:06 pm
Location: Germany

Re: MangudAI-all-in

Post by wattle »

Leif Ericson wrote:
Sat Aug 20, 2022 8:52 am
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.
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.

Post Reply