You must be logged in to post messages.
Please login or register

Modding and Scripting
Moderated by Yeebaagooon, nottud

Hop to:    
loginhomeregisterhelprules
Bottom
Topic Subject: Battle Micro AI
posted 25 August 2008 03:42 PM EDT (US)   
Ok so I might be doing some more work on AI, and I want to focus on the battles micromanagement using Age of Mythology.

I shall divide the micro levels in 5 stages:
  • Stage 1 - The most very basic micro operations.
  • Stage 2,3,4 - The necessary. It varies with the difficulty of accomplishing such task, both to me and to the AI itself.
  • Stage 5 - Reaching out to perfection.

    I want all of you to help me fill them up. You don't necessarly have to worry about the stage level.. Whenever in doubt, give one higher stage than you were thinking. . You can also give some water-specific micro as it differs slightly from land.

    Example post:
    Stage 1 - Calculate the number of enemy units.
    Stage 1 - Calculate the type of enemy units.
    Stage 3 - Calculate the necessary number of arrows to kill one unit.
    Stage 5 - Hack onto enemy computer and make him move his units wildy.

    If people show interest I'll start working on it and show off my leet skills (), if not then this will just be another silently killed AI thread while screaming for attention. .

    Therefore, I demand invite all of you to post, and give me some well though procedures in all stages!
    -invent00r

    My Work: 1 2 3 4 5 6 7 8 9 10

    WIP: Master XS Battle Micro AI
    Paused: AI (%4.247)
    Os segredos são de quem os souber guardar.
  • Replies:
    posted 25 August 2008 05:26 PM EDT (US)     1 / 27  
    Stage 1: Make function that returns basic stats of units + current upgrades
    Stage 2: Make function(int armyArrayID, int enemyArmyArrayID) that can assess you winning chances
    Stage 3: If above function is positive fight and micro, else run.
    Stage 4: ???
    Stage 5: PROFIT!!!

    If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
    Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

    Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
    posted 25 August 2008 05:58 PM EDT (US)     2 / 27  
    Quoted from Mythic_Freak:
    Stage 1: Make function that returns basic stats of units + current upgrades
    Stage 2: Make function(int armyArrayID, int enemyArmyArrayID) that can assess you winning chances
    Well. I think those functions would be 2 and 4 respectly. It isn't as easy as it might sound. .

    The winning chances would be a very complicated formula, simply put: ((enemy unit type)*units vs (our counter type)*units + his micro skill + (enemy hp) vs (our hp))/3*(confidence slider) = likelihood of winning - either that or a even a more advanced statistics conditional probability function based on all elements present in AoM (Including geographic positions + All possible GP influences).

    -invent00r

    My Work: 1 2 3 4 5 6 7 8 9 10

    WIP: Master XS Battle Micro AI
    Paused: AI (%4.247)
    Os segredos são de quem os souber guardar.
    posted 25 August 2008 06:16 PM EDT (US)     3 / 27  
    hmm.... This is interesting.
    Stage 1 - Calculate the number of enemy units.
    Im'a try this but I have no idea where to start...
    *looks at AI Doc*
    posted 25 August 2008 06:29 PM EDT (US)     4 / 27  
    Quoted from rjs23:
    *looks at AI Doc*
    Don't worry. This doesn't need to be very technical.

    All you have to think is what the AI needs to do in order to increase the chances of winning.
    -invent00r

    My Work: 1 2 3 4 5 6 7 8 9 10

    WIP: Master XS Battle Micro AI
    Paused: AI (%4.247)
    Os segredos são de quem os souber guardar.
    posted 25 August 2008 09:01 PM EDT (US)     5 / 27  
    Stage 1: Know location of enenmy unit (without cheating), or if unknown scout properly.

    ||||||||||||||||My Videos||||||||||||||||
    Roxas, his heart was human, yet because of his status as a being his fate was sealed since he was born. How many times must humanity judge others like that as well without giving them a fair chance?

    "It would be very irresponsible of me to give you my thoughts as you are clearly incapable of handling the ones you already have" ~some guy in OD
    posted 25 August 2008 11:31 PM EDT (US)     6 / 27  
    Here's what I did for my oversimplified water micro.

    classical longship wars (most typical)

    1. Find enemy and current civilization and therefore type of ship
    1. Find number of ships belonging to each player.
    2. Find the targets of the enemy ships.
    2. Find the current ships with the most targets and run away with antigrav.
    3. Find the HP of enemy ships.
    3. Find the number of and identify current ships not running away.
    3. Each of the above ships targets enemy ship with lowest hp that is in range.
    4. Each of the above ships targets enemy ship with lowest hp that is in range and not running away.


    5. Find the total available damage output per volley of ships that are not running away, compare the attack to the lowest HP ships in range, and spread the attacks out for maximum kills per volley.


    I've done all except the last with triggers, so good luck
    1-4 is doable with triggers, so I'm assuming it'd be doable with AI. I'm scared of 5 though :P


    For land, I'll stick with basic for now.

    1. Find number of enemy myth units and heroes for both players.
    2. Check if enemy heroes are targeting myth.
    2. Run myth away if targetted by heroes.
    2. Find HP of all enemy myths.
    2. Task heroes on lowest hp myth in range.

    5. Find number and hp of enemy units between hero and myth and use ranged units to clear a path. ;D


    How about some simple proactive micro instead of reactive.

    1. Identify a unit in army with high HP, high speed preferred.
    1. Keep that unit moving ahead of the rest of the formation.
    2. Find targets of enemy units (should be unit from 1. by default) if it was walking in front.
    2. Run back behind formation if unit 1. is being targeted.

    [This message has been edited by HailToTheOboe (edited 08-25-2008 @ 11:41 PM).]

    posted 26 August 2008 06:44 AM EDT (US)     7 / 27  
    @:Roxas
    I've already made some good scouting script, so you can consider this completed. Let's consider that both armies have engaged combat on a open area. The composition of the army can vary at will tho.
    Quoted from HailToTheOboe:
    5. Find the total available damage output per volley of ships that are not running away, compare the attack to the lowest HP ships in range, and spread the attacks out for maximum kills per volley.
    So what you're sort of saying is, grouping the ships? Attacking with the necessary strenght to kill the ship? This is tricky because of accuracy calculation. Although it makes sense as the armies could be 40 longboats - and using them all to attack one unit would be indeed silly.
    Quoted from HailToTheOboe:
    2. Run myth away if targetted by heroes.
    2. Find HP of all enemy myths.
    2. Task heroes on lowest hp myth in range.
    Well, I'm really not so sure about this. The problem is that ordering a norse hero attacking a wadget means that he will quickly die before he gets to it. Only a ranged hero could do such attack saftely. I think heroes, those that aren't ranged, should attack the closest myth unit available - if the myth unit is too far away, then just attack cavalry. Agree?

    This also implies a change on the running away aspect. A wadget should only run away if the hero that is going to attack won't die before that - that is, archers should micro to quickly kill that hero while the wadget maintains his attack.

    Reactive seems a bit difficulty. It seems as tho you can't get enough of Mártirs!!..
    The rest of the suggestions are very good. .
    -invent00r

    My Work: 1 2 3 4 5 6 7 8 9 10

    WIP: Master XS Battle Micro AI
    Paused: AI (%4.247)
    Os segredos são de quem os souber guardar.
    posted 26 August 2008 04:15 PM EDT (US)     8 / 27  
    For 1, could you not also find enemy most "valuable" unit?

    ||||||||||||||||My Videos||||||||||||||||
    Roxas, his heart was human, yet because of his status as a being his fate was sealed since he was born. How many times must humanity judge others like that as well without giving them a fair chance?

    "It would be very irresponsible of me to give you my thoughts as you are clearly incapable of handling the ones you already have" ~some guy in OD
    posted 26 August 2008 07:02 PM EDT (US)     9 / 27  
    I remember DaP had a post about this in Strategy/General, and he said it was easy. I'll go find it.
    posted 26 August 2008 08:34 PM EDT (US)     10 / 27  
    Nah, DaP said that if programmed correctly the micro would be unstoppable, but I'm pretty sure didn't actually know anything about how it would be programmed.
    if the myth unit is too far away, then just attack cavalry. Agree?
    Good point, but no I don't quite agree. if MU is too far away, the hero should hang back away from danger until the path is clear, because the enemy will be trying to eliminate the heros so the myth can reign free.

    So I guess you need some algorithm for determining the path the hero would have to take, and assess the length and risk of the path and make a decision on whether or not it is worth it. Sounds tricky
    posted 26 August 2008 08:37 PM EDT (US)     11 / 27  
    When i said most valuable unit, i meant the units that a) super powerful (SoO Nidhogg etc), or b) have OHK.

    ||||||||||||||||My Videos||||||||||||||||
    Roxas, his heart was human, yet because of his status as a being his fate was sealed since he was born. How many times must humanity judge others like that as well without giving them a fair chance?

    "It would be very irresponsible of me to give you my thoughts as you are clearly incapable of handling the ones you already have" ~some guy in OD
    posted 26 August 2008 08:42 PM EDT (US)     12 / 27  
    1.should also surround enemy units if possible.
    2.in combat,should learn to retreat if unit number is so outnumbered by enemy units/ or ours are only weak units.

    Haha,my poor suggestion, sorry I don't know much about the project you are making, is it a independ AI file that can be used by CPU like the Admiral AI, or it's just revised version of the Original AOM micromanagement Settings----if we use it,whether the behavior of units in any fight will change dramatically regardless of the AI file.

    But I strongly support your efforts, hope to see your work get finished sooner.If possible I also hope to see you can work out the strongest AI in AOM history,stronger than battle machine zeta /admiral x/dom brain and etc.

    [This message has been edited by FlyDays (edited 08-27-2008 @ 06:24 AM).]

    posted 28 August 2008 06:48 AM EDT (US)     13 / 27  
    Just cheat so you always have the exact counters to his units... *rolleyes*

    If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
    Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

    Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
    posted 29 August 2008 05:23 PM EDT (US)     14 / 27  
    posted 30 August 2008 05:03 PM EDT (US)     15 / 27  
    Progress: Ok, I've finished most work on my xfUnitStatGet function - outputs stats like Hack Attack, Pierce Amour, Training time, Speed, etc...
    This function will be used with xfUnitGetCombatAttack - the returned value of this function, divided by the enemy unit HP, will equal the number of necessary attacks, which also equal the necessary seconds to the unit be killed.
    My AI Arrays need to be worked upon before real Battle Micro work.

    Anyways,
    @:Roxas
    Hmm, I'll do so - getting the most highest maximum HP while having the least amount of unit type of his type. . This could result in SoO, Nidhogg, Elephants, a norse Hero...

    @:FlyDays
    Surrounding enemy units include advanced vectorial work - as you know, really hard to do in AI.

    Also, the work I'm doing is fully in a low-level approach - avoid using plans at all, and explore the aiTaskUnit and kb functions. For this I also use arrays to keep track of all the data. Since my approach takes plenty of playtest and patience, I will not waste more time learning the default AI attacking plans and implement micro.

    @:Mythic_Freak
    You know I hate cheating AIs. (-.-)'

    @:HailToTheOboe
    Right, if Ox Carts are not available, spam Pegasus at full strenght!

    My Work: 1 2 3 4 5 6 7 8 9 10

    WIP: Master XS Battle Micro AI
    Paused: AI (%4.247)
    Os segredos são de quem os souber guardar.
    posted 30 August 2008 06:16 PM EDT (US)     16 / 27  
    It would also include units with one hit kills like medusa, argus etc

    ||||||||||||||||My Videos||||||||||||||||
    Roxas, his heart was human, yet because of his status as a being his fate was sealed since he was born. How many times must humanity judge others like that as well without giving them a fair chance?

    "It would be very irresponsible of me to give you my thoughts as you are clearly incapable of handling the ones you already have" ~some guy in OD
    posted 30 August 2008 07:21 PM EDT (US)     17 / 27  
    Or units that counter the core of your army.
    Right, if Ox Carts are not available, spam Pegasus at full strenght!
    Using a handful of pegs vs ranged units is actually a very viable strategy. If they don't micro you own them, and if they do micro, they have to work harder than you.
    posted 18 September 2008 09:36 AM EDT (US)     18 / 27  
    Bump! . I've decided to revive this thread as I have done some work on this.
    I've figured the best solution for the ultimate consists not making a super-one-function-unit-handler, but actually breaking down into several classes and copy pasting the code to each function if necessary. This approach will allow a better behaviour configuration at cost of performance. But that doesn't really matters these days.

    I'm thinking of diving micro into several classes:
  • Archers;
  • Infantry;
  • Cavalry;
  • Heroes;
  • Myth Units;
  • Water Siege;
  • Water Rams;
  • Water Arrow;
  • Water Myth

    Every class will be implemented a specific micro behaviour - so for example, 30 hoplites don't get to attack a single RC.

    To show off a bit, I'm going uploading to AoMH a preview of this Micro. At this point it's only prepared for a Naval Arrow Fight on a specific map.
    It's very limited, however it's already good enough to beat me. And it has some room for improvement(!)...

    Go test it yourself!
    -invent00r

    My Work: 1 2 3 4 5 6 7 8 9 10

    WIP: Master XS Battle Micro AI
    Paused: AI (%4.247)
    Os segredos são de quem os souber guardar.

    [This message has been edited by invent00r (edited 09-18-2008 @ 10:11 AM).]

  • posted 18 September 2008 05:58 PM EDT (US)     19 / 27  
    Teehee, the same loophole still works. 1443 hp, 7 ships left. I should recode the triggers on my map to abuse your loopholes and we can have a rematch of AI vs triggers!
    Or I could just try to add in the regrouping thing we were talking about and see if my triggers can beat your AI then

    I'll give it a shot now without the 2 extra ships, and I'll try not to intentionally take advantage of the loophole

    ps. even though you're not using my triggers for this demonstration, don't I get a little bit of credit for placing that lake in the middle of grass A?
    posted 18 September 2008 06:35 PM EDT (US)     20 / 27  
    Pff. I can also do that and win with 7 ships. Putting you're ships in the middle "his safe path" is a good way to kill him yes - no doubt about that.

    Anyways, good luck applying that strategy in real game and not in simple demo scenario. .

    Why credit you? All you made was the scenario. I honestly thought it would embaress tagging your name to such a low quality and poorly design map. Oh well. . You made some cool triggers yes, but I wanted more ships for my demo.
    -invent00r

    My Work: 1 2 3 4 5 6 7 8 9 10

    WIP: Master XS Battle Micro AI
    Paused: AI (%4.247)
    Os segredos são de quem os souber guardar.
    posted 18 September 2008 10:12 PM EDT (US)     21 / 27  
    Haha, I know, I was mostly joking, since the only thing still there that I put in is the lake.

    Without blocking his retreat, I lose . Even on slow speed. Nice job.
    posted 20 September 2008 05:07 PM EDT (US)     22 / 27  
    I know you're jk. .

    Well, another difference from my AI to your Micro triggers is that, as soon as the victim ship is no longer being microed, it will stop fleeing. This means a faster responce time. Anyways, I've did some modifications and tried a AI battle.

    The outcome was - draw. No damage had been perfomed since reflexs are too fast.

    I'm recoding the whole script so I can add the concept of armies, better interaction with docks and safe locations, and finally try to implement this step:
    5. Find the total available damage output per volley of ships that are not running away, compare the attack to the lowest HP ships in range, and spread the attacks out for maximum kills per volley.
    I'm a little afraid of this last point, as accuracy can be a problem.

    Sadly, I discovered that AoT has ballances skrews when it comes to water - Trimeres have 16 of range instead of 12. This is a really odd and balance issue that I just can't understand.

    Anyways, I shall try to post an updated version today.
    -invent00r

    My Work: 1 2 3 4 5 6 7 8 9 10

    WIP: Master XS Battle Micro AI
    Paused: AI (%4.247)
    Os segredos são de quem os souber guardar.
    posted 20 September 2008 06:39 PM EDT (US)     23 / 27  
    posted 21 September 2008 08:30 PM EDT (US)     24 / 27  
    Here's something to consider: Make the ships move closer than necessary when attacking.

    When testing the longboat attack, I actually payed attention to the accuracy of longboat for the first time, and I realized it kind of sucks. Losing 1/3 or 2/3 of the damage every few shots is pretty crappy, but you can drastically improve accuracy by moving a few tiles closer.
    As a side efect, it makes it harder (for both sides) to run away.
    posted 21 September 2008 09:15 PM EDT (US)     25 / 27  
    I have tested the AI and senerio.

    The first round is AI vs AI.That is the default medium level AI VS the Micro AI, the result is the default AI won.
    Second round I tried using the red ships as player 2, playing at easy level, I won with 9 ships left, including the extra 2 timers.
    Third time, I played at hard level, the result is I won again, but with 5 ships left, several damaged and HP is low, the extra 2 ships also included.

    So far I've only played it several times. So I don't mean the micro AI is not strong, but I wonder why it's not that hard. Maybe I used it wrongly. Get confused a little.

    I will test it more later to see its advantages.

    I have a question: Will this AI be integrated into a big and well-rounded AI in the future, which can be used directly in random map games as the enemy player ?

    [This message has been edited by FlyDays (edited 09-21-2008 @ 09:20 PM).]

    posted 21 September 2008 09:38 PM EDT (US)     26 / 27  
    Haha testing it against the default AI is funny. I just tried it too and got the same result. This is because the first time the AI draws a ship back, the default follows it blindly and ends up with a handful of ships behind the main group of battlemicro AI ships, unintentionally exploiting a loophole that makes winning a walk in the park.

    Have you tried playing against it with even numbers yet? I find those 2 ships make a huge difference.
    posted 22 September 2008 04:32 AM EDT (US)     27 / 27  
    @:HailToTheOboe
    The time delay there is in updating the kb functions and the time a ship got killed can sometimes make the ships move closer. This might be good in terms of accuracy, however, it works both ways - he also gets a better accuracy. On the other side, if my army has a 3 ships advantage, its probably a good tactic to move close to his, difficulting his exit and making the battle to be played at higher speed.

    I think they made this low accuracy intentionally so the water battles were slow placed, and longboats are supposed to attack ramming ships anyways...

    @:FlyDays
    The Micro AI will lose because of what Oboe said, but also because it doesn't divide the strength of an attack. This is, Micro AI will use all his ships to fire against a 1hp enemy. As the default AI doesn't micro, he attacks the closest units - meaning they have less time travelling and more attacking -, and doesn't waste so fire power that needless. All this and the fact that sometimes it moves right into the Micro AI docks! This will mean instant lose in real games as default will no longer have a safe exit root.

    As the battle progress you can notice the HP of default AI winning, but in terms of numbers of boats, you do not until the very last moment.

    This project is being optimized to be used against humans, not AI. I'm hoping dividing the attack power per Longboats will change the outcome of this battles. I'm also rewriting the whole thing, so we'll see. .

    Trying playing against it without using 2 extra ships then. As for your question - maybe. I'm working towards it, however actually finishing looks is too far away. .
    -invent00r

    My Work: 1 2 3 4 5 6 7 8 9 10

    WIP: Master XS Battle Micro AI
    Paused: AI (%4.247)
    Os segredos são de quem os souber guardar.
    Age of Mythology Heaven » Forums » Modding and Scripting » Battle Micro AI
    Top
    You must be logged in to post messages.
    Please login or register
    Hop to:    
    Age of Mythology Heaven | HeavenGames