DUC Tutorial 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
User avatar
Leif Ericson
Waheguru
Posts: 1423
Joined: Wed Dec 09, 2009 8:15 pm
Location: United States

DUC Tutorial AI

Post by Leif Ericson »

This very short script is intended to be a demo of how to use DUC. It orders all of the AI's military soldiers to attack the nearest building if it has at least 7 military population. Essentially, it replicates TSA, though it has the benefit of using formations. I created it for my DUC guide (still in progress, lol), and I figured it might be helpful to upload it here. It's heavily annotated so that someone can understand what each line does.

Note that this script only includes the code to launch attacks, so you'll need to give the AI at least 7 military units and explore enemy buildings before the attack code will execute. I've included a demo scenario where you can watch the code in action.

If you are new to DUC, I suggest reading the script alongside my DUC guide (again, still in progress): https://airef.github.io/duc/articles/le ... intro.html

Whenever you come across a command that you don't recognize, I recommend looking up the command in the AI ref: https://airef.github.io/commands/commands-index.html. It's important to understand what each step is doing, because forgetting a step in your DUC code can mess up your AI's behavior if you aren't careful.

This demo doesn't cover everything that is possible with DUC, such as using control groups, but it should be a good start.

Installation Instructions:
  • Put the .ai and .per files in your AI folder.
  • Put one of the scenario files in your Scenario folder. The .scx file is compatible with all game versions, while the .aoe2scenario file is DE-compatible
Attachments
DUC Demo.zip
DUC Demo AI and scenario files.
(60.32 KiB) Downloaded 338 times

User avatar
Promiskuitiv
Waheguru
Posts: 1364
Joined: Thu Nov 10, 2011 1:07 pm

Re: DUC Tutorial AI

Post by Promiskuitiv »

That's a cool idea Leif, thank you for going through with this and uploading it for the community. :)

User avatar
offwo
Guru
Posts: 541
Joined: Mon Feb 21, 2011 9:31 am

Re: DUC Tutorial AI

Post by offwo »

This is great, thank you!
those hackers are just idiots, i spit on them :lol: - Mabuse

nikolayber3
Forumer
Posts: 3
Joined: Tue Jul 27, 2021 8:33 am

Re: DUC Tutorial AI

Post by nikolayber3 »

Hello, Leif! Any chance we will see the implementation of AI using formations to move and attack in your AI scripts any time soon? (or maybe not so soon :D )

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

Re: DUC Tutorial AI

Post by Leif Ericson »

It's definitely in my plans, even some simple micro like the code in this tutorial might be an improvement over The General's TSA. My focus right now is on macro, but I've been brainstorming plans on how to add formations to it.

nikolayber3
Forumer
Posts: 3
Joined: Tue Jul 27, 2021 8:33 am

Re: DUC Tutorial AI

Post by nikolayber3 »

Yeah, I think making formations usable by the AI will get in on the new level of human-like playing! Good luck, very looking forward to it!

User avatar
jdstankosky
Guru
Posts: 911
Joined: Thu Nov 25, 2010 12:30 pm
Location: Florida, USA
Contact:

Re: DUC Tutorial AI

Post by jdstankosky »

:ph34r: studying for definitely-not-nefarious reasons :ph34r:
Do not try to script a counter for everything. That is reactionary, and always slower than taking the initiative in battle. Decide from the start what you are going to do, and do not waiver from it. Own it.

Post Reply