#AI cannot fly straight to set attack angle

3 messages · Page 1 of 1 (latest)

left relic
#

I know that there should be improvements to the AI coming up later, but to keep track of a specific issue, the current AI logic for flying the ship seems to differ when set as a flying destination and as an attack target (this difference is likely intentional, but has a negative player experience in the current implementation)

If I order the ship to fly to a spot that's straight forward, it will fly straight forward to that spot, as expected. If I order the ship to fly to an attack position that would require simply to fly straight to the spot, the ship will instead fly away from the target and then try to side-strafe to the target position. The attached GIF recording shows the difference in whether the target position is a green (just move) or red (attack). While this reproduces even on stationary targets, such as in the GIF, the situation is much worse with moving enemies as the ship is never able to reach its desired attack position and angle because it tries to take the non-optimal route to do it.

elder hazel
#

So, the reason that this is happening is, as you mentioned, due to differences in how ships move and attack. Specifically, when attacking, ships will prioritise meeting the desired relative attack rotation before meeting the desired attack angle (which is exactly what's going on in your gif). This is done both because attack positions are likely to change position (while movement commands are always static), and to prevent attacking with an undesired rotation, potentially exposing vulnerable parts to an opponent. As a functional example, lets I have ship A trying to attack ship B at a 90d angle (as shown below). Currently it'll first try and keep attack rotation steady (facing the opponent), then when possible it'll try and move to its desired attack angle. If attack angle is prioritised over attack rotation, depending on implementation, ship A in this example would either move straight forwards to its desired destination (showing its left side) or would immediately snap to the desired attack rotation, showing its right side to the opponent while it moves to to the correct attack angle. If the desired attack angle is constantly in motion (such as if you're trying to orbit an opponent), this ends up with your ship never actually facing the "correct" way.
With all of that being said, your point is definitely valid, it's just a matter of figuring out how to smooth out movement in your example without completely breaking it in other places. Maybe the way it initially approaches a desired attack angle should be different than how it maintains that position?

left relic
#

Maybe the AI should have some kind of calculation about the thrusters to figure out that if it cannot reach the requested attack position in the relative angle, it should forfeit that and prioritize getting to the attack position even if that would expose "wrong side" for some time?