Chunnel V23 r27765

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

Vitus
Traffic Manager
Traffic Manager
Posts: 157
Joined: 11 Mar 2009 15:15

Re: Chunnel v10 r16237

Post by Vitus »

Here it is. Chunnel is r16237 and signals on tunnel r16305. It should work well, I hope.

It's built for win32.
Attachments
16305_tunnels.zip
(2.33 MiB) Downloaded 355 times
User avatar
Sensation Lover
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 26 Feb 2009 09:17
Skype: Aron Bogdan Silviu
Location: Torino, Italy
Contact:

Re: Chunnel v10 r16237

Post by Sensation Lover »

thanks a lot!!! :bow: i'll tell you how it works

have a nice weekend!!!
I was in:
Austria,Belgium,Brazil,China,France,Germany,Hungary,Indonesia,Italy,Luxemburg,Malaysia,Mexico,Netherlands,Norway,Panamà,Poland,Romania,
Saudi Arabia,Singapore,Slovenia,Spain,Switzerland,Thailand,U.K.,Ukraine,U.S.A.
User avatar
Sensation Lover
Transport Coordinator
Transport Coordinator
Posts: 338
Joined: 26 Feb 2009 09:17
Skype: Aron Bogdan Silviu
Location: Torino, Italy
Contact:

Re: Chunnel v10 r16237

Post by Sensation Lover »

It's not working just fine but much more!!!!!!!!! Thank you very very much! I hope this would merge to trunk soon! very good job!!!!
I was in:
Austria,Belgium,Brazil,China,France,Germany,Hungary,Indonesia,Italy,Luxemburg,Malaysia,Mexico,Netherlands,Norway,Panamà,Poland,Romania,
Saudi Arabia,Singapore,Slovenia,Spain,Switzerland,Thailand,U.K.,Ukraine,U.S.A.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Chunnel v10 r16237

Post by Terkhen »

While checking a bug reported in TPPP I was able to make the game crash with a binary including only Chunnel v10 r16237. To recreate it, download "The Netherlands by Purno" scenario and try to build a chunnel near Amsterdam without lowering land for its exit, as seen in this screenshot:
chunnels crash.png
chunnels crash.png (70.18 KiB) Viewed 7909 times
I am attaching the crash.log file and the chunnel patch updated to r17097 (the same crash happens in this version). If required I can upload the crash.dmp file too.
Attachments
chunnel_v10_r17097.diff
(3.95 KiB) Downloaded 198 times
crash.txt
(7.68 KiB) Downloaded 199 times
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Chunnel v10 r16237

Post by Wasila »

Are there any patches for signals on bridges/tunnels? EDIT: Just noticed it :oops:. These two patches would be a great combination for what I have planned in my game, and possibly a cheaper option. Tacking it on to my personal build might be the problem... Will the two patches work with r16816?

Which is cheaper, raising land by one level from the sea or building an undersea tunnel of the same length?

As for this, I'm sorry if this has already been asked, but how close is this to trunk? Do the devs like it?

Sorry for all my questions, and thanks! :bow:
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Chunnel v10 r16237

Post by Terkhen »

I have updated both patches a few times: check TPPP svn revisions and grab the correct ones for the OpenTTD revision you want.

Raising land in sea is way more expensive than building a tunnel.

You can get an idea of how close to trunk inclusion is a patch reading the patch thread / flyspray task.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Chunnel v10 r16237

Post by Wasila »

Please note that some of these patches contain changes that alter their features to allow them to work along with other patches.
Is this true for Chunnels/Signals in tunnels and bridges?

The cost saving might mean I get my little project done more quickly, so it'll be very useful! Thanks for your help, I'll tell you how it goes once I get my separate problems with cargodist sorted.
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Chunnel v10 r16237

Post by Terkhen »

You should ask questions related to TPPP at its own thread (answer me there about this topic). Right now there's no altered patches at TPPP and the ones which were altered where only GUI related. Anything else is not changed at all.
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Chunnel v10 r16237

Post by HackaLittleBit »

Ok thank everybody for bug reports.

I was able to reproduce it and during this week I will have a look at it. 8)

Regards HackaLittleBit

P.S. Purno forgot to put the city Haarlem on that "Netherlands scenario". :wink:
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Chunnel v10 r16237

Post by HackaLittleBit »

Ok bug fixed.

Added safety check for the map edges.
Did not test very much but it should work :)

See first post

P.S. Thanks Terkhen
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Chunnel v11 r17206

Post by Terkhen »

I just tested it. The crash does not happen anymore, but the game slows down *a lot* when I try to build a chunnel in the same conditions that previously produced the crash. Is that normal?
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Chunnel v11 r17206

Post by HackaLittleBit »

Terkhen wrote:I just tested it. The crash does not happen anymore, but the game slows down *a lot* when I try to build a chunnel in the same conditions that previously produced the crash. Is that normal?

I am at work and can´t compile here!
Code is not really optimized.
But quick look at code a little change could make a difference
Change this code into

Code: Select all

if (IsValidTile(end_tile + delta) &&
			IsTileType(end_tile + delta, MP_WATER) &&
			!IsWaterTile(start_tile - delta) &&
			end_z == 0) {
			if (GetWaterTileType(end_tile + delta) == WATER_TILE_CLEAR ||
				GetWaterTileType(end_tile + delta) == WATER_TILE_COAST) passing_water = true;
		}
this

Code: Select all

if (end_z == 0 &&
			IsValidTile(end_tile + delta) &&
			IsTileType(end_tile + delta, MP_WATER) &&
			!IsWaterTile(start_tile - delta)) {
			if (GetWaterTileType(end_tile + delta) == WATER_TILE_CLEAR ||
				GetWaterTileType(end_tile + delta) == WATER_TILE_COAST) passing_water = true;
		}
and check it out please.
If I have some time I will look if I can do some more optimalisation. :)
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Chunnel v11 r17206

Post by Terkhen »

The problem is less intense with these changes, but it is still there. The diff is attached here. Don't worry, optimize it when you have time ;)
Attachments
chunnel_optimize.diff
(4.11 KiB) Downloaded 185 times
User avatar
HackaLittleBit
Director
Director
Posts: 550
Joined: 10 Dec 2008 16:08
Location: tile 0x0000

Re: Chunnel v11 r17206

Post by HackaLittleBit »

terkhen can you have a look with this change?

Code: Select all

if (passing_water == false) {
      if (end_z == 0 &&
         IsValidTile(end_tile + delta) &&
         IsTileType(end_tile + delta, MP_WATER) &&
         !IsWaterTile(start_tile - delta)) {
         if (GetWaterTileType(end_tile + delta) == WATER_TILE_CLEAR ||
            GetWaterTileType(end_tile + delta) == WATER_TILE_COAST) passing_water = true;
      }
}
thanks :)
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Chunnel v11 r17206

Post by Terkhen »

It keeps the same with that change.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Chunnel v11 r17206

Post by Wasila »

Hey hackalittlebit, I was wondering if you could shed light on the following posts:

Hey,

I added the patches 'Chunnels' and 'Signals in Bridges and Tunnels' to my running game which already had 'extra-large-maps patch' and 'cargodist'. I have been testing the new addition and have noticed something very peculiar.

Later in the game I planned on constructing a gigantic landbridge to connect two continents on the map. I did a cost estimation and I got roughly £400,000,000. I did this again after installing the new patches and this dropped to under £100,000,000. A tunnel, however, cost £600,000,000 (despite being told that underwater tunnels were cheaper than raising land).

Could someone please shed light onto this situation?
Thanks.

AND:

I recompiled (with a slightly older nightly) with just maps patch and chunnels. The landbridge costed £100,000,000 or so and the tunnel cost just under £500,000,000.

Thanks!
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Chunnel v11 r17206

Post by Terkhen »

The cost for building tunnels don't increase lineally with distance. This means that, since tunnel cost increases faster than raising land cost (which increases lineally with distance) there's a point in which a tunnel is more expensive than raising land. The best solution for your problem will be to build smaller but still large bridges / tunnels.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Chunnel v11 r17206

Post by Wasila »

Hmm... I never thought of that. Thanks!

EDIT: Do you have a formula as to the cost of tunnels?
Terkhen
OpenTTD Developer
OpenTTD Developer
Posts: 1034
Joined: 11 Sep 2008 07:32
Location: Spain

Re: Chunnel v11 r17206

Post by Terkhen »

Check CmdBuildTunnel function, in tunnelbridge_cmd.cpp. I don't know if the formula is in "natural language" somewhere.
Wasila
Tycoon
Tycoon
Posts: 1498
Joined: 15 Mar 2008 07:02

Re: Chunnel v11 r17206

Post by Wasila »

So what is the starting price for one tile? From there, I take it that this:

/** Tile shift coeficient. Will decrease for very long tunnels to avoid exponential growth of price*/
int tiles_coef = 3;
/** Number of tiles from start of tunnel */
int tiles = 0;
/** Number of tiles at which the cost increase coefficient per tile is halved */
int tiles_bump = 25;
/** Tunnel under water flag */
bool passing_water = false;

is what to work things out with.
Post Reply

Return to “OpenTTD Development”

Who is online

Users browsing this forum: No registered users and 41 guests