Help needed with some kind of Kodo TAG AI

world23wc3

Member
Reaction score
6
I've ran into some difficulties as a GUI map maker. Recently I've started to work on a kodo TAG like map and now that I have started to work on the "kodo AI"/"chaser AI" I've run into some problems. I've used the same triggers as the post at the bottom of page 1 on this link. The kodos simply get stuck (see picture below) and I can't figure out a way to solve this problem. Is the terrain too advanced for the kodos to handle or is it the blockade?

219wjn6.png
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
Its the default behavior of the wc3 AI.
A unit is trying to attack back at whatever is attacking it. The default AI is not smart enough to understand that it can not reach its target. It is especially not smart enough to understand it has to attack the walls first.
There is not too much you can do. One thing you can try which may or may not work depending on your map is to give your walls an attack too. Make the walls deal 0-0 damage, this way they will get the same priority as the tower. Problem is that units get a higher priority then buildings, so if you have any attacking units behind those walls you will run into the same problem once again.
In that case the only solution is to script the AI by hand which can be a shit ton of work.
 

jonas

You can change this now in User CP.
Reaction score
66
It's the blockades, not the terrain.

You could check if the kodos moved or attacked every once in a while if they are attacked, and if not, make them attack a random target close to them. It's weak, but probably better than having them stuck.

If it is possible to check if a kodo acquired a target on its own, you can monitor whether the kodo gets stuck or not and assign a random new target (in range), possibly targetting walls in specific.

I didn't check the current AI, so I don't know what other options you have.

If you have more time, you could implement a pathfinding algorithm, but you might have to change the map. As nodes, use squared fields. Make sure that you can easily tell whether two adjacent fields have an edge or not. If a unit is to be attacked, make a breadth first search for that unit's field and find the first field on the path with units and attack them... This of course changes the behavior of the kodos ;)
 

world23wc3

Member
Reaction score
6
Its the default behavior of the wc3 AI.
A unit is trying to attack back at whatever is attacking it. The default AI is not smart enough to understand that it can not reach its target. It is especially not smart enough to understand it has to attack the walls first.
There is not too much you can do. One thing you can try which may or may not work depending on your map is to give your walls an attack too. Make the walls deal 0-0 damage, this way they will get the same priority as the tower. Problem is that units get a higher priority then buildings, so if you have any attacking units behind those walls you will run into the same problem once again.
In that case the only solution is to script the AI by hand which can be a shit ton of work.

It's the blockades, not the terrain.

You could check if the kodos moved or attacked every once in a while if they are attacked, and if not, make them attack a random target close to them. It's weak, but probably better than having them stuck.

If it is possible to check if a kodo acquired a target on its own, you can monitor whether the kodo gets stuck or not and assign a random new target (in range), possibly targetting walls in specific.

I didn't check the current AI, so I don't know what other options you have.

If you have more time, you could implement a pathfinding algorithm, but you might have to change the map. As nodes, use squared fields. Make sure that you can easily tell whether two adjacent fields have an edge or not. If a unit is to be attacked, make a breadth first search for that unit's field and find the first field on the path with units and attack them... This of course changes the behavior of the kodos ;)

I've come up with a few triggers, it still does not work as intended.

Okay, so this is the main "get target" trigger which basically tells the "kodos" (I call them "prebens") where to attack move to if they have no target.
Trigger:
  • Prebens chase target
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • -------- ALL ESCAPERS THAT ARE ALIVE --------
      • Set TempUnitGroup[0] = (Units in (Playable map area))
      • Unit Group - Pick every unit in TempUnitGroup[0] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 12 (Brown)
            • Then - Actions
              • Unit Group - Remove (Picked unit) from TempUnitGroup[0]
            • Else - Actions
              • Do nothing
      • -------- ALL PREBENS THAT ARE ALIVE --------
      • Set TempUnitGroup[1] = (Units in (Playable map area))
      • Unit Group - Pick every unit in TempUnitGroup[1] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Not equal to Player 12 (Brown)
            • Then - Actions
              • Unit Group - Remove (Picked unit) from TempUnitGroup[1]
            • Else - Actions
              • Do nothing
      • -------- ISSUE ATTACK FROM TempUnitGroup[1] TO ATTACK TempUnitGroup[0] --------
      • Unit Group - Pick every unit in TempUnitGroup[1] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of (Picked unit)) Equal to (Order(none))
            • Then - Actions
              • Unit - Order (Picked unit) to Stop
              • Set TempPoint[0] = (Position of (Random unit from TempUnitGroup[0]))
              • Unit - Order (Picked unit) to Attack-Move To TempPoint[0]
              • Custom script: call RemoveLocation (udg_TempPoint[0])
            • Else - Actions
              • Do nothing
      • Custom script: call DestroyGroup (udg_TempUnitGroup[0])
      • Custom script: call DestroyGroup (udg_TempUnitGroup[1])


This trigger is supposed to check if a kodo stands still or not by comparing x- and y-coordinates, 3 second interval. If the kodo stands still it will try to find a target. The target aquiering mechanism has two possible ways. If "target"(explained in the 3rd trigger) is alive the trigger will order the kodo to move to the target (note that walls have 1-1 dmg (couldn't make it 0-0 dmg) and will make kodos attack them if they come close). If "target" is dead the trigger will try to find a new target within 1000 range of the kodo and order the kodo to attack it.

Improvements:
*Check if kodo has attacked lately
Trigger:
  • Untitled Trigger 001
    • Events
      • Time - Every 4.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Set WriteIndex[0] = (WriteIndex[0] + 1)
          • Set unit[WriteIndex[0]] = (Picked unit)
          • Set y_coordinate[WriteIndex[0]] = (Y of (Position of (Picked unit)))
          • Set x_coordinate[WriteIndex[0]] = (X of (Position of (Picked unit)))
      • Wait 3.00 seconds
      • For each (Integer A) from 1 to WriteIndex[0], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (X of (Position of unit[(Integer A)])) Equal to x_coordinate[(Integer A)]
                  • (Y of (Position of unit[(Integer A)])) Equal to y_coordinate[(Integer A)]
            • Then - Actions
              • Set TempPoint[1] = (Position of unit[(Integer A)])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (target is alive) Equal to True
                • Then - Actions
                  • Unit - Order unit[(Integer A)] to Move To (Position of target)
                • Else - Actions
                  • Unit - Order unit[(Integer A)] to Attack (Random unit from (Units within 1000.00 of TempPoint[1] matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True)))
              • Custom script: call RemoveLocation (udg_TempPoint[1])
            • Else - Actions
              • Do nothing
      • Set WriteIndex[0] = 0


This trigger is supposed to help kodos find a "target" by "marking" (storing a unit as a variable) a nearby building from the building that died recently.

Note that this trigger is not ready for "global" use (1-base limit for now)
Trigger:
  • Untitled Trigger 003
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Killing unit)) Equal to Player 12 (Brown)
    • Actions
      • Set TempPoint[2] = (Position of (Dying unit))
      • Set target = (Random unit from (Units within 150.00 of TempPoint[2] matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True)))
 
Last edited:

world23wc3

Member
Reaction score
6
I've come up with a few triggers, it still does not work as intended.

Okay, so this is the main "get target" trigger which basically tells the "kodos" (I call them "prebens") where to attack move to if they have no target.
Trigger:
  • Prebens chase target
    • Events
      • Time - Every 2.00 seconds of game time
    • Conditions
    • Actions
      • -------- ALL ESCAPERS THAT ARE ALIVE --------
      • Set TempUnitGroup[0] = (Units in (Playable map area))
      • Unit Group - Pick every unit in TempUnitGroup[0] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Equal to Player 12 (Brown)
            • Then - Actions
              • Unit Group - Remove (Picked unit) from TempUnitGroup[0]
            • Else - Actions
              • Do nothing
      • -------- ALL PREBENS THAT ARE ALIVE --------
      • Set TempUnitGroup[1] = (Units in (Playable map area))
      • Unit Group - Pick every unit in TempUnitGroup[1] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Owner of (Picked unit)) Not equal to Player 12 (Brown)
            • Then - Actions
              • Unit Group - Remove (Picked unit) from TempUnitGroup[1]
            • Else - Actions
              • Do nothing
      • -------- ISSUE ATTACK FROM TempUnitGroup[1] TO ATTACK TempUnitGroup[0] --------
      • Unit Group - Pick every unit in TempUnitGroup[1] and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Current order of (Picked unit)) Equal to (Order(none))
            • Then - Actions
              • Unit - Order (Picked unit) to Stop
              • Set TempPoint[0] = (Position of (Random unit from TempUnitGroup[0]))
              • Unit - Order (Picked unit) to Attack-Move To TempPoint[0]
              • Custom script: call RemoveLocation (udg_TempPoint[0])
            • Else - Actions
              • Do nothing
      • Custom script: call DestroyGroup (udg_TempUnitGroup[0])
      • Custom script: call DestroyGroup (udg_TempUnitGroup[1])


This trigger is supposed to check if a kodo stands still or not by comparing x- and y-coordinates, 3 second interval. If the kodo stands still it will try to find a target. The target aquiering mechanism has two possible ways. If "target"(explained in the 3rd trigger) is alive the trigger will order the kodo to move to the target (note that walls have 1-1 dmg (couldn't make it 0-0 dmg) and will make kodos attack them if they come close). If "target" is dead the trigger will try to find a new target within 1000 range of the kodo and order the kodo to attack it.

Improvements:
*Check if kodo has attacked lately
Trigger:
  • Untitled Trigger 001
    • Events
      • Time - Every 4.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in (Units in (Playable map area) owned by Player 12 (Brown)) and do (Actions)
        • Loop - Actions
          • Set WriteIndex[0] = (WriteIndex[0] + 1)
          • Set unit[WriteIndex[0]] = (Picked unit)
          • Set y_coordinate[WriteIndex[0]] = (Y of (Position of (Picked unit)))
          • Set x_coordinate[WriteIndex[0]] = (X of (Position of (Picked unit)))
      • Wait 3.00 seconds
      • For each (Integer A) from 1 to WriteIndex[0], do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • And - All (Conditions) are true
                • Conditions
                  • (X of (Position of unit[(Integer A)])) Equal to x_coordinate[(Integer A)]
                  • (Y of (Position of unit[(Integer A)])) Equal to y_coordinate[(Integer A)]
            • Then - Actions
              • Set TempPoint[1] = (Position of unit[(Integer A)])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (target is alive) Equal to True
                • Then - Actions
                  • Unit - Order unit[(Integer A)] to Move To (Position of target)
                • Else - Actions
                  • Unit - Order unit[(Integer A)] to Attack (Random unit from (Units within 1000.00 of TempPoint[1] matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True)))
              • Custom script: call RemoveLocation (udg_TempPoint[1])
            • Else - Actions
              • Do nothing
      • Set WriteIndex[0] = 0


This trigger is supposed to help kodos find a "target" by "marking" (storing a unit as a variable) a nearby building from the building that died recently. It kinda tells the kodo that there is nothing in the way to attack "target"

Note that this trigger is not ready for "global" use (1-base limit for now)
Trigger:
  • Untitled Trigger 003
    • Events
      • Unit - A unit Dies
    • Conditions
      • (Owner of (Killing unit)) Equal to Player 12 (Brown)
    • Actions
      • Set TempPoint[2] = (Position of (Dying unit))
      • Set target = (Random unit from (Units within 150.00 of TempPoint[2] matching (((Matching unit) belongs to an enemy of Player 12 (Brown)) Equal to True)))

Sorry for all the bad variable naming.
I will try to upload my map shortly to give you guys a chance to try things out
 

world23wc3

Member
Reaction score
6
I'm not sure. Triggers didn't turn out as I wanted them. AI is a bit to hard for me to handle when it comes to GUI triggers.
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
You need to be more specific if you want to get any help. I can not know what "didnt turn out as I wanted" means.
 

world23wc3

Member
Reaction score
6
You need to be more specific if you want to get any help. I can not know what "didnt turn out as I wanted" means.

I've decided to stop my "AI"-development. I figured out that I might aswell share how far I came and what ideas I had in mind. I cannot be more specific on what is working or not nor am I asking for any help with it. If you want to continue the development feel free to do so.
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • The Helper The Helper:
    So what it really is me trying to implement some kind of better site navigation not change the whole theme of the site
  • Varine Varine:
    How can you tell the difference between real traffic and indexing or AI generation bots?
  • The Helper The Helper:
    The bots will show up as users online in the forum software but they do not show up in my stats tracking. I am sure there are bots in the stats but the way alot of the bots treat the site do not show up on the stats
  • Varine Varine:
    I want to build a filtration system for my 3d printer, and that shit is so much more complicated than I thought it would be
  • Varine Varine:
    Apparently ABS emits styrene particulates which can be like .2 micrometers, which idk if the VOC detectors I have can even catch that
  • Varine Varine:
    Anyway I need to get some of those sensors and two air pressure sensors installed before an after the filters, which I need to figure out how to calculate the necessary pressure for and I have yet to find anything that tells me how to actually do that, just the cfm ratings
  • Varine Varine:
    And then I have to set up an arduino board to read those sensors, which I also don't know very much about but I have a whole bunch of crash course things for that
  • Varine Varine:
    These sensors are also a lot more than I thought they would be. Like 5 to 10 each, idk why but I assumed they would be like 2 dollars
  • Varine Varine:
    Another issue I'm learning is that a lot of the air quality sensors don't work at very high ambient temperatures. I'm planning on heating this enclosure to like 60C or so, and that's the upper limit of their functionality
  • Varine Varine:
    Although I don't know if I need to actually actively heat it or just let the plate and hotend bring the ambient temp to whatever it will, but even then I need to figure out an exfiltration for hot air. I think I kind of know what to do but it's still fucking confusing
  • The Helper The Helper:
    Maybe you could find some of that information from AC tech - like how they detect freon and such
  • Varine Varine:
    That's mostly what I've been looking at
  • Varine Varine:
    I don't think I'm dealing with quite the same pressures though, at the very least its a significantly smaller system. For the time being I'm just going to put together a quick scrubby box though and hope it works good enough to not make my house toxic
  • Varine Varine:
    I mean I don't use this enough to pose any significant danger I don't think, but I would still rather not be throwing styrene all over the air
  • The Helper The Helper:
    New dessert added to recipes Southern Pecan Praline Cake https://www.thehelper.net/threads/recipe-southern-pecan-praline-cake.193555/
  • The Helper The Helper:
    Another bot invasion 493 members online most of them bots that do not show up on stats
  • Varine Varine:
    I'm looking at a solid 378 guests, but 3 members. Of which two are me and VSNES. The third is unlisted, which makes me think its a ghost.
    +1
  • The Helper The Helper:
    Some members choose invisibility mode
    +1
  • The Helper The Helper:
    I bitch about Xenforo sometimes but it really is full featured you just have to really know what you are doing to get the most out of it.
  • The Helper The Helper:
    It is just not easy to fix styles and customize but it definitely can be done
  • The Helper The Helper:
    I do know this - xenforo dropped the ball by not keeping the vbulletin reputation comments as a feature. The loss of the Reputation comments data when we switched to Xenforo really was the death knell for the site when it came to all the users that left. I know I missed it so much and I got way less interested in the site when that feature was gone and I run the site.
  • Blackveiled Blackveiled:
    People love rep, lol
    +1
  • The Helper The Helper:
    The recipe today is Sloppy Joe Casserole - one of my faves LOL https://www.thehelper.net/threads/sloppy-joe-casserole-with-manwich.193585/

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top