I would go for a method that uses line tracing as a final test, but a simpler method that cuts down the number of traces that you need to do. They call that a broad phase method sometimes.
One idea that comes to mind is by doing a range check before doing the line of sight check, if your AI has a limited vision range. Instead of checking Pythagoras between each AI and each player manually though, you can let the object overlap system optimize on this: Give players and AI a sphere collision shape. The AI’s sphere radius is set to his vision radius. Whenever a player enters the AI’s vision sphere, you ‘somehow’ store that the player is within the AI’s set of potentially visible players. When the player leaves the vision sphere, remove it from the set. Then when its time to do a query for players in vision, you know exactly the set of players that is in range reducing the number of raycasts you need to do. Edit: The assumption here is that because all the spheres are known to UE4’s collision detection system, it can optimize collision detection and does not check each sphere against each other sphere. I’m pretty sure UE4 does this.
So this idea is something that I tested in a multiplayer team vs team game project with vision mechanics like in Dota or League of Legends. In my experience it works quite well and significantly reduces the number of raycasts. The use of this broad phase depends on your context though, if actors are going to be close to each other a lot then less vision checks will be excluded and you will gain less performance.
I think raycasts or something like sphere traces will be necessary for your vision testing purposes and it boils down to finding a suitable broad phase method depending on your game. I would love to hear if someone has an idea that does not require raycasting.