FicsIt-Networks icon indicating copy to clipboard operation
FicsIt-Networks copied to clipboard

Feature Request: Modes for splitters and mergers

Open Justintime505 opened this issue 4 years ago • 6 comments

It would be a really handy feature to have some kind of ability to switch modes on the splitters and mergers to allow items through from a specific input or to a specific output without having to explicitly handle the item transfer in the code. For example you could call splitterFoo:setMode(1)
which would put the splitter into "vanilla" mode where it would act just like a vanilla splitter then you could call something like:

splitterFoo:setOutput(0, false) which would "turn off" the 0 output allowing items through output 1 and 2 but not 0. All of this could be happening without having to explicitly handle each item.

Would this be something anyone else would find useful? Right now we have a lot of control over the splitters and mergers but many times I find myself not needing or wanting that much control. Instead, many times I really need to just control which output the splitter uses.

Justintime505 avatar Aug 30 '20 17:08 Justintime505

For me also. It's rare that I need an item level control. Right now I feel like I'm using to many computer ticks to transfer individual items. I wouldn't mind being able to just set ratios or tell it that the next N items need to be diverted to the output buffer.

SebastianHD avatar Sep 05 '20 03:09 SebastianHD

+1

pinuke avatar Sep 13 '21 09:09 pinuke

I find the best solution would be to be able to enable and disable specific in and outputs for constant item throughput (maybe with configurable rate ?) but also be able to manual transfer single items (like it is now). I also rarely need control over every single item, but i need it in some cases (My sorting and item routing system for example receives orders which include the exact item count).

M-Marvin avatar Dec 23 '22 13:12 M-Marvin

You can do all that in user code and in fact, the proper place for it is in user code. That is to say, what you asked for is all user code related, not low-level functionality related. The basic set of required low level functions to do what you want exist it just remains for you to actually write the user code to do it. You have raw control over the item transfers, build your code library up so you have the functions/systems you want. It didn't take me long to write a simple class that handles a block of an arbitrary number of mergers as a single unit to fetch X number of Y items. My use case is central-storage transferring to train platforms where the train itself tells the system what to load in each cargo wagon (station platform) so it's all directed from any start point (storage) to any end point (platform).

ForsakenShell avatar Mar 01 '23 22:03 ForsakenShell

You can do all that in user code and in fact, the proper place for it is in user code. That is to say, what you asked for is all user code related, not low-level functionality related.

The issue is performance.

Handling transfers at the item level can be expensive on performance if handled in user code. The code has to go through a translation layer before it runs, which can be an expensive task on low end Gaming PCs.

Considering the simplicity of this feature request and the impact on performance, I don't see your justification for "proper place" and I don't see why this shouldn't be added.

pinuke avatar Mar 03 '23 17:03 pinuke

The issue is performance.

That's actually the main reason I even consider to implement this. Ease of use indeed is not, as there is much other stuff people would say that it makes life easier. Prominent example is the lack of a buffered file I/O. Because the intention is to have this stuff in "user space" through an Lua OS. But signals are indeed quite heavy, a lot less heavy than calling a reflected function (not in a polling context even), but handling that still might be heavy depending on the amount of splitters you want to manage. A single splitter is easy to handle, and some more too 900 items/min are 15 items/s which is easy for the lua runtime as it runs with, i think, 1000 lua instructions per frame. Execution is parallel to other factory works (not rendering tho), so on a multi core system (like every system out there) you should be handle many more than just 1 splitter... but if we think of SF scale... not enough performance xD

Panakotta00 avatar Mar 17 '23 16:03 Panakotta00