Currently I have a “does path exist” decorator that will determine if my AI is unable to reach a destination and if not this will be due to walls that the player has built. Now I’m trying to make code that determines which walls are responsible for the barrier so they can be attacked.
My first thought is something along the lines of each time a wall is placed, discover adjacent walls and add them all to a shared group. then, when the actor being sought is not reachable, fire line traces in a radial pattern at the actor location to discover the walled group that’s responsible. The walled group will have to be discovered(line hit) on all sides of actor otherwise it could just be a lone wall sitting inside the walled in area and thus not responsible for the barrier. However, there are other checks that would have to be done and it’s getting complicated and I’m curious if there is a simpler way.