I'll try keep this short since I'm not great at explaining things, if you built a huge area of concrete and ran out of concrete, the robots will do nothing, which is expected (it will say 601 items missing even when more).
However, if you try build another blueprint (just say you restricted that supply of concrete to free up some robots), there will be no movement for a minute or two, before everything then kicks into action. All the construction robots are marked as 'available' and it's pretty confusing as to why nothing is happening.
I know it'll be something to do with the optimisation in a way that you won't notice most of the time, but the delay becomes very obvious when 99% of the jobs are all 'missing item' ones. I think newer blueprints should get priority anyway (maybe find the nearest robot not carrying anything and reassign them for each item), which would possibly also solve this problem
I can attach the save if needed, but I'm guessing it's a general thing.
AI freeze when lots of missing materials
- TruePikachu
- Filter Inserter
- Posts: 978
- Joined: Sat Apr 09, 2016 8:39 pm
- Contact:
Re: AI freeze when lots of missing materials
If jobs for bots are checked by each bot instead of in a network-wide iteration, it will cause something like O(n*i) time to find that all the jobs are invalid versus O(n) time (n is # of jobs, i is # of bots).
Theoretically, the network should check if a job can be completed, and not a bot.
Theoretically, the network should check if a job can be completed, and not a bot.
Re: AI freeze when lots of missing materials
I just had a thought, it could be impossible to do depending on how it's currently coded, but I may as well say
You'd have 3 separate groups of jobs.
The first would be pending jobs, basically the same as it is now.
If any of these are outside the range of a construction zone, it adds it to the second list, which is grouped by chunks. If a roboport is powered or built within a chunk, any jobs in that chunk will be added back to the first list (if it is still outside of the range, they'll be added back to the 2nd list and not be triggered again unless you build another).
If any are missing materials, they'll be added to the third list, grouped by materials. That way, if you have 100000 pending concrete jobs, it only needs to process 1 concrete job to realise there is no concrete That'd possibly be checked every few seconds to leave processing power for the things that actually need building.
You'd have 3 separate groups of jobs.
The first would be pending jobs, basically the same as it is now.
If any of these are outside the range of a construction zone, it adds it to the second list, which is grouped by chunks. If a roboport is powered or built within a chunk, any jobs in that chunk will be added back to the first list (if it is still outside of the range, they'll be added back to the 2nd list and not be triggered again unless you build another).
If any are missing materials, they'll be added to the third list, grouped by materials. That way, if you have 100000 pending concrete jobs, it only needs to process 1 concrete job to realise there is no concrete That'd possibly be checked every few seconds to leave processing power for the things that actually need building.
- TruePikachu
- Filter Inserter
- Posts: 978
- Joined: Sat Apr 09, 2016 8:39 pm
- Contact:
Re: AI freeze when lots of missing materials
The second list could cause issues when the personal roboport is considered, since it moves around without becoming unpowered.Obliterator2 wrote:I just had a thought, it could be impossible to do depending on how it's currently coded, but I may as well say
You'd have 3 separate groups of jobs.
The first would be pending jobs, basically the same as it is now.
If any of these are outside the range of a construction zone, it adds it to the second list, which is grouped by chunks. If a roboport is powered or built within a chunk, any jobs in that chunk will be added back to the first list (if it is still outside of the range, they'll be added back to the 2nd list and not be triggered again unless you build another).
If any are missing materials, they'll be added to the third list, grouped by materials. That way, if you have 100000 pending concrete jobs, it only needs to process 1 concrete job to realise there is no concrete That'd possibly be checked every few seconds to leave processing power for the things that actually need building.
Re: AI freeze when lots of missing materials
The first and second things already exist.
The third idea of "store orders by items needed" is actually a pretty good idea. I'll talk to Posila about implementing that when he's back next week
The third idea of "store orders by items needed" is actually a pretty good idea. I'll talk to Posila about implementing that when he's back next week
If you want to get ahold of me I'm almost always on Discord.