3 ms·
I assume they've split it out so much to better allow smaller systems over larger ones. In theory this should allow better access patterns, for instance for the
by foota 3y ago
I assume they've split it out so much to better allow smaller systems over larger ones. In theory this should allow better access patterns, for instance for the electricity, the AdjustElectricityConsumptionSystem has to consider each building and the information about it, but the ElectricityFlowSystem only has to consider the edges for electricity flow. This means the ElectricityFlowSystem can be access only the data it needs and in theory allows for better code cache efficiency (since the loops are tighter and more focused than they would be if they were all in one).
- meheleventyone 3y agoSplitting things this way is also handy because you can avoid branches, rather than one big loop with lots of conditional branching you have many loops one for each set of elements represented by a branch. Except rather than having to untangle and manage that yourself the granular systems approach make it a more natural way to implement things. Although probably once you're at that stage of optimizing gameplay code it's also probably time to write something specific for the problem rather than trying to fit it into a general purpose framework.
- CaptainOfCoit 3y ago> I assume they've split it out so much to better allow smaller systems over larger ones. In theory this should allow better access patterns Not only that, but modding becomes easier as well, and modding is a big part of the game. If all the electricity stuff was jammed into just one System, it would be harder to modify just some parts of it while remaining compatible with other mods modifying other parts. Instead, Systems are broken down into relevant parts so modders can add easier to it or replace whole Systems, without replacing ALL electricity code.