HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Learning about Melee AI

12-08-2009, 01:03 PM#1
leric
I'm currently trying to develop my own version of AI and is seeking some guidance here since there don't seem to have other forum section dedicated to AI development. I'm still new to warcraft III modding, thus not knowing all the features of Jass and vJass, but do have some general programming knowledge.

Currently i feel that it is so limited that can be done using natives from common.ai and don't really know what exactly how some natives works. I've read a few threads from this forum and found that you guys have been writing your own natives. Mind tell me how to write own natives and make it usable by my AI?
12-09-2009, 12:25 PM#2
Strategy Master
@leric: We modify the common.ai and human.ai, orc.ai etc scripts for AMAI. Common.ai is the control hub of all AI and the functions you make or define in it yourself you can use in all those racial ai files which is the start point of ai. Thats pretty much all there is too it.

Native functions are a different barrel of fish. These are the hardcoded unmodifiable functions that are part of the game engine. We dont touch these but new ones can apparently be made using the grimoire tool on wc3 campaigns resource section. Native functions are all stored in the Common.j and can be used by any warcraft scripts. AI specific natives are single lines stored at the top of the common.ai file and can only be used by ai.
12-10-2009, 07:32 AM#3
leric
Have you been making the AI to pass information around to another AI? I've learnt that gamecache works for it, but also heard that there is a fix 255 instance are allow in the gamecache and they are slow in multiplayer games. From the files in AMAI, i notice blizzard.j have been modified. So does that mean we can modify blizzard.j and common.j? and how we do it? I'm try to add globals in these files so that sharing of variables between AI is available.

Does the user made natives using grimore tools stored inside the map file or i will require to install these files into the .mpq?

Did you mean AMAI have not been using any self made natives?

Lastly, is there a place to read the usage of each natives? Sometimes the natives name are just not self explanatory enough. Like there is a instance GetGoldOwned(), there is another GetGold() function which return the controller gold which confuses the existence of this natives. If you have such a list with simple or detailed explanation on the natives, i hope that you can share it.

I've less than 2 months time left to create the AI for my college project.
12-10-2009, 08:50 AM#4
AIAndy
Quote:
Originally Posted by leric
Have you been making the AI to pass information around to another AI? I've learnt that gamecache works for it, but also heard that there is a fix 255 instance are allow in the gamecache and they are slow in multiplayer games. From the files in AMAI, i notice blizzard.j have been modified. So does that mean we can modify blizzard.j and common.j? and how we do it? I'm try to add globals in these files so that sharing of variables between AI is available.
Every AI script execution uses a separate variable space so you can't transfer information with globals.
There are two ways to transfer information to other AIs iirc. The simple one is the alliance target which is shared between the AIs in an alliance. The other one is sending commands with the native CommandAI and reading it with GetLastCommand and similar natives. Since it has been some time, I might have forgotten some ways though or there might have been new ways found in the meantime.

AMAI changes blizzard.j to give the chance to control the AI somewhat to the user via a command interface.

Quote:
Originally Posted by leric
Does the user made natives using grimore tools stored inside the map file or i will require to install these files into the .mpq?

Did you mean AMAI have not been using any self made natives?
At the time when I wrote the majority of AMAI self made natives were not available, so yes, AMAI does not use any of those. Besides, doing these things requires that you use programs outside the scripting system.
12-10-2009, 10:40 AM#5
leric
Thanks for the response both of you.

I'll go check more on about CommandAI(). Since you've used it, is it good for synchronizing variables?
Any manual for me to read the natives usage? Any tutorial as well?
Some of the common.j natives doesn't seem to work especially the String Utility API. You guys face such problem? Is there alternatives?

I've not been using JNGP effectively due to it says unable find the directory. Is there any good tools to check AI script? Both JassCraft and JNGP gives me alot declaration problems since those globals in common.ai is not taken for checking. I also receive error such as comparing two different primitive but it is actually integer comparing with integer.
12-13-2009, 05:51 PM#6
leric
How to force the AI to display text as chat message to allies and all? I do not want to use DisplayTextToPlayer().
12-14-2009, 01:00 PM#7
AIAndy
As far as I remember there is no direct way to use the chat message system for scripts.
12-14-2009, 01:23 PM#8
moyack
It can't be done, sorry. You have to use the infamous but practical DisplayTimedTextToPlayer command.
12-23-2009, 10:08 AM#9
leric
what is SetGroupsFlee() for? i don't see difference between true or false value put in it.
12-24-2009, 10:48 AM#10
Strategy Master
@leric: With the original blizzard ai it controls how groups of units flee from battle or not. In AMAI it has no effect as AMAI uses its own more advanced group fleeing code.
01-06-2010, 10:00 AM#11
leric
Is there a way for me to register a building e.g: Tree of Life as a town?
I am trying own spot as town so expansion doesn't have to be near goldmine or those expansion spot chosen by blizzard's AI.

I'm only able to ask the unit to build directly on which part of the map but the game doesn't register it as another town so whenever i want a building to be build near this expansion it will build in the initial base and also it doesn't admit that there is a second town exist.
01-23-2010, 01:30 PM#12
leric
i've seen the manipulation of captains in AMAI. mind share on how to correctly manipulate them in order to ask the ai to attack and so on? currently i'm having problem that the captains makes my unit retreat to the base whenever i'm out of the base.