hytonhan / Timberborn-SimpleFloodgateTriggers

MIT License
1 stars 3 forks source link

Optimization? #24

Open VasVadum opened 7 months ago

VasVadum commented 7 months ago

I'm not sure about how your code works, but the freezing issue between start and end events is really annoying. I'm not sure exactly how your mod checks through objects in the lists for these triggers. So I wanted to offer up some thoughts I had just in case it hadn't been considered.

A friend of mine checked and said you've already optimized, but it feels like whenever a drought ends or begins, a check is being run on every single building that has the ability to set a trigger in it. The more buildings I have that have trigger capabilities, the more lag I get on these events.

If the above is whats going on, I'd like to suggest creating separate lists. Only a building that has any option checked in it that would indicate its for the start of a drought, would be added to the list "startdrought", and similar lists for all the other events. So if my pumps are all unconfigured, no options checked, there's no reason for the mod to run a check on them at the start of a drought or end of a drought, right?

I'm somewhere around cycle 56, and building more floodgates, trying to use them to make the flow more dynamic and automated, having lots of difficulties due to certain limitations of the mod. However the more I build, even when not using drought start or tide start triggers, the more lag I get wen these events happen.

If you've already considered this or done this type of optimization, then great. I just wish to try and solve the lag spikes once and for all because they are causing me a lot of difficulty when I'm working on things around the start or end of a cycle.