wc3campaigns
WC3C Homepage - www.wc3c.netUser Control Panel (Requires Log-In)Engage in discussions with other users and join contests in the WC3C forums!Read one of our many tutorials, ranging in difficulty from beginner to advanced!Show off your artistic talents in the WC3C Gallery!Download quality models, textures, spells (vJASS/JASS), systems, and scripts!Download maps that have passed through our rigorous approval process!

Go Back   Wc3C.net > Warcraft III Modding > Hosted Projects > AMAI
User Name
Password
Register Rules Get Hosted! Chat Pastebin FAQ and Rules Members List Calendar



Closed Thread
 
Thread Tools Search this Thread
Old 11-08-2004, 02:48 PM   #1
AIAndy
User


Respected User
 
Join Date: Oct 2002
Posts: 1,296

AIAndy is on a distinguished road (21)

Default

There are many parts in AMAI that can be adjusted that influence game play a lot. One person working on them is just not enough to optimize the settings, rules and formulas in AMAI (and I am adding more and more things that need to be adjusted at the same time).

So what I will do here is explain one such adjustment part of AMAI at a time, and ask you to try around with these things while you play and post the settings that you found worked best.

I will start with the hero flee rules. These are the rules that are activated when the remaining hp of a hero are below flee_minimum_health or he has less than flee_health_percentage parts of his hp left.

There are currently 7 outcomes:
ACTION_DO_NOTHING
ACTION_GO_HOME
ACTION_FOUNTAIN
ACTION_TP
ACTION_ZEPPELIN_HOME
ACTION_ZEPPELIN_FOUNTAIN
ACTION_HEALER

The flee rules now have to decide which of these outcomes/actions to use. They can be found in HeroFleeRules.ai .
Each rule gives or takes points from one or more of the actions depending on if a condition is true.
After all rules are applied, the action with most points is executed.

Each rule is implemented as a call to one of the ActionRule functions. ActionRule allows to adjust the points of one outcome, ActionRule2 the points of 2 outcomes and ActionRule3 the points of 3 outcomes.
ActionRule one is used like this:
call ActionRule(condition,action,points)
ActionRule2 and 3 just got more actions and points.

An explanation of some of the values used:
hero_hp[hn] is the remaining hp part of the hero (1 means he has all hp, 0.5 means he has half hp left)
hero_hp_loss[hn] is the hp part that hero lost in the last 1.5 seconds (0.5 means he lost half of his total hp in the last 1.5 seconds).
hero_enemy_density[hn] and hero_enemy_loc[hn] are a bit special. They give info of the enemy strength and the enemy location within hero_radius around the hero. That means they are especially a good measure on if the hero is surrounded.
If hero_enemy_loc is very near to the hero's location and hero_enemy_density is high (high is relative here), then the hero is likely surrounded.
The same values exist also for allies (with ally instead of enemy in the name). If you want to get an impression on how these values behave, there are some commented out lines in MICRO_HERO.eai that should display these values.

If you have more questions, just ask. If you need some displays so you can see how the points behave, I can add some.
Have fun (and hopefully a better AMAI in the end). Post your results in this thread afterwards.
AIAndy is offline  
Sponsored Links - Login to hide this ad!
Old 11-09-2004, 06:06 AM   #2
peon
User
 
Join Date: Jul 2004
Posts: 38

peon has little to show at this moment (0)

Default

Good to see that! I'm working on it, but it takes a little bit time, 2 or 3 days, maybe ^_^
peon is offline  
Old 11-12-2004, 04:21 PM   #3
peon
User
 
Join Date: Jul 2004
Posts: 38

peon has little to show at this moment (0)

Default

Hello AIAndy:

I have done some suggestion about fleeing rules. Maybe wrong, but you can have a look.

WHEN TO FLEE:

Different hero and unit should have different (unique) flee number and surrounding threats.

flee_health_percentage = 0.25
flee_minimum_health = 100

are inflexible, many times i see the last moving unit in an escaping enemy troop shoot our hero then make our whole troop TP home.
Therefore those numbers should be dynamic values which depend on enemies and not on our own. eg. A hero with only 30hp should not flee if there is only one enemy unit whose hp is 10.

It could be changed to:
flee_minimum_health = hero_enemy_density[hn] * flee_multiplier + ai_preference + enemy_hero_skill + hero_item_skill + other_risk_factor

1. Remove flee_health_percentage because the flee_minimum_health is now a dynamic value.
2. "hero_enemy_density[hn] * flee_multiplier" construct the base flee_minimum_health, flee_multiplier can be adjusted in testing)

Parameters:
- hero_enemy_density[hn]: When there are only a few enemies, then it is not so necessary to flee, but if there are many enemies surrounded, then it is wiser to flee a bit earlier.
- ai_preference: e.g. Aggresso could be -20 so as to make the hero stay longer at the battle field, while chick3n could be +30 so as to avoid losing hero.
- enemy_hero_skill (Whether Hero should flee also depends on the enemy hero. If the following instant killers / draggers exist, our hero should flee before they can kill us). I gathered all the instant killers and draggers:

paladin (instant): if you are undead, and paladin within radius of 800, and he has 65mp, then he can kill you by Holy Light you (200/400/600 damage)
mk (instant and drag): if mk within radius 600, and he has 75mp, then he can kill you by Storm Bolt you (100/225/350 damage, 3 sec stunned)
blademaster (instant): radius 100. A critical strike and kill you instantly (24-48 (lv1) / 27.5-51.5 (lv3) / 31-55 (lv5) ) x (2/3/4 times)
Farseer (instant): radius 700. 120mp. Chain Lighting (80/125/180) damage
Tauren Chieftain (instant and drag):
radius 700. 100mp. Shockwave (75/130/200);
radius (250/300/350). 90mp. Warstomp (25/50/75 damage, 2/3/4 stunned)
Shadow Hunter (drag): radius 800. 70mp. Hex (4/5/6 hex)
Death Knight (instant): if you are not undead. radius 800. 75mp. Death Coil (200/400/600)
Lich (instant and drag): radius 800. 125mp. Frost Nova (100 damage, 2/3/4 slowed)
Dreadlord (instant and drag): radius 800. 100/75/50mp. Sleep, Carrion Swarm (75/125/200)
Crypt Lord (instant and drag): radius 700. 100mp. Impale (50/80/110 damage, 1/2/3 stunned)
Keeper of Grove (drag): radius 800. 75mp. Entangle Root (45/60/125 damage, 3/4/5 stunned)
Priestess of the moon (instant): radius 700. 8mp. Searing Arrow (19-31 + 10 (lv1) / 22-34 + 20 (lv3) / 25-36 + 30 (lv5) )
Demon Hunter (instant): radius 300. 50mp. Mana Burn (50/100/150 damage)
Warden (instant):
radius (400/450/475). 100mp. Fan of Knives (75/125/190 damage)
radius 300. 65mp. Shadow Strike (75/150/225 damage)
Naga Sea Witch (drag): radius 600. 10mp. ( 22-33 (lv1) / 28-39 (lv3) / 33-45 (lv5), 1.5 slowed)
Tinker (drag): radius 800. 70mp. 1.01 stunned)
Dark Ranger (instant): radius 500. 75mp. Life Drain (200/320/440 damage)
Pandaren Brewmaster (instant and drag):
radius 375. 70mp. Breath of Fire (65/130/175 damage)
radius 550. 70mp. Drunken Haze (5 slowed)

- hero_item_skill (counteract the effect of enemy_hero_skill. Our hero can stay longer in battle field if we have special skill / item. eg Tauren Chieften lv 6 or hero with recarnation item should have different number).

SKILL:
Paladin: Divine Shield (25mp. 15 / 30 / 45 sec)
Archmage: Mass Teleport (100mp)
Mk: Avatar: (150mp, 60sec, +500hp) (lv6)
Tauren Chieftain: Reincarnation (lv6)
Keeper of the Grove: (125mp, 30sec, +600hp) (lv6)
Demon Hunter: Metamorphosis (150mp, 60sec, +500hp) (lv6)
Warden: Blink (50/10/10mp)
Alchemist: Healing Spray ( +245/+350/+455hp)
Naga Sea Witch: Mana Shield (25mp, can stand +330 (330mp x1) / +630 (420mp x 1.5) / +1020hp (510mp x 2) )

ITEM:
Health Stone / Portion of Healing / Potion of Restoration: +500hp
Scroll of Restoration: +300hp
Potion of divinity: 25sec
Potion of Invulnerability: 15sec
Ankh of Recarnation

Potion of Healing: +250hp
Potion of Lesser Invulnerability: 7sec
Scroll of Healing: +150hp

other_risk_factor:
if enemy units are mainly melee units, other_risk_factor = 0
if enemy units are melee and ranged unit mixed, other_risk_factor = +5 (because those ranged enemies can shoot you from distance, therefore should leave ealier)
if enemy units are melee, ranged and air unit mixed, other_risk_factor = +10 (because both air and ranged enemies can shoot you from distance, therefore should leave more ealier)

How to determine the value:
1. Detect what enemy hero in the battle field
2. Detect their level
3. Detect their distance to our hero
4. Detect their mp
5. Update flee_minimum_health and decide whether to flee
6. If not flee yet, repeat this process every 5 sec

Example:
A risky situation - chick3n with DH (200 hp, without any items) engages with enemy where lv 2 MK inside his massive footman army at 600 with 75mp:

hero_enemy_density = 1.5 (say)
flee_multiplier = 70 (say)
ai_preference: chick3n = +30 (say)
enemy_hero_skill: MK (instant and drag): Storm Bolt (100/225/350 damage, 3 sec stunned) = +225 (if not within 600 range or MK's mp is lower than 75, this value should be 0)
hero_item_skill = 0 (DH has no healing item or skill)
other_risk_factor = 0 (only the first row of footman can attack you, and the back are blocked)

flee_minimum_health
= hero_enemy_density[hn] * flee_multiplier + ai_preference + enemy_hero_skill + hero_item_skill + other_risk_factor
= 1.5 * 70 +30 +225 + 0 + 0 = 360 which is larger than 200hp. Threat is high and your hero is expected to die, DH should flee immediately.

---------------------------------------------------------

HOW TO FLEE:

ACTION_DO_NOTHING
ACTION_GO_HOME
ACTION_FOUNTAIN
ACTION_TP
ACTION_ZEPPELIN_HOME
ACTION_ZEPPELIN_FOUNTAIN
ACTION_HEALER

Note: Function of Zeppelins:
1. Hero surrounded, and enemy army are mostly melee.
2. Carry slow units - eg. demonlisher
3. Carry units to unreachable places. eg. islands
4. Fly over obstacles and arrive destination faster.
5. Other than the above Zeppelin destination is more or less the same as go destination

There are 4 types of Healers:
HEALER_TYPE_SUDDEN (eg. DRUID_CLAW)
HEALER_TYPE_CONTINUOUS (eg. PRIEST)
HEALER_TYPE_WARD (eg. WITCH_DOCTOR)
HEALER_TYPE_NO_TARGET (eg. OBSIDIAN_STATUE)

It is now better to justifiy action by action:
ACTION_HEALER
- at least one HEALER_TYPE_CONTINUOUS type healer should be always following melee heroes from the beginning of battle. Melee heroes are those easy be surrounded.
- HEALER_TYPE_SUDDEN healer should heal in this priority melee heroes -> ranged heroes -> melee units -> ranged units
- HEALER_TYPE_WARD should be places at the beginning of battle

ACTION_GO_HOME
ACTION_FOUNTAIN
ACTION_ZEPPELIN_HOME
ACTION_ZEPPELIN_FOUNTAIN

Before Calling go actions:
1. check destination enemies strength before calling those actions. If enemy + neutral(daytime) strength is higher than our units (means that place is occupied by enemies/creeps, or properly be taken by enemies/creeps soon)
2. keep checking until a place is safe to go (fountain -> home -> nearest expansion 1 -> nearest expansion 2 ...)
3. Add checking of enemy hero abilities, self hero abilities and items and enemy formation (other_risk_factor)
4. If pathway to avoid creeps attack is not ready, the workaround is that the safe place to go is not go home or fountain, it could be a random place near the field. Injuried heroes can wait there until the battle finished.

e.g pseudo-code
Old:
- When hero surrounded and hero suffered from a great hp loss, TP or Zep
- Problem: A great hp loss may mean focus fire, but could also means MK Storm bolted, which might not happen again is the MK is out of mp.
call ActionRule2((hero_enemy_density[hn] > 2) and (DistanceBetweenPoints_kd(hero_enemy_loc[hn],GetUnitLoc(hero_unit[hn])) < 30)and (hero_hp_loss[hn] > 0.4), ACTION_TP, 200, ACTION_ZEPPELIN_HOME, 150)

New1.
call ActionRule((hero_enemy_density[hn] > 2) and (DistanceBetweenPoints_kd(hero_enemy_loc[hn],GetUnitLoc(hero_unit[hn])) < 30) and (flee_minimum_health > hero remaining hp) and (hero_item_skill=//only have TP scroll//) and (other_risk_factor>0 //means many ranged units can attack you from distance//), ACTION_TP, 200)
- Adding flee_minimum_health > hero remaining hp (which means you expects your hero is going to die because it cover enemy hero's abilities and your abilities, also enemy army's formation), and then make a clear decision to TP

New2:
call ActionRule((hero_enemy_density[hn] > 2) and (DistanceBetweenPoints_kd(hero_enemy_loc[hn],GetUnitLoc(hero_unit[hn])) < 30) and (flee_minimum_health > hero remaining hp) and (hero_item_skill<>//only have TP scroll//) and (other_risk_factor=0 //means mainly melee//), ACTION_ZEPPELIN_HOME, 150)
- The similar situation, but you have no TP scroll, and your enemy are mostly melee, then make a precise decision to Zep


Hope these can help you make amai even harder to conquer!
peon is offline  
Old 11-13-2004, 01:12 PM   #4
AIAndy
User


Respected User
 
Join Date: Oct 2002
Posts: 1,296

AIAndy is on a distinguished road (21)

Default

A very good analysis :)
Very nice. At least quite a lot of that should be implementable. I especially like the part about making the hp when a hero flees depending on the surrounding enemy heroes.
AIAndy is offline  
Old 11-13-2004, 08:25 PM   #5
peon
User
 
Join Date: Jul 2004
Posts: 38

peon has little to show at this moment (0)

Default

Thankyou ^_^
I might have another thing for you and Zal, but it could take 1-2 weeks...
Extremely busy.
Work, work...
peon is offline  
Old 11-14-2004, 08:30 AM   #6
peon
User
 
Join Date: Jul 2004
Posts: 38

peon has little to show at this moment (0)

Default

PS. In fact these concepts can be used in a opposite way

If you have instant killers / draggers in your army, and your enemy is within your skill radius, then you can storm bolt to kill your enemy hero instantly, or you can drag him a let your army kill him if you still have enough mp and you expect him die in the last shot.

ie
ACTION_STORM_BOLT(target)
ACTION_DEATH_COIL(target)
ACTION_ENTANGLE_ROOT(target)
...


Therefore the combined detection function would be:
1. Detect what enemy hero in the battle field
2. Detect their level
3. Detect their distance to our hero
4. Detect their life
4. Detect their mp
5. Update flee_minimum_health and decide whether to flee
6. Update last_shot and decide whether to give him the last shot
6. If not flee or not last shoot yet, repeat this process every 5 sec

Examples:

call Actionrule((//Our hero is instant killer//) and DistanceBetweenPoints_kd(hero_enemy_loc[hn],GetUnitLoc(hero_unit[hn])) < //Our skill radius//) and ( hero remaining mp > // skill required mp//) and ((//enemy_hero_remaining_hp// < //Our skill damage//) or (//enemy_hero_remaining_hp// < //the expected value: seconds enemy hero are dragged * Our units that surround him can do damage every second by focus fire on him) and (other_risk_factor (our army) >0 //means our ranged units can attack him from distance//), ACTION_STORM_BOLT(dying enemy hero), 200)
-- Hero should be so eager to bolt him because he is dying (note. no need to check enemy hero item or skill if our hero is instant killer, we should kill him instantly before he can use his skill or item)

call Actionrule((//Our hero is Pandaren Brewmaster//) and DistanceBetweenPoints_kd(hero_enemy_loc[hn],GetUnitLoc(hero_unit[hn])) < //Our skill radius//) and ( hero remaining mp > // skill required mp//) and ((//enemy_hero_remaining_hp// < //Our skill damage//) or (//enemy_hero_remaining_hp// < //the expected value: seconds enemy hero are dragged * Our units that surround him can do damage every second by focus fire on him) and (enemy hero_item_skill=//have TP scroll//) and (other_risk_factor (our army) >0 //means our ranged units can attack him from distance//), Drunken_Haze (dying enemy hero), 0)
-- All dragging hero skill should check enemy hero item before using his skill. Like this case, the Brewmaster should not drag him if enemy hero has TP, but instead use Breath_of_Fire against (on other Actionrule because damage and radius of Drunken_Haze and Breath_of_Fire are different and should be detect saparately)

^_^
peon is offline  
Old 11-14-2004, 09:28 PM   #7
AIAndy
User


Respected User
 
Join Date: Oct 2002
Posts: 1,296

AIAndy is on a distinguished road (21)

Default

Yes, that is good although I think 5 seconds are not often enough. In 5 seconds everything can happen in a fight.
AIAndy is offline  
Old 11-15-2004, 01:19 PM   #8
peon
User
 
Join Date: Jul 2004
Posts: 38

peon has little to show at this moment (0)

Default

So would 1-2 sec drag the game speed down? I have no idea how much pressure a computer can stand in a real time game with massive units moving attacking and calculations, and together with those scripting language as well...

After all my machine is only 1.8G...

-_-
peon is offline  
Old 11-15-2004, 11:50 PM   #9
AIAndy
User


Respected User
 
Join Date: Oct 2002
Posts: 1,296

AIAndy is on a distinguished road (21)

Default

That depends a lot on how efficient and tricky I will be able to retrieve that info.
AIAndy is offline  
Old 11-16-2004, 05:27 AM   #10
thenonhacker
User
 
thenonhacker's Avatar
 
Join Date: Mar 2004
Posts: 208

thenonhacker has little to show at this moment (9)

Default

@peon: Good-thinking! You should receive credits in the AMAI ReadMe for the functional concept regarding Hero Flee Rules. :D These rules will make the "Force Hero to TP" exploit unusable.
__________________


Starcraft 2 Starfeeder.com: Your Starcraft 2 Tournament Community and Blog!
___
thenonhacker is offline  
Old 11-16-2004, 09:32 AM   #11
peon
User
 
Join Date: Jul 2004
Posts: 38

peon has little to show at this moment (0)

Default

Quote:
Originally Posted by thenonhacker
@peon: Good-thinking! You should receive credits in the AMAI ReadMe for the functional concept regarding Hero Flee Rules. :D These rules will make the "Force Hero to TP" exploit unusable.

Thanks ^_^

I just want AMAI to be a tough ai, not merely a blizz ai replacement. ;P
peon is offline  
Old 11-16-2004, 01:19 PM   #12
Zalamander
User
 
Join Date: Nov 2002
Posts: 391

Zalamander has little to show at this moment (4)

Default

of course anyone that helps us will get a dedicated spot on the credits page, there is still plenty of room for names and new categorys to be created. :)

Sadly we don't get enough donations on paypal to share it, we actualy nearly don't get anything. :/
Zalamander is offline  
Old 11-16-2004, 06:47 PM   #13
peon
User
 
Join Date: Jul 2004
Posts: 38

peon has little to show at this moment (0)

Default

Quote:
Originally Posted by Zalamander
of course anyone that helps us will get a dedicated spot on the credits page, there is still plenty of room for names and new categorys to be created. :)

Sadly we don't get enough donations on paypal to share it, we actualy nearly don't get anything. :/

No worries. I am helping without asking, and I believe people who come for the same thing - fun. ^_^

In fact what I gain is both experience and fun. I was a novice and know nothing about coding, and now I know a bit how the script and the game run. Think about the founders of Blizzard, they are all gamers in the begining, and now they are rich :P

Cheer up man! If you think you really like games, go ahead and make some. People are willing to pay for quality games like wc3. Then you can have fun and we all can have fun too!

:D
peon is offline  
Old 05-20-2005, 10:37 AM   #14
thenonhacker
User
 
thenonhacker's Avatar
 
Join Date: Mar 2004
Posts: 208

thenonhacker has little to show at this moment (9)

Default

@AMAI Team: I'd like to know if Peon's algorithm for AMAI flee rules will be in the next version of AMAI. :)
__________________


Starcraft 2 Starfeeder.com: Your Starcraft 2 Tournament Community and Blog!
___
thenonhacker is offline  
Old 05-20-2005, 03:33 PM   #15
Strategy Master
Great Sage
 
Strategy Master's Avatar


Project Leader: AMAI
 
Join Date: Jun 2003
Posts: 710

Submissions (1)

Strategy Master has a spectacular aura about (77)Strategy Master has a spectacular aura about (77)Strategy Master has a spectacular aura about (77)

Default

Wow. Thanks for bringing this thread to my attention. I had forgotten this had been written.

So unless Zal or Andy has just done something recently its not in yet.
__________________
Strategy Master is offline  
Closed Thread


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off


All times are GMT. The time now is 06:29 AM.


Affiliates
The Hubb The JASS Vault Clan WEnW Campaign Creations Clan CBS GamesModding Flixreel Videos

Powered by vBulletin (Copyright ©2000 - 2019, Jelsoft Enterprises Ltd).
Hosted by www.OICcam.com
IT Support and Services provided by Executive IT Services