Robots don't path-find at all when they set out to do something. They go directly to the target. If in going directly to the target they run out of energy they then search for a roboport nearby to recharge at.mrvn wrote: βFri Nov 23, 2018 10:16 amThe game already does this. Because every time a drone flies of it "path finds" where to go. Then when it runs out of fuel it "path finds" the nearest charging station.keyboardhack wrote: βFri Feb 17, 2017 11:04 pm Assume a base has 20.000 robots in a network, they always have something to do and don't need to recharge. If we assume an average travel time for each robot to be 4sec then 20.000 / 4 = 5000 robots need to pathfind per second.
Factorio runs at 60UPS which means that factorio would have to process 5000 / 60 = 83,3 paths for each update(1 update = 16ms). With a graph consisting of >1000 nodes it would literally be impossible to do it in < 16ms.
Everyone agrees that it would be a good idea to add pathing to robots but no one knows how to do it in a way that is just as fast as how it works right now. Simulation speed is the main reason that robots are stupid.
There is no need to path find the whole way from A to Z. The simplest improvement for drones would be to still do exactly the same thing they do now expect with foresight. When a drone leaves it calculates the distance to the target and checks available fuel. It then knows at which point of the path it runs out of fuel. But instead of waiting to reach that point calculate the nearest charging port from that point at the start and then switch the destination to that charging port directly. The amount of "path finding" work per drone remains the same just the timing changes a bit.
Nobody is going to be able to find a solution which is as cheap as the current implementation because you can't get cheaper than "go directly towards the target" which means adding *any* additional work is more expensive.