CameronJung / ChopperTankFlak

A simple rock-paper-scissors strategy game
0 stars 0 forks source link

AI will sometimes pass up an opportunity to destroy a unit #24

Closed CameronJung closed 2 weeks ago

CameronJung commented 5 months ago

Sometimes the AI will move a unit next to one of the player's units, but not destroy it.

CameronJung commented 5 months ago

This bug is rare, moving forward accounts of its occurrence should be documented here to pin down the cause.

CameronJung commented 5 months ago

While play testing Operation: Flyswatter I observed this bug, where an AI helicopter didn't attack an adjacent player's tank. The tank was in a canyon. This might mean that the AI isn't recognizing attacks that are on tiles the AI's unit can't traverse.

CameronJung commented 2 months ago

I had another thought on this issue recently too. Currently, attack commands have their safety assessed for the hex of the target. Of course, this is erroneous since the attacking unit doesn't move to where the destroyed unit is, but the implications are usually close enough to not matter. It might be the case that moving next to the space of the unit keeps it out of harms way, but the would be victim is on a hex that is covered by another unit.

CameronJung commented 2 months ago

I might have figured it out. Yesterday I found some boolean logic that erroneously tosses out attack possibilities for units on tiles that the attacking unit can't cross. This seems to have fixed the issue, but I want to make sure so I will wait to mark this as done.

CameronJung commented 2 weeks ago

This still happens with the new AI update in 1.6; to prevent it I added a safeguard that checks if the AI could destroy a unit whenever it moves a unit. Improving the AI so that it never misses an opportunity would be better, but this should be enough to close the issue for now.