Author Topic: Long Convoy Patch  (Read 4242 times)

0 Members and 1 Guest are viewing this topic.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4685
  • Total likes: 171
  • Helpful: 108
  • Languages: EN, NO
Re: Long Convoy Patch
« Reply #35 on: May 13, 2017, 05:55:07 PM »
The code limits should generally be beyond the economic limits so that the practical limitations faced by players are the economic limits

The question is how high that would be. A developer has to make a trade-off between computer resources and capability. 640K memory limits and 260 character path limits have gotten lot of hate, but if MS-DOS had been written with higher limits back in its youth, it might have been so bloated that the IBM PC segment never made its breakthrough. And originally, these limits were considered well padded.

I'll leave it to those with experience profiling Simutrans to decide whether Simutrans can bear the burden of having trains with 28-1, 216-1 or 232-1 vehicles.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15458
  • Total likes: 378
  • Helpful: 171
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Long Convoy Patch
« Reply #36 on: May 13, 2017, 07:10:41 PM »
The expanded limits in Extended have not caused any noticeable performance issues: the length of convoys has by itself very little impact on performance.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline DrSuperGood

Re: Long Convoy Patch
« Reply #37 on: May 13, 2017, 08:36:11 PM »
Quote
the length of convoys has by itself very little impact on performance.
That is a bold claim to make. I would imagine them having potentially some performance impact as a result of caching once the data for a single convoy exceeds a certain volume.

Offline jamespetts

  • Simitrans-Extended project coordinator
  • Devotee
  • *
  • Posts: 15458
  • Total likes: 378
  • Helpful: 171
  • Cake baker
    • Bridgewater-Brunel
  • Languages: EN
Re: Long Convoy Patch
« Reply #38 on: May 13, 2017, 09:52:47 PM »
There is a difference between no impact at all and no significant impact.
Download Simutrans-Extended.

Want to help with development? See here for things to do for coding, and here for information on how to make graphics/objects.

Follow Simutrans-Extended on Facebook.

Offline THLeaderH

Re: Long Convoy Patch
« Reply #39 on: May 14, 2017, 12:45:16 PM »
In a convoy, Each vehicles are held as pointers. Only small size of memory is allocated when convoy is created, and the size of array expands only when additional memory is required. Therefore, expanding the limit itself does not affect the performance.
If you want to insist that this patch should cause any severe performance issue, please test and prove it by yourself.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8753
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Long Convoy Patch
« Reply #40 on: May 14, 2017, 01:42:03 PM »
The only negative impact (on CPU load) very long convoys would make are due to the length of the convoys itself, i.e. by bloxking signals and crossings for long amount of times. Since a convoy at a crossing needs to check often quite some track ahead each time, this could slightly increase CPU load. On the other hand, the amount of cargo and passengers is limited by the map. Hence running fewer longer convois would actually generate less CPU load for route finding and so one.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4685
  • Total likes: 171
  • Helpful: 108
  • Languages: EN, NO
Re: Long Convoy Patch
« Reply #41 on: May 14, 2017, 03:06:09 PM »
The only negative impact (on CPU load) very long convoys would make are due to the length of the convoys itself

In that case, those who do not play with long trains, will not suffer from the ability to do so. (Unless the pak set author is in on it, and starts enforcing long trains through balancing.)

Offline THLeaderH

Re: Long Convoy Patch
« Reply #42 on: May 14, 2017, 11:27:25 PM »
In that case, those who do not play with long trains, will not suffer from the ability to do so. (Unless the pak set author is in on it, and starts enforcing long trains through balancing.)
That's absolutely true  :)

Offline River

Re: Long Convoy Patch
« Reply #43 on: May 19, 2017, 02:14:01 PM »
I think longer car convoys are an intrestring option. But i would like to see a penalty for using them just any where. options like fixed monthly cost or extra toll when going through cities, slow down with many turns(i donno if this already exists with cars)? this will not make them the default way to go and have some diversity in what vehicles you use.

For the record there is a legal limit of 1 trailer in the Netherlands. having a hard limit could be seen as a law :)

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4685
  • Total likes: 171
  • Helpful: 108
  • Languages: EN, NO
Re: Long Convoy Patch
« Reply #44 on: May 19, 2017, 03:25:03 PM »
For the record there is a legal limit of 1 trailer in the Netherlands. having a hard limit could be seen as a law :)

I was almost certain that there was some EU law dictating otherwise, since I've seen trucks with two trailers recently in Norway. And I'm not sure whether articulated buses legally count as one or more vehicles, but they certainly would in Simutrans. And people aren't necessarily writing about trailers either, but actual convoys (not Simutrans convois), which sort of unjustifies any strict legal or technical limitations.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8753
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Long Convoy Patch
« Reply #45 on: May 22, 2017, 12:28:26 AM »
The legal limit are usually rather length and number of axis. Hence a short two axis generator may be added to a trailer truck. Otherwise, (in Germany) there are still law from the time, when there were longer convoys using a (steam) tractor to tow like a house, and several trailes. Even now one can see farm tractors pulling two wagons frequently. But then their speed is limited to 25 km/h so they are not counted a trucks (in the highway code).

Nevertheless, since it satisies demand, hat patch should go in.

Offline Ters

  • Coder/patcher
  • Devotee
  • *
  • Posts: 4685
  • Total likes: 171
  • Helpful: 108
  • Languages: EN, NO
Re: Long Convoy Patch
« Reply #46 on: May 22, 2017, 06:13:48 AM »
The legal limit are usually rather length and number of axis.

The two-trailered truck I think I saw, which I believe it was a semi-trailer with another trailer behind it, was in a region of Norway bordering the EU (Sweden) that has a special regulation for cross-border compatibility. As far as I know, that regulation is all about length and weight. (The regulation was also motivated by a major downsizing of Norwegian paper production, which mean that the lesser forms of timber is increasingly exported to Sweden. Cheap long-distance hauling means bigger volumes per driver and engine. This also motivated more use of railroads.)

There are also those tiny, tourist-carrying road trains that actually try to look like trains. They usually have three trailers or more. Maybe they are being forced out by big double-decker hop-on-hop-off tourist buses, though.

Offline THLeaderH

Re: Long Convoy Patch
« Reply #47 on: May 31, 2017, 09:18:39 AM »
I made some fixes needed for the integration.
  • Dirt in code which was suggested here were removed.
  • A comment in Japanese was translated into English so that it will not cause a encoding trouble.
  • The length of convoy is stored in uint8.

The length limit of convoy is set in simuconf.tab. Write parameters in simuconf.tab like
Code: [Select]
max_rail_convoi_length = 128
max_road_convoi_length = 32
max_ship_convoi_length = 32
max_air_convoi_length = 32

Now these parameters are stored as uint8. So the limit of these parameters are 255. If these parameters are not written, the default values are applied, which are
  • max_rail_convoi_length = 24
  • max_road_convoi_length = 4
  • max_ship_convoi_length = 4
  • max_air_convoi_length = 1

Offline THLeaderH

Re: Long Convoy Patch
« Reply #48 on: June 01, 2017, 03:09:03 PM »
Is there any question about this patch?

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8753
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Long Convoy Patch
« Reply #49 on: June 06, 2017, 12:28:40 AM »
No, only me very busy. But I have a look at it today.

EDIT
Some work I have to do (respective already done):
* remove the crollbar until it is needed
* Use proper high with larger themes
* put to config window
* save values so all player have the same settings on networkgames

Ok, done, incorporated.
« Last Edit: June 06, 2017, 02:05:33 AM by prissi »

Offline THLeaderH

Re: Long Convoy Patch
« Reply #50 on: June 06, 2017, 12:13:34 PM »
Thank you very much ;D
Many Japanese players are pleased with this integration!
https://togetter.com/li/1117649

Offline Antarctica

Re: Long Convoy Patch
« Reply #51 on: June 11, 2017, 09:17:52 AM »
My first test with maximum allowed just failed in the June 6 nightly. Seems to be an issue of int8 instead of uint8.

I started Pak 128 German, allowed for 240 vehicles, and then I tried to make a long convoi of BR 480. At 128, it failed:

Quote
FATAL ERROR: array_tpl<T>::[] - index out of bounds: -128 not in 0..129, T=P9vehicle_t

And then there's a off-by-1 glitch: Right now, if you need 255 vehicles, you have to patch in Simuconf.tab, because 254 is the maximum possible in the Settings UI.

Offline Vladki

Re: Long Convoy Patch
« Reply #52 on: June 11, 2017, 10:41:49 AM »
Hi, what are the exact option names for max lenght of tramways, narrow-gauge, maglev and monorail?

Offline An_dz

  • Web Admin
  • Administrator
  • *
  • Posts: 2593
  • Total likes: 289
  • Helpful: 89
  • D'oh
    • by An_dz
  • Languages: PT, EN, (it, de)
Re: Long Convoy Patch
« Reply #53 on: June 11, 2017, 09:28:14 PM »
And then there's a off-by-1 glitch: Right now, if you need 255 vehicles, you have to patch in Simuconf.tab, because 254 is the maximum possible in the Settings UI.
Easily fixed.

My first test with maximum allowed just failed in the June 6 nightly. Seems to be an issue of int8 instead of uint8.
The patch only created the variables but the function that calculated the convoi length was using signed int char to iterate over the cars.

Try r8245

Hi, what are the exact option names for max lenght of tramways, narrow-gauge, maglev and monorail?
Code: [Select]
max_rail_convoi_length = 128
max_road_convoi_length = 32
max_ship_convoi_length = 32
max_air_convoi_length = 32

Offline Vladki

Re: Long Convoy Patch
« Reply #54 on: June 12, 2017, 06:25:57 AM »
I have found those four. So which of them applies to the remaining modes of transport?




Offline Leartin

Re: Long Convoy Patch
« Reply #55 on: June 12, 2017, 09:13:14 AM »
I have found those four. So which of them applies to the remaining modes of transport?

I asked to implement them, but did not get an answer, so it should be the rail_convoy_lenght that applies to all rail-bound vehicles - track, narrowgauge, maglev, tram, monorail.

Offline prissi

  • Developer
  • Administrator
  • *
  • Posts: 8753
  • Total likes: 305
  • Helpful: 229
  • Languages: De,EN,JP
Re: Long Convoy Patch
« Reply #56 on: June 13, 2017, 12:44:18 AM »
Yes, since all these are derived from the rail subtype, the same constrains apply.