The International Simutrans Forum

 

Author Topic: Why the pillar height is limited seven?  (Read 2719 times)

0 Members and 1 Guest are viewing this topic.

Offline Lus1531

  • *
  • Posts: 16
  • BattleSimutrans project maintainer
    • Twitter
  • Languages: JP,EN
Why the pillar height is limited seven?
« 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?

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2618
  • Languages: EN
Re: Why the pillar height is limited seven?
« Reply #1 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.

Offline AP

  • Devotee
  • *
  • Posts: 1202
  • Languages: EN
Re: Why the pillar height is limited seven?
« Reply #2 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). In general terms slenderness ratios over 8:1 get trickier but clearly they've pushed those to 14:1 with some clever design.





« Last Edit: December 10, 2016, 01:00:43 PM by AP »

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4564
  • Languages: EN, DE, AT
Re: Why the pillar height is limited seven?
« Reply #3 on: December 10, 2016, 12:10:25 PM »
This is a limitation in the code, which is pretty difficult to overcome.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 9438
  • Languages: De,EN,JP
Re: Why the pillar height is limited seven?
« Reply #4 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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5454
  • Languages: EN, NO
Re: Why the pillar height is limited seven?
« Reply #5 on: December 10, 2016, 10:30:13 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"?

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2618
  • Languages: EN
Re: Why the pillar height is limited seven?
« Reply #6 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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5454
  • Languages: EN, NO
Re: Why the pillar height is limited seven?
« Reply #7 on: December 11, 2016, 08:38:09 AM »
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".

Offline Dwachs

  • DevTeam, Coder/patcher
  • Administrator
  • *
  • Posts: 4564
  • Languages: EN, DE, AT
Re: Why the pillar height is limited seven?
« Reply #8 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).

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5454
  • Languages: EN, NO
Re: Why the pillar height is limited seven?
« Reply #9 on: December 11, 2016, 02:23:03 PM »
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.

Offline DrSuperGood

  • Dev Team
  • Devotee
  • *
  • Posts: 2618
  • Languages: EN
Re: Why the pillar height is limited seven?
« Reply #10 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.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 5454
  • Languages: EN, NO
Re: Why the pillar height is limited seven?
« Reply #11 on: December 12, 2016, 06:55:44 AM »
underground view [...] probably has different rules. One may notice that underground view has worse performance than surface or sliced view.

That might be.