AI Builder

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
jan1302
Forumer
Posts: 3
Joined: Mon Dec 02, 2013 2:52 am

AI Builder

Post by jan1302 »

Hey guys,

I don't know if you already know me but you might have seen me on aok heaven and such. As a dev for AoF I was asked to make several scenarios and ais for the game but after making several of them I got tired of all the repetitive work and made a small js script to generate the AI's for me. It's far from perfect as my ai knowledge is rather limited. Still for my scenarios they seem to do the job but I was wondering if there would be people here who would be willing to help me improve the script and make it more efficient. Of course you'll be credited for your contributions.
The AI builder can of course be used for more than just the official campaigns. I hope it can help everyone who have no knowledge of AI scripting but like to make their own custom scenarios.

You can find a preview of the AI builder here: http://forgottenempires.net/aibuilder/
(You might need to press build twice)

User avatar
Finaldeath
Guru
Posts: 961
Joined: Tue Mar 27, 2012 6:02 am

Re: AI Builder

Post by Finaldeath »

Neato! I'm totally swamped so can't work my own AI but I can advise a bit on what you've got here.

I can guess the various settings you're using, but some further explanation for newbies might be good. In addition if you use the HTML <abbr title="sn-xx-xx-xx"></abbr> it'll help people debug things/match them up.

Immobile

Possible description: "If activated this sets all units to not wander around the map, react to buildings or units under attack, build anything or gather resources."

Might need more tuning for the additional settings you have. Maybe also add a timer option? (game-time > xxx) essentially - this means the AI halts until the game time matches this. The default campaigns use this a lot (usually combined with a signal - ie; if the player suddenly gets far ahead the "boss AI" activates earlier then the usual time).

Strategic Numbers

"Amount" should be "percent" for most of the left column . I'm not sure what SNs match up for the first 3 - if it is all the villager ones, it in fact might be wrong to reference it as military? Or is that the amount of military units to be used as scouts? Also with Javascript you could set limits to each value adding up to a total of 100.

Task ungrouped soldiers - an advanced description would be "All military units try and spread out until they do not cover each others line of sight. For high line of sight units such as archers this means they will potentially spread to cover the entire map. Be careful using this.£

Amount of Traders - I presume this is actually Trade Cart units? You can also build trade cogs remember :)

Buildings

Amount of Mills - warn if set to more than 1! It will only build at berries usually, otherwise will just spam them. Also might want to even change the rule to having not found food - remember a mill is needed for farms.

No castles? No towers? :o these are pretty easy.

Forward buildings are also pretty easy, but sometimes nonsensical for an AI in a campaign to build.

Multiple TCs are possible and might be good to be a value for instead of a tickbox.

Notes on code:

Defensive code is a bit...odd in AOE2. These lines essentially do nothing.

Code: Select all

	(set-strategic-number sn-maximum-defend-group-size 30) 
	(set-strategic-number sn-minimum-defend-group-size 10) 
	(set-strategic-number sn-number-defend-groups 3)
;-----Dodging rules-----
- Since the AOE2 difficutly only goes on 3 levels, maybe compact these rules into 3 rather than 5. The 100% on hardest can be moved to hard, and easiest values removed perhaps. Even perhaps have it optional and just set it as a new variable in the section above - it has a big impact on some situations especially with archers and might need to be tuned outside of difficulty.

Other rules look pretty good. I guess mostly copied from original AOE2 campaign AI's from what I can see ;)

Things to potentially add:

Wall building code might be fun and is only a few lines. I can dig out some simple rules maybe (time depending!). Would just need a toggle.

Town Size Attack - ie; not "attack-now lag" are easy to have a toggle/option for, which would improve the difficulty. Just again needs a toggle.
Finaldeath

Writing a set of tutorials - My own AI is super secret development!

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

Re: AI Builder

Post by scripter64 »

Finaldeath! :)

jan1302
Forumer
Posts: 3
Joined: Mon Dec 02, 2013 2:52 am

Re: AI Builder

Post by jan1302 »

Hey FinalDeath,

Thanks for the feedback. I've updated the AI builder a bit since last time but haven't uploaded it to the server yet. I'll probably do so when I got decent beta version. Was even thinking of making it possible so other AI's than the one I made can be used but that's for later.

As for your suggestions, it's certainly a good idea to clear things up more. I'll make sure to do that. I also used the html number input to try to limit the amount of numbers but that isn't supported by all browsers and I didn't give the responsibility to the javascript yet although I planned to.
The AI is a mixture of an AI of HockeySam, one of mine and some of the ES campaign AI's. It definitely can be improved but of course for scenarios you often don't need very complex AI's. I think with your suggestions and the ones of Scripter and II2N I can make something solid enough for its purpose.

Well good luck with your swamps and I hope I can show you the improved version soon ;).

User avatar
KiiNgZoNe
Forumer
Posts: 62
Joined: Fri Mar 02, 2012 8:15 am

Re: AI Builder

Post by KiiNgZoNe »

I tried this out, but with a change. I made an AI out of this to try versing others on RM. The AI that came out from this builder was pretty decent, although I had to tweak it a bit (adjusting dark-age economy, removing escrows and changing its attack style to TSA) and it was pretty much good, basically, but below par since it can't beat either Hispain_Special or Chong Hong Wei. Well, this may do, especially for those who are feeling lazy at the moment to build another AI script from scratch and at least reduce :head hehehe.

jan1302
Forumer
Posts: 3
Joined: Mon Dec 02, 2013 2:52 am

Re: AI Builder

Post by jan1302 »

Hey, sorry haven't checked here in a while. Yeah the AI still needs a lot of improvements although it's main use is just plain scenarios and not RMs. Very few scenarios have their players start in dark age so it's more suited for later ages. I plan to make as many values as possible editable in the end so other AIs can be made for it that are better than the one I created.

User avatar
MrElephant
Swami
Posts: 113
Joined: Sun Dec 20, 2020 6:28 am

Re: AI Builder

Post by MrElephant »

Apologies for responding on an old post. However, everyone should know this tool can still be accessed by wayback machine. Link included below

https://web.archive.org/web/20200328153 ... aibuilder/

You will need to hit the "build" button twice. The "Additional per files" are included attached. They will need to be downloaded for your newly generated ai to work.
Attachments
Extra_AI_Files (1).zip
(4.85 KiB) Downloaded 141 times
Author of Charon, Reactionary, Ahulane, and BlackKnight!

Post Reply