News:

Simutrans Tools
Know our tools that can help you to create add-ons, install and customize Simutrans.

wegbauer automated path finder neither builds bridges & tunnels nor terraforms

Started by dschr, September 15, 2017, 02:23:27 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

dschr

Hello everybody,

I am using the latest version from github of simutrans-extended. I already wrote a mail to James Petts about this topic and he replied that this part of the code does not differ much from the standard simutrans code. It also would be interested for me if someone could verify whether this behaviour is also reproducable in standard simutrans.

The behaviour of building a new way (i.e. a road or a track) by drag&drop has some obvious oddities:
- if one needs to pass a river and therefor a bridge becomes necessary, the drag&drop path finder seems to be not able to do so and fails to find a way.
Moreover, if there is any other option for the path finder to bypass the construction of a tunnel or a bridge, it will do so, no matter how  long the detours is.
- I never saw tunnels created by drag&drop, although it might be useful in some cases.
-wegbauer.h seems to have a flag set for terraforming (4), which would be very useful in many cases, however, I never saw that slopes are build by drag&drop.

Many of these points also seem to be true for the intercity roads created at map generation.

My questions are:
1) It would be quite helpful is someone could verify this behaviour for standard simutrans as a reply to this message.
2) Is this just a matter of finding the right configuration or is there simply no code implemented yet for terraforming the landscape with drap&drop way building? Is it possible to build a bridge over a river in simutrans with drag&drop? If not, what hinders us to do so?

Please refer to the attached pictures as an easy to test example of what I mean. In each, I build a track from tile A to tile B by drag&drop. Instead of creating an useful path, the created ways instead do enormous detours as they circumnavigate around the obstacles (1st. picture: the river/ bridges , 2nd. picture: terraforming).

thank you very much,

Daniel

Dwachs

All the corresponding code is there, but not available to the player. This code is used for building roads during map generation: it will build bridges and terraform sometimes. Building tunnels only happens under very special circumstances and is rarely seen.
Parsley, sage, rosemary, and maggikraut.

Ters

Some players might find automatic bridge building counterproductive. The game can't possibly know which bridge they want to build. Also, both bridges and terraforming are relatively expensive. One might go bankrupt if a small mistake causes the game to automatically do a lot of that. Of course, that may happen because the game won't build bridges or terraform, due to enormous detours, but at least that is easier to spot before letting go of the mouse button. This may not be the reason for why things are as they are, but they might be reasons for keeping things as they are.

jamespetts

Thank you for starting this discussion. I believe that Daniel first raised this in e-mail correspondence with me regarding Simutrans-Extended in connexion with bridges not being built in many cases when it would appear optimal to do so when roads are built at map generation. I have not had a chance to test this in detail as it is a complex issue and lower in priority than a number of other things, but it would be useful to know how well that this works in Standard to know whether what I need to do is to make the code work more like Standard or try to find a different way of doing things when I do look into this. (If it does not work well in Standard, it might also be worth considering fixing it there).

As to automatic bridge building for players, I do see Ters's point - it is difficult to see how this would work well given the range of bridges available, at least without a new dialogue allowing the player to choose, one by one, which bridge is to be built (and whether any bridge is to be built) for each river (etc.) crossing, and adding that would be a substantial piece of work.
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.

dschr

Hello,

thank you for your replies.
I guess we have to differ between three different questions here.

The first would be whether the detours of intercity roads created at map generation are caused by a simutrans-extended specific bug or whether this is a behaviour which also could be observed in standard simutrans.
It would be helpful if someone could verify this. To formulate this as a verifiable question: Do you have an example image of an interncity road which was created at map generation and which used a bridge to cross a river outside of a town?

Second question:
I am interested in testing out the described code which map generation uses to find paths (including terraforming, building tunnels and bridges) as a player. Does somebody know what I have to change (probably in wegbauer?) to do this?
How does the algorithm decide where to set a slope tile and/or a tunnel/bridge? Is it by minimizing the cost? Where can I find the relevant part of the code?


The third question would then rather be a feature request: After quite a while of playing simutrans, I do find that the way-building interface is rather simplistic.
Sometimes it becomes therefor a bit user-unfriendly to build new ways; especially at the beginning railway era, where it does make sense to build a wide network of rather cheap lines.
In a perfect world, way building would work as a planning/drawing tool, where you could build draft rails&roads. After you have found the route you want to build, you could then mark the draft route for building.
I understand that this would be quite a lot of work, but if someone with programming skills would be interested in implementing this, I would be grateful to get in contact with him/her.

Best,

Daniel

jamespetts

I should also be interested to know whether the behaviour as to bridges differs between Standard and Extended - if anyone is able to test, I should be very grateful.

As to a way planning tool, this would require a major overhaul of the interface for building ways at its most basic level, and would require a lot of work. This is not a priority for Extended at present, although it would be good to have it one day - when all the higher priority things have been done (or if someone else wants to code this earlier).
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.

Dwachs

1) bridges do get build in simutrans standard during map generation. So this seems to be a simutrans-ex specific bug (or just a missing merge of a bugfix commit)

2) in wegbauer.cc: uncomment the lines with #DEFine AUTOMATIC_TUNNELS / BRIDGES. Then you should be able to build ways with bridges automatically.

in simtool.cc: in tool_build_way_t::calc_route add the terraform flag to bautyp

Parsley, sage, rosemary, and maggikraut.

jamespetts

Thank you very much for the reply: I think that I have now found and fixed the error in which bridges did not build with automatic roads built to connect towns - would anyone be able to re-test to confirm the fix? Incidentally, I do recommend increasing the maximum road distance between towns to make sure that they are all connected.

As to the automatic bridge building that can be enabled, this should still work in Extended as I have confirmed that all the code from Standard is still there (although I have not tested this), but note that this is not really suitable for general usage as there is no interface allowing players to choose what bridge to build: the bridge is chosen for them automatically in the same way as with the bridges built between cities automatically.
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.

dschr

Thank you very much, Dwachs, James and Ters,

With the help of Dwachs comment, I tried out automatic bridge building and terraforming as a player and although it does not work perfect, I have to say that I myself find that the resulting ways are much more useful (and can be used with a higher speed) than before.
Of course, the bridges used by automated drag&drop most often do not fit. However, as it seems that they choose rather cheap ones, I am okay with deleting them and replacing them afterwards.

Also, James already fixed this bug in extended so that intercity roads which are created at map generation also make use of bridges to cross rivers.

Best,

Daniel


jamespetts

Thank you for confirming the fix. I have just pushed a further change where, if you enable AUTOMATIC_BRIDGES or AUTOMATIC_TUNNELS, the bridge or tunnel selected will, if possible, have the same speed limit as the underlying way.

I wonder whether it might be worthwhile changing this setting from a preprocessor definition to something that can be set in simuconf.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.

Ters

Quote from: dschr on September 18, 2017, 07:13:07 AM
Of course, the bridges used by automated drag&drop most often do not fit. However, as it seems that they choose rather cheap ones, I am okay with deleting them and replacing them afterwards.

One possibility could be to do the path finding as if the bridges were built, but without actually building them. That would avoid the potentially high cost of building a bridge only to remove it again. The player would then fill in the gaps with the preferred bridges.

Ves

Would it not be possible to use the last selected bridge and tunnel to be used? Just like there is a shortcut key (or at least I think there is) that selects the "last used" way.
Also we are used to think like that already with the signals and signalboxes.

If it wants to build a tunnel or a bridge, maybe the color on the price tag or something else could be changed, so the player gets a hint before the button is release and everything is built.
One could even think of a way submenu, just like there is on signals spacing and station extension rotation, where the player could tick in boxes to tell the game wether it should automatically build bridges and/or tunnels.

jamespetts

The ideal way of doing it would be:

(1) for special coloured tiles to appear wherever the way builder determines should be a bridge or tunnel; and
(2) after the player releases the mouse when dragging, the screen would centre in turn on each possible bridge or tunnel, and the player would have the option as to which, if any, of the available types to build.

However, this would take quite a lot of work to implement, and is not currently a priority for Extended.
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.

Ters

Quote from: Ves on September 18, 2017, 03:54:31 PM
Would it not be possible to use the last selected bridge and tunnel to be used? Just like there is a shortcut key (or at least I think there is) that selects the "last used" way.
Also we are used to think like that already with the signals and signalboxes.

It is not given that the player wants the same bridge every time. Some bridges look better for short spans while others look better for long spans. Signals don't have the same kind of variation.

Ves

Quote from: Ters on September 18, 2017, 05:51:30 PM
It is not given that the player wants the same bridge every time. Some bridges look better for short spans while others look better for long spans. Signals don't have the same kind of variation.
I think that is a non issue. If the player wants different bridges on the same line, it would have to be built in etapes, which it anyways probably would have to be, since you have to scroll the map. The only issue I can think of would be if the player has selected a bridge which do not support the length that is required. Solution to that could be to use the last selected compatible bridge, alternatively an error sign telling the player the bridge do not support the span.

Most usefull in any circumstances would be to be able to turn the feature of in game, as you sometimes don't need to/can't afford to build too many convenient bridges/tunnels.

Ters

Quote from: Ves on September 18, 2017, 07:35:45 PM
I think that is a non issue. If the player wants different bridges on the same line, it would have to be built in etapes, which it anyways probably would have to be, since you have to scroll the map.

I thought not having to build in sections was the whole point of this change. With two-click construction, you can construct very large spans. Usually, I build in very small sections to get the exact course I want, and therefore has no need for automatic bridge building at all, but I have occasionally built sections that span several "screens".