TL;DR:
the basic idea is to subdivide a blueprint into chunks. Bots don't get assigned to build entities directly, but get assigned to chunks.Details:
Each chunk has four properties:- a chunk ID (not assigned until placed)
- the chunk coordinates (maybe the chunks center of area)
- the entity type
- a list with the coordinates of the entities (max length being the cargo size of construction bots)
Also the upgrade planer could run chunk creation for its selected area.
On Memory cost this might increase the size of a blueprint. But it also might even open a way to actually compress blueprint byte length, if chunks only store relative coordinates (either as unsigned integer with the chunk coords as origin, or with signed int and the origin being the center of area of the chunk) with adjusted byte length.
When creating a chunk it should be checked, that its entities are within reasonable range; when they are not, they get assigned to different chunks, possibly of smaller then max length.
For manually placed ghosts, ghosts from destroyed entities etc. chunks of the length one get created.
From time to time one could go through the list of chunks if there are any of a length shorter then the current maximum and try to merge smaller chunks to maximised ones. This way the chunk map would automatically become updated and optimised if research changes cargo size, ghosts get deleted from a placed chunk etc.
There is no need to do this on a expensive pace since the worst case scenario is basically the same as it is now, but in the end long bot builds might be actually sped up by chunked ghost maps.
"The Roboports" simply need to maintain a list of each, assigned and unassigned chunks, which again is worst case the same length as the list of all placed ghosts.
When a bot gets assigned to a chunk to build and it can't get all items to build the whole chunk at once it just builds as much as it could get items from a single chest and the rest of the chunk becomes a new chunk. If a bot gets destroyed or picked up by player before it can place all entities of the chunk it just changes the state of the chunk back to unassigned.
I'm not sure if any vast changes to bot pathing would be needed, but possibly it might be sufficient to start by moving to the chunks origin and refining the path to each entity within the chunk during travel time.
The optimal advantage would be more efficient bots resulting in lesser numbers of bots active at any given time, which might result in a noticeable performance boost instead of an expected performance loss, if each bot needs to check on assignment, if they could build multiple entities with a single journey.
Why?
The FFF#318 introduced the idea of batch placement of tiles by bots. This is an attempt to provide a computational inexpensive solution to batch placing entities.Inspiration and terminoligy
Obviously the term chunk might be a bit misleading in the factorio context. Probably "ghost group" would have been a better fit.But my inspration lies within the realm of video encoding (especially the hap codec) and since I imagined it to somewhat work like a bitmap to store the ghost groups inside the blueprint the term chunk made a lot of sense to me.