Commit 26573d5f

– Only take the 10 closest light sources per tile into consideration
– Do not update per-tile light index information unnecessarily  

Resolves #58

Hi! Every tile can keep track of up to 10 different light sources that can affect it. Until now, every light source was taken into consideration (read: the first ten), so if a room (or more likely the great outdoors) had more than ten light sources, every light source above that threshold would have no visible effect.
This is now remedied by simply sorting the possible light sources by distance. While doing that, I also did a fair share of profiling to discover a lot of updates to these index values even though they didn’t change on every tick, that too is now remedied as well as some minor optimisations. So I will deem this good enough for the time being.
That means for now the remaining problem are some rather unfortunate recursive ambient light calculation issues when rooms are connected through windows. The end of this topic is finally in sight 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *