Re: [2.1] Roboports should report ghost entities
Posted: Thu Jul 23, 2026 8:41 pm
This is a classic algorithm design question: to cache or not to cache?
The game does have a list of all the entities in the game, some of which are ghosts, some of which are in range of roboports. The gane has a performant way to filter this list based on many criteria.
The game does *not* maintain a separate cached list of all the ghosts in range of each particular roboport network that have a matching force and no construction robot assigned. Without that, it cannot provide a count of them either. (That is what I would expect from a roboport ghost request output.) Maintaining such a cache in a consistent state would be a lot of overhead. It would need to update (using area searches) every time a ghost was created, upgraded, destroyed, revived, or changed force. Also whenever any roboport is built, upgraded, destroyed, change force, lost power, or regained power.
The devs decided that caching such a dynamic list would not be worth it, and that it is better to do a partial search each tick with the latest state of the roboport networks, etc.
The game does have a list of all the entities in the game, some of which are ghosts, some of which are in range of roboports. The gane has a performant way to filter this list based on many criteria.
The game does *not* maintain a separate cached list of all the ghosts in range of each particular roboport network that have a matching force and no construction robot assigned. Without that, it cannot provide a count of them either. (That is what I would expect from a roboport ghost request output.) Maintaining such a cache in a consistent state would be a lot of overhead. It would need to update (using area searches) every time a ghost was created, upgraded, destroyed, revived, or changed force. Also whenever any roboport is built, upgraded, destroyed, change force, lost power, or regained power.
The devs decided that caching such a dynamic list would not be worth it, and that it is better to do a partial search each tick with the latest state of the roboport networks, etc.