Cleaners causes serious slowdowns

Started by SilverWarior, February 22, 2015, 06:51:48 PM

Previous topic - Next topic

SilverWarior

Hi!

I noticed today that whenever my cleaners are deciding on where to go cleaning next it causes considerable slowdowns to the game. The bugger the home region the bigger the effect that I'm seeing.

Now as a developer myself I supect that the cause for this might be that the game is checking every tile marked as home region to see if it needs celaning and then deciding to which the cleaner should clean next.

If my suspisions are corect then I recomend implementing heuristic approach in decision of where cleaners should go next. What do I meand by heuristic approach?

Now if you look at most comon base designs from gamers you will notice that most of them design their bases as series of rooms.

Now currently each room already has its own temperature. So what I recomend is that you just add aditional information to each room (a simple boolean value) which will simply tell if there is any tile inside the room that needs to be cleaned or not.

So now you will be first iterating through rooms to see if they needs cleaning and if they do then you chose the closest one and then iterate through each room tile to see which specific tile needs to be cleaned.

This should greatly reduce the number of tiles that you need to iterate and check every time.
Also when cleaners start cleaning some tile in specific room they should go and clean every tile in that room before moving to the next one. When you are cleaning your house I asume you go and celean one room entirely first and then move to the other. Right?

In case if this aproach suggested should lead to cleaners keep cleaning same rooms over and over again due the fact that they are first checking the closest rooms you can replace the sugested bolean value with a numerical value which will represent room dirtines so the cleaners will go and try leaning more dritier rooms first.