News:

The Forum Rules and Guidelines
Our forum has Rules and Guidelines. Please, be kind and read them ;).

Long Convoy Patch

Started by THLeaderH, April 28, 2017, 09:20:35 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Ters

Quote from: jamespetts on May 13, 2017, 03:58:55 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.

jamespetts

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.

DrSuperGood

Quotethe 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.

jamespetts

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.

THLeaderH

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.

prissi

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.

Ters

Quote from: prissi 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

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.)

THLeaderH

Quote from: Ters on May 14, 2017, 03:06:09 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  :)

River

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 :)

Ters

Quote from: River on May 19, 2017, 02:14:01 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.

prissi

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.

Ters

Quote from: prissi on May 22, 2017, 12:28:26 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.

THLeaderH

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

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

THLeaderH

Is there any question about this patch?

prissi

#49
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.

THLeaderH

Thank you very much ;D
Many Japanese players are pleased with this integration!
https://togetter.com/li/1117649

Antarctica

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:

QuoteFATAL 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.

Vladki

Hi, what are the exact option names for max lenght of tramways, narrow-gauge, maglev and monorail?

An_dz

Quote from: Antarctica on June 11, 2017, 09:17:52 AM
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.

Quote from: Antarctica 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.
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

Quote from: Vladki 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?
max_rail_convoi_length = 128
max_road_convoi_length = 32
max_ship_convoi_length = 32
max_air_convoi_length = 32

Vladki

I have found those four. So which of them applies to the remaining modes of transport?

Sent from my ONEPLUS A3003 using Tapatalk


Leartin

Quote from: Vladki on June 12, 2017, 06:25:57 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.

prissi

Yes, since all these are derived from the rail subtype, the same constrains apply.