GAME INFORMATION
Sorry, I am reporting a bug from a video and do not own the game myself.
- GAME BUILD #: current
- GAME PLATFORM: ?
- OPERATING SYSTEM: ?
ISSUE EXPERIENCED
The boars in this video stop following because they interfere with each other in a relevant way: https://www.youtube.com/watch?v=lN-XEy05I1g&t=488
In general: the issue observed here is NOT that the pathing calculation is bad. It is NOT that melee units freeze indefinitely instead of pathing to their target. It is that they interfere which causes them, either individually or collectively, to move at an average slower speed, even to the point of moving slower than their target which has a slower movement speed.
This is relevant for the common situation of “melee units chasing archers”.
In this specific situation, we can note three important components of the situation: the boars are traveling towards the same target and so a straight-line path would cause them to converge, which they cannot do due to their nonzero size; the fact that their target is moving is probably causing their paths to rapidly be recalculated, which might cause rapid changes in path deconfliction priority (blocking); and the angle at which they are trying to move appears to be one which causes rapid changes in facing of at least the left-most boar.
If not for this last point, one boar would probably have gotten slightly ahead and then blocked the others. But instead, the changes between the two slightly wrong directions (since AoE2 doesn’t allow arbitrary facings, but instead quantizes them, with DE allowing more angles than AoC) mean the speed in the correct direction (the average of the component vectors) is slower, causing the boar to fall behind the slower villager.
FREQUENCY OF ISSUE
Conjecture: 100% of the time that units are in this specific spatial configuration.
REPRODUCTION STEPS
List CLEAR and DETAILED STEPS we can take to reproduce the issue ourselves… Be descriptive!
Bad path can be observed anytime that a group of melee units chases a group of ranged units. In many of those cases, it’s unclear why specific melee units move the direction they do, because it’s not clear which of the ranged units they are chasing. (It could be one in the front of the group, for example.) This example allows better understanding of a simpler situation, from which we can learn how to fix pathing in more complex situations.
EXPECTED RESULT
What was SUPPOSED to happen if the bug you encountered were not present?
The boars get closer to the villager, instead of falling behind due to interfering with each other.
In more detail; this does not really fit this field for a bug report but I will say it. The bad pathing for melee units chasing ranged units: probably has three main components:
- interference between the units when chasing the same target, especially a moving target, as shown here.
- pathing calculations that end up choosing routes through crowded spaces, instead of prioritizing uncrowded routes, especially when the relative movements of other units suggest that the chosen route will be occupied when it comes to travel through it (this is a difficult problem and I cannot offer implementation advice).
- picking the wrong target, perhaps based on the timing of when each enemy unit inflicted damage, and not switching targets in a timely manner. This type of pathing error can be more easily observed in melee vs melee fights, when units walk past several enemies that are attacking them in order to reach another unit which they are fixated on, perhaps because it was closer at the start of the fight (or perhaps because it inflicted damage first to a friendly a unit).
Points 1 and 2 are sort of related. I just want to mention a way of thinking about it: this might be too difficult to actually implement. Imagine an enemy unit traveling north, and three knights abreast chasing it. The knights begin individual pathing calculations, and let’s say at first they all still travel straight north, with the middle knight directly south.
First way of looking at it: left knight says, “I need to travel north-north-east, so I’ll try to cut in front of the middle knight.”
Second way of looking at it: all knights say, “in the next frame, I predict the other knights will be one step north. I cannot occupy the same space as them, and so I should continue north as well.”
After writing it out like this, there might be a solution: instead of doing pathing calculations based on the positions of units in the current frame, do: classify every unit as either moving or stopped (since this information is already visually displayed, this should be easy: units can get stuck in the “moving” animation on the edge of the map, due to other bugs, or simply when they haven’t decided their path is blocked, like with the old “push a deer through a gate without using a sheep” trick). For every unit that is moving, calculate paths as though that unit will continue moving in the same direction in the next frame, and so the path calculation uses its predicted position, not its current position (in the previous frame).
This might be enough to solve this stuttering problem with three boars. It wouldn’t solve the general problem of units not avoiding crowded spaces, wherein with a group of knights chasing other units we see many of the knights turn INWARDS into the other knights, instead of trying to spread out and avoid blocking the other knights.
But a lot of the blocking is probably also because the knights are choosing a bad target to chase. A melee-vs-melee fight gives obvious examples of when a melee unit should change targets (when it takes melee damage and is not about to reach its intended target), but fixing this would not fix the knights-chasing problem: in this, maybe knight on the outside is chasing a target on the inside of a line formation. If the knight is 3 tiles away from the formation, it might be like 3.5 tiles to a target in the center, and 3 tiles to a target on the side of the enemy formation: this small difference would not justify changing targets if the knight was alone.
But perhaps more intelligent target selection in this situation, with a crowd of units, could improve pathing calculations. It’s difficult for a normal player to view targets (the way that, for example, players using CaptureAge can view monk conversion targets, with lines drawn to them). The best a normal player could do to compare outcomes, with bad targeting vs good targeting, would probably be to pause the game in single-player mode and force-attack each individual knight to an appropriate target: with knights on the sides of the crowd directed to attack targets on the sides of the enemy formation, which is moving away.
Then you see how much this improves the performance of the knights. If they bump a lot less, then it might be worth thinking about when and how units could change their target selection in this kind of situation; perhaps taking into account how crowded is the path to their current target, and how crowded the path to an alternate target would be.
Observation: the proposed fix to issue #1, of using the predicted location instead of current location, might basically break the ability to block other units by rapidly clicking to move in front of them, most frequently used during the intense fighting at the start of Rage Forest matches, or to block during boar laming attempts (either blocking the boar, or blocking the scout that’s stealing the boar). Testing might show this, but one solution might be to only predict the movements of friendly units: a unit could still move into the space that an enemy would move into, instead of predicting that space will be occupied.
IMAGE
The boars stop following: