90 degree tunnels

Got an idea for OpenTTD? Post it here!

Moderator: OpenTTD Developers

User avatar
ANIKHTOS
Engineer
Engineer
Posts: 120
Joined: 17 Jan 2013 05:13

90 degree tunnels

Post by ANIKHTOS » 23 May 2018 01:22

would nto be nice to have the opportunity to have angle 90 degree tunnels in the game??

but to make the code easier we can split it into 2 tunnels

if we create a new tool if possilbe
you will be able to lower the soil but in a level under you to create a cave? and road and rail road can have their one tool that will not only create the cave but also put all the diagonal pieces of track so it can be used?

if the game can allow the creation of caves
then we can do 90 degree tunnels by simply make the 2 tunnels that will meet in the underground cave we created.

i do not know how the game treat the hills
but would it be possible??

lets see if i can get another answer than code it ypurself

User avatar
ANIKHTOS
Engineer
Engineer
Posts: 120
Joined: 17 Jan 2013 05:13

Re: 90 degree tunnels

Post by ANIKHTOS » 23 May 2018 02:18

i include a pic to show what i mean

the new tool will make the cave of that size adding the track and leave all soil above untouched only touch this small area

when you have the cave you can just build the 2 tunnels and you have a 90 degree angle tunnel


in more thinking
if cave is possible then we can use the cave tool to excavate a mountain for a 2 line track and only put tunel in the start end of tunnel. the rest will be a cave and you can build signals in the lines crossing.

also it opens the opportunity for underground stations to be build

a huge help for in city transportation where you could have your train station in the city but not destroying the city

we need an offset number in the construction tool to tell the game what depth to build the select item
game can check if there is empty space at that space and build them


in this scenario the copy past utility will be handy since you will not have visibility, so you make the configuration somewhere and then you copy it there it can be more like cut paste.

you build it on surface so you can see what you build and then the cut past function not COPY will just move it in the right place. and the cut paste function does not go against the idea of the game. you build it in real time but this tool will only help you place it where you should have put it

also i remember people asking the tunnel for canals if gave is possible this will be possible to be done.

you can even build underground airports with 100% fatality rate lol

i think the gave idea can really spice up the game
solve many request of the past
underground, 2 lien tunnels, signals in tunnels, underground station, underground canals,
Attachments
90degree.gif
90degree.gif (72.51 KiB) Viewed 1771 times

User avatar
acs121
Tycoon
Tycoon
Posts: 1900
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: 90 degree tunnels

Post by acs121 » 23 May 2018 10:03

Signals in tunnels and bridges are already done as a patch. Look in JGR's patchpack.
Underground station, cave etc idea is good, and is something which would need implementing. However, it would need an underground view (like SimCity 4) and so a rewrite of the map array. Thus, it is possible, you will be able to load your old savegames with the new map array, however, there is total irreversibility. Also, rewriting the map array is hard, although i'm sure there are some people (such HackaLittleBit, that done the signals in tunnels patch and cirdan, who did NMF) which may be able to do it.

User avatar
ANIKHTOS
Engineer
Engineer
Posts: 120
Joined: 17 Jan 2013 05:13

Re: 90 degree tunnels

Post by ANIKHTOS » 23 May 2018 11:15

acs121 wrote:Signals in tunnels and bridges are already done as a patch. Look in JGR's patchpack.
Underground station, cave etc idea is good, and is something which would need implementing. However, it would need an underground view (like SimCity 4) and so a rewrite of the map array. Thus, it is possible, you will be able to load your old savegames with the new map array, however, there is total irreversibility. Also, rewriting the map array is hard, although i'm sure there are some people (such HackaLittleBit, that done the signals in tunnels patch and cirdan, who did NMF) which may be able to do it.

well visibility is another issue
butt first first
if we could get the cave function would be nice even if we build in blind
that why i said the toll like copy past, or even better cut paste will be handy,
build it somewhere you can see and then move it into place.

as i see ti now the landscaping tool effect the whole column of area
to make a cave we will have to say to ignore the above area and only apply changes to the tiles under it

which if possible then we can have the opposite tool and dig in things

dig in an area build what you want to do and then dig it in. in this case the landscape tool will not affect the area bellow only the area above

as for visibility
an easy way around is to draw part of the map
meaning if the map lets say has a height of 16 tiles and you want to see at tile 12 then ignore the 4 tiles or in simple terms treat the game as if it had only 12 tiles and not 16

or maybe with invisibility transparency?? make the above tiles to be invisible??

and this function goes beyond the signals in the tunnel since now you can custom make tunnels of any width and crossing and even put depot inside them

for beginning i would not mind building blind if we can have the feature
visibility can come later on

if we can get visibility then it will be awesome since we can really build underground
imagine a late game with a big city with a complex multi level metro running in it

User avatar
acs121
Tycoon
Tycoon
Posts: 1900
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: 90 degree tunnels

Post by acs121 » 23 May 2018 12:34

ANIKHTOS wrote:
acs121 wrote:Signals in tunnels and bridges are already done as a patch. Look in JGR's patchpack.
Underground station, cave etc idea is good, and is something which would need implementing. However, it would need an underground view (like SimCity 4) and so a rewrite of the map array. Thus, it is possible, you will be able to load your old savegames with the new map array, however, there is total irreversibility. Also, rewriting the map array is hard, although i'm sure there are some people (such HackaLittleBit, that done the signals in tunnels patch and cirdan, who did NMF) which may be able to do it.

well visibility is another issue
butt first first
if we could get the cave function would be nice even if we build in blind
that why i said the toll like copy past, or even better cut paste will be handy,
build it somewhere you can see and then move it into place.

as i see ti now the landscaping tool effect the whole column of area
to make a cave we will have to say to ignore the above area and only apply changes to the tiles under it

which if possible then we can have the opposite tool and dig in things

dig in an area build what you want to do and then dig it in. in this case the landscape tool will not affect the area bellow only the area above

as for visibility
an easy way around is to draw part of the map
meaning if the map lets say has a height of 16 tiles and you want to see at tile 12 then ignore the 4 tiles or in simple terms treat the game as if it had only 12 tiles and not 16

or maybe with invisibility transparency?? make the above tiles to be invisible??

and this function goes beyond the signals in the tunnel since now you can custom make tunnels of any width and crossing and even put depot inside them

for beginning i would not mind building blind if we can have the feature
visibility can come later on

if we can get visibility then it will be awesome since we can really build underground
imagine a late game with a big city with a complex multi level metro running in it
Visibility is an issue. Imagine a train getting blocked because you badly placed a signal. How can you solve the problem if you're in total blindness ?
Underground view is what i am talking about : total transparency for tiles that block the view.

User avatar
Expresso
Tycoon
Tycoon
Posts: 1698
Joined: 09 Aug 2004 00:14
Location: Gouda, the Netherlands

Re: 90 degree tunnels

Post by Expresso » 06 Jul 2018 15:51

For this a rewrite of the map array is needed (all that information needs to be stored somewhere):

iirc the maximum size of the map is 8192x16384. Each tile takes 10 bytes at the time of this writing. So, that's a whopping 1.28 Gigabytes just for the map array. These maps need to be playable too.

However, we're looking to store information on underground. Now we end up doubling the amount of memory required just for storing 1 level of underground. You would probably want more, given that you'd want to build some cool underground constructs. Lets just say 3 underground layers to be nice. That would make it 5.12 Gigabytes of memory needed (ground level + 3 underground levels), just for the map array (if set to max size).

Of course someone is going to come by and ask for tile animations on underground stations, cellars for buildings, caves and underground rivers. Perhaps things get asked about mines in the games actually occupying space underground. So, ok. The game needs to loop over all those tiles too. Now the system requirements for openttd go up even further (not just memory now, but you will also need a faster processor, a faster main board and faster memory.

Ok, obviously it's not useful to blindly claim some Gigabytes of memory when you're not even sure it's all going to be used. So, we need to find a solution to not consume that much memory... however, we must also maintain performance, as openttd's map array is consulted quite frequently by the game.

A solution for the performance/memory problem needs to be found that
  1. Doesn't come at a too big a performance penalty;
  2. Doesn't drain memory too much;
  3. Is compatible with the current map array;
  4. Can be dropped in, instead of needing to change everything.
Now, I'm not a maintainer of OpenTTD; But I do know that OpenTTD is quite complicated and things that might seem easy, may actually be really hard.

EDIT: corrections in maths and explanation added.
Last edited by Expresso on 07 Jul 2018 15:42, edited 1 time in total.

User avatar
trainman1432
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 05 Jan 2013 02:34
Location: at home

Re: 90 degree tunnels

Post by trainman1432 » 06 Jul 2018 16:03

perhaps we should take a peek into

ahem
simutrans
call me a heretic but they get the tunnels right. Subways aren't uncommon there. Heck, most paks have subway kits!
Jetrain

User avatar
acs121
Tycoon
Tycoon
Posts: 1900
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: 90 degree tunnels

Post by acs121 » 06 Jul 2018 19:22

I don't think Simutrans is coded in C++, so in fact that's different.

User avatar
trainman1432
Transport Coordinator
Transport Coordinator
Posts: 278
Joined: 05 Jan 2013 02:34
Location: at home

Re: 90 degree tunnels

Post by trainman1432 » 07 Jul 2018 00:41

Sure, but it may help to look as to what they do to store data on tunnel location. It's not C, sure, but whatever they do might get some ideas flowing.
Jetrain

User avatar
acs121
Tycoon
Tycoon
Posts: 1900
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: 90 degree tunnels

Post by acs121 » 07 Jul 2018 01:12

trainman1432 wrote:Sure, but it may help to look as to what they do to store data on tunnel location. It's not C, sure, but whatever they do might get some ideas flowing.
There are things you can code with Java you can't code in C++.
See Minecraft for example. Coded in Java, thus allowing a HUGE map size and an even more complicated map array, this using as much RAM as a game with over 5k vehicles in OpenTTD.

Alberth
OpenTTD Developer
OpenTTD Developer
Posts: 4718
Joined: 09 Sep 2007 05:03
Location: home

Re: 90 degree tunnels

Post by Alberth » 07 Jul 2018 07:17

acs121 wrote:There are things you can code with Java you can't code in C++.
See Minecraft for example. Coded in Java, thus allowing a HUGE map size and an even more complicated map array, this using as much RAM as a game with over 5k vehicles in OpenTTD.
Oh really, please tell me how that is not possible in C++?

Just because something doesn't exist doesn't mean it's not possible.
Programming language is mostly irrelevant, you can express pretty much everything in any programming language you want.

Likely the real reason why it doesn't exist is that it is a huge undertaking, or it costs too much performance (Minecraft doesn't move 5K vehicles every few micro-seconds), or it would break many or all NewGRFs (Minecraft uses the GPU for rendering rather than the CPU, we can't break away from that without breaking NewGRFs).
So yes, there are likely good reasons why there is no better map array yet, but programming language isn't it.

Of course, feel free to proof me wrong, build openttd2 in Java, and show it can be done. I would honestly be very much impressed if you manage it.
Being a OpenTTD developer does not mean I know what I am doing.
Also, other OpenTTD developers may have different opinions.

lukasz1985
Route Supervisor
Route Supervisor
Posts: 428
Joined: 27 Mar 2013 08:58
Location: Strumien

Re: 90 degree tunnels

Post by lukasz1985 » 07 Jul 2018 15:22

Java eats a lot more memory than C/C++ for a single object. I saw a video somewhere about it. So the map size would be very limited.

User avatar
Expresso
Tycoon
Tycoon
Posts: 1698
Joined: 09 Aug 2004 00:14
Location: Gouda, the Netherlands

Re: 90 degree tunnels

Post by Expresso » 07 Jul 2018 16:10

One solution to the memory consumption problem might be to cut the map up in little pieces (say 64x64 (the smallest map size)) and have underground layers on a per piece basis. However, this would mean another layer of indirection (which would come at a performance penalty).
Another option could be to put all tiles in a separate place when there are underground tiles present and then make the tile in question contain a reference to the appropriate position. However, this also comes at a performance penalty.

How do you solve underground editing for the user interface?
Oh, and while we're at it: and how to deal with the selection rectangles? Leave as is? Apply 3D (no, not opengl) to them? If so, how?
What if you end up editing inside a mountain? How do you solve that problem?
What would happen to the catchment area of stations? Do they check underground too now? How deep underground can stations be built until their catchment area no longer covers the town on top? Does the catchment area remain a flat area, or does it become a box?

Not to imagine, this idea opens up a whole can of worms.

lukasz1985
Route Supervisor
Route Supervisor
Posts: 428
Joined: 27 Mar 2013 08:58
Location: Strumien

Re: 90 degree tunnels

Post by lukasz1985 » 08 Jul 2018 13:47

CS did all this in Locomotion, so it's not impossible, so stop this hysteria. Only we need somebody smart to figure out all this.

User avatar
acs121
Tycoon
Tycoon
Posts: 1900
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: 90 degree tunnels

Post by acs121 » 08 Jul 2018 15:32

Alberth wrote:
acs121 wrote:There are things you can code with Java you can't code in C++.
See Minecraft for example. Coded in Java, thus allowing a HUGE map size and an even more complicated map array, this using as much RAM as a game with over 5k vehicles in OpenTTD.
Oh really, please tell me how that is not possible in C++?

Just because something doesn't exist doesn't mean it's not possible.
Programming language is mostly irrelevant, you can express pretty much everything in any programming language you want.

Likely the real reason why it doesn't exist is that it is a huge undertaking, or it costs too much performance (Minecraft doesn't move 5K vehicles every few micro-seconds), or it would break many or all NewGRFs (Minecraft uses the GPU for rendering rather than the CPU, we can't break away from that without breaking NewGRFs).
So yes, there are likely good reasons why there is no better map array yet, but programming language isn't it.

Of course, feel free to proof me wrong, build openttd2 in Java, and show it can be done. I would honestly be very much impressed if you manage it.
By "you can't code in x or y language" i mean that it can be coded, but very differently.
Of course, Minecraft uses GPU and not CPU like OpenTTD. But what's about "breaking NewGRFs" ? You mean that every addition we make to the game needs to be compatible with stuff from 10 or 15 years ago like the Cargo Set ?

Also, in Minecraft, the only comparable thing to vehicles are mobs, in Minecraft they disappear out of the player's range. This cannot be done in OpenTTD. However, Minecraft can run redstone circuits and thousands of command blocks at the same time, while OpenTTD can't really handle thousands of console entries at the same time.

Eddi
Tycoon
Tycoon
Posts: 7371
Joined: 17 Jan 2007 00:14

Re: 90 degree tunnels

Post by Eddi » 08 Jul 2018 15:44

acs121 wrote:But what's about "breaking NewGRFs" ? You mean that every addition we make to the game needs to be compatible with stuff from 10 or 15 years ago like the Cargo Set?
yes. but not because there's anything special in those GRFs from 15 years ago. any change carelessly done in this regard would throw out ALL the GRFs from the past 15 years simultaneously, including those from yesterday. and that is just too huge of a content library to just throw away for a relatively minor feature.
Last edited by Eddi on 09 Jul 2018 22:31, edited 2 times in total.
You might not exactly be interested in Ferion, but if you are, have fun :)

User avatar
Leanden
Tycoon
Tycoon
Posts: 2621
Joined: 19 Mar 2009 19:25
Location: Kent

Re: 90 degree tunnels

Post by Leanden » 09 Jul 2018 00:17

lukasz1985 wrote:CS did all this in Locomotion, so it's not impossible, so stop this hysteria. Only we need somebody smart to figure out all this.
You mean the game that was built from the ground up with a completely unrelated game engine adopted from RCT with absolutely no legacy or compatibility issues to contest with?

Not sure how this is at all relevant.
Image

User avatar
kamnet
Moderator
Moderator
Posts: 6614
Joined: 28 Sep 2009 17:15
Location: Eastern KY
Contact:

Re: 90 degree tunnels

Post by kamnet » 09 Jul 2018 02:58

Build a better OpenTTD and the world will beat a path to your door.

User avatar
MagicBuzz
Tycoon
Tycoon
Posts: 1158
Joined: 15 Feb 2003 17:32
Location: Paris, France
Contact:

Re: 90 degree tunnels

Post by MagicBuzz » 12 Jul 2018 12:38

Wow, really Strange conversation…

In fact "anything" an be done with "any" langage".

The problem isn't a matter of langage nor even a problem that writting and maintaining more complex code in a langage than with another one.

The problem is a matter of "how it's done now".

The core of OTTD is about it's way to store and manage the map.
We can change the way it's coded, but this implies many changed in all features of the program.

And for some benefits it may bring some enormous limitations.

You may have the same problems with any langage.

User avatar
acs121
Tycoon
Tycoon
Posts: 1900
Joined: 03 Nov 2017 18:57
Location: Courbevoie, near Paris, France

Re: 90 degree tunnels

Post by acs121 » 12 Jul 2018 13:21

MagicBuzz wrote:Wow, really Strange conversation…

In fact "anything" an be done with "any" langage".

The problem isn't a matter of langage nor even a problem that writting and maintaining more complex code in a langage than with another one.

The problem is a matter of "how it's done now".

The core of OTTD is about it's way to store and manage the map.
We can change the way it's coded, but this implies many changed in all features of the program.

And for some benefits it may bring some enormous limitations.

You may have the same problems with any langage.
Right now OpenTTD can't manage some few games, this due to their number of vehicles moving all at the same time, CargoDist (it does use RAM), constant pathfinding, etc.

Game Scripts or AIs will only slow down your game. And they are stored in the savegame as well as the NewGRFs.

Post Reply

Return to “OpenTTD Suggestions”

Who is online

Users browsing this forum: No registered users and 5 guests