Static parts of the factory that are outside the players' view do not have to be exactly simulated but can be approximated.
For parts of the factory that are isolated (only few input/output belts/trains/logistic chests with few item types), simulation could be reduced to keeping only track of percentages of units that need very little updating:
- - Continuous parts of belts keep track of how full they are
- Splitters divide the available capacity evenly between outputs
- Chests keep track of how full they are
- Assembly machines calculate output percentage based on input percentages
could be represented as
When the chest is empty, the percentages have to be updated to look something like this:
Once a player walks towards such system, the simulation has to know how much time passed since the last percentage update, then recalculate all percentages and convert it to real-world items with discrete positions.
This way of simulating is very CPU-friendly since each of these systems only need to be updated once something significant happens: train arriving, player walking close, chests empty, enemy attack. Many items can be simulated this way.
However this technique is not applicable for the entire factory, as circuit components or techniques relying on individual items cannot be abstracted into the percentage system. Belts containing many types of products also do not work well.
PS. Anyone experienced with the modding API: is it possible to skip over or replace parts of the factory simulation?