how to handle a massive number of objects? (creating game like Factorio)

Resource management games like Factorio, Beltmatic, and Mindustry involve a core gameplay loop of resource extraction, processing, and utilization. Players typically manage a network of interconnected structures, each with specific functions. The challenge lies in optimizing this network to efficiently produce desired outputs.

https://preview.redd.it/05ggtxt1vf5e1.png?width=600&format=png&auto=webp&s=44d5e547ef293c09688a01d52e3b0bdec5467927

https://preview.redd.it/ngqhp77bvf5e1.png?width=1920&format=png&auto=webp&s=da4c4cd482f433542b8387ff3098f9a15be4c87e

A common approach in game development is to represent these structures as individual objects, often with associated scripts for complex behaviors. However, this can lead to performance issues, especially when dealing with large numbers of objects.

Tilemaps, while a useful tool for representing spatial information, but can also have limitations in terms of the number of tiles and their complexity. For games with intricate production chains, a more flexible solution may be required.

so, do you know a good way to make games like those in the engine?