For a gameserver/backend, I have a navmesh for "walkable" areas in form of points/triangles.
Now I want to check every gametick if the client is still in a legit place and if he shots/casts a spell, if his target is in line of sight.
I found several possibilities, but I am not sure what is performance-wise ideal.
To check if the player is still in the allowed area (and not wallhacking) I would check if his position is in one of the triangles with a algorithm using barycentric coordinates like this: https://github.com/SebLague/Gamedev-Maths/blob/master/PointInTriangle.cs But this would mean that every gametick I have to check soooo much triangles.
To check if its LoS I could either check if the line from the player to its target crosses one of the "border" lines of the mesh (which have no other triangle next to it). Those border lines could be computed at bake time and are just a static list for each level. But still it would be a lot lines per check. Second option I found would be to start a Simple Stupid Funnel Algorithm (http://digestingduck.blogspot.com/2010/03/simple-stupid-funnel-algorithm.html) until LoS is broken.
The questions now are: How does a good gameserver handle this/can it be optimised? What way to check is the best/fastest? Is it common to only check if the position is legit every now and then or every gametick?
The Levels are fairly simple (~300 mesh-triangles, ~200 border lines, 10 players, 10 npcs maybe)