• 🏆 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!

[General] Getting the AI to build a shipyard

Status
Not open for further replies.
Level 11
Joined
Feb 2, 2011
Messages
342
I was wondering how, in the editor, you could get a custom AI to build a shipyard in shallow water. I tried making the shipyard placement sea path-able but my AI would still not build it at all.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,201
WC3 has no support for Water AI, or specifically island gameplay.

The AI is unable to handle not being connected by land with their opponents, resulting in a resource intensive loop that drops multiple frames every few seconds. I am not even sure if it can detect when it is physically separated from its opponents as a result. Without knowing this, it is impossible to know when to use transports. Even then, it probably does not know where to land with them.

This is in contrast with SC2 where the AI can detect such a condition and will use transports on you.

It also lacks dock placement. It fails badly at finding suitable construction areas for docks even if you tell it to make one. SC2 also lacks dock placement AI as it lacks the theme of water. However the AI building algorithm is often more generous and might be able to find suitable locations for complex structures.

Empire Earth/EDotMW 1 and Age of Empires 1-3 had AI capable of placing and using docks. They would often place many to allow for more production capabilities.

In your case you probably will need a heavily triggered solution. Including detecting when the AI is separated from its opponents (and removing control over its units to stop bad performance) and placing docks to get ships in the first place.

Separation can be detected by ordering dummy land units from their base to a target base. If the land unit never makes it (ends up stopping) then they are probably separated. Alternatively since you do not need to cope with random maps you can hard-code all separate land masses (in form of rects, or regions) and so run tests for if their target is on the same landmass as they are.

For dock placement you can run some kind of "shore detection" for around their base. When suitable shore is found it tries to position a dock on it in a sensible way. Since you do not need to cope with random maps you could also hard-code "optimum dock positions". The AI can then search for an optimum dock position close to its base and order a dock there.
 
Level 11
Joined
Feb 2, 2011
Messages
342
WC3 has no support for Water AI, or specifically island gameplay.

The AI is unable to handle not being connected by land with their opponents, resulting in a resource intensive loop that drops multiple frames every few seconds. I am not even sure if it can detect when it is physically separated from its opponents as a result. Without knowing this, it is impossible to know when to use transports. Even then, it probably does not know where to land with them.

This is in contrast with SC2 where the AI can detect such a condition and will use transports on you.

It also lacks dock placement. It fails badly at finding suitable construction areas for docks even if you tell it to make one. SC2 also lacks dock placement AI as it lacks the theme of water. However the AI building algorithm is often more generous and might be able to find suitable locations for complex structures.

Empire Earth/EDotMW 1 and Age of Empires 1-3 had AI capable of placing and using docks. They would often place many to allow for more production capabilities.

In your case you probably will need a heavily triggered solution. Including detecting when the AI is separated from its opponents (and removing control over its units to stop bad performance) and placing docks to get ships in the first place.

Separation can be detected by ordering dummy land units from their base to a target base. If the land unit never makes it (ends up stopping) then they are probably separated. Alternatively since you do not need to cope with random maps you can hard-code all separate land masses (in form of rects, or regions) and so run tests for if their target is on the same landmass as they are.

For dock placement you can run some kind of "shore detection" for around their base. When suitable shore is found it tries to position a dock on it in a sensible way. Since you do not need to cope with random maps you could also hard-code "optimum dock positions". The AI can then search for an optimum dock position close to its base and order a dock there.

I have some ideas for creating shipyards, creating sea units and transports, sending an attack and transport drop-offs, all using triggers, real and unit variables, and locations, but it may take some trial and error to move forward.
 
Level 25
Joined
May 11, 2007
Messages
4,651
I'm sort of working on a system for this in a campaign map, it uses the trigger editor to train transports, load transports, tell 'em to go unload at a position, order the unloaded units to attack and so on.

So ya, if you want to do this you're going to have to trigger all of it.
 
Level 14
Joined
Jun 15, 2016
Messages
749
I'm sort of working on a system for this in a campaign map, it uses the trigger editor to train transports, load transports, tell 'em to go unload at a position, order the unloaded units to attack and so on.

So ya, if you want to do this you're going to have to trigger all of it.

Did you manage to make it out properly? I'm very curious too. If yes, can you post an example here?
 
Level 11
Joined
Feb 2, 2011
Messages
342
Sorry for late reply on if I was successful with creating a transport drop with standard Warcraft 3 triggers. I was successful! Check out my Rise of the Horde map and look at the triggers to see how I did it. I am still improving my triggers to be less complicated so I apologize if anybody gets confused.
 
Level 14
Joined
Jun 15, 2016
Messages
749
I am also thinking about writing triggers to drop enemy troops loaded onto enemy sea transports onto locations where the player has expanded and built a hall in the future.

Don't know why you double posted o_O but the AI you made for the map is not work properly. It takes ton of time to catch one enemy group arriving and attacking our base, i almost faint while waiting for it.
 
Level 11
Joined
Feb 2, 2011
Messages
342
Don't know why you double posted o_O but the AI you made for the map is not work properly. It takes ton of time to catch one enemy group arriving and attacking our base, i almost faint while waiting for it.

I can make the enemy Grunt production and Orc transport drops much quicker by adding more Orc barracks to produce enemy Grunts at least twice as fast.
 
Status
Not open for further replies.
Top