News:

Simutrans Sites
Know our official sites. Find tools and resources for Simutrans.

Searching for the formula of the speedbonus

Started by Flemmbrav, February 02, 2020, 05:32:37 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Flemmbrav

Hello,
I've been doing some research on this but did not end up finding it. Would love to know how to calculate and I can't really get behind it sadly.


Ters

The formula I've dug out of the code contains an unexplained division by three not reflected in that Excel file. Also, that Excel file doesn't explain some of the inputs to the formula, all of which are pak set dependent in one way or another. (The columns labeled income are also actually profits, since running costs are subtracted.)

Leartin

Formula in that file: "=(1+((100*D2/Q2)-100)*(R2/1000))*(D2/100)"
D2 is max vehicle speed, Q2 the required speed of the speedbonus at vehicle introduction, and R2 the given bonus.

To go through it step by step:

Compare the speed you can reach with the speed you should reach.
Multiply by a hundred and subtract a hundred. Therefore, you get a negative value if you don't reach the required speed.
Multiply by the bonus value in promille. Therefore, the higher the bonus, the more effect.
Add one. This represents the base value that gets altered by the speedbonus.
- so far, so good.
But why multiply by the vehicles speed/100? That would mean even if the vehicle goes faster than the speedbonus requires, as long as it goes under 100km/h, it might still gain less than the base value...

Andarix

Quote from: Ters on February 03, 2020, 06:59:56 AM
The formula I've dug out of the code contains an unexplained division by three not reflected in that Excel file. ...

This is probably related to the information in the goods files. There masn specifies 3 times the price.

DrSuperGood

#5
I have mentioned it several times and the revised speed bonus dialog should make it very clear what is happening (if I ever committed it, I forget).

Speed bonus is percentage bonus income per 10% faster maximum speed than current average speed.

Say the average speed is 100 km/h, the maximum speed of the vehicle is 200 km/h and the speed bonus is 5%.

200/100 = 2: The vehicle is twice the average speed.
2 - 1 = 1: The vehicle is 100% faster than the average speed.
100 / 10 = 10: The speed bonus is multiplied by 10 times.
5 * 10 = 50: The speed bonus total is 50%.
100 + 50 = 150: The per km earned for the good is 150% of its base.
If the good is worth £1.00 per km, then it is worth £1.50 per km due to speed bonus.

This also works for negative speed bonus. The only difference is that the minimum value of a good is capped at some nominal amount (cannot go negative).

Leartin

So...
V = Max speed of the vehicle
A = Base speed set for a specific year
B = Speedbonus of a good in question

((V/A)-1)*10B+100 for the value in percent?
((V/A)-1)*(B/10)+1 for the value as a multiplier?


DrSuperGood

Quote from: Leartin on February 03, 2020, 10:52:08 AM((V/A)-1)*10B+100 for the value in percent?((V/A)-1)*(B/10)+1 for the value as a multiplier?
Yes, assuming B is in %.

Flemmbrav