Chameleon AI, My first AI

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.
Post Reply
scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Chameleon AI, My first AI

Post by scripter64 »

Hi! This is my first AI :)

Current Version (date-time)
Chameleon 20190105-202302

Introduction
Chameleon is a counter AI designed for extensibility and flexibility. It is capable of selecting from a theoretically infinite number of strategies by parsing external strategy scripts. Some strategies will inevitably be weaker, but you never know what you'll get when it changes its colors! This AI is far from being a good tournament AI, but I like to watch it play against other AIs. It chats a lot, so you can see what it's up to. It can cooperate in team games and respond to taunts and things, and can defeat several regular computer AIs on hard. Winning against proper AIs, like those found on this site, is a different story though :lol:

Game Settings
Civilization: Any (see strategies below)
Game Type: Any (prefers Random Map)
Map Type: Any (prefers land maps; will fail spectacularly on Migration-style maps)
Map Size: Any
Difficulty: Hard
Other Players: Any (including teams)
Resources: Standard (Low)
Population: 200-250
Reveal Map: Standard
Starting Age: Any (prefers Dark Age)
Victory: Any
Teams Together: Either
Teams Locked: Either
All Techs: Either
UserPatch: Required

Unique Strategies
Aztecs: 7
- dml.fi.aztec-death-rush
- rml.fc.archon-eagle-warrior-rush
- rml.fc.aztec-jaguar-boom
- rml.fc.offwo-swordsman-rush
- rml.fc.peaceful-conversion
- rml.ff.aztec-infantry-rush
- wrl.fi.aztec-wonder-rush
Britons: 5
- dml.fi.briton-death-rush
- rml.fc.briton-archery-boom
- rml.ff.guarded-briton-crush
- rml.ff.unfairesteels-lightning-archer-flush
- wrl.fi.briton-wonder-rush
Byzantines: 6
- dml.fi.byzantine-death-rush
- rml.fc.byzantine-counter-strike
- rml.fc.marathon-defensive-feint
- rml.ff.byzantine-neutrality-accord
- rml.ff.lazarus-trash-flush
- wrl.fi.byzantine-wonder-rush
Celts: 6
- dml.fi.celtic-death-rush
- rml.fc.celtic-scorpion-strike
- rml.fc.offwo-dark-attack
- rml.fc.offwo-woad-raid
- rml.ff.capricious-celtic-rush
- wrl.fi.celtic-wonder-rush
Chinese: 8
- dml.fi.chinese-death-rush
- rcl.fc.marathon-twin-towers
- rml.fc.chinese-archery-boom
- rml.fc.chinese-rocket-assault
- rml.fc.marathon-archery-attack
- rml.fc.offwo-eskirm-rush
- rml.fc.unfairesteels-knight-rush
- wrl.fi.chinese-wonder-rush
Franks: 5
- dml.fi.frankish-death-rush
- rml.fc.archon-eta-attack
- rml.fc.frankish-paladin-invasion
- rml.ff.shooting-axe-attack
- wrl.fi.frankish-wonder-rush
Goths: 6
- dml.fi.gothic-death-rush
- rml.ff.gothic-infantry-archer-boom-rush-by-lazarus
- rml.ff.gothic-infantry-boom
- rml.ff.gothic-psycho-invasion
- trl.ff.gothic-infantry-blast
- wrl.fi.gothic-wonder-rush
Huns: 5
- dml.fi.hun-death-rush
- rml.fc.hun-cavalry-boom
- rml.fc.hun-hit-and-run
- rml.ff.hun-cavalry-rush
- wrl.fi.hun-wonder-rush
Japanese: 7
- dml.fi.japanese-death-rush
- rml.fc.japanese-silver-steel
- rml.fc.karuto-kyoudan
- rml.fc.offwo-dark-defence
- rml.fc.petersen-push
- rml.ff.swift-samurai-strike
- wrl.fi.japanese-wonder-rush
Koreans: 4
- dml.fi.korean-death-rush
- rml.fc.korean-rolling-conquest
- rml.fc.korean-tower-fortress
- wrl.fi.korean-wonder-rush
Mayans: 7
- dml.fi.mayan-death-rush
- rml.fc.elite-mayan-eagle-wing
- rml.fc.plumed-hurricane
- rml.fc.strongbow-suicide-xbow-rush-by-marathon
- rml.ff.crusade-2-1-mayans-by-campeador
- rml.ff.mayan-archer-apocalypse-by-offwo200
- wrl.fi.mayan-wonder-rush
Mongols: 5
- dml.fi.mongol-death-rush
- rml.fc.murray-noctua
- rml.fc.murray-rage
- rml.fc.promis-cavalry-onslaught
- wrl.fi.mongol-wonder-rush
Persians: 5
- dml.fi.persian-death-rush
- rml.fc.persian-cavalry-bombardment
- rml.fc.persian-knight-feint
- rml.ff.persian-paladin-rush
- wrl.fi.persian-wonder-rush
Saracens: 5
- dml.fi.saracen-death-rush
- rml.fc.saracen-arrow-storm
- rml.fc.saracen-desert-excursion
- rml.fc.saracen-zealotry
- wrl.fi.saracen-wonder-rush
Spanish: 5
- dml.fi.spanish-death-rush
- rml.fc.conquistador-crush
- rml.fc.spanish-inquisition
- rml.ff.spanish-annexation
- wrl.fi.spanish-wonder-rush
Teutons: 7
- dml.fi.teutonic-death-rush
- rml.fc.archon-knight-rush
- rml.fc.teutonic-knight-invasion
- rml.ff.teutonic-cavalry-boom
- rml.ff.teutonic-militiaman-rush-by-offwo200
- rml.ff.teutonic-rush-by-lazarus
- wrl.fi.teutonic-wonder-rush
Turks: 5
- dml.fi.turkish-death-rush
- rml.fc.turkish-cannonball
- rml.ff.light-artillery-invasion
- rml.fi.cakes-bt-boom-strategy
- wrl.fi.turkish-wonder-rush
Vikings: 6
- dml.fi.viking-death-rush
- rml.fc.berserker-invasion
- rml.fc.marathon-infantry-attack
- rml.ff.offwo-feudal-attack
- rml.ff.wayward-viking-flood
- wrl.fi.viking-wonder-rush
Shared: 2
- variable
- default

Random Statistics
Rules: 1771
Consts: 403589
Strats: 106

SetupAI Script Generator
This application, which is included with the AI, generates strategy scripts for Chameleon. It is simply an accessory; if you have no interest in creating new strategies or changing existing ones, there's no need to run it. A guide, which is incomplete at the moment, is included with the application. SetupAI requires at least Windows XP and your user must have write permissions to the AI and Data folders.

Final Notes
I'd like to humbly thank ARFFI04, IS_NormanDuck, thegreatkazein, Berrys66, MuRRay Jnr, ER, Leif Ericson, marathon, THE RULER, Archon, Suriel, Campeador, offwo200, UnfairestEel, Promi, and all others for helping me with my script. I'd also like to honor the aiscripters.com site, the AllianceThundaEmpire script, the IS_Machine script, the Kosmos script, and the ARFFI De'gel script. These scripts inspired me and helped me to make my own.

Here is Chameleon! Please try it and let me know what you think!
Attachments
Chameleon.20190105-202302.zip
Chameleon 20190105-202302 (latest, ladder)
(1.99 MiB) Downloaded 828 times
Chameleon.20150224-111920.rar
Chameleon 20150224-111920
(584.97 KiB) Downloaded 707 times
Last edited by scripter64 on Sat Jan 05, 2019 8:25 pm, edited 446 times in total.

User avatar
thegreatkazein
Waheguru
Posts: 2167
Joined: Mon Jan 16, 2006 4:07 pm
Location: noitacoL
Contact:

Re: Chameleon AI, My first AI

Post by thegreatkazein »

Not bad for a first AI script. Though, if I read right <.<, you forgot to state the intended opponent for the AI. The two choices are AI or Humans.

If the intended opponent were AIs, then I suggest you get to castle quicker and defend against castle rushes better. Also, most of the scripts here use military-population comparisons as a constant factor when deciding to attack. If you only have 3 military compared to their 15...Your town will be run over in a matter of seconds. (unless of course your horded resources and have 10 or more buildings that can train offensive units)

If the intended opponent were humans, then I suggest you defend against flushes better. But, all in all, your AI needs to be more competitive. (faster age times, more or stronger military units, more research done, and a more effecient economy)

If you're looking to counter whatever you happen to find on the battlefield, I suggest you find one or two unit combinations that work great with your civ and stick with them.

scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Re: Chameleon AI, My first AI

Post by scripter64 »

Thank you for testing my AI thegreatkazein! :)

I didn't really have a target in mind when I made it, but I've been testing it against the regular ensemble studios AI, AllianceThundaEmpire, IS_Machine, and Kosmos, so I suppose it's targeted against AIs, but I also put a lot of chat in there so it can interact with humans. Honestly, I just like watching it play for me :lol:

I appreciate your advice, and am looking into making the AI more aggressive. I have taken your suggestion of using military-population into account when planning attacks :)

I hope to have an updated version soon! I'm currently watching it play an over 3 hour game, Arabia 1 vs 1 vs 1 against IS_Machine and AllianceThundaEmpire :lol:
Image

scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Re: Chameleon AI, My first AI

Post by scripter64 »

I've updated my AI a lot in the last few days, following some of the advice from IS_NormanDuck, ARFFI04, thegreatkazein, and others. There are many, major changes to its speed, how it researches, and other things. The SetupAI script generator has also been expanded, so very fine micromanagement of research, building, and unit creation can be done. One of the more important changes is that now you can have per-technology cross-category dependencies, so man-at-arms, for example, can be set to wait until double-bit-axe has started research. Before, a technology could not be set to wait for another if the other one is in a different category (arbalest and cavalier, for example, are in 2 different categories, archery and cavalry).

You can also set up 2 phases per unit, each with a required units setting and a maximum units setting. This can allow for strategies that change considerably mid-game. For example, starting early in the feudal age, you can make it create a lot of archers and men-at-arms, but after the middle of the castle age, you can have it stop creating them, while increasing the number of knights and cavalry archers. Then, in imperial, the cavalry archers may be reduced to a lower number, in order to boom hand cannoneers. Counter units are separate, so even if you phase out skirmisher-line units, if the AI sees archers, it will create however many you set for the skirmisher-line's counter response levels (low, medium, high). I hope to try to use these new features more thoughtfully after some more testing.

As far as the AI itself, I've adjusted things so that it can advance to the feudal age in a very short time, often starting research at around 9:50 to 10:20. It also makes a military much earlier than before, and maintains a good number of units. It now takes into consideration the military population of the enemy when it chooses to attack. I've been testing it mostly on Tiny Arabia 1 vs 1, as recommended by IS_NormanDuck. I hope the AI is a little bit better than before, at least :lol:

Remember that the SetupAI application requires at least the .NET Framework 2.0 to be installed, but you don't have to use SetupAI at all to try the AI. It's only if you want to alter one of the AI's strategies or make a new strategy of your own.

If you have time, please try it ^_^
Last edited by scripter64 on Fri Jul 31, 2009 10:49 am, edited 2 times in total.

scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Re: Chameleon AI, My first AI

Post by scripter64 »

Random Attachment Post :lol:
Attachments
BoarTest.rar
Boar Test AI + Scenario
(2.29 KiB) Downloaded 393 times
ally-test.rar
Ally Test AI + Scenario
(33.29 KiB) Downloaded 379 times
Last edited by scripter64 on Wed Mar 16, 2011 1:42 pm, edited 10 times in total.

User avatar
IS_NormanDuck
Waheguru
Posts: 2054
Joined: Thu Jan 18, 2007 8:10 am
Location: Italy

Re: Chameleon AI, My first AI

Post by IS_NormanDuck »

Nice improvements ^^
a couple of notes:
- research ri-loom in dark age
- upgrading your AI, it is easy you will note that japanese would be nomore your best civ on land maps. This is normal since they need a manage that it is difficult an AI is capable to do. If you like infantery, check goths and vikings, else also huns, aztecs (they need some unique strategies including for example EWs or monks or their unique units) mayans (if you flood with archers).
- one of the improvements may be a better attack groups management. If you only set attack groups, it is easy that your armi is destroyed simply passing near enemy troops. One of the methods to improve battle behaviour is to reset your attack groups putting them to 0 at one cycle and then again to the standard values the next cycle. This cause attack groups retarget and then your army starts to fight near enemies instead of trying to pass through. You can retarget using a timer (20 - 30 seconds) or checking some other conditions
- don't attack a castled enemy when you are in feudal age unless you have a wide army advantage

scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Re: Chameleon AI, My first AI

Post by scripter64 »

Thanks IS_NormanDuck!
research ri-loom in dark age
This is a good idea, now that I've been testing on the tiny arabia recently. On the larger maps, normal and above, the wolves rarely cause a problem until I would get loom near castle age, but on the tiny map, I've already lost far too many lumberjacks to wolves early :lol:
upgrading your AI
You're right; I'm going to work soon on creating more specific strategies than just a single infantry strategy, archery strategy, etc. like I have now.
one of the improvements may be a better attack groups management
When my AI was playing against IS_Machine yesterday, this problem, with my units just walking silently past a row of firing crossbowmen, happened a lot. I already have it so that I think every 30-45 seconds, the attack-groups are set to 0, and then set back afterward, but that might be too long and, in order to reset the attack groups right now, I put a condition that my AI still has the military population advantage. I've seen that this sometimes causes it to send attack groups, lose military advantage, set attack groups to 0 on the timer, then never reset it back until it's too late :lol:
don't attack a castled enemy when you are in feudal age unless you have a wide army advantage
This is good advice. Right now, it's only checking for military populations to be nearly equal or greater, when choosing to attack. I should probably make it greater or much greater instead, especially like you said, in feudal against castle.

Thank you again for all of your help :)

User avatar
ARFFI04
Guru
Posts: 597
Joined: Sun Jul 26, 2009 6:33 pm
Location: Japan

gg scripter64

Post by ARFFI04 »

>scripter64

gg. Usally, scripts has errors and will be cleaned off at the end after a long game.
Still, your script did not have a vital error till 3 hours when it resigned.
Nice scripting.

Some comments.
I tested Hun, Aztec, Goth for your AI.
Seems Goth >> Hun >= Aztec for potential of your AI. (arabia)

Goth
Good. Milita/others-defence is quite expencive yet not easy to take over.
Still, I think you should train skimers faster to avoid fast crow-bow crush (one of the strong strategy for AI).
When you detect crow-bow crush, you are usally attacked. (fast-ones come in 20 min)

Aztec
Well balanced. Yet a little bit week in economy.
This may due to that you collect relics a little slow.
Aztec has relic bonus, meaning monks are gold-miners as well as long-range archers.
If you stay long in feudal, spread your military-units to avoid enemy-colecting relics near your town.

Hun
I do not know well, so no comments. :lol:

Thanks.
ARFFI: A scripter from japan : Main script ARFFI-De'gel

scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Re: Chameleon AI, My first AI

Post by scripter64 »

Thank you for your comments ARFFI :)
Seems Goth >> Hun >= Aztec for potential of your AI.
I only got Goth 1 time while using Random civilization in testing, so I never had a chance to see what it could do with them. This is good to know!
Still, I think you should train skimers faster to avoid fast crow-bow crush (one of the strong strategy for AI).
This is very true. When I started scripting, IS_Machine would do that to me a lot :lol: I remember my AI getting rid of all of the enemy pikemen, but then, since the crossbows aren't directly next the town center, the villagers would come out and the crossbows would just shoot them all :( lol
I'll try to get more skirmishers earlier.
This may due to that you collect relics a little slow.
Yes, in that game that I lost over 400 units to conversions against ARFFI De'gel, your AI had collected all of the relics before I got to the castle age.
Aztec has relic bonus, meaning monks are gold-miners as well as long-range archers.
I never thought about it like that, and with redemption, they're also like super quick town builders lol
If you stay long in feudal, spread your military-units to avoid enemy-colecting relics near your town.
That's a good idea, I'll try the task-ungrouped-soldiers to move them around.

Thank you ^_^

scripter64
Waheguru
Posts: 5891
Joined: Fri Jan 16, 2009 8:36 pm

Re: Chameleon AI, My first AI

Post by scripter64 »

I've updated it to create more skirmishers earlier, along with more consistent villager and military creation. In other words, hopefully it won't idle in castle age, trying to advance to imperial, with only 70 villagers anymore :lol: I've also changed it so that there are 3 random personalities; this capability was already there, but I never decided how to use it. The personalities are normal, defensive, and aggressive. Depending on the personality, it may attack earlier, later, scout differently, etc. If it falls behind the enemy in age, it may now decide to immediately begin preparing to advance, in order to catch up. This may help with the relics problem, too.

With these changes, it was finally able to win a random-map game against IS_Machine in about 1:05, all available research complete, Japanese vs Mongols, with the default.per strategy and defensive personality. It was a large map though, so it's not as important :lol: On a tiny map, I'm sure IS_Machine will still destroy it lol

I also optimized the AI a bit, removed about 50 rules by merging them with others, and enabled the building of wonders. I created a "fast" imperial strategy for it (wonder.per), so it can play and attempt to win a wonder race. In testing, it won the wonder race in 0:36:02, but I don't think the other AIs were trying to build a wonder. It could be a lot faster, I think; I only spent 10 minutes in SetupAI to make the strategy. Here's a picture of the age advancement times and the timeline (notice no military created):
Image Image

I think the core of the AI has improved, thanks to the advice from all of you, but the strategies it uses are still kind of poor and generic. I'm going to start adding more specific strategies soon, like the "KLEW."

I updated the first post, so it's accurate about the game settings. Please try it!
Last edited by scripter64 on Sun Aug 02, 2009 10:16 pm, edited 1 time in total.

Post Reply