I have a little problem concerning detectors that I can't seem to figure out. More specifically how enemies can tell the difference between spotting a player and not being able to see him due to an obstacle between them.
Behold! My artistic sketch(and notes below) to help illustrate my question:
A) Enemies in my game will chase you down upon detecting you. To detect the player I have 1 rectangular active object act as their line of sight. If it collides with the player the enemy will rush towards him.
B) The problem is that if the enemy happens to be behind an obstacle it will just end up continuously knock into it forever since it will try to chase the player despite being blocked.
C) So I figured why not chase player only if the detector isn't also colliding with a wall? Well... It turns out that you can also hit an obstacle behind the player...
I'm coming up short on ideas. Best I've got so far is that I could have the enemies fire tiny detectors like bullets. Then if they hit the player, enemy start chasing but if detector hits a wall instead it'll just simply destroy itself. However having a bunch of enemies firing a bunch of detectors each isn't very efficient on performance, especially not when I want them to instantly react to the player's presence. Fastloops also become very performance heavy once multiple enemies starts checking for a player and obstacles.