The International Simutrans Forum

 

Author Topic: Routing with 2 halts on factory.  (Read 313 times)

0 Members and 1 Guest are viewing this topic.

Offline hreintke

  • *
  • Posts: 159
Routing with 2 halts on factory.
« on: November 07, 2018, 04:58:14 PM »
I am trying to get a detailed grasp of the routing.

Observed the following.

I have :
An Oilfield factory "Oil 2" which has two halts attached "Oil 2 Halt" and "Oil 2a halt"
Oil is supplied to one "Oil Central" which has one halt : "Cen 2 Halt".
A halt "Oil middle" not connected to a  factory.

The lines are :
1/ "Oil 2 Halt" -> "Cen 2 halt"
2/ "Oil 2a Halt" -> "Oil middle halt"
3/ "Oil middle halt" -> "Cen 2 halt"

As the direct line 1/ is shorter than the combined 2/ & 3/ I expected all the goods passing thru that line.

However, The oil is transported along both options.
What is the reasoning behind this way of transporting ?

Attached a small savefile which includes the config described above.
 


Offline TurfIt

  • Dev Team, Coder/patcher
  • Devotee
  • *
  • Posts: 1305
Re: Routing with 2 halts on factory.
« Reply #1 on: November 07, 2018, 08:18:45 PM »
Distribution of goods from factories to connected halts is before the routing. It's done in a round robin fashion for 'fairness'. i.e. It's expected if there's multiple stations, they belong to different companies, hence the goods are distributed roughly equally to each.

Offline Leartin

  • Devotee
  • *
  • Posts: 1062
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Routing with 2 halts on factory.
« Reply #2 on: November 08, 2018, 06:43:05 AM »
Distribution of goods from factories to connected halts is before the routing. It's done in a round robin fashion for 'fairness'. i.e. It's expected if there's multiple stations, they belong to different companies, hence the goods are distributed roughly equally to each.
Wait, how does that work? Goods are only put into a connected halt if there is a route to a consumer. How would it know whether there is a route to a consumer before routing?  :o
I would have thought the routes Oil2-Central and Oil2a-Central would be seen as completely different things, just as if they would have different destinations. And between different routes, it does not matter which is shorter, it's only about the shortest route between the same two stations.
Or is that what you meant? That Routing does not start at the factory, but the stations, hence it's "after" goods are placed in them, even though they are only placed if routing was successful?

Offline hreintke

  • *
  • Posts: 159
Re: Routing with 2 halts on factory.
« Reply #3 on: November 08, 2018, 02:52:40 PM »
Checked in the code from fabrik_t::verteile_waren(product)

Code is :

Code: [Select]
For all halts attached to fab
For all consumers of product
assign goods (partial) to halt,destination consumer
End
End
For all assigned goods
Search Route between assigned halt and consumer
If Route available
Deliver goods to assigned halt
End if
End

I expected it to be something like this

Code: [Select]
For all consumers of product
Find Route (partial) goods to consumer using all halts
If Route Available
Deliver goods to found halt
End if
End

That would give that goods are always transferred using the shortest route

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5337
  • Languages: EN, NO
Re: Routing with 2 halts on factory.
« Reply #4 on: November 08, 2018, 05:58:08 PM »
At first, it seemed odd, but then I started thinking about it.

Realistically, a factory would deliver cargo to the station with the best balance of the average cost of getting the goods to its ultimate destination and the speed of which it gets there. (Or to the company paying the biggest bribe.) However, I don't think regular Simutrans is smart enough for any of that. How many hubs the goods have to pass through is not something the customer would care about, as long as it is efficient, except for passengers to some degree.

In some cases, they may perhaps split the load between several shippers to minimize the risk that deliveries stop completely due to labor disputes, bankruptcies or other company specific problems. Or simply because there is no single company with enough capacity. Neither is much of an issue in Simutrans, but it gives fair distributions a somewhat root in reality.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9278
  • Languages: De,EN,JP
Re: Routing with 2 halts on factory.
« Reply #5 on: November 08, 2018, 11:47:12 PM »
Since stops can overcrowd, a bad route will have overcrowding issues. And since in early networkgames stealing of goods was an issue, the current implementation was added.

Offline Leartin

  • Devotee
  • *
  • Posts: 1062
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Routing with 2 halts on factory.
« Reply #6 on: November 09, 2018, 05:38:26 AM »
How many hubs the goods have to pass through is not something the customer would care about, as long as it is efficient, except for passengers to some degree.
While theoretically true, if that's the arguement, it would apply to every route, and the entire idea of counting stops and hops could go into the circular file.

Quote
In some cases, they may perhaps split the load between several shippers to [...]
All true, but would not be dependent on having several loading docks. If any of your reasons were to be assumed, the second route would not cease to exist merely because Oil2 and Oil2a would merge.


Since stops can overcrowd, a bad route will have overcrowding issues.
Might stop the bad route from being available most of the time, but only at the cost of constant overcrowd messages, and since it's probably an unintended cross-connection, will hurt the route of other goods that were actually supposed to go that way.

Quote
And since in early networkgames stealing of goods was an issue, the current implementation was added.
Does that really solve anything?
With this behaviour, even if you already have a direct point-to-point connection, someone else can come along and build a ridiculous route to some faraway hub that eventually leads to the same destination and would steal half the goods.
Without this behaviour, goods could not be stolen unless a more or equally direct route is buildt. And then, it's not so much stealing as it is simply outcompeting. With a nice side-effect, since bouncing goods between stations for extra money would be risky and players discouraged from doing so.
The only time goods should be split is if two routes are equal.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5337
  • Languages: EN, NO
Re: Routing with 2 halts on factory.
« Reply #7 on: November 09, 2018, 03:53:42 PM »
All true, but would not be dependent on having several loading docks.
No, but in Simutrans, companies build their own, rather than the factories having one built in (except for off-shore "factories"). In network games, one could have a game master providing public stops, but I don't know if that is done.

Offline hreintke

  • *
  • Posts: 159
Re: Routing with 2 halts on factory.
« Reply #8 on: November 10, 2018, 11:15:51 AM »
Independent on how simutrans acts like real life.

I had the impression the transfer was consistent across shortest route.
In this case that is not, so need to be especially careful when designing layouts with multiple halts at one factory

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5337
  • Languages: EN, NO
Re: Routing with 2 halts on factory.
« Reply #9 on: November 10, 2018, 02:01:09 PM »
I've fortunately never had the idea to have more than one stop for collecting stuff from a factory, only to deliver stuff without also creating a transfer to other lines. The only reason to do so that I can think of, is if one line is chronically overcrowded, preventing goods from being delivered to the other lines. I would have tried everything to get rid of the overcrowding first, though.