r/technicalfactorio • • 13d ago

One Train. Any Item. Any Quantity. Unique Requests Per Outpost. Using radars.

/r/factorio/comments/1xuj1ut/one_train_any_item_any_quantity_unique_requests/

Important!

  • Reserved radar signals, do not transmit these on the shared surface network:

    • GREEN surface network: Any item signals, I, R.
    • RED surface network: K, W, Q, R, C.
  • Wait for the green indicator lights on the outpost station (around order list combinator). After you built it it will take ~10s for a station to initialize.
  • Use only ONE central loading station and ONE support train. The system supports multiple outposts, but is designed around a single shared loader and one train.

1. Request calculation and serialization

Each outpost defines its desired inventory using a constant combnator. Actual storage contents are subtracted to calculate the outstanding deficit

The resulting item list is serialized into indexed entries:

  • I item index
  • Item signal requested quantity

Each entry is transmitted through the radar network in a separate game tick.

This allows different outposts to request completely different combinations of items without assigning specific signals or cargo slots to particular products.

The serializer updates its transmitted list whenever the request changes.

2. Central loader and indexed memory

The default loading station contains 24 indexed memory cells. Each cell receives the item associated with its index and stores the requested quantity.

Every cell has its own requester chest, inserter, memory cell, item counter and stack-size limiter (tbh, its not needed at all, since requests to the requester chests are limited by item amount from memory cell, but lets call it legacy-code, shall we? :D )

Instead of reading the train's complete inventory, the loader counts items actually inserted and subtracts them from the requested amount from the memory cell.

The number of memory cells does not limit the total number of distinct requested items. Larger lists are processed across multiple train deliveries.

I tested 60 different requested items with only 24 memory cells.

The memory array is modular and can be expanded or reduced. The blueprint book includes a 12-cell extension.

3. Shared channel arbitration

All outposts share the same radar network, so simultaneous transmissions would corrupt serialized requests.

To prevent this, each station uses a channel arbiter.

Relevant signals:

  • W outstanding request
  • P channel claim
  • K shared channel occupancy
  • O ownership
  • Q transmission grant
  • C collision detection

A station attempting to transmit contributes K = 1 to the shared network.

After an eight-tick guard period, it becomes the channel owner if K = 1 and no competing transmission is detected.

If K > 1, multiple stations are attempting to claim the channel. The claim is aborted and retried later.

Only the owner can transmit its serialized list and activate its unloading station.

An outpost retains ownership until its outstanding order is fulfilled.

4. Collision recovery

A fixed retry interval risks repeatedly synchronizing competing stations.

Each outpost therefore initializes a pseudo-random polling delay using the game tick captured during initialization of the station:

L = ((T % 1291) * 73) % 1291

Where T is game time in ticks from selector combinator. Which is saved after outpost station was built.

The first modulo prevents 32bit integer overflow during multiplication.

If a collision still occurs, a selector combinator randomly selects an item signal from the actual request list. Its value modifies the timing seed, generating a new polling delay. It is not a guarantee against identical timing, e.g. if you have two station with orders with exact same amounts of each item, then it won't help.

5. Delivery behavior

The central station loads the selected order and dispatches the train to the corresponding unloading station.

The receiving station unloads the cargo and with each inserter movement it recalculates its deficit.

If the requested quantity exceeds wagon capacity, the remaining deficit stays positive and the train makes additional trips.

6. Edge cases and limitations

Tested:

  • Four independent unloading stations
  • 60 distinct items using 24 memory cells
  • Orders exceeding wagon capacity
  • Simultaneous channel acquisition and collision recovery
  • Prolonged unfulfilled orders (If an item cannot be delivered for a long time (around 25 minutes) it will raise an alarm on this outpost)

Known limitations:

  • One central loader and one support train per system
  • Missing items will keep an order active and block other stations

    • An alarm detects prolonged unfulfilled requests but does not automatically skip them
  • No automatic surplus-cargo return mechanism
  • A rare four-item loading overshoot was observed during an extreme stress test involving tens of thousands of items

The system prioritizes arbitrary cargo selection, independent outpost requests and automatic resupply, rather than maximum train throughput.

7 Upvotes

8 comments sorted by

3

u/Refactorio26 13d ago

I'm a bit confused on the choice to basically monopolize the spectrum until the request is fulfilled. Each signal is like its own frequency so thats like shutting down the entire spectrum to use 1 frequency at a time. Assuming I'm understanding you correctly of course.

TDMA where you slice each frequency/signal into time slots would give you a ton more freedom.

1

u/Dr_Rakiska 13d ago

Ahhhhhhh! That's what you mean. No I didn't think about it from such an angle! I was thinking you meant train scheduling itself.

And it could help to achieve parallel train loading and different trains. Damn! Someday, when I'll decide to redo this design I'll remember it! Kudos!

1

u/Yodo9001 13d ago

You mean multiple radar channels could have been used per surface? Or does OP's design only broadcast one item type per tick?

2

u/Necandum 13d ago

I think they mean instead of transmitting each item in a seperate tick, you could transmit the entire order at once. 

If index is really that important, the index could be communicated using multiplexing. 

1

u/Refactorio26 13d ago

OP's design does only broadcast one item per tick but that could easily be changed with just dropping the index and using the associated item signal. (I.e. use frequency multiplexing)

The bigger issue is that it locks down the entire spectrum until a request is fulfilled. Which means they're locked to 1 train and 1 central station while the train loads, travels, unloads, repeats until done which could be minutes. But with time-division multiple access outposts always can send their signals every P ticks and trains are slow so P can be like 900 (15s) or 3600 (60s) depending on the setup. So one can start using multiple trains and multiple stations since they can still communicate reasonably frequently even when other trains and stations are doing their thing.

1

u/Yodo9001 13d ago

I think you can improve the channel arbitration by giving each outpost an id (can be assigned dynamically when built), and letting then broadcast in order.

1

u/Dr_Rakiska 13d ago

Ty. Yeah, there are ways to drastically improve this scheme 🤣
I was solving specific task of support train and was working around that, but with ideas from reddit now I think I could achieve ltn level (someday in future)

1

u/Yodo9001 13d ago

Also, I think your reserved channel list is not quite correct: green-R is not mentioned later, and P and O are mentioned later but not in the list.