Hello pkyrkos,
with the old system, which consists of sending a ray to all near monsters, it was very heavy with a big group of monster. And of course the computation grew exponentially.
With this new method, it grows linearly with the number of monsters.
And I do another optimisation, not explained here for simplicity reason, which consists of recalculating visibility only when a character move from one cell to another different one. (and when something changes in the current visibility, like a door closing/opening). So 1 or 2 calculation of the visibility for each monster every second. If you have 60 monsters at 60 FPS, it should be something like two visibility calculations per frame.
I didn't make a bench, but this algo looks like to be super light. (I had an increase in FPS). It's an old school 2D grid algo after all :)
WildFactor
Me joined
This member has provided no bio about themself...