• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Unsolved] Custom AI

Status
Not open for further replies.
Level 4
Joined
May 2, 2013
Messages
107
Hi everybody,


I want to add a AI system on the AI in me map.. The only thing I want my AI to order is purchasing (if its possible randomly) upgrades.. And the next thing I want them to order is building refinery's on geysers all over the map.. Those are the only 2 things I need to know for programming my AI.. I made some triggers for this..
I looked at the AI Module, but its seems very default and limited to me.. So I checked out the triggers...

I made this:

Event: Map initialiing

Action: start repeating timer





Event: When timer expires

Action:
AI - advanced- Research upgrade x in players 1's town -1 priority 1
AI - advanced- Research upgrade q in players 1's town -1 priority 1
AI - advanced- Research upgrade w in players 1's town -1 priority 1
AI - advanced- Research upgrade y in players 1's town -1 priority 1
etc
etc

many upgrades..

So i think every time the timer expires.. it purchase the first upgrades in the list which it can purchase..


But it doesnt work.. I dont know where that 'Town' parameter stands for..

But do someone know how I can realize programming the AI to research upgrades and making refineries on geyser all over the map??

Still didnt find anything to order my AI to build refineries on geysers which all are all over the map..

Thanks in advance..!!!!
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
So i think every time the timer expires.. it purchase the first upgrades in the list which it can purchase..
It should try and research them all, and will keep doing so until you clear the queue or the queue times out. Of course you need to enable AI queues and things. You also need to make sure the AI can afford the research, for logical reasons.

I dont know where that 'Town' parameter stands for..
Specifies which base the AI will use to do something. -1 stands for any available base.

The AI divides its domain into bases. Each base is an area of construction. Usually the AI will only have 1 main base and the rest are expansions for resource harvesting. The campaign used them differently where in a mission where you have to push through many areas each is a separate base and as one falls it starts using the next.

There is a limit to the number of bases an AI can have and the size of each base an AI can make buildings in. I do not think bases can overlap so near-by bases might have a cut-off where it stops considering structures in one base and instead considers them in the other.

To get the AI to work properly you will need to set it up. By default the campaign AI is a good one to use as its settings are more flexible. Melee AI is very strict with its behavioural patterns which can be annoying. GUI does not let you toggle advanced AI behaviour as the appropriate constants are missing. Your only option is to use custom script which allows you access to the constants.

If you toggle the queue timeout behaviour to off you can queue a lot of technologies and it should research them 1 by 1 until it is empty. If you leave queue timeout on then you will need to re-issue the research orders every so often (like you do) and it should take all it can and eventually do something else.

You can queue a lot of tasks to the AI but do remember the AI will execute them in priority order. If you give an entire build order you might have problems getting the AI to respond to changes in the environment.

If you give me the map I could take a look and see if there is a way to get the AI to build all over the map. Refineries gave me problem in the past but I did eventually manage to get the AI to build them.
 
Level 4
Joined
May 2, 2013
Messages
107
I send you an old file.. If its not to much effort --> Can you also show me how to let the AI make upgrades..? Cause I just can't order de AI to make 1 simple Action.. I don't know what I'm doing wrong..

And if you like, can you also explain a lil what you've changed to make it work so I can learn from it..

Many Thanks!

It should try and research them all, and will keep doing so until you clear the queue or the queue times out. Of course you need to enable AI queues and things. You also need to make sure the AI can afford the research, for logical reasons.
It thought with this method, it will research from the list what can be researched if he got the resources.. I dont know what resources the AI has on a certain point in the game, so thats why I add the timer on.. So every time its expires, it makes atleast something from the whole action list.. Something he can purchase because it has the right amount of resources.. The rest of the list wont be researched.. But in the next time the timer expires, when its got the right amount of resources that is...

But I dont know if that is happening..

For now I simple made an event with map initializing and an action to order AI to research a upgrade..

But still when I test it.. it doesnt research the upgrade, it isnt doing anything!.. I just dont understand lawl.. -.-'
 

Attachments

  • Version 130422 V1.SC2Map
    502.2 KB · Views: 69
Last edited by a moderator:
Level 4
Joined
May 2, 2013
Messages
107
I could not find any AI triggers in the map. I assume it is a version before you tried to add AI?

Yes, that is correct. This is an very old version, Version 130422 V1.SC2Map ---> a version of 22 april 2013 so it seems. And the map I work with now is mostly diffrent and better than this old version. But the idea is still the same. It doesn't feel save to upload the map on the net public which cost me like 7 months to make, I'll hope you understand. :)

But the only thing I started with was just a trigger with an event: 'Map initializing' with 1 simple action: Order AI to research upgrade (an costem upgrade I made).

And yet even that didn't worked. I wish there was a Manual or something for programming the AI. Internet sites doesn't seem to have an answer also.

And the thing about programming the AI to build refineries all over the map, I didn't even started yet finding that out. This because I coudn't even let the AI make 1 simple upgrade. Thereby I cound't find the right triggers that describe the action to order the AI making refineries.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
You did start the AI right? The AI will do nothing until you turn them on.

To get AI to do anything at all you need to do the following.
1. Make sure their slot is occupied by a computer player. If their slot is empty or occupied by a human player you will be unable to use AI on it.
2. Turn the AI on (Start AI). This begins the AI thinking engine which is used to order units around, perform tactical decisions and manage bases.

This is the bare minimum you need to even start thinking of getting the AI to do anything. I will try and make your map do something as an example in a little while.
 
Level 4
Joined
May 2, 2013
Messages
107
2. Turn the AI on (Start AI). This begins the AI thinking engine which is used to order units around, perform tactical decisions and manage bases.


Ahhh, I see indeed an action which is called: 'Start AI'.

I didnt knew you have to turn the AI on. It doesnt make sense to me, cuz as long you don't program the AI it won't do anything. Bothering turning it on seems double work to me. But lets role.

I see the start AI. It seems you have to choose between campaign mode or melee mode for a player x. But what I want is not campaign nor melee. I just want it to make certain upgrades and building refineries.

Question:

If I start the AI by map initializing while all slots are takin as user won't influence the game of the players? Because I want to let the AI to take over players who leaves the game.

I want to make the players be able to start playing with AI from the start. But also when players want to do a 3 v 3.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
I see the start AI. It seems you have to choose between campaign mode or melee mode for a player x. But what I want is not campaign nor melee. I just want it to make certain upgrades and building refineries.
Melee runs melee AI, including build behaviour. Campaign runs a more general blank AI that is pretty much a blank canvas for you to customize.

They both call the actual required native. Which starts the AI system for the player. The difference is with how they configure the AI system (how it autonomously responds) and complex AI thought (melee runs melee decision functions and starts timers, campaign ends there and waits for you to create any decision logic required).

They actually call a variety of configuration natives to set how the AI system makes decisions. Although you can call the native using GUI, you cannot select most of the constants. You can use custom script to reference the other constants but you will need basic galaxy knowledge so as to reference the variable names correctly (really, you just need to ctrl+c and ctrl+v the variable names from the source code file which defines them).

If I start the AI by map initializing while all slots are takin as user won't influence the game of the players? Because I want to let the AI to take over players who leaves the game.
This is not possible as I already said. The AI will only work for players who are set to a computer controller. Trying to start AI on users or empty slots will do nothing and the AI will not start.

I want to make the players be able to start playing with AI from the start. But also when players want to do a 3 v 3.
As long as the player is defined as a computer controller you can start AI for him. Otherwise you will need to script an entire AI system which issues unit orders.
 
Level 4
Joined
May 2, 2013
Messages
107
This is not possible as I already said. The AI will only work for players who are set to a computer controller. Trying to start AI on users or empty slots will do nothing and the AI will not start.

So when player properties in my editor file all are on user. But when I have that published and someone host a game online on bnet and put a AI in a slot. The AI will not work??

So I cannot change the ownership of properties of a player to computer (AI) with a trigger when a player leaves and then again restart the AI, while playing the game??
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
So when player properties in my editor file all are on user. But when I have that published and someone host a game online on bnet and put a AI in a slot. The AI will not work??
No it will work because the player controller is a computer. It will not work if you leave them as open slots or they are slots that contain human controllers (even if they leave during the session) .

So I cannot change the ownership of properties of a player to computer (AI) with a trigger when a player leaves and then again restart the AI, while playing the game??
As far as I am aware this is impossible. Mind you I did try it during the StarCraft II Beta all those years ago.
 
Level 4
Joined
May 2, 2013
Messages
107
No it will work because the player controller is a computer. It will not work if you leave them as open slots or they are slots that contain human controllers (even if they leave during the session) .

Okay, fair enough.


As far as I am aware this is impossible. Mind you I did try it during the StarCraft II Beta all those years ago.

Aahhw man. Thats not cool. Would be an awesome solution for the 'Player leave' balance problem that I got.

Thanks for the information anyways.

I was able to let the AI make 1 upgrade at map initializing, but unfortunate not with Periodic events!! It gave many errors though while testing it.. :(
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,198
I also managed to get the AI to make one upgrade. However for some reason I was ordering Marine/Zergling/Zealot 5 and it would only make 1 then stop. Not sure why as the AI should be smart enough to make all the requirements (maybe that part of the AI was turned off...).

Still no luck with your Extractors.
 
Level 4
Joined
May 2, 2013
Messages
107
Ya, it's strange it doesnt work on a simple timer.

Having no progress in this area. I think to let this one pass by.

This THREAD CAN BE CLOSED
 
Last edited by a moderator:
Level 4
Joined
May 2, 2013
Messages
107
Okay. Don't bother. I'm thinking about skipping this one. Thanks anyway for trying :D

The Autocast of the Stalker and the caster moving thing at the other threads have way higher priority than this one. If you got spare time, I rather would like you to check those threads instead of this one. :)
 
Status
Not open for further replies.
Top