That moment when you thought something would be easy to implement and then it broke all the old code. :(
This is a great example of a "simple to think about, hard to implement" game mechanic. It sounds great on paper but has a very fatal flaw when implemented that I didn't catch.
The short version of the mechanic is that
1- The level has torches around it that can be lit up by the player.
2 - The objects loaded in when the level is built are hidden at first, and when a torch is lit, it enables a list of objects to show themselves. (Each torch has previously scanned to build this list at the start of the level).
3 - The player can light their own "torch" to reveal objects nearby as they wander the level, and use this torch to light the unlit ones.
The system worked great but it had a major flaw. I recently introduced the player being able to carry a dynamic light source around, and that broke everything.
The player controlled object has to erase it's own trail, because if the player moves away from something dark it should hide itself again. Otherwise the player's light source just becomes a fancy paintbrush that reveals everything in the level.
But in adding that bit, the player is now overwriting the previously lit objects.
The result is that lighting a torch and then moving away will hide the objects again even though the torch right next to them is still lit. Doh! x_x
I got a few ideas how to go about fixing it. The tricky part is to do it without needing to always re-find the objects they lit up, as that's the main memory hog of the system. But I need a break for now. My current fix idea is to have the torches "tag" objects as "skip hiding this one", since in this system (for now) the torches never turn off again.
In the end, it will probably cost me an extra few minutes tomorrow to fix. However, it's a great example of why planning is very important.
Anyway, I just thought it might be fun to share this little game mechanic planning mishap. This is why testing your ideas out on paper is so important, as well as running over all combinations of game elements during the design.
Remember to check out Drake at https://darkgriffin.itch.io/drake if you haven't played it yet! It's the latest game I've made and I'd love some help sharing it around to new players!