[Fixed 1.13][Bug 1.11] FPS spikes with big factories

This is something I need to set aside time to consider in some detail. You are right in that it is related entirely to changes to routes caused by new resource conveyors or car conveyors.
The current solution ‘works perfectly’ in terms of routing, but beyond a certain size it gets super slow. I need to re-engineer it to ensure it can cope better with massive networks, and that will probably take at least a week, so it will probably be a few weeks before I can find time to give it a proper go.

Tech stuff:
Games like factorio let objects on conveyors just blindly move in the direction shown. PL lets resources decide which route to take based on the most efficient path. That means evaluating every possible path and picking the shortest. With 30 importers and 100 destination slots, thats 3,000 routes that have to be re-calculated every time the layout changes. with 100 importers and 500 slots, its 50,000 and thats a LOT of processing. (Pathfinding is extremely CPU intensive). if routes are long, are there are many of them, it becomes even worse. I have a potential solution, it just involves some pretty complex code :smiley:

Hi Cliff,

hope you have had some nice days at the GDC …

Hmmm, when no new resource is connected and no other (second) resource conveyor is crossed there is no need to recalculate the routes. So maybe this could be a small temporary improvement.
The recalculation itself is seems (from a non technical point of view) not to be very CPU intensive atm. When pausing the game in a huge factory and placing some new resource conveyors the CPU usage drops from 30-65% down to 15-30% while no core is at or near 100%. So the expectation does not meet the watched behavior. Or anyone else with a different observation?

I’m making some decent progress on this BTW. Its not perfect, but expect some improvements in 1.13. I have grand plans for some refactoring of the code tomorrow!

Ok, its MASSIVELY better now: positech.co.uk/cliffsblog/2017/0 … ries-ahoy/

Good news! Thanks for tracking down this issue.
So now waiting for 1.13 and starting with a new huge map :smiley: