Author Topic: Bug: Ship canal not buildable above certain altitudes?  (Read 691 times)

0 Members and 1 Guest are viewing this topic.

Offline AP

Bug: Ship canal not buildable above certain altitudes?
« on: August 30, 2017, 04:43:40 PM »
In my latest game, the Ship Canal refuses to build above contour -3 (sea level being -8), even though there are large rivers at much higher altitudes. Is this deliberate behaviour? It will happily build on the lower terrain.

This is on flat open countryside with a solvent company.

Online Rollmaterial

Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #1 on: August 30, 2017, 05:07:13 PM »
The behaviour is intended to simulate canals needing a source of water. Thus the higher the altitude, the smaller the canal can be.

Offline AP

Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #2 on: August 30, 2017, 05:12:58 PM »
In which case,  it doesn't work, and should be scrapped.  It's too crude a method if it doesn't analyse the map. And building a better method of restriction is probably quite hard.

My map has numerous large rivers nearby at higher altitudes,  which ships can already use,  and which I quite reasonably want to join together and build branches and shipyards on. And this prevents me from doing so.

I also have an enormous high altitude inland sea I want to connect to the actual sea.

Lack of water not an issue in either case.

River width is, as has been noted elsewhere, simply derived from rivers joining together, not length or altitude.  So if 4 mountain streams join near the top of a mountain,  you get an epic width river all the way down the mountain.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15697
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #3 on: August 30, 2017, 06:14:26 PM »
This is indeed intentional as Rollmaterial points out: see this video for details.

It is realistic that larger canals cannot easily be built at higher altitudes because of the difficulty in getting water to those altitudes: larger canals were not in fact built at higher altitudes. This is one of the reasons that Cornwall, a hilly part of the country, had so many very small tub-boat canals. It is necessary to have a mechanism in the game that provides a realistic incentive to build the smaller canals.

It does not fundamentally undermine this basic reason that there are some circumstances in which specific river generation settings combined with the specific permutations of the random number generator occasionally produce large rivers at high altitudes. In any event, it is somewhat doubtful in reality that it would be realistically possible to harness such high altitude rivers as a reliable source of water for a large canal. If there is something that needs remedying, it is the prevalence of large rivers at higher altitudes, not the prohibition of canals at such altitudes, but it is unlikely that spending much time on such a feature will be worthwhile in the short term as having large rivers at higher altitudes occasionally does not of itself seriously unbalance the game and changing this would take a lot of time that could more profitably be deployed on more pressing features.
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.

Offline AP

Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #4 on: August 30, 2017, 06:20:18 PM »
Not sure this is the right answer, this breaks water transportation at present.

The middle third of my map is an enormous inland lake, fed by multiple rivers the size of the Thames. And the excuse is "lack of water"...?!  It'd be like saying you couldn't build the Caledonian Canal, plenty of altitude gain on that, look at the locks at Banavie.

It's an arbitrary restriction. How is it coded, as a %  of map terrain range? Why not link it to the highest tiles of medium river instead?

Worth also being mindful that what is considered "high"  altitude should probably be as defined in the Climate settings at map creation e.g. as Mountains. Which this definitely wasn't. Now we have doubleslopes it's easy to get through quite a lot of contours but that doesn't mean you are actually in the alps.


I think it's the construction costs and maintenance that should encouraguh e different sized canals,  tbh. Land being expensive
« Last Edit: August 30, 2017, 06:32:08 PM by AP »

Offline DrSuperGood

Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #5 on: August 30, 2017, 06:41:05 PM »
The only reason larger canals did not exist at high altitudes is due to there generally being less running water at high altitudes, not that the altitude itself was limiting. Limiting by altitude results in the problem AP is describing, where there is an enormous high altitude lake due to geography but one cannot build cannals from it.

I would suggest making the maximum canal altitude a configurable map setting so it can be tailored on a per map basis to be realistic to the geography of that map. In the future maybe some water model could be created that limits canals to run from inland lakes or other water sources and their size is restricted by the flow potential of that source.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15697
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #6 on: August 31, 2017, 10:30:48 PM »
Thank you both for your feedback.

The way in which the maximum canal height is coded is using the max_altitude setting in each canal's .dat file. This defines a number of tiles above sea level beyond which the canal cannot be built.

The most straightforward solution, until there is somebody with the time and experience to build a full water/terrain model as Dr. Supergood suggests, is likely to be to apply a maximum altitude restriction to rivers and lakes, too (so that joining rivers do not create larger rivers if the larger river would be above the maximum altitude for that type and that lakes do not form above a certain altitude). As large rivers and lakes are less common at high altitudes in reality, then, absent a fully detailed water/terrain model, this would seem to be the most sensible way of resolving the anomaly described.

I should note that this is not currently a high priority issue in light of the other features/issues currently in progress.
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.

Offline AP

Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #7 on: September 03, 2017, 12:02:00 PM »
The way in which the maximum canal height is coded is using the max_altitude setting in each canal's .dat file. This defines a number of tiles above sea level beyond which the canal cannot be built.

The most straightforward solution, until there is somebody with the time and experience to build a full water/terrain model as Dr. Supergood suggests, is likely to be to apply a maximum altitude restriction to rivers and lakes, too (so that joining rivers do not create larger rivers if the larger river would be above the maximum altitude for that type and that lakes do not form above a certain altitude). As large rivers and lakes are less common at high altitudes in reality, then, absent a fully detailed water/terrain model, this would seem to be the most sensible way of resolving the anomaly described.

Without knowing how the code works at all - could you not simply make the canal builder check for an adjacent water tile of equal-or-greater width, when building?  That would ensure all canals start from an adequate source of water.

You could augment that with a second check that the water tile should be at equal-or-greater height as well, if you wished (perhaps only doing this prior to the date pumping stations become available*).

This would also give players an incentive not to create 'desert' maps, and avoid restricting the map generator which could have adverse effects.

*1793 for the Kennet & Avon canal, but there may be earlier examples.

If we were being really graphically swish, I suppose we could have canals build "dry" until the water tile is connected, rather than refuse to build at all, but even to me that sounds like a lot of work!
« Last Edit: September 03, 2017, 06:21:24 PM by AP »

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15697
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #8 on: September 11, 2017, 05:44:27 PM »
Thank you for the suggestion and apologies for the delay in relying: I have recently returned from holiday.

The idea is an interesting one, but a difficulty is that there is no representation of width as such in the code. Instead, there are abstract way constraints of one of two types: either permissive or prohibitive. Permissive constraints permit vehicles that have a matching constraint to travel upon them (ways without a matching constraint cannot be traversed by the vehicle). Prohibitive constraints prohibit all but vehicles with matching constraints from travelling upon them (vehicles without a matching constraint cannot traverse the way).

For waterways, we have quite a large set of constraints. Waterways generally have a single permissive "waterway" constraint, which allows boats that are not capable of travelling on the open ocean to travel on them. Waterways (be they rivers or canals) also have a series of prohibitive constraints:

(1) tub boat canal;
(2) narrowboat canal;
(3) barge canal; and
(4) ship canal.

All of the boats with the "tub boat canal" constraints are also coded with "narrowboat canal", "barge canal" and "ship canal" constraints; all of the boats with "narrowboat canal" are also coded with "barge canal" and "ship canal" constraints, and all of the boats with "barge canal" are also coded with "ship canal" constraints. This establishes in practice a hierarchy of canal/river sizes, so that smaller boats can travel on larger canals/rivers, but not vice versa.

However, this hierarchy is implemented entirely at pakset level and cannot unpicked on the fly (at least, not without some fantastically complex and probably very unreliable code, as the game would have to infer the hierarchy of ways by comparing the constraints of different vehicles). All that the code sees is a series of constraints. It would not be too hard to allow a canal to be built next to a river with an identical matching set of constraints, but the code would not know that "ship canal" ranks higher than "barge canal", and, whilst the boats have multiple constraints, the rivers/canals have only one constraint. Thus, a small canal could not be built next to a large river, which would be arbitrary and less comprehensible to players than the current system.
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.

Offline AP

Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #9 on: September 28, 2017, 08:01:27 PM »
Hi James

I've been doing some more reading on canals recently, and realised the waterway width thing is a complete red herring. You just need to check for any adjacent water tile* when building.

Canals are basically static bodies of water, they don't flow like rivers, and are constructed to hold water well. They lose a negligable amount to evaporation.  Once built and filled (which can take as long as required), their water consumption is only really defined by whether there are any locks. Locks are installed in series, so the number of locks is irrelevant, the water loss is the same whether there is 1 lock on a canal or 100. 

The only thing that influences the volume of water loss from the locks on the canal, is how often the lock gates are opened and closed. And clearly that's not something we're ever going to calculate or simulate. 

But basically, so long as you can get some water from somewhere to the canal summit, the canal will work. The smallest spring can fill the largest ship canal, given enough time.  You just use a summit reservoir to make up the disparity in supply and demand. And ultimately have a transit limit through your locks which I suggest we ignore.

*So we should just make canal tiles check for any adjacent water tile of equal or greater altitude when building, job done. Surely that is an easy code fix?

We could introduce a non-navigable "feeder aquaduct" waytype and bridge if you wanted to encourage proper hydraulic engineering.
« Last Edit: September 28, 2017, 08:32:12 PM by AP »

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15697
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #10 on: September 28, 2017, 08:59:26 PM »
May I ask what the source for that is? I recall reading that tub boat canals were chosen in Cornwall specifically because of the difficulty in getting enough water for a larger canal to higher altitudes.
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.

Offline AP

Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #11 on: September 28, 2017, 09:08:18 PM »
I've been reading a variety of websites and such. Much of it is simple physics. Lock gates leak slightly but lock volume is known and far greater. Evaporation from a given surface area is known.  Lock volume is lost at a rate directly related to the number of boats traversing the canal.

The important thing is that "higher altitudes" is subjective. Ultimately if you want to take a canal above the local water table, yes there will be issues.  But that is inherently a matter of understanding local geography - finding the highest suitable watercourse and going no higher. And that depends on the map in question.

See https://en.wikipedia.org/wiki/Summit-level_canal

The wikipedia article on the Canal Du Midi is interesting because it had exactly that problem. Lots of people thought it a good idea but it took ages before someone with the right knowledge was able to find a route that allowed a water source to the summit.
https://en.wikipedia.org/wiki/Canal_du_Midi#Study_of_the_project

I think giving players the same puzzle could be entertaining.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15697
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #12 on: September 28, 2017, 10:27:52 PM »
Thank you - I will have to study that carefully when I have time.

However, changing this system would create a serious problem: the existing tutorial video about waterways expressly states that canals need a source of water and that smaller canals can be built at higher altitudes than larger canals. Changing this would be a huge amount of work. Deleting it would involve destroying a huge amount of work already undertaken, much of which would still be useful. Retaining it would involve confusing players with outdated and misleading information.
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.

Offline AP

Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #13 on: October 03, 2017, 06:52:32 PM »
That's a nuisance, yes. Possibly it may be worth keeping tutorials in written form only, going forward, until more playtesting has been done? 

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Moderator
  • *
  • Posts: 15697
  • Total likes: 395
  • Helpful: 174
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Bug: Ship canal not buildable above certain altitudes?
« Reply #14 on: October 03, 2017, 09:39:40 PM »
The trouble is that there is no end to how much more play testing can be done (meaning that there will never be any video tutorials if one were to adopt that view), and people find the video tutorials extremely helpful.
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.