News:

Simutrans Wiki Manual
The official on-line manual for Simutrans. Read and contribute.

Road autobuilder is extremely wasteful

Started by freddyhayward, December 27, 2020, 11:32:16 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

freddyhayward


I created this mess by clicking once the townhall road and each attraction. The road builder supposedly checks for existing roads but I don't know why that doesn't help.

prissi

It strongly depends on the weight setting you used and wether you pressed control or not (you did not, of course).

Also curves are very expensive, so if it can save a curve, it will do a new route unless it can save 20 tiles or so. On real maps, this is leass obvios, since the topography usually determines the shape of teh roads a lot.

freddyhayward

Quote from: prissi on December 27, 2020, 01:21:26 PM
It strongly depends on the weight setting you used and wether you pressed control or not (you did not, of course).

Also curves are very expensive, so if it can save a curve, it will do a new route unless it can save 20 tiles or so. On real maps, this is leass obvios, since the topography usually determines the shape of teh roads a lot.
I'm not sure what you mean here, are you suggesting possible causes of the bug, or saying that it is not a bug?

Mariculous

#3
It's not a bug, it's the way how the way constructor works.
You can configure that behavior in simuconf.

freddyhayward

Quote from: Freahk on December 28, 2020, 01:39:28 AMIt's not a bug, the the way how the way constructor works.
You can configure that behavior in simuconf.
Typical KDE user response ;D. But seriously, I have tried all sorts of combinations in simuconf.tab and it usually makes it worse. If the default is that bad, and it cannot easily be improved through settings, it is probably either a bug or bad design.

Mariculous

Quote from: freddyhayward on December 28, 2020, 02:51:02 AMTypical KDE user response
actually true :D

Quote from: Freahk on December 28, 2020, 01:39:28 AMIf the default is that bad, and it cannot easily be improved through settings, it is probably either a bug or bad design.
The latter I guess

prissi

It should make a difference, if the costs for curves are lowered. But then the first road may look weird.

freddyhayward

#7
Quote from: prissi on December 28, 2020, 05:14:46 AM
It should make a difference, if the costs for curves are lowered. But then the first road may look weird.
This is how it looks with all curve costs halved:

prissi



Dwachs

#10
Changing all costs by a constant factor will not change anything. You have to change the ratios of the costs to get a different output. A first step could be to lower the high costs for these advanced curve penalties.

For the way builder in the scripted AI, I implemented something that is equivalent to way_straight=8, way_curve=4.

Edit: corrected the weights
Parsley, sage, rosemary, and maggikraut.

freddyhayward

Quote from: Dwachs on December 28, 2020, 09:42:02 AMChanging all costs by a constant factor will not change anything. You have to change the ratios of the costs to get a different output. A first step could be to lower the high costs for these advanced curve penalties.
I did not change all costs - I changed all curve costs, so the ratio of all curves to straights decreased. Secondly, increasing all costs by a constant factor should change things in theory, because the cost of all new roads would increase relative to the cost on existing tiles: costs = str ? 0 : s.way_count_straight;
Thirdly, trying your settings (except that the minimum cost is 1, and there is no setting for an additional penalty for tiles without roads) produced a significantly worse result:

Dwachs

If way_curve is smaller than way_straight then following a curved road is cheaper then creating a new straight piece of road.

The cost of going along an existing straight road is zero. The cost of building a straight new piece of road is way_straight. The cost of changing direction then added   (way_curved). So the cost to follow an existing curve is way_curve, where the cost to build a new curve is way_straight+way_curve. The costs of all the other penalties is added on top.

One certainly has to play with these values to get visually pleasing results.
Parsley, sage, rosemary, and maggikraut.

jamespetts

It is probably rather harsh to call this a "bug": what is needed in order to remove these symptoms is likely to be a much more sophisticated algorithm which would take considerable work to implement. What we have at present works, albeit is somewhat suboptimal. I am sure that if someone could come up with a design to make the road building algorithm more sophisticated, it would be incorporated. Certainly, I should be happy to incorporate a more sophisticated algorithm into Extended, although ideally one would use the same algorithm in both Standard and Extended since there is no reason for this part of the code to differ, so it would be better for such a change to go into Standard first.
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.

freddyhayward

Quote from: jamespetts on December 28, 2020, 01:25:33 PMIt is probably rather harsh to call this a "bug": what is needed in order to remove these symptoms is likely to be a much more sophisticated algorithm which would take considerable work to implement. What we have at present works, albeit is somewhat suboptimal. I am sure that if someone could come up with a design to make the road building algorithm more sophisticated, it would be incorporated. Certainly, I should be happy to incorporate a more sophisticated algorithm into Extended, although ideally one would use the same algorithm in both Standard and Extended since there is no reason for this part of the code to differ, so it would be better for such a change to go into Standard first.
The main relevance to extended here is the road connections automatically built for industries and attractions - this is what led me to test it in standard.

prissi

Also the building order is important. When starting at the attractions the roads are much more messier, since it tend to generate direct lines and new connections would be detours. If starting at the townhall and build first the the closest and then further out, the road layout with the same weight is much better. I could never produce the spaghetti in your images. (And this is with default weights).

jamespetts

Freddy - I did suspect that that might be the case.

Prissi - interesting. I will have to see whether I can look into reversing the origin and destination pairs in Extended for the automatic industry/attraction road builder.
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.

Vladki

Quote from: jamespetts on December 28, 2020, 02:12:30 PM
Prissi - interesting. I will have to see whether I can look into reversing the origin and destination pairs in Extended for the automatic industry/attraction road builder.
And also the order in which they are built (as Prissi said, build roads to the closest targets first)

jamespetts

Quote from: Vladki on December 28, 2020, 02:22:20 PM
And also the order in which they are built (as Prissi said, build roads to the closest targets first)

There is nothing that can be done about that when industries open one by one as the game progresses.
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.

Vladki

Well, often a whole chain is created at once - one factory and several dozens of farms supplying it. In such case it would be worth to build the roads in proper order.