Is it possible to find line of sight with a navigation mesh?

Started by
2 comments, last by Crayz92 7 years, 5 months ago

Hello, I assume there's an algorithm out there for this but I'm having trouble finding it. I am using a navigation mesh to calculate paths and hope to use the mesh for determining line of sight as well, if possible. I'm not very smart with geometry, I'd appreciate as much info as possible

Problem:

Players shouldn't be able to see around corners. The server needs to be aware of what the player can see without relying on the client's view. Raycasts will only work client-sided. I prefer a cheap method that gives performance over an expensive method with great accuracy.

Diagram:

http://puu.sh/sdcRP/cc2b9fa39d.jpg

Marked yellow are vertex points that are within the line of sight, dark green M are enemies outside line of sight. I can use client-side lighting to generate shadows and hide monsters accordingly however the server needs to be able to do this strictly by code. It's not necessary to find line of sight in a 360 degree radius, I only need to know if point A can be seen by point B strictly by traversing vertex points on the nav mesh

Advertisement

Raycasts will only work client-sided

Why?

A navmesh lacks some of the important information you need to do this correctly, because it tells you nothing about the gaps in the mesh. In your example picture, it has no way of knowing whether the gaps at the side of the ramps are open or if they're actually tall and impassible walls.

The algorithm you want is basically the raycast algorithm; so you may as well get the geometry working server-side.

Yeah, maybe if your game has very specific requirements, but otherwise, a navmesh might make something impassible because it's a steep drop, water, or a half height wall. Things that don't break LoS.

It's not about relying on the clients view, the server knows where the player is and should be able to do the raycasts on it's side accurately.

I hoped there was an algorithm for navmesh LoS, I've been avoiding utilizing collision data on the server but now it seems inevitable. Thanks for the replies :)

This topic is closed to new replies.

Advertisement