Closed FrostionAAA closed 3 years ago
@FrostionAAA , can you modify the map and remove the connection between those territories? Then run the game and see if it still is stacking units.
I went stepped through the code during the Orcs turn and it recognized that it couldn't travel across those connections. It looked like it was stacking not because there was a canal but because it the AI doesn't see any reason to move the units. It didn't consider the territories that it can reach as being important to put units in. That's why I'd like to see what happens if the connections are gone completely. I'm expecting that it will still stack.
"can you modify the map and remove the connection between those territories? Then run the game and see if it still is stacking units." @trevan I already did this and they don’t do the same thing. There is actually a new XML with the map that has the connections removed.
But I can make a save and show you. It will take bit ;-)
Hmm, I thought that new XML map just turned off the canal piece. Didn't realize it removed the connections entirely.
If you could get me a saved game with the same set of territories owned by the Orcs and the same set of units but without the connections, that would be helpful. You could maybe do it with the edit mode or maybe change the xml to set it up that way. That way, I can compare and contrast the two situations and see why the AI is reacting differently.
NoUnitsAtHordeCapitals.zip In this save, you can see that the 4 Horde capitals are empty, as the AI units have not been given the option to use the blue arrow connections / territories with restricting canals. Only containing units that have just been placed. You can scroll through history and see that they were placed during round 5. Something fishy is going on.
I've modified the engine to remove the connections between Orgrimmar and the other two. After making that change and playing the original save, it does move the units. So, I just need to figure out what triggers the different behavior.
I think I've figured out the reason but I don't know how to solve it.
What happens is that the AI calculates the "value" of each territory. The value is a calculation that includes the distance to each enemy capital/factory, the production value of nearby enemy/neutral territories (within distance of 2), and how many total nearby territories (within distance of 6). Once it calculates the value of each territory, it then goes through each territory that has units available to move and moves them to the territory with the best value.
So, when the connections exist, Orgrimmar has a higher value than The Forlorn Ridge and Durotar because it is connected to more nearby enemy territories than the others. This causes all the units in Orgrimmar, The Forlorn Ridge, and Durotar to go to Orgrimmar. When the connections don't exist, The Forlorn Ridge has a high value and units go that direction.
The reason I'm not sure how to fix this is because the land value is currently independent of the units. Making it dependent on the the units will cause performance issues. Another idea is to decrease the value of nearby territories if there is a canal connecting it.
@FrostionAAA , do you know if there are other maps that use canals in land connections?
I've created #8289 to potentially fix this. What I've done is added a new condition when calculating the distances between territories. If there is a canal and it isn't open, then the connection between the territories will be ignored. For Warcraft War Heroes, it should make the AI almost treat the air canals as non-existing. The units, though, should still be able to travel through it. So, when it has a unit that needs to move and the shortest path to its destination goes through the air canal, it should take it.
@trevan Sounds sweet :-D I am eager to test it out. And I do not know of other maps that uses "excludedUnits" with canals, but as the option is there, then I would imagine that there could potentially be some, or maybe just in the future ;-)
Unless I'm misunderstanding G 40 uses excluded units in canals.
I think the 1941/1942 v3 does as well.
Ahh...yea, not with land connections tho
Unless I'm misunderstanding G 40 uses excluded units in canals.
I think the 1941/1942 v3 does as well.
I believe G 40's canals are sea only. I'm looking for land-based canals.
yea just caught that sorry :)
The linked issue was merged so I think this can be closed.
The Issue: The Hard / Easy AI cannot handle and make use of territory connection with canal attachments that only allows certain unit types traverse the canal.
Canals like this one from Warcraft War Heroes, that only allows a group of air units to cross:
I have here a save game made in the current and newest v0.1.6 Warcraft Warheroes map. It has AI stacking up at all four Horde capitals, as they all have territory connections with restricing canals / blue arrows:
MAPv0.1.6-AI-Airways.zip
As this screenshot shows, the AI starts stacking up units at several locations, notably at the Horde players’ capitals, as these places all have “Airways” / such restricting canals, visually marked with blue arrows.
Why is it stacking up units?: My theory (without being able to decipher savegames and cryptic code) is that the AI actually wants, tries and fails to move the units via connections with canals … fails as only Air may cross … and then just leaves the units standing there. The AI can have units standing still at the canals for many rounds, but sometimes after many rounds the map situation makes the AI finally make another decision and moves the same units via another route.
What should happen instead?: I guess that AI should determine what kinds of units can / cannot make use of that individual canal while figuring out how to proceed with CM and NCM. Even better, also AI should take same info in mind when doing threat assessments / determining what enemy units might cross and attack via specific canal routes. (The Warcraft map uses only 1 canal type, excluding land units from passing, but in theory maps might make use of several types of limited access)
PS: I have seen the AI successfully make use of restricting canals if it is only trying/wanting to move one or more units that may actually pass: