ID:2218893
 
At tgstation we were attempting to implement a limited FOV system, where the area behind a player (projected in a cone) would be obscured to the player.

atoms and items could be seen as normal (under a HUD overlay that darkened them out) but mobs and hud items would be obscured.

The issue we ran into is that it was too costly to iterate over the coned area on ever mob move and select the mobs to set their overidden image as hidden so they could not be seen.
https://github.com/tgstation/tgstation/pull/24537/files for our attempted implementation and discussion

Of course at 70 players this quickly brought our server to it's knees.

Therefore I am curious, does anyone know a better way to implement such a system? Is there a way to setup a layer such that it only obscures a subsection of layers (i.e the hud and mob layers) and leaves alone the object/item/atom layers? My naive understanding is that layers simply go on top of everything below them in priority

Anyway, curious to hear how others might have implemented it, or tips and tricks people might have for a more performant system
Also understand that reordering our layers would be quite difficult as most of our objects and items probably sit under the mob layer although if such a project was the only way to get this effect then it could be considered.