New map features

Forum for technical discussions regarding development. If you have a general suggestion, problem or comment, please use one of the other forums.

Moderator: OpenTTD Developers

Post Reply
dan137
Engineer
Engineer
Posts: 11
Joined: 10 Sep 2009 08:33

Re: New map features

Post by dan137 »

The way you show it takes 2 tiles and you have to terraform, while what I'm proposing needs only a single tile. For example think about multiple lines crossing a diagonal track. With bridges all of them can be minimal length, while with current tunnels they all have to be longer (see image). This really makes a difference when you have many parallel tracks.
The interface could be exactly the same behavior as for bridges, the only difference is that it's not above but below the surface everywhere.
On top of that it would automatically be a coherent implementation of underwater tunnels.
Attachments
bridge_tunnel.png
bridge_tunnel.png (47.62 KiB) Viewed 3690 times
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

dan137 wrote:The way you show it takes 2 tiles and you have to terraform, while what I'm proposing needs only a single tile. For example think about multiple lines crossing a diagonal track. With bridges all of them can be minimal length, while with current tunnels they all have to be longer (see image). This really makes a difference when you have many parallel tracks.
You are right in that it takes two tiles, instead of one. However, the situation you describe would be better fixed by having custom tunnelheads (so that the tracks above the tunnel can overlap the tunnel entrance).
dan137 wrote:On top of that it would automatically be a coherent implementation of underwater tunnels.
Err, I cannot see how this automatic implementation would work.
dan137
Engineer
Engineer
Posts: 11
Joined: 10 Sep 2009 08:33

Re: New map features

Post by dan137 »

I don't think custom tunnel heads would fix this problem. If you have many parallel lines in tunnels it would still require much longer tunnels to cross a diagonal track. (with diagonal tracks overlapping the tunnel entrance you only get 2 tiles shorter tunnels regardless of the number of them)
Don't get me wrong though, custom tunnel heads would be an awesome thing too!
About the underwater tunnels I just mean, that if you can build tunnels 1 unit below a completely flat terrain without terraforming, then it might as well work starting from sea level. As a "side effect" this would make it possible to tunnel under seas without any kind of hacking or having land below sea level.
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

dan137 wrote:I don't think custom tunnel heads would fix this problem. If you have many parallel lines in tunnels it would still require much longer tunnels to cross a diagonal track. (with diagonal tracks overlapping the tunnel entrance you only get 2 tiles shorter tunnels regardless of the number of them)
All right, now I see what you mean: Being able to place a tunnel entrance on a flat tile would lift the requirement that adjacent tunnels have adjacent entrances. Yes, this is something that would be nice to have.
dan137 wrote:About the underwater tunnels I just mean, that if you can build tunnels 1 unit below a completely flat terrain without terraforming, then it might as well work starting from sea level. As a "side effect" this would make it possible to tunnel under seas without any kind of hacking or having land below sea level.
I am afraid it would not. There are deeper assumptions in the code that would prevent that; for instance, a vehicle's position must always be above (or at) sea level (its z coordinate must be greater or equal than 0), and this cannot be worked around. So tunnels below sea level would require more changes than just tunnel entrances on flat tiles.
dan137
Engineer
Engineer
Posts: 11
Joined: 10 Sep 2009 08:33

Re: New map features

Post by dan137 »

I just photoshopped (poorly) an image how it would look with the tunnel heads proposed. Pretty neat!
Attachments
New tunnelheads.png
New tunnelheads.png (39.31 KiB) Viewed 3613 times
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: New map features

Post by JacobD88 »

dan137 wrote:I just photoshopped (poorly) an image how it would look with the tunnel heads proposed. Pretty neat!
It looks like you are effectively proposing a (visually) ground level version of the "Tunnels can Cross Each other" cheat?

Trains on opposing tracks effectively can pass one another without crashing, but they are on the same level?

It's not really a "Tunnel Head" thing... Custom Tunnel Heads would allow you to build track across the entrance to a tunnel;which Cirdan has already covered the situation with in posts above.

It might be worth PM-ing or Posting to Hackalittlebit's Worm-hole threads to see the feasibility of what you propose as he's worked a lot with Tunnels/Chunnel and you appear to want the implementation of something that allows you to specify a stretch of tiles in which any other track crossing, and the traffic which travels on it, doesn't risk a crash, or stop for anything passing between point A and B of the specified worm-hole length...

Cirdan, i love this series of patches thank-you for all the effort you have put in trying to bring custom bridge heads and all the other features to OTTD, 399+ small patches is a remarkable feat and both this and Fonso's CargoDist are number one on my wishlist for (hopefully) trunk inclusion :bow:
dan137
Engineer
Engineer
Posts: 11
Joined: 10 Sep 2009 08:33

Re: New map features

Post by dan137 »

JacobD88 wrote: It looks like you are effectively proposing a (visually) ground level version of the "Tunnels can Cross Each other" cheat?
Trains on opposing tracks effectively can pass one another without crashing, but they are on the same level?
That's not what I mean. Of course this is a wormhole as any tunnel, but the tunnel should physically be one level lower than the track it crosses. (If you look closely, the track in the tunnel head tile is sloped). That's the reason it wouldn't solve the tunnels under seas issue. What you say would be a simplified workaround (that is not very elegant imho).
JacobD88 wrote: It's not really a "Tunnel Head" thing... Custom Tunnel Heads would allow you to build track across the entrance to a tunnel;which Cirdan has already covered the situation with in posts above.
I think it's a tunnel head thing in the sense that it requires a new type of tunnel head both functionally and visually. It's just the same thing as the two types of bridge heads (flat and sloped) in the original TTD. Besides adding custom bridge/tunnel heads cirdan's patch is also about unifying bridge and tunnel behavior, so it seems the best place to coin such ideas.
dan137
Engineer
Engineer
Posts: 11
Joined: 10 Sep 2009 08:33

Re: New map features

Post by dan137 »

I found a small bug:

When approaching a red signal on the bridge head at the end of a bridge, the train doesn't slow down gradually, but stops abruptly.
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: New map features

Post by JacobD88 »

dan137 wrote:....but the tunnel should physically be one level lower than the track it crosses. (If you look closely, the track in the tunnel head tile is sloped). That's the reason it wouldn't solve the tunnels under seas issue. What you say would be a simplified workaround (that is not very elegant imho).
The problem is that tunnels in (O)TTD have to, currently at least, operate from Point A to Point B on the same map layer; what you propose is that a means to drop down a layer in a single tile with no transitional slope (except visually), then re-emerge on the same layer in another single tile; how would the game register the tile level?

For example; the line passing North-South is on Level 9, the Tunnel East-West should be on Level 8, would the entrances be registered as on Level 9 or Level 8? It can't be both; but your mock up is effectively proposing a tile at each end to serve as a tunnel entrance and a slope between any two given levels. AFAIK this is not possible with the current map array as a tile cannot be registered on two layers at once! This is why to build a tunnel you have to drop down below an obstacle with a slope, then tunnel, before sloping up again each tile involved serves 1 purpose; it is either on one level or the other, a transition between levels, or a wormhole entrance/exit, not both at the same time.

My suggestion for contacting Hackalittlebit was because he has done some work with wormholes passing between levels; e.g. entrance on level 8, exit on level 9, and not necessarily in a straight line too, which whilst is not quite the same as you are proposing, it is a patch that is already trying to extend wormhole functionality rather than this one which is more focussed (for now at least) on working custom bridge heads into the game
dan137
Engineer
Engineer
Posts: 11
Joined: 10 Sep 2009 08:33

Re: New map features

Post by dan137 »

JacobD88 wrote:
dan137 wrote: For example; the line passing North-South is on Level 9, the Tunnel East-West should be on Level 8, would the entrances be registered as on Level 9 or Level 8? It can't be both; but your mock up is effectively proposing a tile at each end to serve as a tunnel entrance and a slope between any two given levels. AFAIK this is not possible with the current map array as a tile cannot be registered on two layers at once!
So how does a bridgehead do the transition between two levels then?
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: New map features

Post by JacobD88 »

dan137 wrote:So how does a bridgehead do the transition between two levels then?
Quite simply it doesn't, the bridge head, not the bridge between point A and B is either a Sloping tile, a level tile, OR, with this patch, it contains crossing tracks on the same physical map level as the highest point of the bridge (Hence the foundation sprites being a square block occupying the entire tile). It's never a slope AND a crossing of tracks at the same time.

The bridge itself is still on the same level as the higher level bridgehead tile, travelling in a straight line across XX distance, before staying on the same level, or dropping down, for the last tile as though that head was a slope. Nothing can cross the bridge on the same level, and it cannot deviate from a straight line between Bridge-Head A and Bridge-Head B because there is no *actual* tile floating above the level below, the game simply draws the bridge sprites between Head A & B and any vehicle between, they are not physically there in-game, vehicles passing over a bridge or through a tunnel are just calculated to enter/exit the bridge head or wormhole at a time calculated by their speed what you see is just a representation of that calculation, not the vehicle passing through a physical tile.

Custom tunnels are more difficult because a tunnel entrance is always a wormhole and you are trying to make a track cross it as though it were a bridge too (and ideally a bridge you can additionally place signals and points on aswell).

Quite simply for custom tunnels you have to do more things with a tile than can currently be done without serious patching... Worst case scenario coding wise; you want a tunnel entrance to be a wormhole, bridge, bridgehead, points AND a signal (possibly on two separate levels) too, it can only be one of these.

In-short, what you propose is technically more complex than making a bridge invert from _/``````````\_ to a tunnel that goes \,,,,,,,,,,,,,,,,,/ because bridges and tunnels work differently even if they are both forms of wormhole :wink:

Hope that all makes sense, i'm struggling with explaining how it works. Hopefully one of the Devs who deals with this area of the map array can explain better than i can.
AMX
Engineer
Engineer
Posts: 34
Joined: 31 Oct 2007 19:08

Re: New map features

Post by AMX »

Is there an actual need to put the slope on the same tile as the tunnel entrance?
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: New map features

Post by JacobD88 »

AMX wrote:Is there an actual need to put the slope on the same tile as the tunnel entrance?
For what Dan137 proposed in his mock-up, yes, otherwise, you would just make an indent and tunnel to another indent which we already can do

Dan137's Proposal (an underground "bridge" effectively):
Image

In-game already, compared to a bridge that does the same job as Dan137's tunnel:
Image

To be honest, you only save one tile with Dan137's proposal, and that space can already be saved with bridges. Finally with maps as large as they are in OTTD it's a lot of effort for no real gain.

It's only the TTDP users, such as SAC, who struggle with space on a 256x256 map who would get any benefit from this, and if Cirdan can get Custom Bridgeheads into OTTD one of the obstacles holding back the remaining TTDP users from moving across is ticked off...

Side-Note to thread: AFAIK the main reasons for people not moving from TTDP (other than nostalgia; i still play it) are Custom Bridge Heads, Custom Tunnel Entrances, Cargo Distribution, Programmable Signals and a few other minor features that OTTD never had implemented from "The Patch"
AMX
Engineer
Engineer
Posts: 34
Joined: 31 Oct 2007 19:08

Re: New map features

Post by AMX »

I guess it's best if I make my own mockup...

Not quite as space-efficient, but probably easier to implement.
Attachments
mockup.png
mockup.png (62.66 KiB) Viewed 3392 times
User avatar
JacobD88
Chief Executive
Chief Executive
Posts: 708
Joined: 16 Aug 2008 17:51
Location: Long Eaton, Nottinghamshire. UK
Contact:

Re: New map features

Post by JacobD88 »

AMX wrote:I guess it's best if I make my own mockup...
Not quite as space-efficient, but probably easier to implement.
That looks more sensible; it's still a tile shorter than the current method and i would say, apart from the outside tiles (which could still be built on anyway) just as space-efficient as the bridge, but without the speed limits :D
User avatar
Chris
Tycoon
Tycoon
Posts: 1985
Joined: 05 Oct 2009 16:36
Location: Leeds, UK

Re: New map features

Post by Chris »

Being able to terraform tunnels so that they have vertical sides would make me extremely happy.
Screenshots

Formerly Class 165
User avatar
shampie
Engineer
Engineer
Posts: 120
Joined: 13 Feb 2005 01:13
Location: Eindhoven - Netherlands Ottawa - Canada

Re: New map features

Post by shampie »

AMX wrote:I guess it's best if I make my own mockup...

Not quite as space-efficient, but probably easier to implement.
This looks interesting yet realistic.
Tunnel ends I have found a challenging game item to deal with in regards to diagonal tracks.
Is this possible to implement?
To express moral judgments about good and evil, you must posit that good and evil exist
If good and evil exist, you must posit a moral law by which we can distinguish between good and evil
If a moral law exists, a moral law giver must exist.
dan137
Engineer
Engineer
Posts: 11
Joined: 10 Sep 2009 08:33

Re: New map features

Post by dan137 »

AMX wrote:I guess it's best if I make my own mockup...

Not quite as space-efficient, but probably easier to implement.
I like this version, if it's any easier to implement, I would be very happy with this.
User avatar
cirdan
Director
Director
Posts: 539
Joined: 07 Apr 2007 18:08

Re: New map features

Post by cirdan »

dan137 wrote:I found a small bug:

When approaching a red signal on the bridge head at the end of a bridge, the train doesn't slow down gradually, but stops abruptly.
Let me commend you for your observation skills--I would have never noticed that.

The bug here is that trains in a wormhole skip the line end check, which includes checking for a red signal on the next tile, so they happily drive at full speed until they are in front of it. This is something that I will have to change. However, since this issue does not affect gameplay and I still have to settle on the best way to fix it, it may take me a while to do it.
User avatar
ChillCore
Tycoon
Tycoon
Posts: 2822
Joined: 04 Oct 2008 23:05
Location: Lost in spaces

Re: New map features

Post by ChillCore »

Don't know if you are aware of this but bridges have a speed limit while tunnels have not.
Not sure if that should be changed at all.


Also I had a quick browse throught the first 15/20 patches or so and IHMO many of these patches belong in trunk instead of in your patchpack. ;).
Would you mind me extracting some stuff from time to time like codechanges and codingstyle that do not really affect your patch functionwise?
Or would it cause to much trouble for you to rebase and stuff if some things already went to trunk at this point in time?
-- .- -.-- / - .... . / ..-. --- .-. -.-. . / -... . / .-- .. - .... / -.-- --- ..- .-.-.-
--- .... / -.-- . .- .... --..-- / .- -. -.. / .--. .-. .- .. ... . / - .... . / .-.. --- .-. -.. / ..-. --- .-. / .... . / --. .- ...- . / ..- ... / -.-. .... --- --- -.-. .... --- --- ... .-.-.- / ---... .--.

Playing with my patchpack? Ask questions on usage and report bugs in the correct thread first, please.
All included patches have been modified and are no longer 100% original.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: Bing [Bot] and 38 guests