Excessive Depot Trips:
1- Oil request to T1 in LTN Depot,
2- T1 loads at "Oil Provider",
3- T1 unloads at "Oil Requester",
4- LTN reports "No fluid train found in depot"
5- T1 goes to LTN Depot,
6- After some time, the #4 request gets reissued.
From forum posts, I think this is a perf concern about scanning for trains that just became free this tick?
What about having a "LTN Comptroller" station as the final destination of an LTN schedule? That could be used to (a) determine trains that just became free, (b) when you get the no-path signal you can check the station it just unloaded at for a valid demand, and cut out the trip to the depot.
Stacks:
I think I understand why LTN doesn't allow multiple stops with the same name, but we still build stacks, and I'm new enough to LTN that this still gets very messy for me. I just had all my oil trains sent to the same station at the same time. Does LTN use a signal at stations to track pending balance deductions?
And is there a way to tell LTN that two (or more) stops/stacks/platforms service the same requester?
Depots and stacks
Moderator: Optera
Depots and stacks
"Worst thing about being a game dev is the dev-mode switch when you spot a stray pixel/server lag right as your guild starts the boss fight, your team engages the enemy, or whenever it's least inconvenient. And you're dead."
Re: Depots and stacks
By "scan the station it just unloaded at" - I mean look at the N-1th destination in the train's schedule.
"Worst thing about being a game dev is the dev-mode switch when you spot a stray pixel/server lag right as your guild starts the boss fight, your team engages the enemy, or whenever it's least inconvenient. And you're dead."
Re: Depots and stacks
If you want trains to park next to requesters for some reason just build the depot there.kfsone wrote: ↑Sun Sep 30, 2018 11:39 pm What about having a "LTN Comptroller" station as the final destination of an LTN schedule? That could be used to (a) determine trains that just became free, (b) when you get the no-path signal you can check the station it just unloaded at for a valid demand, and cut out the trip to the depot.
No path is a problem with your rail design. LTN can not interact with train pathfinder simply because there is no api for it.
You can install another mod creating warnings for train out of fuel and no-path.
Give each stop an unique name and hook up only that station buffer into LTN, it will balance them automatically.kfsone wrote: ↑Sun Sep 30, 2018 11:39 pm I think I understand why LTN doesn't allow multiple stops with the same name, but we still build stacks, and I'm new enough to LTN that this still gets very messy for me. I just had all my oil trains sent to the same station at the same time. Does LTN use a signal at stations to track pending balance deductions?
The only reason why you'd ever need more than 1 stop per name with LTN is having stations serviceable from both sides.
Again, there's no point. LTN only creates schedules, pathfinding is done by factorio itself. See the wiki for base game pathfinding rules: https://wiki.factorio.com/Railway/Train_path_finding
My Mods: mods.factorio.com
Re: Depots and stacks
Miscommunication there.Optera wrote: ↑Mon Oct 01, 2018 5:38 amIf you want trains to park next to requesters for some reason just build the depot there.kfsone wrote: ↑Sun Sep 30, 2018 11:39 pm What about having a "LTN Comptroller" station as the final destination of an LTN schedule? That could be used to (a) determine trains that just became free, (b) when you get the no-path signal you can check the station it just unloaded at for a valid demand, and cut out the trip to the depot.
No path is a problem with your rail design. LTN can not interact with train pathfinder simply because there is no api for it.
I want LTN to skip sending the train to the depot sometimes, by doing a work check when a train goes from "unloading at requester" to "moving to depot".
I thought you'd said in other threads that it was too hard to do this because you'd have to scan the trains and that was expensive. Hence I was looking for a signal-based approach, so I was suggesting a fake/virtual "comptroller" station to deliberately trigger a no-path.
I/we aren't worried about pathing, but rather the train state change that occurs when a train changes schedule step to one targeting an unreachable station. So, make up a name, or use one a player can never input, and make that the last-but-one step of the schedules LTN generates. Now you get a (slightly indirect signal to tell you that a train can either take some more work now. If we don't want it to do more work, we just send it to the next step in the schedule (i.e the depot) as before.
Code: Select all
-- PSEUDO CODE, I haven't done much Lua in a while.
-- This is a fake station that should never exist, it's sole purpose is to
-- make the train tell us it cannot reach it's current destination.
ltn_unreachable_station = "LTN Comptroller"
script.on_event(defines.events.on_train_state_changed, function(event)
local event_train = event.train
-- Only interested in LTN trains that have no path.
if train.has_path or not is_ltn_train(train) then return
-- Look at the schedule to see if the train was trying to go to the comptroller
local schedule = train.schedule
if not schedule then return end
-- current = 1 -> depot, current = 2 -> provider, current = 3 -> requester, 4 = comptroller
-- so any train that has current < 4 can be ignored.
if schedule.current < 4 then return end
-- if the train was headed for the comptroller, check if there is no work to be done.
if schedule.records[current].station == ltn_unreachable_station then
local next_ltn_job = ltn_get_job(train)
if not next_ltn_job then
-- send the train on its way
schedule.current = schedule.current + 1
return
end
-- since we found work, we can re-task the train immediately without a pit stop
ltn_schedule_train(train, next_ltn_job)
end
end)
1. Train sits at Depot,
2. Schedule assigned: Depot -> Provider -> Requester -> Comptroller -> Depot
3. Train executes schedule step #2 -> Go to provider
4. Loading completed, Increment schedule step
5. Train goes to requester
6. Unloading complete, Increment schedule step
7. Train changes state to "no-path" (we don't care about the path, it's just a trigger for a signal)
8. We see it's an LTN train attempting to go to the comptroller,
9. There is no additional work -> Increment schedule step,
10. Train goes to depot
or
1. Train sits at Depot,
2. Schedule assigned: Depot -> Provider -> Requester -> Comptroller -> Depot
3. Train executes schedule step #2 -> Go to provider
4. Loading completed, Increment schedule step
5. Train goes to requester
6. Unloading complete, Increment schedule step
7. Train changes state to "no-path" (we don't care about the path, it's just a trigger for a signal)
8. We see it's an LTN train attempting to go to the comptroller,
9. We find a new assignment -> Back to step 2
Last edited by kfsone on Mon Oct 01, 2018 7:18 am, edited 2 times in total.
"Worst thing about being a game dev is the dev-mode switch when you spot a stray pixel/server lag right as your guild starts the boss fight, your team engages the enemy, or whenever it's least inconvenient. And you're dead."
Re: Depots and stacks
Instead of "Comptroller" you could call it "Check LTN for work"
Now, when LTN assigns a train a schedule it might look like this:
Now, when LTN assigns a train a schedule it might look like this:
Code: Select all
1. LTN Depot,
2. Oil Provider,
3. Oil Requester,
4. Check LTN for work,
5. LTN Depot
"Worst thing about being a game dev is the dev-mode switch when you spot a stray pixel/server lag right as your guild starts the boss fight, your team engages the enemy, or whenever it's least inconvenient. And you're dead."
Re: Depots and stacks
From what I've gathered you explain a way of detecting when LTN trains leave the requester.
LTN already knows the state of controlled trains.
I won't implement chained deliveries from requesters because it's highly unlikely a new request is triggered with a provider nearer to a train in a requester than the depot.
It's also prone to errors from residue and no-path.
Edit: see also this thread: viewtopic.php?f=214&t=51770
LTN already knows the state of controlled trains.
I won't implement chained deliveries from requesters because it's highly unlikely a new request is triggered with a provider nearer to a train in a requester than the depot.
It's also prone to errors from residue and no-path.
Edit: see also this thread: viewtopic.php?f=214&t=51770
My Mods: mods.factorio.com
Re: Depots and stacks
Awesome - this might actually be useful to work into the intro page, because it does factor into layout design - i.e don't put all your depots on the outside of your to keep them out of the way Also, don't be stingy with trains.
While starting out with LTN I was focused on reducing train count, where I have lots of trains that spend a lot of time idle. Adding buffer trains makes perfect sense.
Thanks for the answer!
"Worst thing about being a game dev is the dev-mode switch when you spot a stray pixel/server lag right as your guild starts the boss fight, your team engages the enemy, or whenever it's least inconvenient. And you're dead."