The International Simutrans Forum

 

Author Topic: Industry and attraction automatic road connexions  (Read 446 times)

0 Members and 1 Guest are viewing this topic.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19273
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Industry and attraction automatic road connexions
« on: January 27, 2020, 01:19:33 AM »
From to-morrow's nightly build, road connexions will automatically be built to industries and attractions built outside towns. This will happen both on map generation and when new industries are built during the course of the game. The road used will be the standard inter-city road for the period, and they will be built as unowned public rights of way, ready to be upgraded or diverted by players.

Here is a screenshot of the effect of this in a new game generated in 1750:


This can be disabled in simuconf.tab:

Code: [Select]
# This setting will connect every industry and attraction not in a town by road to the nearest town
# that it can reach whenever an industry or country attraction is built. The number specifies how far down
# the rank order of nearest towns that the industry/attraction will try to connect to if it cannot
# connect to the nearest town.
#
# 0 = disabled
# 1 = try to connect to the nearest town
# 2 = try to connect to the nearest town, and, if unsuccessful, try to connect to the second nearest town
# 3 = ...first, second, then third nearest town
# ...etc.
auto_connect_industries_and_attractions_by_road = 4
This should help to affect balance at the beginning of games, as players will not need to incur the forge cost in connecting to industries and attractions by road.

Offline Freahk

  • *
  • Posts: 577
  • Languages: DE, EN
Re: Industry and attraction automatic road connexions
« Reply #1 on: January 27, 2020, 02:00:28 AM »
That's quite a lot of stupid looking roads. However, it will fix the issue that serving attractions outside of towns is most often not worth it. Same for small industries. Thus it's fine.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19273
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Industry and attraction automatic road connexions
« Reply #2 on: January 27, 2020, 12:22:08 PM »
Thank you very much for testing: this is most helpful.

The somewhat disorganised nature of the roads is unfortunate; this is one of those things where solving the small problems takes much more work than solving the large problems. This is one of the reasons why I made this feature optional.

There was a time, years ago, when the connexion of towns by roads had the same disorganised appearance because basically the same algorithm was used. This was then changed to a spanning tree algorithm used now, which makes the initially generated town roads much neater and more realistic. I did look into adapting this at least for initially generated industries, but found that this is not possible without a very large amount of work, as the industries and attractions are all generated after the inter-city roads are created.

In any event, the spanning tree algorithm cannot assist for industries generated after map creation, which need to calculate their roads one by one.

However, it does occur to me, in connexion with our private car routing discussion, that these routes could be used to seed the initial town to industry routes.

Offline accord2 pt

  • *
  • Posts: 241
  • Languages: EN, PT
Re: Industry and attraction automatic road connexions
« Reply #3 on: January 27, 2020, 03:15:03 PM »
I was testing it and I can't turn this feature off. When I edit simuconf I can "disable" it with = 0, but in game, when I edit the settings using "i", I can't write 0, that means that this feature cannot be turn off. Zero is not accepted by the settings, just 1, 2, 3, etc

Offline Matthew gb

  • *
  • Posts: 316
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
Re: Industry and attraction automatic road connexions
« Reply #4 on: January 27, 2020, 03:54:57 PM »
James, thank you very much for implementing this! It is a long-standing extension request and makes a very big difference to the economics of freight in particular.

That's quite a lot of stupid looking roads.

 ??? I see one weird road in the middle centre of that image (the two roads running parallel), otherwise they all look pretty realistic to me. But maybe I'll see more weird cases when I test it properly.

Offline Ranran jp

  • *
  • Posts: 659
  • Languages: ja
Re: Industry and attraction automatic road connexions
« Reply #5 on: January 27, 2020, 04:00:31 PM »
That's quite a lot of stupid looking roads.
Is it difficult to stop extending a road when it crosses another road?

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19273
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Industry and attraction automatic road connexions
« Reply #6 on: January 27, 2020, 09:40:59 PM »
Accord2 - thank you for that report: I believe that I have now fixed this. I should be grateful if you could re-test with the next nightly build.

Matthew - that is kind of you to say.

Ranran - this would involve modifying the algorithm for building roads, which would considerably increase the amount of work required; all that I did for this was to use the existing road-building algorithm.

It could be done eventually, but this is not a high priority compared to having some road connexions to industries.

Offline Vladki cz

  • Devotee
  • *
  • Posts: 2906
    • My addons, mostly roadsigns, pak128.cs
  • Languages: EN, CS
Re: Industry and attraction automatic road connexions
« Reply #7 on: January 27, 2020, 10:36:14 PM »
On stephenson siemens, now several new roads appeared. I have rebuild some of the ugly ones as public player, but after a while they are back. Even if the industry is already connected, the road is built again. E.g. (163, 279) or (886, 911)

They are rebuilt with every save/load cycle.

See one of the very bad ones...
« Last Edit: January 28, 2020, 12:16:37 AM by Vladki »

Offline Qayyum

  • *
  • Posts: 158
Re: Industry and attraction automatic road connexions
« Reply #8 on: January 28, 2020, 04:03:19 AM »
Several:

1. Ugliness in game = 'It is just agame'
2. Several road connect=Thepriceoffreedom

Offline accord2 pt

  • *
  • Posts: 241
  • Languages: EN, PT
Re: Industry and attraction automatic road connexions
« Reply #9 on: January 28, 2020, 08:55:16 AM »
Thank you James, it is fixed now. :)
@Vladki I can confirm this and in my game I fixed it repairing the roads and then disabling the feature.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19273
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Industry and attraction automatic road connexions
« Reply #10 on: January 29, 2020, 02:33:04 AM »
I believe that I have now fixed the issue in which roads would be generated when a game was loaded - I should be grateful if this could be re-tested and confirmed.

Offline Leartin at

  • Devotee
  • *
  • Posts: 1340
  • PAK-DEV P192C
  • Languages: DE, EN
Re: Industry and attraction automatic road connexions
« Reply #11 on: January 29, 2020, 07:40:48 AM »
Just a general idea:
Dumbed down, this is basically an AI clicking with the build-road-tool once next to the factory and once in a city, right?
The pathfinding for the roadbuilding gives different weights to different tiles - to avoid slopes and tight corners when possible, but also to reuse existing roads (that's why you can't build long parallel tracks, as you gain more from reusing the same track than you spend on curves, while short parallel tracks work), right?
Could you just redefine the weights to make everything ten or a hundred times more 'expensive', except for tiles with existing roads/make existing roads free? Therefore, instead of heading straight for the next city, the pathfinder should pretty much try to access the nearest road, which would also be the cheapest option to build and involve less road tiles overall.

Offline Freahk

  • *
  • Posts: 577
  • Languages: DE, EN
Re: Industry and attraction automatic road connexions
« Reply #12 on: January 29, 2020, 10:23:13 AM »
I don't think it's just a call of the build road tool as that tool won't do any terrain alignment.

Offline Matthew gb

  • *
  • Posts: 316
    • Japan Railway Journal
  • Languages: EN, some ZH, DE & SQ
Re: Industry and attraction automatic road connexions
« Reply #13 on: January 29, 2020, 10:37:26 AM »
I believe that I have now fixed the issue in which roads would be generated when a game was loaded - I should be grateful if this could be re-tested and confirmed.

This is now fixed for at least the first load. I was getting crashes every time I tried to load my current save game, so this is good news!

Several:

1. Ugliness in game = 'It is just agame'

Quite right! Anyway, I have run several test maps (256x256 using the master from today, 20-01-29) and the attraction & industry roads all look right to me. I have never seen a repetition of the two long parallel roads in James' screenshot, so either that was unlikely or the algorithm has been improved since then. I sometimes see many industries without roads, which is possibly correlated with a large percentage of the map being filled by fields. But I don't think having a road to everywhere is particularly necessary. So I don't see ugliness, I see a beautiful new feature!

Quote
2. Several road connect=Thepriceoffreedom

Yes, that's a good way of looking at it. There was no master planner behind Great Britain's 17th-century road network, after all.

BTW auto_connect_industries_and_attractions_by_road is currently listed in the Extended/Passengers tab of the Settings Window. This was about the last place I looked for it. Wouldn't 'Routing' be a more sensible place? But it's a very minor point.

Offline jamespetts gb

  • Simutrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 19273
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Industry and attraction automatic road connexions
« Reply #14 on: January 29, 2020, 11:12:48 AM »
Splendid, thank you all for testing. I do not believe that there is a means within the existing algorithm to alter the weightings on a per caller basis, so this would be a larger project. I did indeed simply re-use the existing build road algorithm rather than write a new one.

I will have to look into moving the position of this item in the advanced settings dialogue tab.