The International Simutrans Forum

Development => Bug Reports => Topic started by: Lus1531 on December 10, 2016, 01:57:19 AM

Title: Why the pillar height is limited seven?
Post by: Lus1531 on December 10, 2016, 01:57:19 AM
For some days,
I have created a very steep map from height map, for playing and demand of Japanese community.
When I was going to build bridge at deep ravine, the simutrans returned error "bridge is too high for its type!".

I changed the executable. It based 120.1.3.
Change "bridge_reader.cc" line 143, "besch->max_height = 7" to besch->max_height = 31".
Well, I can build the bridge, but the pillar is drowing only seven heights.

I reed source code, but I don't found a reason.  Why don't draw?
Title: Re: Why the pillar height is limited seven?
Post by: DrSuperGood on December 10, 2016, 02:24:36 AM
Quote
I reed source code, but I don't found a reason.  Why don't draw?
Looking at the code I tend to think it is a limit with the renderer as the code to make the pillars for bridges ignores that constant entirely and instead makes pillars based on the height difference between the bridge level and the natural ground under it. Unless this is something stupidly large, probably even impossible due to other limits, there is no chance an overflow or underflow has occurred.

I think it only looks a certain number of objects above a ground when deciding what to render. This is why airplanes cannot fly very high in a straight line and instead hug the terrain to some extent, often glitching in the process and sometimes failing to render entirely.

Performance and implementation reasons were cited why the limit exists, for airplanes at least. As far as I am aware there is no quick fix solution to it.
Title: Re: Why the pillar height is limited seven?
Post by: AP on December 10, 2016, 10:16:02 AM
What we need is some kind of suspension bridge...

There are physical limits to the height of piers that modern engineers can build so its logical the game reflects this. The Millau viaduct's tallest is 244m (they taper from a 27x17m base see link p6 (http://www.bath.ac.uk/ace/uploads/StudentProjects/Bridgeconference2007/conference/mainpage/Saxton_Millau.pdf)). In general terms slenderness ratios over 8:1 get trickier but clearly they've pushed those to 14:1 with some clever design.





Title: Re: Why the pillar height is limited seven?
Post by: Dwachs on December 10, 2016, 12:10:25 PM
This is a limitation in the code, which is pretty difficult to overcome.
Title: Re: Why the pillar height is limited seven?
Post by: prissi on December 10, 2016, 09:01:03 PM
I am rather surprise that the bridges shows up. When scrolling to the bottom edge of the screen, such a high bridge may partly vanish too.
Title: Re: Why the pillar height is limited seven?
Post by: Ters on December 10, 2016, 10:30:13 PM
Quote from: prissi on December 10, 2016, 09:01:03 PM
I am rather surprise that the bridges shows up. When scrolling to the bottom edge of the screen, such a high bridge may partly vanish too.

Can the fact that the bridge itself has its own "ground" have something to do with it? Or is the drawing somehow tied directly to the "ground-ground"?
Title: Re: Why the pillar height is limited seven?
Post by: DrSuperGood on December 10, 2016, 11:32:01 PM
Quote
Can the fact that the bridge itself has its own "ground" have something to do with it? Or is the drawing somehow tied directly to the "ground-ground"?
I am guessing its tied to the coordinates that are being viewed. It makes sense that only tiles within a certain projection of the centre of view are searched for stuff to draw.
Title: Re: Why the pillar height is limited seven?
Post by: Ters on December 11, 2016, 08:38:09 AM
Quote from: DrSuperGood on December 10, 2016, 11:32:01 PM
I am guessing its tied to the coordinates that are being viewed. It makes sense that only tiles within a certain projection of the centre of view are searched for stuff to draw.

But what difference is there between the tiles on the tops the mountains on either side, and the tiles of the bridge across? The only difference is that the former are "primary grounds/tiles", while the latter are "secondary grounds/tiles".
Title: Re: Why the pillar height is limited seven?
Post by: Dwachs on December 11, 2016, 10:59:34 AM
The bridge will be shown, if the ground under the bridge is on the screen (or at least close to the bottom border of the viewport).
Title: Re: Why the pillar height is limited seven?
Post by: Ters on December 11, 2016, 02:23:03 PM
Quote from: Dwachs on December 11, 2016, 10:59:34 AM
The bridge will be shown, if the ground under the bridge is on the screen (or at least close to the bottom border of the viewport).

So it only looks at the "ground-ground", not the other "grounds" like "bridge-ground"? Which should cause the same effect for tunnels, just in the other direction.
Title: Re: Why the pillar height is limited seven?
Post by: DrSuperGood on December 11, 2016, 10:28:02 PM
Quote
Which should cause the same effect for tunnels, just in the other direction.
Except all tunnels are underground so invisible anyway. Sliced view/underground view must be used to see tunnels but it probably has different rules. One may notice that underground view has worse performance than surface or sliced view.
Title: Re: Why the pillar height is limited seven?
Post by: Ters on December 12, 2016, 06:55:44 AM
Quote from: DrSuperGood on December 11, 2016, 10:28:02 PM
underground view [...] probably has different rules. One may notice that underground view has worse performance than surface or sliced view.

That might be.