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
 
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 ;)
 
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:
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
 
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.
 
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.
 
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.
  • Varine Varine:
    And since almost all of my programming experience is with defunct shit now, I figure my best place is helping preserve legacy stuff. Which I don't know how to do necessarily, but I need some kind of a hobby and figuring out how older things worked is the only shit that really interests me. Well soldering and restoration is fun too, but no one is bringing me new stuff to fix and restore, so it's mostly old shit, and I LOVE OG Xbox so much. I want to make sure it can function as long as possible, until someone can effectively emulate it at least. I have like 15 I was going to fix over the winter and didn't get to.
    +1
  • Varine Varine:
    I also have a couple OG gameboys, but idk if I can do that without like, manufacturing new parts that no one makes anymore and I can't do that right now
  • tom_mai78101 tom_mai78101:
    Currently in the middle of getting the probate process going. We're doing the informal probate process.
    +3
  • Varine Varine:
    A probate is usually done with a will, yes? If so I am sorry for your loss
    +1
  • The Helper The Helper:
    Yeah Tom, me too sorry for your loss buddy my mom told me she finds out her olds friend died from Google searching them. She had not talked to one of her old friends in a year and found out she died from Google. Also another one in the same session. RIP all of them my sincere condolences Tom
    +1
  • Varine Varine:
    We have some elderly guests that regularly come hang out at the bar at the end of the night, and every once in a while we don't see someone for a few weeks and then someone shows up with their obituary.
  • Varine Varine:
    We usually let them do their memorials there in the morning if they want to and I'll make them some snacks and drinks. There was one guy named Tom that came in like every night and would sit by himself and get a bunch of soup and a glass of wine. idk why but he LOVED our fucking soup, like he would order a fucking quart of it at a time and would always get so sad when we stop doing it for the summer.
    +1
  • Varine Varine:
    But he also loved our calamari, which is another thing I hate but it sells super well so I can't change it. There was one day he came in and was asking me how to make it, because he tried to at home once in the off season when we stop running it and he really wanted it lol
  • Varine Varine:
    I think he's one of the only people I've made recipes for for free because he really wanted a broccoli cheddar, and it was like dude I don't have a recipe, it's just whatever I have, but here, this is how you do it
  • Varine Varine:
    I don't think he ever figured out how to do the calamari in a pan though, like idk how to do that either. He was afraid of the at home deep fryers though and it's like yeah, that's fair, I am too
  • Varine Varine:
    He was just such a sweet old man, we had two servers pregnant and they held a baby shower together, he was soooooo fucking excited to get to see a baby. Unfortunately he died a month or so before they were born
  • The Helper The Helper:
    So I decided to Google some people that I had not seen or heard from in a while and sure enough one of my old best friends, we had a falling out years ago but whatever, find out he died of Pancreatic Cancer in January. I have also lost a few of my closer acquaintances from growing up the last year. Getting old - people die - I kinda thought it was going to be this way a few years ago....
    +2
  • The Helper The Helper:
    Forum running super slow again
  • Ghan Ghan:
    Not really clear from the stats as to what is causing the slowness.
  • Ghan Ghan:
    We get a lot of guest traffic so it may just be the load is getting too high and not from any particular source.
  • Ghan Ghan:
    Looks like the server is maxed out on CPU.
  • Ghan Ghan:
    Oh it looks like a lot of the traffic is Silkroad Forums. That domain isn't protected by Cloudflare.
  • Ghan Ghan:
    But the old Silkroad site is still on its own server. I just had a test site set up on this server for it.
  • Ghan Ghan:
    I just disabled that test site. Let's see if that helps the load.
  • Ghan Ghan:
    Looks much better already.
  • The Helper The Helper:
    I had actually forgot about the Silkroad site. I had asked
  • The Helper The Helper:
    SD Ryoko about it and he said the couple of people left on there really like it, that was a few years ago, maybe I should check back
  • jonas jonas:
    I guess when you're getting old, and the last day of soup season draws near, you start wondering
  • jonas jonas:
    will I make it to the start of the next season? or was this the last time I'll ever have my favorite dish?
  • The Helper The Helper:
    I am doing my first Vibe Coding project. In installed the environment and tools according to instructions but it is all chat doing this for me at my direction. It is fun really and holy shit I might finish in 2 hours what it would have taken a day to in my Access and this would be an electron app complete new

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials
      Top