Why is this train being stupid?

Post all other topics which do not belong to any other category.
lingnau
Inserter
Inserter
Posts: 20
Joined: Mon Jun 27, 2016 10:16 am
Contact:

Why is this train being stupid?

Post by lingnau »

I've browsed around, but couldn't find an explanation. I imagine that someone might have already encountered this (issue?) as most people now use queuing stations instead, but I would expect this to work in a small set-up. From my knowledge of trains, this should work. However, the result is rather confusing.
  • Should this train be behaving this way?
Some background explanations:
  1. Both train stops to the left are have the same name ("Ore Unload" or similar). All trains go from some outpost to these two stations
  2. O / Circle = Regular Signal(color represents status)
  3. □ / Square = Chain Signal (color represents status)
Questions
  • Since the shortest path and the "clear" path are the first choice, why does this train want to enter the second station and not the first one?
Note: There couldn't have been a second train on the first station before this train, there are only 4 ore trains in this railroad.
Note2: The image you're about to see is not OCD friendly. Which some take very seriously. :)
Attachments
not_the_brightest_train.png
not_the_brightest_train.png (1012.81 KiB) Viewed 7742 times
_________
Whatever I said is not legally binding.

Frightning
Filter Inserter
Filter Inserter
Posts: 807
Joined: Fri Apr 29, 2016 5:27 pm
Contact:

Re: Why is this train being stupid?

Post by Frightning »

It's path and choice of (un)loading bay were made long ago, and at that time, the 2nd bay was free (or had less trains waiting for it). This is the thing you were hearing a lot about on these boards when 0.13 was still experimental. The trains aren't smart enough to re-check their path choice to see if a different bay has opened up, hence why people use queuing style setups now: it solves this problem (at least as well as can be done in 0.13 iirc).

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Why is this train being stupid?

Post by Optera »

I'm using multiple loading bays with the same station name too. Trains do reevaluate their paths eventually. Sadly routing is nowhere close to OTTD.

lingnau
Inserter
Inserter
Posts: 20
Joined: Mon Jun 27, 2016 10:16 am
Contact:

Re: Why is this train being stupid?

Post by lingnau »

Frightning wrote:It's path and choice of (un)loading bay were made long ago, and at that time, the 2nd bay was free (or had less trains waiting for it). This is the thing you were hearing a lot about on these boards when 0.13 was still experimental. The trains aren't smart enough to re-check their path choice to see if a different bay has opened up, hence why people use queuing style setups now: it solves this problem (at least as well as can be done in 0.13 iirc).
Uh, thank you for the feedback/explanation.
Optera wrote:I'm using multiple loading bays with the same station name too. Trains do reevaluate their paths eventually. Sadly routing is nowhere close to OTTD.
Thank you for your reply. While it is unfortunate and I may need to change my design, we must agree that OTTD's sole existence purpose is exactly this sort of thing, Factorio is a mix from good stuff about other games. While this is annoying, it wont be the end of the world for me. :)
_________
Whatever I said is not legally binding.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Why is this train being stupid?

Post by Optera »

One thing i noticed that's different between your station and mine is your exit signals (in red squares in your screenshot) are chain signals while i use block signals.

Here are my unloading stations. Even the circuit controlled block signals from the crossings don't seem to freak out path finding.
2016-10-22-18-09-54-4871776.jpg
2016-10-22-18-09-54-4871776.jpg (499.41 KiB) Viewed 7670 times

lingnau
Inserter
Inserter
Posts: 20
Joined: Mon Jun 27, 2016 10:16 am
Contact:

Re: Why is this train being stupid?

Post by lingnau »

Optera wrote:One thing i noticed that's different between your station and mine is your exit signals (in red squares in your screenshot) are chain signals while i use block signals.

Here are my unloading stations. Even the circuit controlled block signals from the crossings don't seem to freak out path finding.
2016-10-22-18-09-54-4871776.jpg
I believe this is a slightly different situation, since you have the same amount of trains and stations, which makes its "hassle free". Btw, cool to see double-headed-push–pull trains with 6 wagons. :D
_________
Whatever I said is not legally binding.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Why is this train being stupid?

Post by Optera »

lingnau wrote:
Optera wrote:One thing i noticed that's different between your station and mine is your exit signals (in red squares in your screenshot) are chain signals while i use block signals.

Here are my unloading stations. Even the circuit controlled block signals from the crossings don't seem to freak out path finding.
2016-10-22-18-09-54-4871776.jpg
I believe this is a slightly different situation, since you have the same amount of trains and stations, which makes its "hassle free". Btw, cool to see double-headed-push–pull trains with 6 wagons. :D
The train entering the top copper station originally wanted to go to the bottom station. It can't really be shown in a single screenshot.
Sometimes it takes trains so long to find the new path, another train simply dashes in that station.

I like 2L-6C-2L, they are fast and deadly. These gate controlled signals on the rr crossings are pure survival. One of those trains has more kills on me than all biters together. :D

User avatar
impetus maximus
Smart Inserter
Smart Inserter
Posts: 1299
Joined: Sat Aug 20, 2016 10:07 pm
Contact:

Re: Why is this train being stupid?

Post by impetus maximus »

try putting a station before the unload stations (left of blue square) with a wait time of 0 seconds. trains should recalculate after the 0 second stop.

Jupiter
Fast Inserter
Fast Inserter
Posts: 174
Joined: Thu Jun 23, 2016 2:38 pm
Contact:

Re: Why is this train being stupid?

Post by Jupiter »

impetus maximus wrote:try putting a station before the unload stations (left of blue square) with a wait time of 0 seconds. trains should recalculate after the 0 second stop.
I have used this technique in my previous game but it seems that it only works to a degree. This is because the trains will leave from that station immediately and only then will they calculate their path. If, at that moment, none of the stations are free it will just pick one. If that station isn't the first to clear up it won't reconsider its options.

While writing I thought about a possible solution. With the new train waiting conditions it's possible to have trains wait until some circuit condition is met. You could use a circuit network to check if any of the stations are clear and as soon one is you'll let the train leave. So it will delay calculating its path until it actually has to move.

However, in my new game I've circumvented the issue entirely with the following unloading station design:

http://imgur.com/a/IoJEg
Image

This design maximizes the unloading capacity of the station itself by having as many output belts as possible. I have tested this setup and one station nearly fills up all 16 belts (it's more than 15 belts for sure). I also have separate waiting bays for each station with a capacity of 12 or so 2-4-0 trains and I made sure that the time between 1 train leaving and the next standing still for unloading is as short as possible. In the screenshot I'm only using 4 belts but this way I can expand much much more.
The benefit of this is that you need just 1 station for each type of resource you're shipping in (and therefore circumventing the problem) because you probably won't need more than 16 belts anyway. And even if you do, just build a second one and you have enough capacity to supply a sizable mega base with 32 belts.
The only downside is... it's kinda huge. But that's mainly due to the waiting bays.
Blueprint string

lingnau
Inserter
Inserter
Posts: 20
Joined: Mon Jun 27, 2016 10:16 am
Contact:

Re: Why is this train being stupid?

Post by lingnau »

Jupiter wrote:
impetus maximus wrote:try putting a station before the unload stations (left of blue square) with a wait time of 0 seconds. trains should recalculate after the 0 second stop.
I have used this technique in my previous game but it seems that it only works to a degree. This is because the trains will leave from that station immediately and only then will they calculate their path. If, at that moment, none of the stations are free it will just pick one. If that station isn't the first to clear up it won't reconsider its options.

While writing I thought about a possible solution. With the new train waiting conditions it's possible to have trains wait until some circuit condition is met. You could use a circuit network to check if any of the stations are clear and as soon one is you'll let the train leave. So it will delay calculating its path until it actually has to move.

However, in my new game I've circumvented the issue entirely with the following unloading station design:

This design maximizes the unloading capacity of the station itself by having as many output belts as possible. I have tested this setup and one station nearly fills up all 16 belts (it's more than 15 belts for sure). I also have separate waiting bays for each station with a capacity of 12 or so 2-4-0 trains and I made sure that the time between 1 train leaving and the next standing still for unloading is as short as possible. In the screenshot I'm only using 4 belts but this way I can expand much much more.
The benefit of this is that you need just 1 station for each type of resource you're shipping in (and therefore circumventing the problem) because you probably won't need more than 16 belts anyway. And even if you do, just build a second one and you have enough capacity to supply a sizable mega base with 32 belts.
The only downside is... it's kinda huge. But that's mainly due to the waiting bays.
Blueprint string
At this point in the game I don't even get to use all the resources that I'm able to collect, so usually trains take a while to unload because the belts/furnaces to which they output are barely consuming anything.


I've actually (on a different game) settled for something more traditional (train queue) which appears to work pretty well. One could also improve this by reading the amount of resources on the chests from each "bay" and only open the signal once the whole incoming train can be unloaded (8k resources for 4 wagons), this can reduce unloading time.

On the screenshots, trains come from the south, hold one the "wait stations" (bottom of the screenshot) before proceeding to the free unload station (top of the screenshot). It scales pretty easily by adding additional "wait" stations (one for each train that uses the station above should be more than sufficient) and it's cheap to build(and, very small footprint).
Attachments
train_wait_station.png
train_wait_station.png (957.1 KiB) Viewed 7514 times
_________
Whatever I said is not legally binding.

Jupiter
Fast Inserter
Fast Inserter
Posts: 174
Joined: Thu Jun 23, 2016 2:38 pm
Contact:

Re: Why is this train being stupid?

Post by Jupiter »

lingnau wrote:At this point in the game I don't even get to use all the resources that I'm able to collect, so usually trains take a while to unload because the belts/furnaces to which they output are barely consuming anything.

I've actually (on a different game) settled for something more traditional (train queue) which appears to work pretty well. One could also improve this by reading the amount of resources on the chests from each "bay" and only open the signal once the whole incoming train can be unloaded (8k resources for 4 wagons), this can reduce unloading time.

On the screenshots, trains come from the south, hold one the "wait stations" (bottom of the screenshot) before proceeding to the free unload station (top of the screenshot). It scales pretty easily by adding additional "wait" stations (one for each train that uses the station above should be more than sufficient) and it's cheap to build(and, very small footprint).
My point was that you can have enough with just one station per resource and therefore get rid of the problem all together. It's high capacity is just an added bonus that makes the solution future proof.

lingnau
Inserter
Inserter
Posts: 20
Joined: Mon Jun 27, 2016 10:16 am
Contact:

Re: Why is this train being stupid?

Post by lingnau »

Jupiter wrote:
lingnau wrote:At this point in the game I don't even get to use all the resources that I'm able to collect, so usually trains take a while to unload because the belts/furnaces to which they output are barely consuming anything.

I've actually (on a different game) settled for something more traditional (train queue) which appears to work pretty well. One could also improve this by reading the amount of resources on the chests from each "bay" and only open the signal once the whole incoming train can be unloaded (8k resources for 4 wagons), this can reduce unloading time.

On the screenshots, trains come from the south, hold one the "wait stations" (bottom of the screenshot) before proceeding to the free unload station (top of the screenshot). It scales pretty easily by adding additional "wait" stations (one for each train that uses the station above should be more than sufficient) and it's cheap to build(and, very small footprint).
My point was that you can have enough with just one station per resource and therefore get rid of the problem all together. It's high capacity is just an added bonus that makes the solution future proof.
Point taken. :)
_________
Whatever I said is not legally binding.

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Why is this train being stupid?

Post by Deadly-Bagel »

Trains recalculate when they pass signals. Therefore there is a problem when you use chain signals, where if a train queues up at a chain signal but then a different bay becomes free, the train will not see it because is not recalculating its path.

The solution is to make a "faux-chain signal" which is just a regular signal that you connect to the circuit network to behave like a chain signal. Connect it to all the adjacent-forward signals via circuit network and tell it to go red if [Green] = 0. Therefore when ANY bay becomes available it is allowed to become green, the train will pass it, recalculate, and enter the available bay. See this topic for more info
Money might be the root of all evil, but ignorance is the heart.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2916
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: Why is this train being stupid?

Post by Optera »

Deadly-Bagel wrote:Trains recalculate when they pass signals. Therefore there is a problem when you use chain signals, where if a train queues up at a chain signal but then a different bay becomes free, the train will not see it because is not recalculating its path.

The solution is to make a "faux-chain signal" which is just a regular signal that you connect to the circuit network to behave like a chain signal. Connect it to all the adjacent-forward signals via circuit network and tell it to go red if [Green] = 0. Therefore when ANY bay becomes available it is allowed to become green, the train will pass it, recalculate, and enter the available bay. See this topic for more info
Circuit controlled "faux-chain signal" seem to force pathfinder to update instantly while regular chain signals will update only every minute or so.
2016-10-27-11-45-10-6699145.jpg
2016-10-27-11-45-10-6699145.jpg (396.52 KiB) Viewed 7263 times
It took that train half a minute to update it's path to a free station.
2016-10-27-11-45-33-9442457.jpg
2016-10-27-11-45-33-9442457.jpg (318.48 KiB) Viewed 7263 times

lingnau
Inserter
Inserter
Posts: 20
Joined: Mon Jun 27, 2016 10:16 am
Contact:

Re: Why is this train being stupid?

Post by lingnau »

Deadly-Bagel wrote:Trains recalculate when they pass signals. Therefore there is a problem when you use chain signals, where if a train queues up at a chain signal but then a different bay becomes free, the train will not see it because is not recalculating its path.

The solution is to make a "faux-chain signal" which is just a regular signal that you connect to the circuit network to behave like a chain signal. Connect it to all the adjacent-forward signals via circuit network and tell it to go red if [Green] = 0. Therefore when ANY bay becomes available it is allowed to become green, the train will pass it, recalculate, and enter the available bay. See this topic for more info
Awesome! Thank you. Eager to try that out now. :)
_________
Whatever I said is not legally binding.

User avatar
ssilk
Global Moderator
Global Moderator
Posts: 12888
Joined: Tue Apr 16, 2013 10:35 pm
Contact:

Re: Why is this train being stupid?

Post by ssilk »

That is also my experience and also the issue: Some way to tell a train, that he now needs to search a new path, but avoid to search always for new paths (cause this is CPU-intensive). In other words: A train should search new path only, if he needs to. :)

The problem with this definition is, that every player can interpret that differently and a programmer cannot guess, he needs to decide how that could be interpreted.

This is also the answer the OP question: This is "stupid", cause some programmer had to decide between using less CPU and more cleverness and he decided for the CPU, which was at that time the right decision, cause he could not know all implications, if he made it more clever, but know all if he decided for the CPU.
Cool suggestion: Eatable MOUSE-pointers.
Have you used the Advanced Search today?
Need help, question? FAQ - Wiki - Forum help
I still like small signatures...

User avatar
Deadly-Bagel
Smart Inserter
Smart Inserter
Posts: 1498
Joined: Wed Jul 13, 2016 10:12 am
Contact:

Re: Why is this train being stupid?

Post by Deadly-Bagel »

Hmm, well the programmatic way to decide that would be when a signal changes, it would fire a Signal Changed event (I presume it does this already). Any chain signals 'linked' to it would be subscribed to that event so it knows to update, which would trigger a path recalculation for any trains in its block. However I am aware of the problem where trains recalculate halfway through a junction of chain signals and pick a route that isn't available, deadlocking the junction. A way around this would need to be devised, I can think of three off the top of my head with various pros and cons.

When I tested this before, might have been 0.13, the train never recalculated.
Money might be the root of all evil, but ignorance is the heart.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Why is this train being stupid?

Post by mrvn »

Jupiter wrote:
impetus maximus wrote:try putting a station before the unload stations (left of blue square) with a wait time of 0 seconds. trains should recalculate after the 0 second stop.
I have used this technique in my previous game but it seems that it only works to a degree. This is because the trains will leave from that station immediately and only then will they calculate their path. If, at that moment, none of the stations are free it will just pick one. If that station isn't the first to clear up it won't reconsider its options.
Have you tried putting the station just behind a signal that you turn green only when a spot opens up? The train will then try to reach the station but gets stoped just before it by the signal. When the signal turns green it will reach the station and then find the way to the open spot.

Jupiter
Fast Inserter
Fast Inserter
Posts: 174
Joined: Thu Jun 23, 2016 2:38 pm
Contact:

Re: Why is this train being stupid?

Post by Jupiter »

mrvn wrote:
Jupiter wrote:
impetus maximus wrote:try putting a station before the unload stations (left of blue square) with a wait time of 0 seconds. trains should recalculate after the 0 second stop.
I have used this technique in my previous game but it seems that it only works to a degree. This is because the trains will leave from that station immediately and only then will they calculate their path. If, at that moment, none of the stations are free it will just pick one. If that station isn't the first to clear up it won't reconsider its options.
Have you tried putting the station just behind a signal that you turn green only when a spot opens up? The train will then try to reach the station but gets stoped just before it by the signal. When the signal turns green it will reach the station and then find the way to the open spot.
Nope and it would work indeed. However, that signal would have to be a normal signal hooked up to the circuit network but then the 0 sec trainstop would be redundant because, if I'm right, leaving that signal would cause a recalculation anyway. You practically end up with the faux-chain signal idea.

mrvn
Smart Inserter
Smart Inserter
Posts: 5704
Joined: Mon Sep 05, 2016 9:10 am
Contact:

Re: Why is this train being stupid?

Post by mrvn »

Have to try this with and without the extra station. If the signal is enough to recompute the way this could be fun.

Challenge: Design a minimal train network where the signals are such that the train always finds a path but never reaches its goal.

Post Reply

Return to “General discussion”