0ptera / Logistic-Train-Network

Factorio mod adding logistic network for trains.
Other
155 stars 55 forks source link

Repeating satisfied requests in the same tick state until that request is fully satisfied #309

Closed Quezler closed 1 year ago

Quezler commented 1 year ago

TL;DR If a delivery succeeds and the station still wants more of that item, dispatch additional trains in the same tick state.

What ? Currently (it appears) that during the tick state cycle only 1 train per item/fluid gets dispatched, which is not ideal for high traffic stops with just one thing to request.

It would be neat that when a delivery succeeds it'll get added back to the end global.Dispatcher.Requests so the next( will eventually get back to it within the same tick state, and it will continue until there is nothing more to requests or no more trains to assign.

I understand that "updates per tick" will cause the dispatcher to fire more often overall, but from a performance perspective it doesn't really have to grab all station signals & sort them again if it can still make valid deliveries with the signals it has already gathered.

Why ? Not having to mess with the updates per tick unnecessarily should be valuable for megabases with high throughput requesters. (aka: not having to boost how often all stations are queried for signals when you just want one to be faster)

Admittedly the user could also build bigger trains, but that might be difficult based on the layout of the rails, station & combinator settings, for example:

I am currently running into throughput issues with "waste" thermofluid in my k2 + se run, i have a station set to "collect" the 25 degrees fluid from all of the stations by setting it to -10M, but due to the amount of train stops placed across all the surfaces it'll rarely get above 125k incoming deliveries (5 trains with one fluid wagon), thus causing provider stations to clog.

I'll have to resort to update all the stations more frequently, even though i'm only really running into the issue with this one requesting station, rewarding successfully dispatched deliveries more passes at the end of the array sounds rather solid.

0ptera commented 1 year ago

Creating only one delivery per request per cycle is intentional to prevent badly configured requests from using up all available trains.

Update frequency and updates/tick can be used to speed up cycles. Larger trains will solve the issue without performance issues.