News:

Simutrans Forum Archive
A complete record of the old Simutrans Forum.

Industry and attraction automatic road connexions

Started by jamespetts, January 27, 2020, 01:19:33 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

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:

# 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.
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.

Mariculous

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.

jamespetts

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.
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.

accord2

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
Son of a railroad man,  growing up in train stations, lover of trains

Matthew

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.

Quote from: Freahk on January 27, 2020, 02:00:28 AM
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.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Ranran(retired)

Quote from: Freahk on January 27, 2020, 02:00:28 AMThat's quite a lot of stupid looking roads.
Is it difficult to stop extending a road when it crosses another road?
ひめしという日本人が開発者達の助言を無視して自分好みの機能をextendedに"強引に"実装し、
コードをぐちゃぐちゃにしてメンテナンスを困難にし(とりわけ道路と建物関連)、
挙句にバグを大量に埋め込み、それを知らんぷりして放置し(隠居するなどと言って)別のところに逃げ隠れて自分のフォーク(OTRP)は開発を続けている
その事実と彼の無責任さに日本人プレイヤーは目を向けるべき。らんらんはそれでやる気をなくした(´・ω・`)
他人の振り見て我が振り直せ。ひめしのようにならないために、らんらんが生み出したバグや問題は自分で修正しなくちゃね(´・ω・`)

jamespetts

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.
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

#7
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...

Qayyum

Several:

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

Simutrans - the open source Transport Tycoon Deluxe clone.

accord2

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.
Son of a railroad man,  growing up in train stations, lover of trains

jamespetts

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.
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.

Leartin

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.

Mariculous

I don't think it's just a call of the build road tool as that tool won't do any terrain alignment.

Matthew

Quote from: jamespetts 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.

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!

Quote from: Qayyum on January 28, 2020, 04:03:19 AM
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!

Quote2. 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.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

jamespetts

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.
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.