Peppe

AI Skirmish Mod .25n Release 11/27/2010 (Major Revision)

AI Skirmish Mod .25n Release 11/27/2010 (Major Revision)

 

Release 25 :  

Mod Version - Skirmish/Online Play: 

http://www.filefront.com/17572530/Skirmish_AI_v25n.zip

http://www.filefront.com/17572533/Skirmish_AI_v25n.exe

 

-This version only works in skirmish mode and has no lobby modifications.

 

Tournament Edition - Offline/Singleplayer:  http://www.filefront.com/17552549/Skirmish_v25_TEd.zip

-This version works in all game modes (tournament/skirmish) and adds some functionality to the auto-fill lobby button.

 

Gameplay should be the same in each version.

 


 

Major Changes:

Version D or later will support replay playback.  Thanks miriyaka

Stuck AI issue fixed by slowing down shopping to one action per second.  AI is a little slower to shop, but plays every game reliably.

AI goals are overridden based on conditions:

  • First 20 seconds of the game -> Shop.
  • Next 10 seconds -> capture flag (gets them all moving to nearest avialable flag).
  • If the enemy has the same or more flags and we are at full health -> capture flags
  • If we are war rank 3 and have enough money for currency -> Shop

The result of the above is a good clean opening.  And the AI spending most of the game capturing flags -> fighting at the flag -> retreating -> healing -> shopping -> leaving shop area -> capturing flags.   If it doesn't take a lot of damage it may only retreat a little and then rejoin the fight.  If it takes a lot of damage it usually retreats to the health crystal.

AI will spend much less time doing nothing or aimlessly wondering around.

 

Minor Changes:

Item weights for common items (health stacking items).  AI's will use similar items, with a few builds picking up class/build specific items.

Most builds have 1-3 achievement items, so the AI will be a little different game to game even if it only has one build for that Demigod type.

 

29,339 views 110 replies
Reply #101 Top

Whipped up an AIGlobals function that checks the AI's brain for a table containing the upgrades that specific AI should be saving for: http://pastebin.com/DMQzVLNd

Just need to find a convenient place to load this table that will only run once per team, and happens after AIBrain OnCreate.

 

Quoting Peppe, reply 100
If it becomes an issue we can probably modify the gold saving section i have now to check in on each ally brain's gold.  The ally brain with the highest gold can have its item budget reduced to purchase upgrades.   May be less reliable as the AI can still purchase other upgrades while its item budget is reduced.

Half done.  As for citadel upgrades, just plug this into the citadel upgrade purchase function as well?

Reply #103 Top

Re-worked the Graveyard priorities so even I should never be purchased by Normal AIs unless death penalty is on high, or the team is spending most of their time dead. Nightmares will purchase I in any normal game, and II-III if they're getting spanked.

I think that is a great idea, btw.  Graveyard is NEVER used in MP and this would be an opportunity to add it

 

Reply #104 Top

Quoting miriyaka, reply 101
Whipped up an AIGlobals function that checks the AI's brain for a table containing the upgrades that specific AI should be saving for: http://pastebin.com/DMQzVLNd


Just need to find a convenient place to load this table that will only run once per team, and happens after AIBrain OnCreate.

 


Quoting Peppe, reply 100If it becomes an issue we can probably modify the gold saving section i have now to check in on each ally brain's gold.  The ally brain with the highest gold can have its item budget reduced to purchase upgrades.   May be less reliable as the AI can still purchase other upgrades while its item budget is reduced.
Half done.  As for citadel upgrades, just plug this into the citadel upgrade purchase function as well?

 

Function looks good.  Could drop it in any file.  Probably add it as a function in the shopping utilities file. 

What do you think about dynamically gimping the AIs.  We can call it in the AIshoputilities whenever an AI is building its shopping list (where the current reserve x gold stuff i posted earlier is). 

I think if you just looped over ArmyBrains in your function and found the AI with the highest gold on each team you could return the amount to save to the high AI and for everyone else return 0.   Then if someone gets a kill or something that AI could jump to the high or if the current high AI buys an upgrade, then the new high AI will get the reserve amount set in its item purchase function.

I can write that part if you want.  I just did brain looping in the summon priests and teleport priest re-assignment functions. 

Reply #105 Top

Yeah, that would work.  Just loop brains, add gold to a table with the index of the army, something like:

--removed--

The reason I put it in AIGlobals is so it can be easily accessed anywhere, and already has a bunch of utility functions at its disposal.  Whatever you do, make sure it can be reused for both citadel upgrades and items.  For cit upgrades, just add another parameter to the function with the name of the upgrade it's trying to purchase, and if that matches the currently prioritized upgrade, then give it a pass or something.

Edit: Whoops, I'm tired.  That method of sorting won't work at all.  Welp.

Edit 2: --removed--

Reply #106 Top

Ok, this should work.  Untested code, but it's simple enough. http://pastebin.com/64vj0LgR

Agh, made another mistake.  Trying again: http://pastebin.com/miTcUGw8

Takes a second optional parameter with the name of a citadel upgrade being checked for priority/purchasing.  If it's the same as the current save-for upgrade, it skips the save cost and returns 0.  This should work for preventing the AI from buying any cit upgrades other than the one it's saving for, until that one's purchased.  Let me know if I messed something up.

Reply #107 Top

Testing new function now.  Changed

   ' if goldTable[1].Army = unit:GetArmy() then'  to double equals...

also changed sort to     table.sort(goldTable, sort_down_by 'Gold' ).  Not sure if that is needed as i changed it before changing the other line.  Think original format was ok.

 

 

Edit:

Gold is nil.   Save it for another day...

Reply #108 Top

Welp, I was getting pretty tired last night.  It needed two changes as far as I can tell, the equals sign, and you know, actually getting the gold of the unit in question and not just its teammates.  If you were testing with just one AI, that would be why gold was nil.  If you had more than one AI on that team, then I probably did something else wrong that I'm still not seeing.  Updated to start with the army and gold of the checking unit: http://pastebin.com/3nKK7bBP

Reply #109 Top

Not sure what get allied armies is returning, but I switched it to army brains and now can get gold.

My section:

    for k, brain in ArmyBrains do
        if brain.Score.HeroId and IsAlly(aiBrain:GetArmyIndex(), brain:GetArmyIndex()) and brain.BrainController != 'Human' then    

            table.insert(goldTable, {Army = brain:GetArmyIndex(), Gold = brain.mGold  })
        end
    end
    table.sort(goldTable, sort_down_by 'Gold' )

Reply #110 Top

Huh.  It's a function in AIBrain, that should be returning all brains allied with the provided brain.  I've used it before, not sure why it wouldn't be working now, but your fix looks fine.  It'll put the unit's army/gold in twice if the table is pre-loaded with it, probably, but that doesn't really matter.