News:

Simutrans.com Portal
Our Simutrans site. You can find everything about Simutrans from here.

Tunnel Improvements

Started by PJMack, March 26, 2022, 10:56:19 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

PJMack

I am currently working on a PR to enable half height tunnels.  I am also planning on a second PR to add basic restrictions and conditional costs to tunnels (see below), as well as considering the feasibility of a third PR to add ventilation based restrictions to tunnels.

The first PR to enable half height tunnels is intended for car only road tunnels, narrow-boat tunnels, and light rail and tube tunnels.  That last point is a bit tricky as per this post: https://forum.simutrans.com/index.php/topic,21146.0.html.  If I were to include the changes to allow all way-types to have low bridges and tunnels and all vehicles to use the is_tall flag, would those changes be used.  By default I would set all rail, narrow, maglev, and air vehicles "is_tall" flags to true.  For routing of those way types, I would either require the control key pressed for routing under low bridges and/or have a flag in the way descriptor to allow routing under low bridges.

For the second PR, I had noticed that a wealthy player could build a sub-sea tunnel in 1750, which is not that realistic.   For this I plan on adding a flag to the tunnel descriptors to allow sub-sea tunnel building, as well as a second build price for when building under a water tile.  I would also add a per-depth-below-ground charge added to the build costs for more realistic pricing of cut-and-cover tunneling.  It can also be taking under consideration restricting some types of tunnels from being built beneath public structures and/or add extra costs in doing so, as some tunnels types can interfere with the foundations of buildings and damage them without the proper precautions.

For the potential third PR, I am still trying to find a simple way to implement some sort of ventilation based restrictions and model the associated costs.  I also do not want to turn this into another major project.

Vladki

I think that narrow gauge should be "not tall" by default. I'm not sure about maglev. They seem to be not very high but may require higher clearance due to aerodynamics in high speed.

Regarding cut and cover. It could be implemented so, that a tunnel that is less that X levels deep, cannot be built under existing structures. X should be at least 2 (full height), and then the level of the building divided by some well chosen factor, to prevent digging shallow tunnels under skyscrapers.

Regarding the ventilation, each tunnel type (and engine type) could have a defined max length. Of course this is not easy to check if the tunnel splits into complex underground network. This could be be checked when routing the vehicle through the tunnel, so that exceeding the allowed length of continuous tunnel ride will show as "no route". To allow "metro" operation, a stop that is connected with a stop on surface would count as ventilation point (tunnel exit and entry)

Sirius

Regarding cut-and-cover, I don't think there should be hard height restrictions to this technique as technologically, it seems to be possible to build cut-and-cover tunnels nearly everywhere. It's simply not economical at some point.
You can even build cut-and-cover tunnels underneath existing (large) buildings as a quite controversial project demonstrates:
https://www.esslinger-zeitung.de/media.media.b11b5fd5-d2e0-4983-9b46-540ce692a4dd.normalized.media

So what about scaling construction costs of such a tunnel in a non-linear way related to depth underneath ground?
Objects above should be another cost factor. It was quite common in Ruhr Area around the 1970s to demolish roads, build a cut-and-cover "Stadtbahn" tunnel and finally put the road on top again.
I am quite sure this is more expensive than a cut-and-cover tunnel underneath unimproved grounds.

There should be a hard limit anyways to protect players from instant bankruptcy when they accidentally attempt to build the Gotthard base tunnel as cut-and-cover.
That limit might make use of the cost calculation and simply forbid construction if a specific absolute or relative (to base costs) value is exceeded per tile.

Regarding ventilation, I am not a fan of invisible routing restrictions.
It's quite difficult to find the reasons of a "no route" already.
I like the idea of different ventilation requirements in tunnels for different stock though.
Sadly, I don't have an idea how these ideas could accord.

Matthew

Quote from: PJMack on March 26, 2022, 10:56:19 PM
I am currently working on a PR to enable half height tunnels.  I am also planning on a second PR to add basic restrictions and conditional costs to tunnels (see below)

These changes would definitely be the kind of details that Extended players like. May I wish you every success with this project!

QuoteThe first PR to enable half height tunnels is intended for car only road tunnels, narrow-boat tunnels, and light rail and tube tunnels.  That last point is a bit tricky as per this post: https://forum.simutrans.com/index.php/topic,21146.0.html.  If I were to include the changes to allow all way-types to have low bridges and tunnels and all vehicles to use the is_tall flag, would those changes be used.  By default I would set all rail, narrow, maglev, and air vehicles "is_tall" flags to true.  For routing of those way types, I would either require the control key pressed for routing under low bridges and/or have a flag in the way descriptor to allow routing under low bridges.

This all sounds very sensible, though I am not clear how you would distinguish "light rail" in the game.

QuoteFor the second PR, I had noticed that a wealthy player could build a sub-sea tunnel in 1750, which is not that realistic.   For this I plan on adding a flag to the tunnel descriptors to allow sub-sea tunnel building, as well as a second build price for when building under a water tile.

This would be great. But you know that the game has no differentiation between open ocean and tiny ponds. This might have odd effects if a map has mountain lakes. But maybe that's unlikely.

QuoteRegarding cut and cover. It could be implemented so, that a tunnel that is less that X levels deep, cannot be built under existing structures. X should be at least 2 (full height), and then the level of the building divided by some well chosen factor, to prevent digging shallow tunnels under skyscrapers.

Quote from: Vladki on March 27, 2022, 08:03:03 PMI would also add a per-depth-below-ground charge added to the build costs for more realistic pricing of cut-and-cover tunneling.  It can also be taking under consideration restricting some types of tunnels from being built beneath public structures and/or add extra costs in doing so, as some tunnels types can interfere with the foundations of buildings and damage them without the proper precautions.

If you want to add an optional Minimum Depth below buildings for tunnels, then that would definitely be a neat new feature. However, I have some concerns about particular contexts.

Firstly, would we ever want a situation where you can't tunnel through a mountain range because there is a Factory (in the game sense) at a tile over the route? It would be possible to code a system that allowed tunnels under Fields but not under Steel Mills etc. But in my opinion, only activating the Minimum Depth rules within cities (as defined by City Limits) would be realistic, relatively easy to code, and run the smallest risk of cache misses. (I know that the tunnel-building code is called very rarely, but still, that's our main bottleneck and who knows when that code might get called elsewhere?).

Secondly, I am more keen to see Maximum Depths than Minimum Depths. ;D We want to make shallow, cut-and-cover tunnels to be a realistic strategy in the late 19th century in very dense cities (maybe a single city on a map the size of B-B). You are thinking of a "per-depth-below-ground charge" and this is definitely the best option in a fully balanced game. Even a straight depth * cost multiplier would be an improvement. But neither option is unlikely to effect player behaviour in this decade because so many players are so wealthy.  Hence Maximum Depths (per tunnel way type) would be an neat addition too. But that's just a dream; obviously you will and should only add code that's within your vision.

Thirdly, I can see how Minimum Depth would be useful in pak256-Ex, where there are some impressive tall skyscrapers. But the most popular pakset is pak128.Britain-Ex, which rightly has very few tall buildings. In fact, the most common buildings are hovels, which have foundations less than one level deep (if at all). So I would prefer to see Minimum Depth checked on a per-building basis, rather than a blanket restriction. But I worry that means bringing the building descriptions into memory many more times. And again, it's easy for me to add items to the wishlist since I'm not writing the code.  :-[

Quote from: Vladki on March 27, 2022, 08:03:03 PMI'm not sure about maglev. They seem to be not very high but may require higher clearance due to aerodynamics in high speed.

I don't think any Extended pakset has maglev. So maybe just leave it as it is.

QuoteRegarding the ventilation, each tunnel type (and engine type) could have a defined max length. Of course this is not easy to check if the tunnel splits into complex underground network. This could be be checked when routing the vehicle through the tunnel, so that exceeding the allowed length of continuous tunnel ride will show as "no route". To allow "metro" operation, a stop that is connected with a stop on surface would count as ventilation point (tunnel exit and entry)

This seems like a newbie trap, even by Extended standards.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Sirius

Quote from: Matthew on March 28, 2022, 09:46:23 PMI don't think any Extended pakset has maglev. So maybe just leave it as it is.
Sorry, but pak128.britain-ex has maglevs

PJMack

I created a branch here https://github.com/PJMack/simutrans-extended/tree/half_height_tunnels_and_trains.  Half height tunnels can be enabled in the pakset using the "half_height=1" line in the dat file.  Narrowgauge and track have been added to the list where low clearance bridges can be used.  For narrowgauge vehicles, the default is for not tall, however standard gauge rail vehicles are tall by default and "is_tall=0" would be needed for short rail vehicles.  All standard gauge rail vehicles loaded from a previous version of makeobj-extended would load as if is_tall was set.  This branch is actually a branch off of the pier_system branch as I needed some functions from that branch, so I have not created a PR to master as of yet.

As for the pricing, I plan on having the build cost be the current base cost plus a charge for building under water plus a charge for each tile below ground level (or the sea floor) plus a charge for being beneath a building, plus a charge for being beneath a road.  Any of those charges would be set-able per tunnel type and could be zero where necessary.  I also plan on having the tunnel restrictions on depth below ground/sea floor, (maybe depth below sea level), and whether it is build-able below buildings or water tiles.  I may also consider a flag to permit tunnels under a building, but adjacent to parellel tunnel beneath a way to be considered under the way.  This would be to compensate for roads only being one tile for two way traffic but other ways needing two tiles. 

As for a minimum depth to tunnels below buildings, that is something to think and research about.  I to remember see a documentary on the London Victoria line where a tube tunnel went through the basement to a department store, so I am not sure there is actually a minimal depth for tunneling beneath buildings. 

For maglevs, I did leave things as is.  Maglevs are indeed in pak128.Britain-ex, however there are no in service maglev lines in Britain as far as I am aware of.  I personally think is throws the balance of the game in the modern timeline, however this is not a discussion for this thread.

I also should make a clarification to my previous post.  Where I said "light rail" I had tram systems in mind (including grade separated tram systems). 

Matthew

Quote from: PJMack on March 29, 2022, 02:39:13 AM
I created a branch here https://github.com/PJMack/simutrans-extended/tree/half_height_tunnels_and_trains

It's great to see that you have started on this project!

I am not qualified to comment on code quality, but it looks to me like the error messages might updating at some point? I guess this is work-in-progress though.

QuoteHalf height tunnels can be enabled in the pakset using the "half_height=1" line in the dat file.  Narrowgauge and track have been added to the list where low clearance bridges can be used.  For narrowgauge vehicles, the default is for not tall, however standard gauge rail vehicles are tall by default and "is_tall=0" would be needed for short rail vehicles.  All standard gauge rail vehicles loaded from a previous version of makeobj-extended would load as if is_tall was set.  This branch is actually a branch off of the pier_system branch as I needed some functions from that branch, so I have not created a PR to master as of yet.

As for the pricing, I plan on having the build cost be the current base cost plus a charge for building under water plus a charge for each tile below ground level (or the sea floor) plus a charge for being beneath a building, plus a charge for being beneath a road.  Any of those charges would be set-able per tunnel type and could be zero where necessary.  I also plan on having the tunnel restrictions on depth below ground/sea floor, (maybe depth below sea level), and whether it is build-able below buildings or water tiles.  I may also consider a flag to permit tunnels under a building, but adjacent to parellel tunnel beneath a way to be considered under the way.  This would be to compensate for roads only being one tile for two way traffic but other ways needing two tiles. 

This all sounds exciting. I thought of the parallel tunnels idea as well, but I didn't want to burden you, so I'm so glad you're independently interested in it.

QuoteAs for a minimum depth to tunnels below buildings, that is something to think and research about.  I to remember see a documentary on the London Victoria line where a tube tunnel went through the basement to a department store, so I am not sure there is actually a minimal depth for tunneling beneath buildings. 

I guess that from the late 20th century onwards, the civil engineers can do whatever you want if you have enough time and money.

For maglevs, I did leave things as is.  Maglevs are indeed in pak128.Britain-ex, however there are no in service maglev lines in Britain as far as I am aware of.  I personally think is throws the balance of the game in the modern timeline, however this is not a discussion for this thread.

QuoteI also should make a clarification to my previous post.  Where I said "light rail" I had tram systems in mind (including grade separated tram systems).

Thank you. I thought trams just use rail (and road?) tunnels, but I might be wrong.

Quote from: Sirius on March 29, 2022, 12:09:58 AM
Sorry, but pak128.britain-ex has maglevs

Thank you for the correction.  :thumbsup:

How strange. The pakset sets so much store by realism and then it has an entirely fictional waytype.  :o
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Vladki

Hello,

I agree that abusing "no route" for tunnel length check is newbie trap. "no route" is problem in many other cases (weight restrictions, missing electrification). That should be addressed separately, and then it could be more useful. Perhaps checking if there exists shorter path (or any path at all) without any restrictions, and instead of "no route" saying: there is (shorter) path, but with restriction at tile x,y. And allow player to ignore that warning if longer route is OK.

Regarding the underground railway passing through building foundations - there is a building in Brno, that has two tunnel holes in the foundations prepared for future underground railway. And I heard about similar thing in Bratislava, but could not find any details. But I doubt that it will be feasible to dig through existing foundations. Such limit would of course have to be scaled by the "level" of building above. Let's say level=10 requires the tunnels to be at least 2 levels (full height) deep. (I mean two levels empty, so the tunnel will be on 3rd, or 4th underground level depending if it is for tall vehicles or not).

Tunnel just below the surface (cut and cover), could be very cheap compared to deeper (bored) tunnels, but you would have to demolish the buildings/roads above, and then build them again. E.g. that was exactly how the oldest underground line in budapest was built. It is very shallow, and is just below the main road.

Octavius

(I've been away for a while, but recently reinstalled simutrans-extended.)

The north-south line of the Amsterdam metro, opened in 2018, cuts through the pilings of Amsterdam Central railway station, opened in 1889. So, yes, it can be done, but it isn't common. They first constructed new pilings and support walls underneath the station, then poured a concrete slap to connect the old foundations to the new pilings. Next they removed the old pilings and soil from underneath the slab. Then the place was flooded. In a separate building yard, the metro station was build, then floated into place, then all the gaps were sealed. So it's actually an immersed tunnel, not a proper cut and cover tunnel, but it's close. Most of the metro line, costing 3.1 billion euros for just 9.7km, was bored about 30m below the surface, below the pilings of existing buildings, but how deep you have to go depends on local geology and you can't really say anything about that in general. The pilings go down to a particular depth because that's where you find a suitable layer of soil, not because it's 50% of the height of the building or 3 metres for every 100kPa of ground pressure (unless you want your building to float in the ground, but most buildings aren't designed like that).

The cost of cut-and-cover tunnels must increase rapidly with depth. Faster than linear, in particular when you get below the groundwater table. Turning it into an immersed tunnel (like they did near Amsterdam Central – it must be added that they had to cross the water anyway) may be cheaper in such cases, as you don't have to pump the building pit dry and don't risk the resulting subsidence. For bored tunnels through rock, depth doesn't appear to be much of an issue. The increasing rock pressure may be a bit of a nuisance in soft rocks and there's the thermal issue, but tunnels get bored routinely more than 1000m below the surface and have been for ages (look at old mines; they go in horizontally from the valley floor and end op 1500m below the mountain tops).

As for length limits, the longest tunnel designed for steam trains is the 15.003km Gotthard Tunnel (Switzerland), opened in 1882, no intermediate ventilation accesses. Forced ventilation was only added in 1899, when traffic hit around 60 trains per day, mostly for the benefit of maintenance workers. The line was electrified in 1920. On the other hand, the Cascade Tunnel (USA, 12.55km, opened 1929) was designed for electric traction, but converted for diesel. It has forced ventilation, but still only allows 28 trains per day. Keep in mind that (1) health regulations have changed since 1899; (2) 28 American diesel goods trains have more locos than 60 steam trains; (3) modern diesels are far more powerful than steam locos of around 1900 and (4) although steam trains consume more oxygen and produce more carbon dioxide than diesel trains of the same power, they aren't that bad in terms of the more dangerous nasties like carbon monoxide. Tunnels for electric trains can be very long before requiring forced ventilation, as the trains act as pistons in a tube, forcing ventilation themselves. Forced ventilation in the Channel Tunnel is only needed in emergencies.

As for sub-sea tunnels, the main issue isn't being below water. That isn't worse than being underground, below the groundwater table, like pretty much every tunnel not in a desert. A bigger problem is not having a continuous way down to the exit, so you need pumps to get the water out. That's the same for most metro tunnels. Metro tunnels tend to go though soft soil, where groundwater is a serious problem. Sub-sea tunnels have more groundwater pressure to deal with, but can often be routed through impermeable rocks, eliminating the problem. In fact, had the Channel tunnel been drilled 20 metres higher or lower, it would have been more expensive, as it was precisely routed through a very nice, not too hard, not too brittle, impermeable layer of limestone.

Vladki

Quote from: Matthew on March 28, 2022, 09:46:23 PMBut you know that the game has no differentiation between open ocean and tiny ponds.

This distinction exists, at least in extended. If you click on a water tile, it will tell you if it is ocean or lake. Only some (bigger) ships can enter ocean in extended, others are limited to lakes, rivers and channels. But I'm not sure how is the distinction implemented. IMHO it is related to the water level specified when creating the world, or to the fact that ocean touches the map edge.

Regarding the foundations - Amsterdam is imho quite special, as the soil there cannot hold much and you have to hit some solid base deeper. Look at New York, the highest buildings are built on rock. The area without rock has smaller buildings. IMHO there is some relation that you need deeper foundations for higher building, but that ratio is different for each place.

Anyway, real world constraints for building tunnels seem to be very complex. It seems that it was not only money that prevented our ancestors from building channel tunnel, or gotthard basis tunnel 100 years ago. It could have been also the level of technology for geological survey, or other factors. Or just the logistics needed to get the digged stuff out of the way. Imagine guys digging 50 km long tunnel with only a horse tramway available to carry away the rocks... The workers would have to sleep there, or they would spend all time getting from the workplace to the barracks.  For the game simulation it is necessary to simplify these things somehow:

- Price should be dependent on depth, increasing for a few (4-6 maybe more?) levels (deeper cut), then remaining constant (bored tunnel costs are not very dependent on depth).
- Also the price should be balanced so that making the cut and leaving it open must be cheaper than the tunnel.
- if the tunnel is very shallow (1 or 2 levels), there should not be anything above (cut will destroy everything, and bored tunnel will hit the foundations).
- if the tunnel is deeper that that, it can be built underneath existing buildings, but at the full price of bored tunnel.
- I still like the idea that high level buildings would force the tunnel go deeper. Just like you cannot build bridge over high level building.
- if there is a way to find the height of nearest body of water (lake or river), then charge some extra for building under the groundwater table.
- building tunnel under the sea level, could have extra charge

Length of tunnels itself was probably not the limit at any time, but the safety limits have changed overtime, and so should increase the price. (And old cheap unsafe tunnels, should be discontinued).


PJMack

I had intended on the pakset having different tunnel types for bored vs cut-and-cover tunneling leaving it up to the player to decide what type is best.  The intent behind tunnel interactions with buildings was to model added costs due to the piling/foundation modification needed for cut and cover tunnels as well the monitoring and building inspection needed for bored tunnels beneath existing foundations.  As for variances in geology and water tables, that would be difficult to model, code, and portray to the user.  I do not think it would be worth the coding effort.  A non-linear depth to cost function is doable though, as is a cost for being below sea level.  (The O'Neill tunnel in Boston is cut and cover built 37m deep and below sea level.)  I considered having a an additional pseudo random cost applied to tunnel construction as unexpected costs do often occur in reality, however I do not think this would be a very popular feature.

As to length and ventilation, using routing would be difficult to code as the routing algorithm is a performance critical function.  In more technical terms, the routing algorithm in Simutrans is a breadth first algorithm so any length count would be needed as an additional variable in each queue element.  The bridge weight limit algorithm is heuristic and does give false negatives and false positives.  (I am assuming that this is heuristics and not a bug.)   Due to the nature of there only being a few short bridges on the map relative to any network, the number of false positives is kept low enough to be unnoticeable during game play.  Using the same method for tunnels would be infeasible since for metro systems the entire network would be mostly underground.  There had been some discussion as to replacing absolute bridge weight limits with axle load limits, a topic that may need to be reconsidered.

I still plan on continuing adding the optional costs and restrictions that I had planed in my previous post, with the aforementioned additions of a below-sea-level charge as well.  The defaults would be that tunnels are buildable below buildings and not buildable below sea level.

Octavius

Quote from: Vladki on March 31, 2022, 08:38:26 PMRegarding the foundations - Amsterdam is imho quite special, as the soil there cannot hold much and you have to hit some solid base deeper.
That solid base is sand, so still fairly weak, but better than the peat on top. Below the sand is another weak layer, than a second layer of sand, through which the  metro tunnels were bored. Such weak soils are not uncommon in river deltas and many big cities are in such places (Shanghai, Dhaka, Calcutta, Bangkok, Saigon, Venice, New Orleans).
QuoteAnyway, real world constraints for building tunnels seem to be very complex. It seems that it was not only money that prevented our ancestors from building channel tunnel, or gotthard basis tunnel 100 years ago. It could have been also the level of technology for geological survey, or other factors. Or just the logistics needed to get the digged stuff out of the way.
Or construction time. Construction of the old Fréjus tunnel was expected to take up to 40 years. Fortunately, after 9 years Alfred Nobel invented dynamite, cutting construction time to just 13 years. And in Simutrans we have digital dynamite, so we can build anything in an instant.
Quote- Price should be dependent on depth, increasing for a few (4-6 maybe more?) levels (deeper cut), then remaining constant (bored tunnel costs are not very dependent on depth).
- Also the price should be balanced so that making the cut and leaving it open must be cheaper than the tunnel.
- if the tunnel is very shallow (1 or 2 levels), there should not be anything above (cut will destroy everything, and bored tunnel will hit the foundations).
- if the tunnel is deeper that that, it can be built underneath existing buildings, but at the full price of bored tunnel.
Fair enough. However: "Making the cut and leaving it open must be cheaper than the tunnel." Closing it means that you don't have to stabilise the sides of the cut and don't have to buy the land.
Quote- I still like the idea that high level buildings would force the tunnel go deeper. Just like you cannot build bridge over high level building.
Reasonable, but hard to quantify given how chaotic this relation is in real life.
Quote- if there is a way to find the height of nearest body of water (lake or river), then charge some extra for building under the groundwater table.
Simulating the groundwater table with an acceptable level of realism sounds infeasible at this time. It's higher than the surrounding surface water, unless that surface water drains into the ground. Around here (Netherlands), the groundwater table is usually between 3 and 70 centimetres below the surface, so pretty much every tunnel is below the groundwater table (well, except that railway tunnel that was made by piling a dike over an existing railway 130 years after is was build. It's actually below sea level). There are a few places though where groundwater is deeper than 10 metres, mostly near the edges of sandy plateaus.
Quote- building tunnel under the sea level, could have extra charge
I don't see how being below sea level can be relevant. That's a global condition, where cost would normally depend on local conditions. Being 10 metres below an alluvial plain should be fairly similar, independent of that plain being 50 metres above, 5 metres above or 5 metres below sea level. What makes bored undersea tunnels expensive is (1) the lack of intermediate access points and (2) the need for drainage pumps, as the water has to go up to reach the exit.
Quote from: PJMack on March 31, 2022, 10:04:04 PMThe defaults would be that tunnels are buildable below buildings and not buildable below sea level.
Interesting... Around here the majority of buildings is below sea level. But the idea sounds OK, at least as far as the buildings are concerned: a cheap tunnel that cannot be build under buildings or very deep, and an expensive tunnel that can. Would it be possible to later build a building on top of the cut-and-cover tunnel?

BTW, any particular ideas about immersed tunnels, like the Fehmarn Belt Fixed Link? They are the underwater equivalent of cut and cover tunnels and quite common. We even have immersed tunnels on land: dig a canal, put the tunnel in, then fill the canal. It allows centralising most of the construction work and avoids disruption of groundwater.

Vladki

Quote from: Octavius on April 04, 2022, 07:15:54 PMOr construction time. Construction of the old Fréjus tunnel was expected to take up to 40 years. Fortunately, after 9 years Alfred Nobel invented dynamite, cutting construction time to just 13 years. And in Simutrans we have digital dynamite, so we can build anything in an instant.

That could be done on pakset level. Now we have tunnels distinguished mostly by speed. Material (stone, brick, concrete) is usually just eye-candy. But we could make the distinction based on technology available at the given time - tunnels digged by pickaxe, tunnels digged with dynamite, tunnels bored with boring machine...  So building channel tunnel before dynamite would be prohibitively expensive even for the richest players.

Same thing should be (and maybe already is) applied to bridges. The inventions in materials and building machinery allowed bridges to be longer, higher, faster and cheaper.

PJMack

The technology needed to build a tunnel underwater (the tunneling shield) was not available until the 1820-40s.  I agree through that the details should be left up to the pakset designer as to what types of tunnels can or cannot be dug, where they can be dug, and how much they should cost for the given geology of where the pakset takes place.  As to allowing prices to change with time, that would be part of another planed project, but for now, a new type of tunnel would need to be added to the pakset to invoke a change in price and technology.

I did find in the landscaping tools that each tile in Simutrans has it's own water level to prevent Terra-forming below groundwater.  I am hoping to make use of this, however it appears that the ground water level is a constant hard-coded -6 on for ground tiles.  I may need to do some more investigating.

Another note: due to the changes needed for makeobj-extended, I think I will only checkout one PR for both the half height tunnels and the additional restrictions, unless I am advised otherwise.

PJMack

I have completed the PR for extended, though it may not be much use without a corresponding PR for pak128.Britain.  Here is a list of features (by dat file keyword) that made the cut and their intended uses:

half_height: tunnel uses single level height rather than the traditional double level. Disabled by default.
allow_subsea: allow tunnel to be constructed under water tiles. 
subsea_cost: additional construction costs for building tunnel under water tiles.
subsea_maintenance: additional maintenance for tunnel under water tiles.
subwaterline_cost: additional construction costs for tunnel below the groundwater level.
subwaterline_maintenance: additional maintenance for tunnel below the groundwater level.
forbid_subbuilding: forbid tunnel from being built beneath a building*.
subbuilding_cost: additional construction costs for tunnel beneath a building*.
depth_cost: additional construction costs for tunnel per depth of tunnel below surface.
depth_squared_cost: additional construction costs for tunnel per depth of tunnel below surface squared. 
sub_way_cost: additional construction costs for tunnel beneath a way.
depth_limit: limit of depth below surface for tunnel.
*except when the tunnel is for a tracklike waytype (e.g. not road or canal waytypes) and is adjacent (NSEW) to the same type of tunnel beneath a road.  This is to allow to two lanes of subway tracks to be placed along city streets.

The reasoning behind the subsea and subwaterline distinction is to allow cut and cover tunnels to be dug below the [ground] waterline. 

For cut-and-cover tunneling, the depth costs would be greater than or equivalent to digging a trench, sub_way_cost moderately low, subbuilding costs high (need to mess with foundation), subsea not allowed, and subwaterline only allowed once pumping technology develops.  For bored tunnels, sub building costs would be low (just monitoring), subwaterline allowed when pumping technology develops, subsea allowed when tunneling shield technology develops, and no sub_way or depth costs. 

I did not add any ventilation as discussed below (e.g. no easy way to simulate accurate ventilation without newbie trap).  For the waterline, I use the maximum of sea level (welt->get_groundwater()) and the incomplete builtin waterline (welt->lookup_water_hgt). 

Additional translation texts for tooltips: "Half Height", "Depth Limit", "Per-Depth", "Per-Depth-Squared", "Sub-Way", "Sub-Building Prohibited", "Sub-Building", "Sub-Groundwater Permitted", and "Sub-Sea Permitted".

Matthew

Quote from: PJMack on April 07, 2022, 09:56:51 PMI have completed the PR for extended, though it may not be much use without a corresponding PR for pak128.Britain.

This looks awesome! I never imagined that you would make so much progress so fast! As you say, there's plenty of pakset implementation and testing to do, but this looks like a complete new feature that perfectly fits the Extended vision.

Looking at the changes to simtool.cc, it seems that trying to build a tunnel in an inappropriate location triggers NOTICE_TILE_FULL. I haven't studied that part of the code yet, but it looks like a generic error message. Do you plan to add specific error messages so that players are told why certain tunnel types cannot be built in certain tiles? If not, I would like to request this addition please, as an aid to new players.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Octavius

#16
Quote from: PJMack on April 07, 2022, 09:56:51 PMFor cut-and-cover tunneling, the depth costs would be greater than or equivalent to digging a trench, sub_way_cost moderately low, subbuilding costs high (need to mess with foundation), subsea not allowed, and subwaterline only allowed once pumping technology develops.
Apart from pumps, you may need sheet pilings (or some precursor of those) driven into the ground before you start digging. Otherwise not only the flow of groundwater may be too high for your pumps to manage, but this flow of water will take sand along, causing subsidence and collapsing buildings in surrounding areas.

QuoteFor bored tunnels, sub building costs would be low (just monitoring), subwaterline allowed when pumping technology develops, subsea allowed when tunneling shield technology develops, and no sub_way or depth costs.
1: If I design my tunnel such that water can flow out by gravity, I don't need pumps. For example, I could enter a mountain from the valley floor, going slightly up, and end up below the summit well below the groundwater table. Of course, this would require a somewhat more complex check of the tunnel's geometry.
2: The tunnelling shield was meant to allow tunnelling through soft, wet soil. When tunnelling through hard rock, you don't need it (but we don't simulate geology to that level). Also, it doesn't really matter whether that river is straight above your head or just a bit to the side. But then, no 19th century tunnel builder would even consider boring a tunnel through soft, wet soil unless it was the intention to pass underneath a river.

Speaking of foundations, waterways have foundations too. About 15 metres for a modern ship canal.

And in addition too allow_subsea (or actually under any water; sea, lake, river or canal), you may want a setting to require subsea. Immersed tunnels would have to be close to the surface and below water. They could be pretty cheap. If you think it's an exploit to build a canal, build a cheap immersed tunnel underneath, then destroy the canal, think again. This is actually done in real life.

PJMack

I did find one bug.  I did not add the new descriptor variables to the checksum function.  I put the PR in draft mode.

Quote from: Matthew on April 08, 2022, 11:09:44 AMThis looks awesome! I never imagined that you would make so much progress so fast! As you say, there's plenty of pakset implementation and testing to do, but this looks like a complete new feature that perfectly fits the Extended vision.
Thank You.  This so far is collection of minor tweaks rather than a major project as far as coding (and I hope to keep it that way).  Testing and pakset balancing on the other hand will be challenging. 

Quote from: Matthew on April 08, 2022, 11:09:44 AMLooking at the changes to simtool.cc, it seems that trying to build a tunnel in an inappropriate location triggers NOTICE_TILE_FULL. I haven't studied that part of the code yet, but it looks like a generic error message. Do you plan to add specific error messages so that players are told why certain tunnel types cannot be built in certain tiles? If not, I would like to request this addition please, as an aid to new players.
I can change the NOTICE_TILE_FULL errors upon setting the tile slope too deep to a more appropriate error message.  Unfortunately, there is no easy way to get error messages from deep within the routing algorithm (where the checks reside) all the way to the user, particularly since multiple routes are checked and may all have different reasons not working.  I did make sure to put the limits and permissions into the tooltips for the tunnel tools.

Quote from: Octavius on April 08, 2022, 04:42:43 PMApart from pumps, you may need sheet pilings (or some precursor of those) driven into the ground before you start digging. Otherwise not only the flow of groundwater may be too high for your pumps to manage, but this flow of water will take sand along, causing subsidence and collapsing buildings in surrounding areas.
This would depend on the area.  In particularly rocky areas, a simple sub-pump would be needed, but in sandy areas, sheet pilings may be needed whether or not it is below the water table.

Quote from: Octavius on April 08, 2022, 04:42:43 PM1: If I design my tunnel such that water can flow out by gravity, I don't need pumps. For example, I could enter a mountain from the valley floor, going slightly up, and end up below the summit well below the groundwater table. Of course, this would require a somewhat more complex check of the tunnel's geometry.
Indeed this would be very difficult to simulate in the context of Simutrans. 

Quote from: Octavius on April 08, 2022, 04:42:43 PM2: The tunnelling shield was meant to allow tunnelling through soft, wet soil. When tunnelling through hard rock, you don't need it (but we don't simulate geology to that level). Also, it doesn't really matter whether that river is straight above your head or just a bit to the side. But then, no 19th century tunnel builder would even consider boring a tunnel through soft, wet soil unless it was the intention to pass underneath a river.
A tunneling shield may be needed if tunneling through hard rock beneath groundwater, as without it, any fissures encountered would immediately flood the tunnel.  For bored tunneling, yes it does not matter if the tunnel is beneath water or to the side (much, there may be some exceptions, I am not a geologist).

Quote from: Octavius on April 08, 2022, 04:42:43 PMSpeaking of foundations, waterways have foundations too. About 15 metres for a modern ship canal.

And in addition too allow_subsea (or actually under any water; sea, lake, river or canal), you may want a setting to require subsea. Immersed tunnels would have to be close to the surface and below water. They could be pretty cheap. If you think it's an exploit to build a canal, build a cheap immersed tunnel underneath, then destroy the canal, think again. This is actually done in real life.
I did not add any restrictions for tunneling beneath canals or rivers, which is something I probably should look into.  As to immersed tube tunnels, I believe they can be built on land as well.  I did run into trouble getting the depth limit to work underwater (for ITTs) but may look into it again.

Quote from: Octavius on April 04, 2022, 07:15:54 PMWould it be possible to later build a building on top of the cut-and-cover tunnel?
Sorry for the late reply.  Yes is is possible to build a building on top of a cut and cover tunnel.  In Boston, buildings have been placed on top of the O'Neill and Ted Williams Tunnels,  and the Pru tunnel would have been merely a trench if it were not for the Prudential Center.  One of the ventilation towers is for the Ted Williams Tunnel is actually on top of an ITT section.  There are also buildings built on the Callahan and Sumner tunnels which were bored.

PJMack

I completed the aforementioned changes took the PR out of draft mode.  I also put a PR for pak128.Britain so that most tunnel types have allow_subsea set. 

jamespetts

Thank you for your work on this. I am in the process of testing this now. The feature permittng only certain sorts of tunnels to be built beneath the level of groundwater seems to work well, although it is not easy in practice to distinguish sub groundwater level building from subsea building, as the sea is, by definition, at sea level, and the water table will presumably not be below sea level.

I do not think that any of the tunnels in Pak128.Britain-Ex with your additions are set to be able to be built with half heights - is this intended? This does meant that I cannot test this feature at present. Is it necessary to have additional portal graphics in order to allow tunnels to work at half heights or will existing portal graphics work? If the latter is the case, then we can just define the tube tunnels to be half height for testing. If not, it will be very difficult to test this properly.

Similarly, I do not think that we have any depth limits set in the current modified pakset - was it intended to have depth limits on any of the Pak128.Britain-Ex tunnels? Was depth per se a limiting feature in tunnel building?

Also, I should be grateful for people's views on the tooltips. At present, the player is notified if a tunnel can be built beneath groundwater or beneath the sea, but not otherwise. A player used to the current system where any tunnel may be built below the groundwater or sea may be very confused by this. Would people think it preferable to have a system in which the tooltip tells players either way whether a tunnel can be built below groundwater or below the sea?

Thank you again for your work on this.
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.

PJMack

You're Welcome.  The difference between subsea and sub-ground water was intended for modern cut and cover tunnels where they can be dug below ground water level but only on land.  In game, sub-sea is below a water tile where sub-groundwater is below sea-level or below below the level groundwater set during map generation, whichever is higher.  (Note: the current map generator sets the groundwater level to below sea level except under water tiles, however if the map generator were to be upgraded to a better groundwater map, the tunneling system would make use of it)

I am still working on the graphics adjustments for pak128.Britain-Ex, however I just finished with the canal tunnels and pushed them accordingly (PR#135).  Simply setting the tube tunnels with "half_height=1" and the tube trains with "is_tall=0" would work, the portals would just look funny.  Adjusting the graphics and setting those flags was going to be my next step.  For testing, I made temporary changes to the stone tunnel and a couple of random diesels.

The depth limits are intended for future additions of cut and cover tunnels to the paksets.  Cut and cover tunnels such as the district line are not represented, and I had planned on adding them after adjusting the tube and narrow gauge tunnel graphics for half height.  I believe the district line stock is short enough to also be considered half height.  Currently, the only tunnel in the pakset where a depth limit may be appropriate is the concrete light rail tunnel, which I did make temporary changes to for testing.  Cut and cover tunnels do have depth limits as do immersion tube tunnels (depth below sea floor).

For the tool-tips, I would like other people's views as well.  It is always a balance between displaying information and not cluttering it up too much.  It also needs to fit on the screen, even when translated.

Vladki

I would prefer to see the tooltip if tunnel can not be built below ground water. Players imho expect that tunnel can be built at any depth, so any limits on that must be communicated somehow.

PJMack

I made the tool tip adjustments while creating the alternate depth limit as discussed on the other thread. 

I also completed the graphics for half height tube tunnels and removed the height restriction to what I am pretty sure is all the tube trains.

Person0123452

Quote from: Matthew on March 29, 2022, 07:18:19 PMThank you for the correction.  :thumbsup:

How strange. The pakset sets so much store by realism and then it has an entirely fictional waytype.  :o
Entirely fictional? The first commercial maglev was built in birmingham in 1984. There have been a number of operational maglevs around the world over the years and there are also operational high speed maglevs today (mostly in china). As far as I know there have never been any high speed maglevs in britain but to call maglevs entirely fictional seems like a strange statement.

jamespetts

Thank you for your work on this. I have now had a chance to review this further. Some further comments at this stage.

First of all, the half height Tube tunnel entrances seem to have some graphical issues: see here for example:



This does not appear to apply to the new "subsurface" type.

Secondly, there seems to be an anomaly, in that Tube tunnels cannot be built into full height slopes. Was this intended? If so, what real life engineering constraint was this intended to simulate? This is likely to seem odd and anomalous to players.

Thirdly, there seems to be an inconsistency in height between the Tube and subsurface tunnel graphics:



This issue may be related to the first issue.

Fourthly, the subsurface tunnels seem both to represent half-height tunnels and cut-and-cover tunnels. In reality, cut-and-cover tunnels were built to all gauges: on the London Underground, it was the deep level, bored "Tube" tunnels that were built to a very restricted loading gauge. The cut-and-cover, subsurface tunnels (for the Metropolitan, Hammersmith & City, Circle and District lines) were built to more or less ordinary railway gauge (see here for an illustration), and full sized main line trains regularly used them until 1939. Thus, we need to separate the cut and cover restriction on building underneath the sea from the half height restriction.

Fifthly, the overlap between the function of the tube tunnel way constraint and the half height tunnels is a problem. What needs to be done, I think, is remove the tube tunnel way constraint entirely and replace it with the new system (which is likely to necessitate allowing the half height tunnels to be built into full height slopes), because duplication between the two makes no sense. But also, we need to clarify the message showing the restriction to players. Currently, all of the messages are bridge specific: these need to be reworded to include tunnels (e.g., replacing "low bridge" with "low clearance," etc.).

Further, one thing that is not clear from the tooltips is what the relationship is between the number of meters after the "sub sea permitted xxxm" and the "x tiles" depth. Without the "x tiles" depth, it seems as though the 500m (etc.) is actually a depth limit, but I suspect that it means something else; but what else is not clear. Did you implement a system to do a search from the tile to the nearest tunnel entrance or tunnel tile not underwater to simulate the need for ventilation? If so, it may be necessary to clarify this in the tooltips.

Testing the length restriction algorithm itself, it seems to be based on how close that the tunnel actually gets to land (an option discussed above, I believe). I am not convinced that this accurately represents reality: I am not aware of any actual tunnels that had long horizontal ventilation shafts from land running parallel to them some kilometres away, and, even if this were possible, the cost of this would be gargantuan compared to ordinary ventilation shafts immediately above the tunnels; these costs would have to be simulated for this feature to balance properly. What I suggest instead is that the length be based instead on the number of tiles along the route of the tunnel to the nearest land tile under which the tunnel passes.

In any event, thank you again for your work on this: it is much appreciated.
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.

Sirius

Quote from: jamespetts on May 01, 2022, 03:53:33 PMFifthly, the overlap between the function of the tube tunnel way constraint and the half height tunnels is a problem. What needs to be done, I think, is remove the tube tunnel way constraint entirely and replace it with the new system (which is likely to necessitate allowing the half height tunnels to be built into full height slopes), because duplication between the two makes no sense.
I don't think removing the tube tunnel constraint is a good idea.
Currently, all sinle deck trams are considered "low". Further DLR stock and some other heavy rail vehicles are just as low, but still won't fit in a tube tunnel!

Anyways, I don't see a need for a special "low vehcile" flag on tunnels at all.
It's all coded in the way constraints already.
Define low tunnels with the low constraint and normal tunnels without. That's all you need to do.

The high-clearance pseudo-constraint is indeed redundant but it always had been.

A correlation between loading gauge way constraints (tube, light-rail) and the high-clearance flag is surely preferable, but not an issue newly introduced by the Tunnel improvements.

jamespetts

Sirius makes a good point - for tunnels, we do need the way constraint system for the height for the reasons that he gives. Pakset designers can simply code half height tunnels to have whatever low tunnel constraint is necessary for the pakset(s) that they are making.

We do also need the bridge height system for bridges, however, as bridges do not affect the constraints of the way below them, so the way constraint system cannot be used here.
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.

PJMack

Quote from: jamespetts on May 01, 2022, 03:53:33 PMFirst of all, the half height Tube tunnel entrances seem to have some graphical issues: see here for example:
The new tube tunnel graphics was accidentally committed to the wrong branch.  I pushed the fix.

Quote from: jamespetts on May 01, 2022, 03:53:33 PMSecondly, there seems to be an anomaly, in that Tube tunnels cannot be built into full height slopes. Was this intended? If so, what real life engineering constraint was this intended to simulate? This is likely to seem odd and anomalous to players.
I did not think that once half height tunnels were enabled there would not be any desire to build them for a full height slope.  Rather than adding a new set of graphics, I took the simpler approach to having half slopes for half height tunnels and full slopes for full type tunnels.  Having half height tunnel entrance graphics on a full height slope does not look too anomalous, so I did push a fix.

Quote from: jamespetts on May 01, 2022, 03:53:33 PMFourthly, the subsurface tunnels seem both to represent half-height tunnels and cut-and-cover tunnels. In reality, cut-and-cover tunnels were built to all gauges: on the London Underground, it was the deep level, bored "Tube" tunnels that were built to a very restricted loading gauge. The cut-and-cover, subsurface tunnels (for the Metropolitan, Hammersmith & City, Circle and District lines) were built to more or less ordinary railway gauge (see here for an illustration), and full sized main line trains regularly used them until 1939. Thus, we need to separate the cut and cover restriction on building underneath the sea from the half height restriction.

I have not yet added a full height cut-and-cover tunnel to Pak128.Britain-Ex.  Codewise there is nothing to prevent one from doing so.  As for London's subsurface lines, they are about a foot shorter than the mainlines (see https://www.devboats.co.uk/gwdrawings/loadinggauges.php) and the steam engines were special made for the tunnels.  I am aware that some of the rolling stock for those lines were also used in surface lines, however in my research I did not find instances of those tunnels using engines designed for surface use. 

Quote from: jamespetts on May 01, 2022, 03:53:33 PMFurther, one thing that is not clear from the tooltips is what the relationship is between the number of meters after the "sub sea permitted xxxm" and the "x tiles" depth. Without the "x tiles" depth, it seems as though the 500m (etc.) is actually a depth limit, but I suspect that it means something else; but what else is not clear. Did you implement a system to do a search from the tile to the nearest tunnel entrance or tunnel tile not underwater to simulate the need for ventilation? If so, it may be necessary to clarify this in the tooltips.

Testing the length restriction algorithm itself, it seems to be based on how close that the tunnel actually gets to land (an option discussed above, I believe). I am not convinced that this accurately represents reality: I am not aware of any actual tunnels that had long horizontal ventilation shafts from land running parallel to them some kilometres away, and, even if this were possible, the cost of this would be gargantuan compared to ordinary ventilation shafts immediately above the tunnels; these costs would have to be simulated for this feature to balance properly. What I suggest instead is that the length be based instead on the number of tiles along the route of the tunnel to the nearest land tile under which the tunnel passes.
The limit is distance to shore.  Although it may not be the most accurate way to prevent intercontinental tunnels, it was the most accurate per the amount of coding involved.  Implementing a trace like that would take a while to code and debug, time that would probably be best spent creating other features that have a better ratio of improvement to gameplay verse resources to implement.  This was extensively discussed in the other forum thread.
As far as the tool-tip is concerned, we can change reword the subsea limit to "limit to shore" in the translation texts, however as that tool-tip is starting to become too long to fit on the screen, we may need to begin abbreviating.

jamespetts

Thank you for fixing the tube tunnels and full heights graphical issues - I will test those when I have a moment. The reason that players might want to build Tube tunnels into a full height slope is because Tube tunnels are much cheaper than ordinary tunnels - this, rather than the ability to be built into a shallower slope, is the main reason for building them (hence them being built all over the Bridgewater-Brunel server now, even before this feature has been implemented).

In terms of loading/structure gauge, the Metropolitan loading/structure gauge was much closer to the various main line loading gauges than either was to Tube gauge. In the pre-grouping era, as you will see from the web page that you linked, each individual railway company had its own bespoke loading/structure gauge, and that of the Metropolitan, although at the lower end of the spectrum in terms of height, is not of a wholly different order of smallness in the way that the Tube lines are. In fact, main line carriages did frequently run on the Metropolitan/District lines before 1939 - there was a service from Ealing Broadway to Southend via the District and a service from Southall/Uxbridge Vine Street to Liverpool Street via Paddington and the Metropolitan. The loading gauge of the carriages for the latter were slightly less than those of other GWR carriages, but they were not noticeably on a different scale to them in the way that trains for, e.g., the Bakerloo Line would be. We do not simulate all of the intricacies of slightly different loading gauges in Pak128.Britain-Ex, so it does not make sense to align the sub-surface tunnels with the Tube loading gauge rather than the main line loading gauge.

In terms of subsea tunnelling distance, I have not looked at the code for checking distance to shore, but are you sure that it is much harder to use a way-finding system to find the nearest shore tile back along the length of the existing tunnel than to run an expansive search for all tiles in the vicinity? There is existing code used for, e.g., electrification that sets up a dummy vehicle and uses the built-in way-finding algorithm that could easily be re-used for this purpose. It really is very anomalous and likely to be (1) incomprehensible to most players; and (2) giving rise to exploits and perverse incentives for tunnel distance from shore to be measured other than along the tunnel's own length.

In any event, thank you again for your work on this.
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.

Sirius

Quote from: jamespetts on May 02, 2022, 10:33:40 AMso it does not make sense to align the sub-surface tunnels with the Tube loading gauge rather than the main line loading gauge.
As "something in between", the light-rail loading gauge might be an option.
However, that gauge is meant to represent the typical rectangual loading gauge shape of only 2.65m in width and up to ~3.70 in height.

PJMack

Quote from: jamespetts on May 02, 2022, 10:33:40 AMIn terms of subsea tunnelling distance, I have not looked at the code for checking distance to shore, but are you sure that it is much harder to use a way-finding system to find the nearest shore tile back along the length of the existing tunnel than to run an expansive search for all tiles in the vicinity? There is existing code used for, e.g., electrification that sets up a dummy vehicle and uses the built-in way-finding algorithm that could easily be re-used for this purpose
I did look into the algorithmic complexity of using the existing path finding verses the extensive search and found the extensive search to likely run faster in most circumstances.  The land contour map and water level map are stored in simple arrays which can be easily traversed in for loops maintaining a high cache hit rate and high level of accuracy from the branch prediction hardware.  The underground way data is rather scattered in memory and traversing it involves several unpredictable conditional jumps, which would lead to plenty of cache misses and pipeline stalls.  The existing code is also designed to only work with the existing route, and new code would need to be added to traverse the proposed route.
Quote from: jamespetts on May 02, 2022, 10:33:40 AMIt really is very anomalous and likely to be (1) incomprehensible to most players; and (2) giving rise to exploits and perverse incentives for tunnel distance from shore to be measured other than along the tunnel's own length.
Although it is still somewhat anomalous, it is less anomalous that what it was.  The goal with this was purely to prevent intercontinental tunnels.  I am not saying the a more extravagant solution is not doable or undesirable, I just do not think it should be a priority at the moment.  As far a player confusion, as long as "distance to shore limit" is somewhat clearly labeled, I do not think it will be a problem.



Quote from: jamespetts on May 02, 2022, 10:33:40 AMIn terms of loading/structure gauge, the Metropolitan loading/structure gauge was much closer to the various main line loading gauges than either was to Tube gauge. In the pre-grouping era, as you will see from the web page that you linked, each individual railway company had its own bespoke loading/structure gauge, and that of the Metropolitan, although at the lower end of the spectrum in terms of height, is not of a wholly different order of smallness in the way that the Tube lines are. In fact, main line carriages did frequently run on the Metropolitan/District lines before 1939 - there was a service from Ealing Broadway to Southend via the District and a service from Southall/Uxbridge Vine Street to Liverpool Street via Paddington and the Metropolitan. The loading gauge of the carriages for the latter were slightly less than those of other GWR carriages, but they were not noticeably on a different scale to them in the way that trains for, e.g., the Bakerloo Line would be. We do not simulate all of the intricacies of slightly different loading gauges in Pak128.Britain-Ex, so it does not make sense to align the sub-surface tunnels with the Tube loading gauge rather than the main line loading gauge.
Quote from: Sirius on May 02, 2022, 01:01:03 PMAs "something in between", the light-rail loading gauge might be an option.
However, that gauge is meant to represent the typical rectangual loading gauge shape of only 2.65m in width and up to ~3.70 in height.
For pak128.Britain-Ex, my thought was to have the metropolitan line tunnels be the threshold for what is considered to be tall or not.  6" may not sound like much, but when it is the difference between clearing and hitting a bridge or tunnel roof that 6" is significant.  Most of the subsurface stock is the same height or shorter than the Sheffield Supertram, so it makes no sense to have the Supertrams be capable of going under low bridges and tunnels whilst the sub-surface stock cannot.  (Having the light rail loading gauge for tunnels does make sense, however, as trams are thinner and not as long as mainline rail.) 

We may need a broader discussion on to how to define what can and cannot go beneath a low bridge for road, tram, and rail vehicles in pak128.Britain.

Matthew

Quote from: jamespetts on May 02, 2022, 10:33:40 AMIn terms of subsea tunnelling distance, I have not looked at the code for checking distance to shore, but are you sure that it is much harder to use a way-finding system to find the nearest shore tile back along the length of the existing tunnel than to run an expansive search for all tiles in the vicinity? There is existing code used for, e.g., electrification that sets up a dummy vehicle and uses the built-in way-finding algorithm that could easily be re-used for this purpose. It really is very anomalous and likely to be (1) incomprehensible to most players; and (2) giving rise to exploits and perverse incentives for tunnel distance from shore to be measured other than along the tunnel's own length.

Quote from: PJMack on May 03, 2022, 05:17:12 PMAlthough it is still somewhat anomalous, it is less anomalous that what it was.  The goal with this was purely to prevent intercontinental tunnels.  I am not saying the a more extravagant solution is not doable or undesirable, I just do not think it should be a priority at the moment.  As far a player confusion, as long as "distance to shore limit" is somewhat clearly labeled, I do not think it will be a problem.

I agree the blocking off the intercontinental tunnel exploit is a valuable improvement. I think a simple 'distance to shore' rule is very easy for players to comprehend.

The most obvious exploit is building sub-sea tunnels parallel to shore. But I haven't yet thought of reason why players would want to do this. If it's an urban shore, then players would normally want to build under the city to serve it. If it's a rural shore, then you can build at ground level.

In my opinion, blocking a known exploit is more important than blocking unknown ones.

Quote from: PJMack on May 03, 2022, 05:17:12 PMI did look into the algorithmic complexity of using the existing path finding verses the extensive search and found the extensive search to likely run faster in most circumstances.  The land contour map and water level map are stored in simple arrays which can be easily traversed in for loops maintaining a high cache hit rate and high level of accuracy from the branch prediction hardware.  The underground way data is rather scattered in memory and traversing it involves several unpredictable conditional jumps, which would lead to plenty of cache misses and pipeline stalls.  The existing code is also designed to only work with the existing route, and new code would need to be added to traverse the proposed route.

Although this code should only be called rarely (when a client tries to build new tunnel tiles), it is really great to see active consideration of cache misses in Extended design, as I suspect it's the most important bottleneck.
(Signature being tested) If you enjoy playing Simutrans, then you might also enjoy watching Japan Railway Journal
Available in English and simplified Chinese
如果您喜欢玩Simutrans的话,那么说不定就想看《日本铁路之旅》(英语也有简体中文字幕)。

Phystam

I don't know how realistic an estimate this is, but one model to prevent the construction of intercontinental tunnels is to try to impose a nonlinear (e.g. quadratic or exponential) cost on the distance measured from the entrance to the tunnel.
As a side effect, it would be more effective to build half of the tunnel from both directions instead of building it from one direction. This would reflect the actual tunnel construction method.

prissi

The route search (find_route) for platforms can be easily used for finding tunnel entries as well, so that code could be reused. Just return true on a tunnel entry instead of a platform of the stop.

jamespetts

Quote from: prissi on May 04, 2022, 11:28:35 AMThe route search (find_route) for platforms can be easily used for finding tunnel entries as well, so that code could be reused. Just return true on a tunnel entry instead of a platform of the stop.
That is one way of doing it.

However, in terms of searching for the length of the proposed tunnel to the nearest ventilation point, if building a tunnel by clicking and dragging, we already have a list of tiles in memory for the route of the proposed tunnel. If that passes through a shore tile, we can simply use that list. If it does not, and ends on another undersea tunnel tile, we can then count the number of proposed tiles, then start the route finder from the last built tunnel tile and check how many tiles that there are to the shore. Players can properly be prevented from building tunnels that start and end undersea.
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.