Water Tunnels

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

Orko
Engineer
Engineer
Posts: 1
Joined: 26 Jan 2010 13:59

Re: Water Tunnels

Post by Orko »

Hi,
After reading this i had to register and get something of my chest.

I drove once throu one of those channal tunnels and its an amazing mysterius experience. Going int that black hole and echoing your machine from the walls. That was a tunnel of the Rhine rone channel.
A quite big one at it too.

also here a list with other channel tunnels http://en.structurae.de/structures/ftyp ... fm?ID=2099
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: Water Tunnels

Post by Hyronymus »

How feasible are canal tunnels nowadays?
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Water Tunnels

Post by Eddi »

there is no technical reason that prevents water tunnels, but the graphics will glitch horribly, because ships are just too big.
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: Water Tunnels

Post by Hyronymus »

Eddi wrote:there is no technical reason that prevents water tunnels, but the graphics will glitch horribly, because ships are just too big.
With the release of FISH I wonder and it is up to players to decide which ships to send through a tunnel in the end.
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7238
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Water Tunnels

Post by Redirect Left »

Orko wrote: I drove once throu one of those channal tunnels http://en.structurae.de/structures/ftyp ... fm?ID=2099
I've been on a tour through one of the ones near me It really is a very weird, almost surreal experience being on a tunnel in a boat. Nothing but the echoes of your engine, and the pitch black around you. Would be great if this was ever put into OpenTTD, and definately a feature i'd use. The possible clipping, well i've got used to it. Sadly the devs say its impossible to fix, at least not without rewriting everything or something. But, I wouldn't put off making such a feature based upon a bit of clipping.
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
User avatar
SquireJames
Tycoon
Tycoon
Posts: 1863
Joined: 07 Aug 2004 11:56
Skype: squirejames5
Location: Stoke-on-Trent
Contact:

Re: Water Tunnels

Post by SquireJames »

I have thought before that canal tunnels would be handy, but as Jolt says I figured there would be issues with ship size and I also (probably wrongly) thought that since I had some up with an idea and no-one had apparently mentioned it yet, it must be impossible to do else someone far cleverer and far more talented than myself would have already done so :)

I never have any good ideas first you see :)

Would it be possible to make ship sprites go translucent like train sprites can when they enter tunnels? Would that perhaps resolve the clipping thing a little, since you wouldn't see which bits were clipping through terrain and which bits weren't?
Image
User avatar
FLHerne
Tycoon
Tycoon
Posts: 1543
Joined: 12 Jul 2011 12:09
Location: St Ives, Cambs, UK

Re: Water Tunnels

Post by FLHerne »

SquireJames wrote:Would it be possible to make ship sprites go translucent like train sprites can when they enter tunnels? Would that perhaps resolve the clipping thing a little, since you wouldn't see which bits were clipping through terrain and which bits weren't?
I think the problem is that ship sprites are often larger than a tile, so the front starts poking 'through' the terrain behind the tunnel mouth before the rear of the ship has finished moving into the tunnel. So making the front invisible in time to avoid clipping would lead to the rear of the ship 'vanishing'.

Of course, I could be completely wrong as usual... :roll:
Temporary Permanent signature filling text. Content coming soon delayed indefinitely! Oh, and I have had a screenshot thread.
Linux user (XMonad DWM/KDE, Arch), IRC obsessive and rail enthusiast. No longer building robots; now I ring church bells.
Author of an incredibly boring stickied post about NewGRFs.
User avatar
SquireJames
Tycoon
Tycoon
Posts: 1863
Joined: 07 Aug 2004 11:56
Skype: squirejames5
Location: Stoke-on-Trent
Contact:

Re: Water Tunnels

Post by SquireJames »

Well, hence me suggesting translucent :) Like the "Fake Subway" set, or normal trains when they enter a tunnel. Sort of grey and and shadowt
Image
Eddi
Tycoon
Tycoon
Posts: 8258
Joined: 17 Jan 2007 00:14

Re: Water Tunnels

Post by Eddi »

that is not at all what happens when a train enters a tunnel...
Supercheese
Tycoon
Tycoon
Posts: 1660
Joined: 16 Dec 2007 22:24
Location: Idaho, USA

Re: Water Tunnels

Post by Supercheese »

Eddi wrote:that is not at all what happens when a train enters a tunnel...
I believe there's a patch (also included in Chill's PP) that has the behavior described: http://dev.openttdcoop.org/projects/cli ... nnels.diff
Eyecandy Road Vehicles | Fake Subways | Supercheese's NewObjects

"Fashions and cultures change, but steam trains shall always be majestic."
-Professor Hershel Layton
User avatar
SquireJames
Tycoon
Tycoon
Posts: 1863
Joined: 07 Aug 2004 11:56
Skype: squirejames5
Location: Stoke-on-Trent
Contact:

Re: Water Tunnels

Post by SquireJames »

Ah that would be it. Thanks supercheese.
Image
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: Water Tunnels

Post by Hyronymus »

Eddi wrote:that is not at all what happens when a train enters a tunnel...
Please, spare us the details :mrgreen: .

How up to date is that diff in regards to 1.3.0?
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Water Tunnels

Post by Roujin »

Eddi wrote:there is no technical reason that prevents water tunnels, but the graphics will glitch horribly, because ships are just too big.
Well, since there there is a request for it and I thought I could after long time get into OpenTTD coding again, I wrote a patch. Searching yielded an old patch that did this already, but as that one is quite old I decided to rewrite it from scratch instead of trying to update it.

I made two versions of the .diff, one just uses the road sprites (gui, cursor, 48 tile sprites) for everything, the other adds new sprites, which would require a modified base graphics set with new sprites added.
I made some shoddy sprites based on the opengfx road tunnel sprites and the water tile, but I wasn't able to create a modified opengfx with these sprites added in the appropriate locations. Maybe some graphics wizard could jump in and help me out here? Attached are the sprite sheets with sources (gimp .xcf). The GUI sprites are supposed to be added at the end of SPR_OPENTTD_BASE (after the recently added delete buttons), the tile sprites got their own section after SPR_RAILTYPE_TUNNEL_BASE. See sprites.h in the newsprites-diff.


Anyway, here's a screenshot using the version which uses the road sprites. As predicted there's glitches due to the size of the ship.
water tunnels test 1.png
water tunnels test 1.png (84.32 KiB) Viewed 3119 times
And here's the diffs. You can use the newsprites one, but it will show a warning that sprites are missing and tunnels will look glitchy.
watertunnel_v1_roadsprites_r24893.diff
Version using road sprites.
(15.85 KiB) Downloaded 99 times
watertunnel_v1_newsprites_r24893.diff
Version using new sprites (requires modified base graphics set which does not exist yet).
(18.42 KiB) Downloaded 94 times
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Water Tunnels

Post by Roujin »

... and here's the sprites. If someone could make a modified OpenGFX with these added, or even make proper ones that line up with canal tiles, would be greatly appreciated.

Everything's in the zip, added the pngs extra for viewing convenience only.
Attachments
OpenTTD watertunnel sprites.zip
(78.39 KiB) Downloaded 92 times
watertunnel.png
(33.34 KiB) Downloaded 2 times
watertunnel_gui.png
watertunnel_gui.png (1.33 KiB) Viewed 3114 times
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
Redirect Left
Tycoon
Tycoon
Posts: 7238
Joined: 22 Jan 2005 19:31
Location: Wakefield, West Yorkshire

Re: Water Tunnels

Post by Redirect Left »

That's pretty nice. Although, the sprite glitch isn't exactly overly annoying, really.
Image
Need some good tested AI? - Unofficial AI Tester, list of good stuff & thread is here.
Roujin
Tycoon
Tycoon
Posts: 1884
Joined: 08 Apr 2007 04:07

Re: Water Tunnels

Post by Roujin »

Well, this screenshot doesn't really convey the whole truth of these graphical problems...

First, the passenger ferry is pretty small, larger ships will obviously show through the ground longer/more.
Also at the point where the vehicle becomes invisible, quite a bit of the ship is still outside, so that sudden vanishing is (much more) noticeable compared to buses / train wagons. Of course that can't be seen on a screenshot. But you can imagine.. on the screenshot with the ferry I think I captured the last frame before the ship becomes invisible.

edit: I lied. The ferry goes in quite a bit more before vanishing. So the vanishing thing isn't that big of a problem, but the "showing through the ground" is worse than as seen on my previous screenshot. I will provide a new screenshot shortly.

edit2: these screenshots show the last frame shown before the ship disappears, for the passenger ferry, and the cargo ship (afaict the biggest ship in OpenGFX), respectively.
Attachments
water tunnel glitch ferry.png
water tunnel glitch ferry.png (78.39 KiB) Viewed 3091 times
water tunnel glitch cargo ship.png
water tunnel glitch cargo ship.png (79.66 KiB) Viewed 3091 times
* @Belugas wonders what is worst... a mom or a wife...
<Lakie> Well, they do the same thing but the code is different.

______________
My patches
check my wiki page (sticky button) for a complete list

ImageImage
ImageImageImageImageImageImageImage
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: Water Tunnels

Post by Hyronymus »

Perhaps a stupid suggestion but will it work if you extend the water tunnel graphics to the tile immediatly behind the tunnel entrance? I.e. extend it with a flat green tile.
User avatar
planetmaker
OpenTTD Developer
OpenTTD Developer
Posts: 9432
Joined: 07 Nov 2007 22:44
Location: Sol d

Re: Water Tunnels

Post by planetmaker »

Hyronymus wrote:Perhaps a stupid suggestion but will it work if you extend the water tunnel graphics to the tile immediatly behind the tunnel entrance? I.e. extend it with a flat green tile.
That of course will look great, if it's a rail tile, a house tile or an industry tile. Or even a water tile. ;-)

@Roujin: nice to see you back :-)

Wrt tunnels: wouldn't it make sense to implement for water tunnels straight the way we draw newgrf rail tunnels which allow separate drawing of ground, rail, portal and slope. Of course ground and rail would in this case be the water tile - but portals and slope could be a separate sprite which do not contain the water itself. And it could contain an overlay sprite (analogue to rail) which would allow to simulate shaddow on the water.
User avatar
Hyronymus
Tycoon
Tycoon
Posts: 13233
Joined: 03 Dec 2002 10:36
Location: The Netherlands
Contact:

Re: Water Tunnels

Post by Hyronymus »

planetmaker wrote:
Hyronymus wrote:Perhaps a stupid suggestion but will it work if you extend the water tunnel graphics to the tile immediatly behind the tunnel entrance? I.e. extend it with a flat green tile.
That of course will look great, if it's a rail tile, a house tile or an industry tile. Or even a water tile. ;-)

@Roujin: nice to see you back :-)

Wrt tunnels: wouldn't it make sense to implement for water tunnels straight the way we draw newgrf rail tunnels which allow separate drawing of ground, rail, portal and slope. Of course ground and rail would in this case be the water tile - but portals and slope could be a separate sprite which do not contain the water itself. And it could contain an overlay sprite (analogue to rail) which would allow to simulate shaddow on the water.
As I wrote, perhaps a stupid suggestion (still curious whether it would solve the issue though).
User avatar
Zuu
OpenTTD Developer
OpenTTD Developer
Posts: 4553
Joined: 09 Jun 2003 18:21
Location: /home/sweden

Re: Water Tunnels

Post by Zuu »

Hyronymus wrote:As I wrote, perhaps a stupid suggestion (still curious whether it would solve the issue though).
It sounds like it will cause problems. It might prove easier to experiment with ways to not blit the whole ship. Eg. maybe the portal can define a clip rect for the ship? Assuming the portal is large enough that you can let the one of the two vertical borders of the clip rect go through the portal.

In the upscaled screenshot below, I've added a clip rect in pink that should be able to cut away the part of the ship that is show up after the tunnel portal. However, I haven't had a look on the NE/NW directions which might be more troublesome. But if the graphics are designed such that a clip rect can be placed either with a vertical or horizontal border cutting through portal, that trick may solve this issue.

The issue with ships disappearing before they have fully entered the tunnel is however not solved by adding a clip rect.
Attachments
ship-tunnel-clip-rect.png
ship-tunnel-clip-rect.png (49.07 KiB) Viewed 3049 times
My OpenTTD contributions (AIs, Game Scripts, patches, OpenTTD Auto Updater, and some sprites)
Junctioneer (a traffic intersection simulator)
Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 3 guests