Things have been moving slowly so I haven’t achieved much recently so here’s a small demonstration to show crude implementation of shader-based line of sight / fog of war and x-ray effect when behind other objects.
Backtop belong to the “upper floor” so it will only lit up if the character is on the same floor. I will improve the algorithm so that stuff that can be seen from the lower floor like trees should be lit.
Stress test 162 NPCs (can go higher if I zoom-in to avoid overdrawn) with their own light source, line of sight, x-ray, collision detection, and basic AI movement.
In the actual game there will be a maximum of 100 NPCs per map. So this is just to make sure I can still hit 60 FPS on this decade-old laptop when more features are added.
In the first video use of the shader was hard to spot. At first I thought “why did they abandon the idea?” So I watched it again to see that the Hero is still visible through the walls. I’m glad you made this second video - It shows the transparency trick very well.
Personally I think you could tone down the highlighted area a bit, or reduce gloss of some materials because they can be very bright.
Looking at the inventory: if the border between cells was thicker, it would help seeing which object is selected. I do understand it’s a draft, though. Also I can’t see the mouse pointer in UI.
Bug report: In the first video, and around 1:42, when you destroy the fireplace light casted by it remains.
From what I see, it’s a game I’d like to play Discovery + building = good fun. And I see your solutions are well thought, so I’ll wait for more to come.
Bug report: In the first video, and around 1:42, when you destroy the fireplace light casted by it remains.
The fireplace was not destroy, but instead got hidden by the fog of war.
In the first video use of the shader was hard to spot.
Well there’re actually 2 ways to hide any objects that block players from seeing their character:
If the character is inside a room, then the upper floors will be hidden. This was shown in the 1st clip.
If the character is behind any wall, then a simple shader will be used to modify the alpha value of the wall in screen space. This was shown in the 2nd clip.
Picrel is Inside a tunnel, which is not category as a room and thus only the shader kicked in.
Thanks to the new built-in profiler, I managed to bring PlayerControlScript:update() down from 0.4ms per frame to less than 0.1ms per frame , this was done on a 12-year-old laptop so expect much better performance on modern PC.