[0.8.0] Train Pathfinding.
[0.8.0] Train Pathfinding.
In my recent game, I am making a train heavy factory. This means a lot of dropoff and pickup stations to make the factory more flexible in expanding it. I recently built a coal depot and a new coal mine to connect it to. Now the train takes the correct route, MOST of the time. Sometimes, I observe the following routes from and to the depot:
I understand that this is possibly because of path caching, and might not even be a bug, but more time-efficient if it accounts for other planned routes. I do hope to get an answer.
Edit: I've seen other trains behave similar, taking routes that are definitely not the shortest, but for example take all 4 loops instead of just the one that is needed to get there.
I understand that this is possibly because of path caching, and might not even be a bug, but more time-efficient if it accounts for other planned routes. I do hope to get an answer.
Edit: I've seen other trains behave similar, taking routes that are definitely not the shortest, but for example take all 4 loops instead of just the one that is needed to get there.
Ignore this
Re: [0.8.0] Train Pathfinding.
There is no rail path caching. The path is always recalculated completely. The only thing that can influence the route at the moment are the one way streets. So it could be a bug. Could you post your save so we can have a look at it?
Re: [0.8.0] Train Pathfinding.
Here's a bit older savegame where the situation is still like in the screenshot.
I am running these mods:
- Test mode
- Treefarm Mod
I am running these mods:
- Test mode
- Treefarm Mod
- Attachments
-
- Train Pathfinding.7z
- Pathfinding savegame
- (2.78 MiB) Downloaded 99 times
Ignore this
Re: [0.8.0] Train Pathfinding.
So there is one more rule in the pathfinder I didn't mention:) When the next block is occupied or reserved (the train reserves his path 1-block ahead), then the path finder always prefers a different way. This makes sense for avoiding deadlocks on the 2-way single rail with occasional second rail for waiting trains. That is actually what is causing the issue here. If the train would be alone (I tried switching off all the other trains) it always takes the correct (shortest) path. The problem comes when he needs to stop on the signal because of some other train in the way. At that moment he looks whether there is not another way to take and it can happen that it is the "way around" in your scenario.
There is a relatively simple improvement that can be done (and will be for 0.8.1 unless we come up with something better). That is, that the train would recalculate the path also at the moment when the rail signal he is waiting at becomes free. I am saying improvement, not a fix, because it can still happen that the train will take a longer route. For instance if he needs to update the path, while he is on the roundabout. Then he can immediately take the longer (but free) path instead of waiting for the shorter one. I played with your save for a while and it happens now and then. But I consider it actually a correct behavior, because the train doesn't have a knowledge about what is happening ahead on the blocked rail and therefore he takes the shorter one.
If the train would have the knowledge, that the situation ahead will solve itself, then he could just wait for the shortest path and not recalculate. Something like Pathsignals?
P.S. Nice rail system;)
There is a relatively simple improvement that can be done (and will be for 0.8.1 unless we come up with something better). That is, that the train would recalculate the path also at the moment when the rail signal he is waiting at becomes free. I am saying improvement, not a fix, because it can still happen that the train will take a longer route. For instance if he needs to update the path, while he is on the roundabout. Then he can immediately take the longer (but free) path instead of waiting for the shorter one. I played with your save for a while and it happens now and then. But I consider it actually a correct behavior, because the train doesn't have a knowledge about what is happening ahead on the blocked rail and therefore he takes the shorter one.
If the train would have the knowledge, that the situation ahead will solve itself, then he could just wait for the shortest path and not recalculate. Something like Pathsignals?
P.S. Nice rail system;)
Re: [0.8.0] Train Pathfinding.
I deliberately chose not to put signals in the circle because I'm afraid it might cause deadlocks with 4 wagons behind an engine. With this setup, the intersection has to clear before a new train may enter
I'm also not yet at a point to mass produce signals.
I'm also not yet at a point to mass produce signals.
Ignore this
Re: [0.8.0] Train Pathfinding.
You should at least use more signals in sections between circles. Because now as soon as train exits circle block it will reserve the next circle block.
Test mode
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Searching Flashlight
[WIP]Fluid handling expansion
[WIP]PvP gamescript
[WIP]Rocket Express
Autofill: The torch has been pass to Nexela
Re: [0.8.0] Train Pathfinding.
I've since added more signals to the tracks. At the time I posted the savegame, it was an already 20 minutes old autosave to best illustrate what happens. I know there are also some flaws in execution, but they can be improved
@NeoTix: What software do you use to make those drawings? They look cool, and useful.
@NeoTix: What software do you use to make those drawings? They look cool, and useful.
Ignore this
Re: [0.8.0] Train Pathfinding.
I'm using AutoCad.
Re: [0.8.0] Train Pathfinding.
that's hardcoreNeotix wrote:I'm using AutoCad.
I have no idea what I'm talking about.
Re: [0.8.0] Train Pathfinding.
Nope. I'm working on that software 8h every day so i'm used to it. Besides, I drew almost all important parts and copy/pasty as blocks them and snap them to grid. It's really very easy to design big structures, easier then build them in the game.
Example, design of my sorting line. I'm not tested it yet in game
P.S Sorry for offtop
Example, design of my sorting line. I'm not tested it yet in game
P.S Sorry for offtop