News:

Use the "Forum Search"
It may help you to find anything in the forum ;).

[Patch] Speed bonus (local) and obsolete running costs - UPDATED 5 JAN '09

Started by jamespetts, December 13, 2008, 09:41:15 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

jamespetts

This patch does two things: (1) increases the running costs of all obsolete vehicles by an amount specified in simuconf.tab; and (2) reduces the effect of the speed bonus for all journeys under a certain length, again, based on values specified in simuconf.tab.

The new configuration lines required in simuconf.tab for the increase of running costs are these (shown with default values):

obsolete_running_cost_increase_percent = 400
obsolete_running_cost_increase_phase_years = 20

The increase in running costs are phased in over time, given in the second line. The first line gives the percentage increase in running costs after the full period specified in the second time has elapsed. For example, if a vehicle's ordinary running cost is 1.00c / km, given the above settings, 10 years after the vehicle becomes obsolete, the running cost would be 2.00c / km, and 20 or more years after it became obsolete, the running costs would be 4.00c / km. To disable the feature, set the first number to 100. Note: this feature is automatically disabled in games when the timeline is turned off.

The new configuration lines required in simuconf.tab for the reduction of the effect of the speed bonus for short journeys are these (shown with default values):

min_bonus_max_distance = 16
max_bonus_min_distance = 256
local_bonus_multiplier_percent = 10

The first two lines are distances specified in tiles: the first, the distance below which the speed bonus does not apply at all, and the latter, the distance above which the full speed bonus applies (as it does now). Between those figures, the speed bonus is applied by a proportionate amount. For example, given the above values, for a journey distance of 120 tiles, half the speed bonus (either negative or positive) would be given. For a journey of 10 tiles, no speed bonus (either positive or negative) would be given. For a journey of 300 tiles, the full speed bonus (either negative or positive) would be given. The third line is the "local bonus", a compensation for the speed bonus for short journeys. It is intended to be used to rebalance paksets that balanced on the basis that vehicles designed for local transport will earn a speed bonus greater than zero. It is a percentage bonus applied to all journeys of less than the "min_bonus_max_distance" figure, and proportionately applied up to the "max_bonus_min_distance" figure. It can safely be set to zero if the pakset is balanced with this patch in mind (or happens to be balanced correctly for it, including speedbonus.tab). To disable this feature, set both "min_bonus_max_distance" and "max_bonus_min_distance" to 0, and the speed bonus will then work in exactly the same way that it does now.

An updated version of simuconf.tab with the default values is included in the patch. This patch is a superset of the patch contained here. The reason that I have included two separate features in one patch is because, as Prissi pointed out in that thread, the first feature will cause gameplay problems without the second feature, since there won't be enough of a disincentive to use obsolete vehicles for local journeys if the speedbonus is disapplied there.

Note: there seems to be somewhat of a bug either in my patch code or the original code, with the result that, if obsolete_running_cost_increase_percent  is set too high, the maintenance costs of obsolete vehicles will become 0. (That figure should never be set below 100 in any event).

I should be most grateful for any feedback on this patch. Thanks to everyone who helped me to overcome the difficulties that I had in writing this patch.

Edit (as of the 5th of January 2009): This patch has now been fully revised and updated to take account of the new translations in the code. The original version of the patch would not have compiled if applied to the current version of the code.

Furthermore, there are a number of enhancements in the new patch. Now, the additional running costs for obsolete vehicles are visible in the depot window, and are also taken into account by the AI player when deciding what vehicle(s) to buy. I have removed the simuconf.tab file from the downloads (as the file contained many unrelated settings that might interfere with people's existing settings), and instead attach a chunk of settings (with much fuller documentation than before, including full documentation on how to revert to the default Simutrans settings as they exist in the current code just by changing the configuration in simuconf.tab) below, which should be inserted into simuconf.tab to make the new features work:


# Adjustment of speed bonus for local transport
#
# These settings allow the speed bonus to be disapplied selectively to some
# local journies, and a supplementary local bonus applied instead. The idea
# is to simulate the fact that high speed vehicles are not suitable for local
# transport, and that transport costs/revenues do not always scale in a linear
# way for very short journies.
#
# The max_bonus_min_distance (in tiles) is the distance above which the full
# speed bonus applies in the normal way. The min_bonus_max_distance is the
# distance below which no speed bonus applies at all. Between the two, the
# bonus is phased, so, for example, at halfway between the minimum and maximum
# distances, half the speed bonus applies.
#
# The local bonus applies instead of the speed bonus to local journies, and
# applies irrespective of the maximum speed of the vehicle. Below the distance
# specified min_bonus_max_distance (in tiles), the local bonus applies in full.
# Above the max_bonus_min_distance, the local bonus does not apply at all.
# Between those two values, a proportion of the local bonus applies. For example,
# halfway between the two, half the local bonus would be payable.
#
# To revert to previous behaviour (as of Simutrans stable 100 and earlier), in which
# the speed bonus was paid in full for journies of any length, and there was no
# local bonus, set the min_bonus_max_distance and the max_bonus_min_distance to 0.

min_bonus_max_distance = 16
max_bonus_min_distance = 256
local_bonus_multiplier_percent = 25

# Settings for obsolete vehicles
#
# Obsolete vehicles cost more to maintain, depending on these settings. The increase
# percent is the extra amount that it costs to maintain a vehicle after its retire
# date. For example, if a vehicle cost 0.10c to maintain when not obsolete, and
# obsolete_running_cost_increase_percent was set to 200, it would cost 0.20c to
# maintain after its retire date.
#
# The phase years stipulate how long it should be after the retirement date before the
# full percentage increase comes into effect. Between the retirement date and that number
# of years after the retirement date, a proportion of the increase percentage applies.
# For example, if the obsolete_running_cost_increase_phase_years was set to 10 in the
# above example, then, 5 years after the retirement date for the vehicle, the running
# costs would be 0.15c, and ten or more years after the retirement date, they would be
# 0.20c.
#
# To revert to previous behaviour (as of Simutrans stable 100 and earlier), in which
# there was no increase in the running costs for obsolete vehicles, set the increase
# percent to 100 and the phase years to 1.

obsolete_running_cost_increase_percent = 800
obsolete_running_cost_increase_phase_years = 40
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.

colonyan


  I like this patch.
  JR in Japan charges express or limited express fee depending on
  the distance.
 
  Along with the passenger generation patch, I guess more control
  on the excessif income from passenger service is achieved.

  Keep on going :)

Frank

Quote from: jamespetts on December 13, 2008, 09:41:15 PM
...
The new configuration lines required in simuconf.tab for the increase of running costs are these (shown with default values):
....

Save the configuration in speedbonus.tab ?

jamespetts

Quote from: Frank on December 14, 2008, 07:04:14 PM
Save the configuration in speedbonus.tab ?

I don't think that speedbonus.tab is formatted for it. It'd need the whole code for speedbonus.tab reworking to take anything other than year, speed pairs, I imagine, whereas simuconf.tab is designed to be able to take arbitrary parameters.
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.

jamespetts

Update: Since the recent changes in the code to move certain player options from umbebung_t to einstellungen_t, I have modified this patch to do the same with the values in question. I have also changed the obsolete vehicle running cost values from uint8 to uint16 to make the system work with values >256. I have put the updated patch in the original post instead of the original patch.
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.

jamespetts

Update - 5th of January 2009: I have now updated this patch to work with the recent translations of certain parts of the code, and also made a number of functional enhancements (including showing the modified running costs for obsolete vehicles in the depot window). The modified patch, with a fuller explanation, is attached in the original post.
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.