Chunnel V23 r27765
Moderator: OpenTTD Developers
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Chunnel V23 r27765
Chunnel patch.
Wat it does.
Enabeling building tunnels crossing water.
Features.
Only on tile level 0 it is possible to use.
Tunnel building tool switches automatically to chunnelmode when water encountered.
Any kind of coast tile can be used.
Tunnels over water can cross each other.
Limitations: Oil rigs can not be constructed on top of chunnel, nor can the be passed by chunnel.
Happy Tunneling.
Wat it does.
Enabeling building tunnels crossing water.
Features.
Only on tile level 0 it is possible to use.
Tunnel building tool switches automatically to chunnelmode when water encountered.
Any kind of coast tile can be used.
Tunnels over water can cross each other.
Limitations: Oil rigs can not be constructed on top of chunnel, nor can the be passed by chunnel.
Happy Tunneling.
- Attachments
-
- Chunnel.png (98.23 KiB) Viewed 26434 times
-
- chunnel_trunk_27765_v23.zip
- (28.33 KiB) Downloaded 819 times
Last edited by HackaLittleBit on 06 Mar 2017 18:53, edited 29 times in total.
Re: Chunnel v1 r15422
not bad, not bad at all! 
Nice idea to use this corner case for undersea tunnels. It doesn't make sense to build a tunnel that ends right in front of water anyways, so I don't think anyone will miss that situation...
Oh and it was good practice to seperate undersea tunnels from the "tunnel-like-you-want"-tunnels you had in your last patch.
But there's still two seperate features in this patch that could be seperated - "build undersea tunnels" and "display exit in viewport when holding ctrl while building a tunnel".
Two seperate patches for two features will each have a higher chance on trunk inclusion than two features in one patch.
edit: testing your patch...

Nice idea to use this corner case for undersea tunnels. It doesn't make sense to build a tunnel that ends right in front of water anyways, so I don't think anyone will miss that situation...
Oh and it was good practice to seperate undersea tunnels from the "tunnel-like-you-want"-tunnels you had in your last patch.

But there's still two seperate features in this patch that could be seperated - "build undersea tunnels" and "display exit in viewport when holding ctrl while building a tunnel".
Two seperate patches for two features will each have a higher chance on trunk inclusion than two features in one patch.

edit: testing your patch...
Re: Chunnel v1 r15422
So... after some testing I've got some things to mention.
Firstly, the viewport popup should really not happen on only pressing Ctrl. Ctrl+Click: okay. Only Ctrl: no-no. For example, I got extremely annoyed by it when I tried to take a screenshot using Ctrl+S, while selecting the tile I wanted some tunnel built (see screenshot below), so one can see the selection.
(and as I said before, it's better to put those two features in two different patches)
Secondly, there is some inconsistency in when you can build a tunnel under water, and when not.
Compare screenshot #1 and screenshot #2 for a situation where trying the tunnel from one end will allow the undersea tunnel, but from the other end will result in a tunnel ending at the water edge. It seems that your patch doesn't handle diagonal water edges very well...
Also see screenshot #3 for an overview where the desired undersea tunnel can be built and where not, in my setup.
The green dots are where I could build the desired tunnel, the yellow and red dots are where it did not work. The yellow dot is probably due to a slightly different problem (the water being only 1/2 tile wide there) than the red dots (diagonal water edge at the nearer side), so I colored it different.
---
Oh, and found another problem, that may be a conceptual problem:
It is possible to raise any tile in the stretch where the tunnel is going undersea, but not to lower it anymore.
This also enables you to make impossible constructions like this (screenshot #4 in next post).
... and finally, it enables you to make crossing tunnels without enabling the crossing tunnels cheat. (screenshot #5 in next post)
I am not sure how to address these last issues...
Firstly, the viewport popup should really not happen on only pressing Ctrl. Ctrl+Click: okay. Only Ctrl: no-no. For example, I got extremely annoyed by it when I tried to take a screenshot using Ctrl+S, while selecting the tile I wanted some tunnel built (see screenshot below), so one can see the selection.
(and as I said before, it's better to put those two features in two different patches)
Secondly, there is some inconsistency in when you can build a tunnel under water, and when not.
Compare screenshot #1 and screenshot #2 for a situation where trying the tunnel from one end will allow the undersea tunnel, but from the other end will result in a tunnel ending at the water edge. It seems that your patch doesn't handle diagonal water edges very well...
Also see screenshot #3 for an overview where the desired undersea tunnel can be built and where not, in my setup.
The green dots are where I could build the desired tunnel, the yellow and red dots are where it did not work. The yellow dot is probably due to a slightly different problem (the water being only 1/2 tile wide there) than the red dots (diagonal water edge at the nearer side), so I colored it different.
---
Oh, and found another problem, that may be a conceptual problem:
It is possible to raise any tile in the stretch where the tunnel is going undersea, but not to lower it anymore.
This also enables you to make impossible constructions like this (screenshot #4 in next post).
... and finally, it enables you to make crossing tunnels without enabling the crossing tunnels cheat. (screenshot #5 in next post)
I am not sure how to address these last issues...
- Attachments
-
- chunnel #1.png (64.53 KiB) Viewed 47279 times
-
- chunnel #2.png (63.67 KiB) Viewed 47290 times
-
- chunnel #3.png (61.33 KiB) Viewed 47290 times
Re: Chunnel v1 r15422
screenshots #4 and #5
- Attachments
-
- chunnel #4.png (57.33 KiB) Viewed 47292 times
-
- chunnel #5.png (64.14 KiB) Viewed 47268 times
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Chunnel v1 r15422
Thanks Roujin
Am checking your post now.
will hear of me later.
Split patch in two see above
regards.
Am checking your post now.
will hear of me later.
Split patch in two see above
regards.
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Chunnel v1 r15422
Ok the issue of Ctrl
Changed it into V + Ctrl
V is standard viewport.
when viewport open Ctrl fixes on end tile.
Made this feature to avoid loosing crazy amounts of money while building wrong tunnel.
Will come back to you regarding other issues.
HackaLittleBit.
Changed it into V + Ctrl
V is standard viewport.
when viewport open Ctrl fixes on end tile.
Made this feature to avoid loosing crazy amounts of money while building wrong tunnel.
Will come back to you regarding other issues.
HackaLittleBit.
- Attachments
-
- viewport _V_plus_Ctrl.patch
- (2.37 KiB) Downloaded 884 times
Re: Chunnel v1 r15422
Ctrl with other actions is used for too many "magic" functions in the game, i think it is a very bad idea to make it do something on its own.
at best, you could use Ctrl+V to open a viewport at the "target" place of the tunnel.
at best, you could use Ctrl+V to open a viewport at the "target" place of the tunnel.
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Chunnel v1 r15422
Check this line in the code it says it allSecondly, there is some inconsistency in when you can build a tunnel under water, and when not.
Compare screenshot #1 and screenshot #2 for a situation where trying the tunnel from one end will allow the undersea tunnel, but from the other end will result in a tunnel ending at the water edge. It seems that your patch doesn't handle diagonal water edges very well...
if (IsWaterTile(end_tile + delta) && !IsWaterTile(start_tile - delta)) passing_water = true;
so shoreline is not considered a water tile.
I could make it more flexible the code but I think that it is in a way allready futuristic and if people want to make an tunnel under water they have to prepare the shore line.
Whats wrong there am I not allowed to make a tunnel under island?This also enables you to make impossible constructions like this (screenshot #4 in next post).
About this raising and lowering land I'll come back to you.
Screenshot 5
Am not able to reproduce that situation.
Are you shure you switched off the tunnel_cheat?
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Chunnel v1 r15422
Ok about this diagonal building I fixed that.
see patch and foto
regards
see patch and foto
regards
Re: Chunnel v1 r15422
Here's how I did the crossing tunnels in three steps:
(screenshot taken with the old version of your patch, but just tested the new one (v3) and it still works)
(screenshot taken with the old version of your patch, but just tested the new one (v3) and it still works)
- Attachments
-
- chunnel bug #1.png (47.63 KiB) Viewed 47089 times
-
- chunnel bug #2.png (54.27 KiB) Viewed 47091 times
-
- chunnel bug #3.png (49.69 KiB) Viewed 47072 times
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Chunnel v1 r15422
Thanks a lot Roujin
Know exactly where to look.
while (z < height); here it is!!
need to have a good look at this procedure will take some time
regards HackaLittleBit
Know exactly where to look.
Code: Select all
bool IsTunnelInWayDir(TileIndex tile, uint z, DiagDirection dir)
{
TileIndexDiff delta = TileOffsByDiagDir(dir);
uint height;
do {
tile -= delta;
if (!IsValidTile(tile)) return false;
height = GetTileZ(tile);
if (IsTileType(tile, MP_WATER)) height += 1; // Underwater tunnels
} while (z < height);
return
z == height &&
IsTunnelTile(tile) &&
GetTunnelBridgeDirection(tile) == dir;
}
need to have a good look at this procedure will take some time
regards HackaLittleBit
Re: Chunnel v1 r15422
Can I suggest that underwater tunnels be more expensive than normal tunnels?
Melt with the Shadows,
Embrace your destiny...
Embrace your destiny...
-
- Tycoon
- Posts: 5954
- Joined: 27 Apr 2005 07:09
- Contact:
Re: Chunnel v1 r15422
Not necissarily.Thief^ wrote:Can I suggest that underwater tunnels be more expensive than normal tunnels?
At least IRL, mined tunnels are the most expensive, regardless if subterraneous or underwater. OTOH, in flat waters, "floating assembly" of a tunnel is usually much cheaper than having to use sophisticated and expensive tunnel drilling machines in hard rock zones.
Nevertheless, it´d be an interesting feature to be able to set cost of tunnels differently from newgrfs.
regards
Michael
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Chunnel v1 r15422
Latest update of patch
Solved most of the problems encountered by Roujin.
Problems remaining:
Terra forming downward not allowed over tunnel upward allowed(Is that a problem?)
Now the cost of creating the tunnel through water is cheaper than through land.
I suggest to keep these costs the same. although don't know how to do that.
Regards
Solved most of the problems encountered by Roujin.
Problems remaining:
Terra forming downward not allowed over tunnel upward allowed(Is that a problem?)
Now the cost of creating the tunnel through water is cheaper than through land.
I suggest to keep these costs the same. although don't know how to do that.
Regards
- planetmaker
- OpenTTD Developer
- Posts: 9432
- Joined: 07 Nov 2007 22:44
- Location: Sol d
Re: Chunnel v1 r15422
It's not understandable, that you cannot restore the previous condition, should you have accidentially made sea into land. So, I think, it's something which needs taken care of.hackalittlebit wrote:Terra forming downward not allowed over tunnel upward allowed(Is that a problem?)
An evil person could use this to totally sabotage your shipping routes without you having the possibility to undo it.
OpenTTD: manual | online content | translations | Wanted contributions and patches
#openttdcoop: blog | wiki | public server | DevZone | NewGRF web translator
DevZone - home of the free NewGRFs: OpenSFX | OpenMSX | OpenGFX | Swedish Rails | OpenGFX+ Trains|RV|Industries|Airports|Landscape | NML
- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Chunnel v1 r15422
Got it Will have a look at it
Re: Chunnel v1 r15422
nice, here's some more testing by mr. extreme-bug-finderhackalittlebit wrote:Latest update of patch[...]

very short tunnels can still bypass the no-crossing-tunnels limitation (see screenshot)Solved most of the problems encountered by Roujin.
(the long tunnel again was an undersea tunnel, then filling up some land and building the very short tunnel; finally filling up the remains of the sea

I'd say it is, because it does not make sense: imagine there's a sea and you build a tunnel through it. You can then raise a piece of land where the tunnel is supposed to be. But then you cannot flatten it again? For what logical reason would that be?Terra forming downward not allowed over tunnel upward allowed(Is that a problem?)
[...]
Plus it destroys the image of a floating tunnel, that is used when building such an undersea tunnel.
The problem if you want to enable both raising and lowering is, then you have to enable lowering everywhere, that would mean tunnels being complete wormholes. No more "can't lower land here: tunnel in the way", crossing tunnels by default, heck why not introduce the arbitrary tunnels again then?
So the only way to go would be disallowing both raising and lowering. Luckily, there is also a logical explanation for it: we just say those undersea tunnels are of the "floating tunnel" kind. This of course explains why it's forbidden to raise a tile above the undersea part of the tunnel: the tunnel is floating in the water there, so it's in the way if you plan to raise the land there.
As a bonus, imo it would even give a logical explanation for the following discrepancy:
Forbidden: raise land in the middle of a sea tunnel Allowed: destroying the tunnel, raising the land in the middle of the sea, building the tunnel again The explanation for this would be (again using the idea of floating tunnels) that floating tunnels are used in the second picture from coast to coast, then a little peace of normal land tunnel, then again a floating sea tunnel from coast to coast. This cannot be archieved just by filling up some land when there is already a floating sea tunnel through the whole sea (image 1).
---
Uhm, are my ideas still understandable?

- HackaLittleBit
- Director
- Posts: 550
- Joined: 10 Dec 2008 16:08
- Location: tile 0x0000
Re: Chunnel v1 r15422
Ok Here the reply to planetmaker
No more terra forming over undersee tunnels
Now going to have a look at your message Roujin
EDIT: Think it should not be possible anymore now.
regards
No more terra forming over undersee tunnels
Now going to have a look at your message Roujin
EDIT: Think it should not be possible anymore now.
regards
Last edited by HackaLittleBit on 09 Feb 2009 22:22, edited 1 time in total.
Re: Chunnel v1 r15422
with that, you basically already did what I said in the second (larger!) part of my last post. nice!hackalittlebit wrote:Ok Here the reply to planetmaker
No more terra forming over undersee tunnels
Now going to have a look at your message Roujin
regards
so the only thing remaining is the bug with a very short tunnel being allowed where it shouldn't be.
edit: tested new version 5 and noticed two more small things
I hope you're still regarding this as valuable input, and I am not just annoying you

1) the error message when raising land over an undersea tunnel is a little wrong.. it's mentioning an excavation, while you're actually filling up land. I think you should just add a new string (something like "filling would damage undersea tunnel")
2) small discrepancy between two situations:
Allowed (automatically lowers one edge to build a tunnel exit there): Disallowed (or rather, disregarded and algorithm continues search until it finds an already suitable place for tunnel exit):
Last edited by Roujin on 09 Feb 2009 22:38, edited 1 time in total.
Re: Chunnel v1 r15422
If tunnel entrances are enough distant I don't know why crossing tunnels should be forbidden, if they don't make your trains exit the tunnel from a wrong exit (try to build a tunnel 'inside' another with the same method you used, if you can) I think they might be allowed, but the entrance must be at least 2-3 tiles away from the intersection (so parallel tunnels should be forbidden)
This is what I mean (side view) IMO this might open the path to other nice junctions etc, and if we might get crossing bridges too it should be the same thing, with the top bridge longer than the bottom bridge
This is what I mean (side view) IMO this might open the path to other nice junctions etc, and if we might get crossing bridges too it should be the same thing, with the top bridge longer than the bottom bridge
Who is online
Users browsing this forum: No registered users and 30 guests