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

[AI] Build Orders

Status
Not open for further replies.
Level 3
Joined
Aug 29, 2007
Messages
44
Well, i have created a working AI and im quite pleased with it, but i feel it could be much more efficient after ive played it a few times, for example.

If i kill its Hero, it will stop producing troops whilst the hero is being revived, id like it to carry on with everything else and just revive the hero.

Its the same with units, if its at Tier 3 and is making knights, and i kill some footmen, it will replace the footmen, is there an easy way of changing this?

Ive heard you can do some triggers to check if it has a castle and then cancel the trained footman and make it train a knight.

:vw_sad:
 
Level 20
Joined
Feb 24, 2009
Messages
2,999
I'm going to assume your using the AI Editor.

The AI within such works through a "priority tree"

In a nutshell, you list a load of units and unemcumbered the AI will always MAKE or REPLACE the units/buildings at the top of this tree.
So if your list looks like this:

Peasant
Peasant
Peasant
Farm
Barracks
Footman
Footman


If a peasant is ever killed, the computer will almost immediately think it needs to replace that peasant (as it's the "highest" priority).

This can as you imagine (and seem to be finding out), prove rather annoying. Especially if it's pumping out peasants while under attack and training footman in tier3.

However there is a solution (sortof) you'll have noticed you can attach conditions to each priority, things like if Number of Unit Type = integer (whole number) and base is under attack equal to true/false.

So let's rewrite the previous list;

Peasant (Base is under attack = false)
Peasant (Base is under attack = false)
Peasant (Base is under attack = false)
Farm (Base is under attack = false)
Barracks
Footman
Footman


Now even if all your peasants die, the computer will make a barracks (if it hasn't got one) and footman first WHEN UNDER ATTACK AT HIS MAIN TOWN (not if he's attacked in an assault).
Can you see the usefulness in that? :p

There are plenty of other conditions to, you'll want one alongside some of your footmen (if upgrade is at level x) or amount of castles = 1 etc...

Hope that helped (and sorry if it's a bit late)!
It's merely about balancing the list order and various conditions, you can also use AND conditions to link several conditions like in triggers.

P.S.

As for the one process at a time thing, I've never experienced that, are they gathering adequate resources?
 
Level 20
Joined
Feb 24, 2009
Messages
2,999
Actually, the AI editor can be used with custom content (races etc) you just need to import the relevant maps data. The problem comes only when gameplay is VERY different, for e.g. you'd struggle making AI for a tower defense, aos or similar custom map in the editor. But alternate melees or heavily modded RTS variants usually work quite well :)
 
Status
Not open for further replies.
Top