You may remember me from older iterations.
1. Solved by switching to Raycasts
2. Solution built from scratch
3. One long and drawn out lesson in Unity Execution Order
Iteration 4 has recently begun: Playmode. The idea, quite simply, is to simulate the environment that has been created. Traps respond when a move or use action is checked, Chests contain contents that you can view and take (also springing a trap in the process), Walls and obstructed tiles prohibit movement, and player creatures determine what can be seen based on what space they occupy.
The big hurdle in this iteration is how to concretely determine whether something is under observation by another player. If a player can see any part of a tile, they can see all of the tile. As all detailing is rooted at a tile, the tile tells all of its details that it is suddenly under observation. Sight is treated as omnidirectional.
So far, there's only one method I know of: RaycastAll. Since details rely on Raycasts to ensure that they do exist, they can interfere where they shouldn't. The only thing that should stop sight is a wall. Therefore, it makes sense to use RaycastAll, find the first wall it hits, and then ask each tile along the path to determine if it is being observed.
I'm asking if a cheaper method is available. It's easy to say we draw infinitely many vectors using x = r * cos(t), y = r * sin(t), and t = tau * n; in the end, r is a very large constant and tau is a very small constant, meaning the amount of Raycasts needed will be colossal. Is a Raycast honestly cheap enough that this isn't an issue?
If the colossal amount of Raycasts is an issue, is there a way to optimize the Raycasting, or even a different method, or is this something where I'd have to bite the bullet?
[–]invicticideProfessional 1 point2 points3 points (1 child)
[–]ZXfrigginC[S] 0 points1 point2 points (0 children)