Advanced Melee AI

This tool originates from here

Source code now available at: SMUnlimited/AMAI

AMAI is a mod/tool for Warcraft III: Reign of Chaos and The Frozen Throne made to improve the computer AI of the game in many possible ways.

AMAI will make it easier to edit the War3 AI, harder to beat and more fun.

The goal is to make a human like opponent or ally that both react on events and tries to insult you by chat taunts while playing in a more human like way.

  • Personality Profiles: Each AI opponent has a set profile which modifies how it reacts or plays the game. Some can be real chickens and never dare to attack you while others will rush you down.
  • Dynamic Strategies: Constantly monitors the current situation of the game and always try to pick the best suited strategy to counter the enemy forces.
    • The computers will pick from all strategies depending on what kind of units the enemy has, how long the game has been going and what favorite units the current profile has.
  • Enhanced Micromanagement Control
    • To help keep as many units as possible alive by fleeing by town portal, zeppelin or foot.
    • This includes better use of items and healing items.
    • Makes the enemy force suffer as much as possible by focusing fire on the most vulnerable enemy units first if they are in range.
    • Will buy neutral heroes and units.
    • Can occasionally attempt tower rushes and militia/ancient expansions.
  • Enhanced Team Play
    • Coordinates with allies what it will be attacking or will join allies in attacking a target.
    • Human players have access to the Commander, letting you give commands.
    • Asks for aid if running out resources.
  • Surrenders : Based on profiles some AI's will give up when it detects its losing, while others will fight to the death.
  • Chat Support
    • AMAI will taunt enemy players, and share its build strategy with team players.
    • Includes Support for 10 different languages.
  • Easy to use Strategy and Profile editor.
    • Supports an unlimited amount of your own profiles.
    • Supports an unlimited amount of your own strategies.
    • Auto Building feature for example: a AMAI computer only needs to know that it shall build a hero and 15 footmen. It will automatically build all needed buildings, workers and farms in order to get this as fast as possible.


Requirements
AMAI VersionWar3 SupportComments
2.5.4Min 1.24+ - Max 1.28Classic edition from 2008
2.6.2Min 1.24+Some support for 1.30+ features
3.0Min 1.32+Full Support for the 1.32+
3.1Min 1.32.10+
3.2Min 1.33


  • Avoid v1.29 of Warcraft 3 as it breaks various things and prevents AMAI from chatting. This is just an issue with this version and you can downgrade or upgrade.

How to play
AMAI release comes with the standard AI scripts pre-built for you.

It is suggested to create a subfolder in your "maps" folder like C:\Users\<username>\Documents\Warcraft III\Maps\AMAI and copy the maps you intend to use AMAI with there.
You can opt to download a map pack containing a selection with AMAI preinstalled on or you can install onto your own maps.
For Warcraft 1.30 onwards you need to use Casc Storages - Main page to extract a copy of official maps.

On windows make sure the maps to install on are not in a protected UAC location. This may mean you have to copy into your Maps folder afterwards.

AMAI Installer
  • The installer has to be downloaded separately as its much larger compared to the AI package.
  • Unzip the contents of the installer to a folder of your choice.
  • After unzip, download the newest version of AMAI and unzip it in the folder {your-amai-installer}/resources/AMAI
    • Minimum needed is the Scripts folder and MPQEditor.exe placed in the AMAI directory.
  • Double-click amai-electron-manager.exe to open the installer.
  • You can install to a single map or a whole directory.
229876-72e655a9dd9f2e63484ded955b08e80c.jpg


Command Line Install
  • From a windows commandline or powershell type InstallTFTToMap.bat "C:\mymap.w3m" and press enter to install AMAI to maps

  • Alternatively for complex installs if you have perl installed from a commandline you can type perl InstallTFTtoDir.pl "C:\Documents\Warcraft III\Maps\AMAI" and press enter to install AMAI to all maps in a directory and subdirectories.
  • After installing AMAI on your map just start Warcraft3: RoC or TFT and play the map against and/or with computers to make use of AMAI.
Notes
  • Advanced Melee AI is made to be used on 'melee' maps only so please don't try to use it on custom maps (e.g towerdefence), it will make no difference on such maps.
  • The old AMAI.exe installer from classic AMAI has been moved into the Templates folder and will not work unless you run MPQEditor htsize "C:\mymap.w3m" 64 from a commandline first.
  • You may need to run as an administrator if you have issues with maps not displaying any teams.

V2.54
The original 10 year old version that supports 1.24 - 1.29 warcraft.
The download for 2.54 is the developer edition intended for developers to use.

For everyday use the player edition is alternatively available to download here


NOTE: The old 2.5.4 zip is now password protected because Google Chrome is flagging it as malicious software. The password is amai. Note some of the dlls are flagged as virus generic false positives in 2020 due to there age, but they are false positives


Keywords:
Artificial Intelligence, AI
Previews
Contents

AMAI 3.2.2 (Binary)

AMAI Installer Win x64 (Binary)

AMAI Map Pack 3.2.2 (Binary)

AMAI 2.6.2 (Binary)

AMAI 2.6.1 (Binary)

AMAI 3.1.1 (Binary)

Advanced Melee AI 2.54 (Binary)

Reviews
AMAI is very, very good. Much better than any Blizzard AI. I love it. ==Update - 25/08/12== It has recently come to our attention that some antivirus softwares like Norton detect a virus in this, however, we can assure you that it is a false...
Level 4
Joined
Aug 28, 2022
Messages
32
Quoted just to confirm that this works for me. To anyone having problems, try the following:
-The Path where you have saved/unzipped the AMAI files (including the InstallTFTToMap.bat) should not contain any blanks.
-The map on which you want to install AMAI should not contain any already existing triggers, scripts etc (for example, w3champions maps may cause issues because of this). Just take a plain melee map.
To install in a path with spaces, the segment containing the space must be double-quoted. Something like:

InstallTFTToMap.bat "C:\Users\paulo\Documents\Warcraft III"\Maps\AMAI_test

perl InstallTFTtoDir.pl "C:\Users\paulo\Documents\Warcraft III"\Maps\AMAI_test
 
Level 3
Joined
Jan 5, 2022
Messages
25
Here are 300 maps. Both AMAI vs AMAI and AMAI vs Blizz A.I. Simply put it in your documents folder. It includes every map that comes automatically with Reforged and almost every map from Liquipedia's "Other competitive maps". Reminder that several maps are missing because I either could not find them or found them with w3c triggers (these break AMAI last time I tested. Note that Synergy, Friends and maybe Vanguard Point will not work because the spawns are too close. You can edit them within like 10-15 mins through the world editor

Google Drive links:
AMAI vs AMAI: AMAI vs AMAI – Google Диск
AMAI vs Blizz: AMAI vs Blizz A.I – Google Диск
I forgot to copy the original maps and hvave them somewhere without AMAI at all so you either search the map you want or put the right teams if you want Blizz vs Blizz A.I. (like let's say that you want to play 2v2 with Blizz A.I. on Feathervile, put it team 2 vs team 4
 
Last edited:
Level 6
Joined
Sep 1, 2018
Messages
51
Good afternoon. I was writing AI for my map with non-standard races. I did it in a standard AI editor, getting a .wai file. I don't always like the way AI works, I would like a faster and more flexible solution, similar to how it is with you. I understand correctly, this can be achieved by editing the ai file, and it is completely written in the jass language. Thank you in advance for your answer!
 
Level 4
Joined
Aug 28, 2022
Messages
32
Good afternoon. I was writing AI for my map with non-standard races. I did it in a standard AI editor, getting a .wai file. I don't always like the way AI works, I would like a faster and more flexible solution, similar to how it is with you. I understand correctly, this can be achieved by editing the ai file, and it is completely written in the jass language. Thank you in advance for your answer!
I believe that AMAI is not yet ready for custom races or any other standard race (not orc, human, elf, or undead) in the game. But I'm not the best person to talk about it, because I'm just starting the project and only with the installation process. I'm looking to do something in the Deep Learning sense, but it's still going to be a long time coming out. Maybe this kind of solution fits what you want.
 
Level 6
Joined
May 26, 2004
Messages
37
Good afternoon. I was writing AI for my map with non-standard races. I did it in a standard AI editor, getting a .wai file. I don't always like the way AI works, I would like a faster and more flexible solution, similar to how it is with you. I understand correctly, this can be achieved by editing the ai file, and it is completely written in the jass language. Thank you in advance for your answer!
You can by heavily editing AMAI and creating a new version pack with different races in it (how ROC and TFT are separate folders). Its been done in the past with various old long forgotten projects. And yes AMAI makes things easier in terms of writing the actual AI scripts with the strategy editor. But you have to setup all the AMAI csv and txt files with the new units and dependencies so that initial setup takes longer (assuming no bugs to fix with moving away from standard races)
 
Level 6
Joined
May 26, 2004
Messages
37
3.2.2 Released

Added​

  • New AMAI installer (powered by Electron) for a user friendly way to install to maps or directories (Thanks paulo101977)
  • Commander is no longer installed by default if you use the bat scripts. You must use the new `InstallCommanderToMap.bat' file.
  • Added a script DisableCommander.bat if you want to disable the commander post install.
  • Counter strengths are now translated.

Changed​

  • The install AMAI to a directory perl script supports passing an additional argument "false" to not install the commander.

Removed​

  • (DevTools) Stopped AMAI.mpq being generated, it is an old leftover from the old ways to run AMAI.
  • (DevTools) Removed ancient AddToMPQ.exe and use MPQEditor for all operations under the hood.

Fixed​

  • Re-installing AMAI should no longer increase map file size. Also maps file size after install appear to be about 40% smaller.
  • Fixed some memory leaks mainly with the commander, this was more of an issue now that dialogs are being regenerated.
  • Fixed Norwegian Commander caused by translating text to empty strings. Such behavior so should no longer break commander logic.
  • Fixed an issue where air creep strength was assumed to be 0 which could cause AI to attack air creeps without a way to attack them.
  • Fixed an issue where invisible pathing units were not moving on very large maps with lots of mines and neutral buildings and players.
  • Reduced lag impact that invisible pathing units have on game start for large amounts of players.
  • Fixed an issue where an ai could surrender and give all there buildings to Player 13.
  • Invalid strategy commander message is now translated.
 
Level 6
Joined
Sep 1, 2018
Messages
51
Good afternoon. Not really into the subject, but I think you, as a jass-ai pro, can help me. I made an AI for my upgraded alliance. At first I did it in the AI editor, then I decided to try writing through jass and ran into two problems.

1) the function for creating a new thread, namely "call StartThread(function UpdateForgeAssignment)" does not work, more precisely, it does not do anything from it, or does it much later than it can.
2) for some reason, the UpdateConditions function does not work, and to be precise, it does not update the gCond_Pehotinec variable, according to the logic of which, it should return false if there is a CASTLE, but it still returns true. The AI is in the attachment, and please tell me what I'm doing wrong?
3) And please tell me how I can debug my script? BJDebugMsg does not work. Well, that is, how can I send messages to players from a bot?

This is the third place where I write.
 

Attachments

  • LudiT1_jass.ai
    39.1 KB · Views: 4
Last edited:
Level 3
Joined
Jan 5, 2022
Messages
25
So installing 3.2.2 ON TOP of the 3.1.1 AI doesn't decrease size. In a few days I will provide my map pool with 3.2.2 AMAI. BTW can you tell me if there's a way to install AMAI vs Blizz via the installer? Didn't look for that one.

Also installer didn't do the job for me? For some weird reason? Maybe I'm doing something wrong, will check

Thank you for the update and huge thanks to Electron for the installer/
 
Level 6
Joined
Sep 1, 2018
Messages
51
now I have been experimenting for a long time and came to a sad conclusion for myself. For some reason, the AI can't run multiple infinite threads. When running in the main function ,
call StartThread( function UpdateForgeAssignment )
call StartThread( function WorkerBuildPriorities )
call StartThread( function WorkerAssignment )
call StartThread( function StartHarvestPriorities )
call StartThread( function AttackAssignment )

In which there are infinite loops, it runs only the first 3-4. The rest are just ignored. This is very sad, I will think about another solution.
 
Level 6
Joined
May 26, 2004
Messages
37
@gartoll Yes installing it over older versions won't give the savings as the map mpq file is already messed up at that point. But on top of 3.2.2+ should be fine.

You need to compile the AI vs AMAI version like normal than copy the scripts over to the installer (or run installer if you extracted AMAI to the installer resources folder anyway)

@komarovba Correct only so many threads allowed in AI scripts, what I've noticed when you start adding more is it appears to start to kill threads even if one is running it will halt half way. AMAI is able to use 5 threads and we have built a scheduling system into one of the threads so we can queue actions into it.
 
Last edited:
Level 6
Joined
Sep 1, 2018
Messages
51
@komarovba Correct only so many threads allowed in AI scripts, what I've noticed when you start adding more is it appears to start to kill threads even if one is running it will halt half way. AMAI is able to use 5 threads and we have built a scheduling system into one of the threads so we can queue actions into it.

I'm not doing it on an AMAI bot.
I've been experimenting with different options all day and damn, I can't get anything good.
I always get that only two threads work.
call StartThread( function WorkerAssignment )
call StartThread( function AttackAssignment )
And I assume that call CampaignAI (HOUSE, null) this is also the launch of a separate yet.
This thing is very annoying. I'm not going anywhere from the big conditions, it saddens me.
 
Level 4
Joined
Aug 28, 2022
Messages
32
I'm not doing it on an AMAI bot.
I've been experimenting with different options all day and damn, I can't get anything good.
I always get that only two threads work.
call StartThread( function WorkerAssignment )
call StartThread( function AttackAssignment )
And I assume that call CampaignAI (HOUSE, null) this is also the launch of a separate yet.
This thing is very annoying. I'm not going anywhere from the big conditions, it saddens me.
You can take a look at how AMAI scripts work and try to tweak from there.

Have a look here too: How to make a Campaign AI - WC3 Modding Information Center

I did an experiment once, based on this link
 
Level 3
Joined
Jan 5, 2022
Messages
25
So downloading became really easy now. It's impossible to have trouble, just put your 3.2.2 AMAI folder into your resources folder that comes with the AMAIInstaller.
However, if you still face problems, here are my 300 maps updated. The map pool barely changed and this time I added all of them as Blizz vs Blizz. Yet again, it has every single blizz map along with most of the maps that liquipedia considers competitve (click a map and expand the "other competitive maps" thing), the FML map pool and some others map in order to reach that number

Files: https://drive.google.com/file/d/13Es8E4xUxWxIrmVwrU4FvrfRdba31yfo/view?usp=sharing
 
Last edited:
Level 1
Joined
Oct 30, 2022
Messages
2
The installation on maps via command line doesn't work for me anymore. The installer issues the error spawnSync MPQEditor.exe ENOENT. What to do?
 
Level 23
Joined
May 14, 2021
Messages
726
The installation on maps via command line doesn't work for me anymore. The installer issues the error spawnSync MPQEditor.exe ENOENT. What to do?
Are you using the older versions of AMAI? I highly recommend getting the latest one (installer + latest version of AMAI binaries).
That way, you can use the "amai-electron-manager.exe" to install this mod instead of the commandline provided in AMAI binaries. Remember to place the binaries inside the "resources/AMAI" folder.
 
Level 1
Joined
Oct 30, 2022
Messages
2
Ok, I got the installer to work. There mustn't be a second subfolder called AMAI, which is created by just unzipping.
The command line still doesn't work for me anymore though (it did in the past). It issues ECHO Cannot be found error for the map. But w/e, Installer should be good enough I guess.
 
Level 3
Joined
Jun 23, 2016
Messages
57
I'd like to use the profile manager, but it needs perl with tk and I can't manage to install tk. Tried to install it through activeperl, but there's an error, and I can't find the 5.8 version which apparently has tk already included on it. I'm not familiarized with coding platforms so I don't know if there's an easier way to do it or if I'm messing things up. I use windows 11.

Another question: AMAI stops working as soon as I modify a map even though I keep it melee. I added taverns to a blizzard map and now I only get the default AI. I also can't manage to install it on hive melee maps, it says that it was installed correctly but I'm always getting the default AI.

Thanks in advance.
 
Last edited:
Level 1
Joined
Mar 17, 2021
Messages
6
Love this mod! Great work here!

I have one question though. To me it seems like the ai retreat their units when their healthbar reaches the red stat, wich would mean this is percentage based. I wonder if there is something i can change to make it a set hp, like 200 hp or something.

The problem right now is that grunts are maneuvered very well because their hp pool is large, but archers are only 2 hits away from death when they try to retreat.

Thx in advance :)
 
Level 1
Joined
Jan 24, 2023
Messages
1
The AI Humans constantly sends workers to the enemy base in an attempt to build a tower and all the workers just dying :(
Also, the AI continues to build new workers and send them to the enemy base until it loses.
Amai 2.6.2
image



Is it supposed to be like this ? The AI is building a tower very far from his base.
image

image

image


There is not a single tower at the base for protection
image


On the additional base the defensive towers are present
image


AI often does not pick up artifacts
image

image

1674580349695.png



Will there be further improvements to AMAI for the old version of Warcraft 3 (1.28) ?
 
Last edited:
Top