News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

Changes to distribution of goods from factory to stations

Started by Fifty, November 25, 2012, 04:16:48 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Fifty

I have two suggestions in order to improve routing in Simutrans. I know these may be rather complex, but they would help gameplay quite a bit.

The first, mentioned here, relates to multiplayer networks. Factories will give their entire output to whatever station has the largest capacity, and not produce for other players serving the factory until the largest station is overcrowded. This leads to players putting huge numbers of station extension buildings everywhere. There seem to be some occasional exceptions to this, but I don't really know why they occur. I would suggest splitting cargo evenly, or, even better, choosing the better route based on transfers/distance if two players offer service to the same destination.

The second has to do with what the "better route" is. Currently, passengers and freight will first look for the route with the smallest number of transfers, and then if two routes have the same number of transfers, for the route with the shortest first leg. This makes non-circular passenger rail lines work rather poorly, as oftentimes passengers will choose a different route to their destination than they do home. Thus trains lines will be more heavily loaded in one direction than the other. I would suggest that if two routes have the same number of transfers, that pax/goods will take the one with a shorter total distance, and thus the same route in both directions.


Edit: changed post title to change thread title -- dwachs
Why do we park on the driveway and drive on the parkway?

Dwachs

Quote from: Fifty on November 25, 2012, 04:16:48 PM
The first, mentioned here, relates to multiplayer networks. Factories will give their entire output to whatever station has the largest capacity, and not produce for other players serving the factory until the largest station is overcrowded. This leads to players putting huge numbers of station extension buildings everywhere. There seem to be some occasional exceptions to this, but I don't really know why they occur. I would suggest splitting cargo evenly, or, even better, choosing the better route based on transfers/distance if two players offer service to the same destination.
I see your point, imho the distribution of goods to factories could be reworked.

If transfers are taken into account, then direct connections will win. Every player will build direct connections. Now, how to distribute between two networks?

Imho, somehow quality of service should be taken into account: that is, how many goods can be delivered by a player's network per time. I do not know, how to implement such a thing.

Quote
The second has to do with what the "better route" is. ... I would suggest that if two routes have the same number of transfers, that pax/goods will take the one with a shorter total distance, and thus the same route in both directions.
What do you mean by total distance?

Routing is now based on two facts:  Routes are chosen to have as less transfers as possible, while counting in-between halts.
Parsley, sage, rosemary, and maggikraut.

Fifty

Quote from: Dwachs on November 25, 2012, 04:49:51 PM
Imho, somehow quality of service should be taken into account: that is, how many goods can be delivered by a player's network per time. I do not know, how to implement such a thing.

Perhaps goods could be sent by a ratio based on how many units per month of transport capacity serves that station? Of course that would not work for new stations, however.

Quote
What do you mean by total distance?

Routing is now based on two facts:  Routes are chosen to have as less transfers as possible, while counting in-between halts.

It seems I'm confused about how routing works. Let's use a basic example: You have 2 tracks from A to E, one running A-C-E and the other A-B-D-E. A-B is shorter than A-C, E-C is shorter than E-B.

  /-B---D-\
A<          >E
  \-----C-/


Let's say that trains don't stop at D. How would passengers get from B to C? Would they take the same route back from C to B? Now what if trains do stop at D, how would pax get from B to C and back? How would pax get from A-E? would it matter if one route was shorter (fewer tiles)?

My biggest concern is that pax often do not take the same route to their destination as they do back, so it is difficult to balance flows with some setups.
Why do we park on the driveway and drive on the parkway?

Ters

My solution to the uneven flow problem is to avoid loops of even number of lines, but it becomes difficult once the network becomes complex.

jamespetts

The first suggestion was implemented by Knightly into Experimental a long time ago; and Experimental already has time based routing to deal with the second issue.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

sdog

Quote from: Dwachs on November 25, 2012, 04:49:51 PM
Imho, somehow quality of service should be taken into account: that is, how many goods can be delivered by a player's network per time. I do not know, how to implement such a thing.

One way would be to check the global rating of a player, compare goods transportet last 3 months and compare it with the total amount of goods at stations of the last three months. In a real setting a customer would also only have an idea of the overal reputation of a company.

It would have the nice sideffect that players need to create efficient networks before expanding, else the competitors will get a larger share of goods.

TurfIt

#6
For the first, that shouldn't be happening. I've just recently seem some wrong distributions (yet again!) and planned to look into it today, but that was with only a single player/station. Do you have a small simple savegame demonstrating this?

The size of the stations should only come into play when there's no convoys loading. Before I added size as a factor, larger stations were useless as it would always distribute evenly until the smaller overflowed. Now, it should be distributing in proportion to the sizes. E.g. station A with capacity 100, station B with capacity 200. Distributions should be A, B, B, A, B, B, ...
If any player has a convoy loading, then that empties the station and will result in all distributions to him.
If all players have a convoy loading, then it should distribute A, B, C, A, B, C, ...
So, if you're in a 'war' for cargo, you need to leave a convoy loading at all times. Just like good ole TTD!


Defining 'better' for routing is quite a task. Dwachs had tried a journey time implementation but it suffered from oscillations of the routes. It's certainly worth another try...

I believe a distance based criterion was tried in the past most unsuccessfully. Prissi?

On my todo list is to try a hybrid approach -  number of hops with distance as a tie breaker. That way if there's two routes with the same number of hops, the one with the shortest distance will be prefered, but if there's a route with less hops, it will be taken even if longer. That should even the flows.


Edit:
Note there's a big difference between factory distributions and routing, perhaps this should be two topics?

Fifty

Please take a look at this example savegame I just created. Blue has the larger station. http://simutrans-germany.com/files/upload/multiplayer_routing.sve

If both red and blue trains are at the station, then only the blue train will load. Once the blue train leaves the station, it fills to what seems to be some percentage of its capacity, and then the red train begins to load. If I add enough station extensions, the red train will never leave the station, as all of the coal will go to the blue platform.

If both trains are out of the station, then the station with a greater difference between its capacity and the amount in the station gets the freight. For example, if blue has a 1000 unit platform filled with 600 units of coal and red has a 200 unit platform filled with 50 units of coal, blue will get the freight until it has 850 units, at which point supply will alternate.

Quote from: TurfIt on November 25, 2012, 06:11:22 PM
On my todo list is to try a hybrid approach -  number of hops with distance as a tie breaker. That way if there's two routes with the same number of hops, the one with the shortest distance will be prefered, but if there's a route with less hops, it will be taken even if longer. That should even the flows.

Edit:
Note there's a big difference between factory distributions and routing, perhaps this should be two topics?

This is what I would very much like to see. Please feel free to split these topics, sorry for creating confusion!
Why do we park on the driveway and drive on the parkway?

Dwachs

#8
Quote from: TurfIt on November 25, 2012, 06:11:22 PM
The size of the stations should only come into play when there's no convoys loading. Before I added size as a factor, larger stations were useless as it would always distribute evenly until the smaller overflowed. Now, it should be distributing in proportion to the sizes. E.g. station A with capacity 100, station B with capacity 200. Distributions should be A, B, B, A, B, B, ...
If any player has a convoy loading, then that empties the station and will result in all distributions to him.
If all players have a convoy loading, then it should distribute A, B, C, A, B, C, ...
Thats not what is happening. It seems that the shift-right >> precision_bits in distribute_ware_t constructor is wrong. results in integer underflow.

Quote from: jamespetts on November 25, 2012, 05:58:22 PM
The first suggestion was implemented by Knightly into Experimental a long time ago; ...
??? The method in question (fabrik_t::verteile_waren) seems almost identic in standard and experimental (the only differences I could spot where due to the different routing in exp).
Parsley, sage, rosemary, and maggikraut.

Dwachs

Mod Note:

Please continue discussion about passenger routing over there:

http://forum.simutrans.com/index.php?topic=10932

Thank you.
Parsley, sage, rosemary, and maggikraut.

Dwachs

here is a patch for distribute_ware_t, which should be integer overflow and underflow save.
Parsley, sage, rosemary, and maggikraut.

TurfIt

Heh, was just going to say time for 64bit! Feels like a cop out to keep changing to 64bit calcs all over the place rather than working within the 32bit bounds...

Go ahead and commit; It fixes things. I also found the source of the distribution problem I mentioned - index_offset needs to be on a per ware basis.

Dwachs

Parsley, sage, rosemary, and maggikraut.