The International Simutrans Forum

 

Author Topic: Speedbonus  (Read 3201 times)

0 Members and 1 Guest are viewing this topic.

Offline Zruty

  • *
  • Posts: 15
Speedbonus
« on: October 13, 2009, 05:15:02 PM »
I still don't understand how does the 'Bonus' column work in the Goods list. The Help doesn't make it clear as well.

Let's assume I'm transporting passengers via train. My train max speed is 73 km/h, the track allows up to 65 km/h.
I look at the goods list:
65 km/h corresponds to speed bonus level of -16, with revenue of 0.03
73 km/h corresponds to speed bonus level of -6, with revenue of 0.04

I think I actually get money according to #2, am I right?

Where does the bonus of 18% fit in? I get 18% extra if I deliver passengers faster? Faster than what?

Please clarify this to me :)

Offline Combuijs

  • Web Team
  • Devotee
  • *
  • Posts: 1394
  • Maintainer of maps.simutrans.com
    • Combuijs
  • Languages: EN, NL
Re: Speedbonus
« Reply #1 on: October 13, 2009, 05:31:30 PM »
Yes, you are right. For the speedbonus the maximum speed of the convoi is used. Not the actual speed, not the maximum track speed.

I don't know what you mean with the 18% extra. The only extra money is the speedbonus.

Offline Zruty

  • *
  • Posts: 15
Re: Speedbonus
« Reply #2 on: October 13, 2009, 05:47:58 PM »
I mean, the goods in the Goods list have the following properties:
Name Revenue Bonus Type Weight

Offline DirrrtyDirk

  • Devotees (Inactive)
  • *
  • Posts: 1253
  • JR 700 Series Shinkansen
  • Languages: EN,DE
Re: Speedbonus
« Reply #3 on: October 13, 2009, 05:51:00 PM »
The 18% is the speed bonus rate for passengers.

This number is used internally to calculate just how much higher (or lower) speeds effects your revenue. The higher this rate is, the greater is the effect. But it is already included in the numbers you told us. The difference between 0.03@65 and 0.04@73 is internally calculated and based on these 18% and by the difference between the reference speed for that year (*) and "actual" speed. Every km/h more or less is considered - but due to numbers being rounded up or down you won't see every single step on that list.

*) that should be displayed when you leave the setting at "0".

Oh and BTW - speed bonus is only active with active timeline, IIRC.

Offline Djeserkheperure

  • *
  • Posts: 17
Re: Speedbonus
« Reply #4 on: October 13, 2009, 06:15:50 PM »
If you're into details, for every 10 % your convoy's maximum speed beats the reference speed, the price per passenger per km goes up that 18 %. Few quick examples: compared to the reference speed, at 110 % max speed the price goes up 18 %, at 120 % max speed it goes up 36 %. But like DirrrtyDirk said, the table does the calculations for you.

To me that fixed percent gives away said payload's sensitivity towards speed.

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Speedbonus
« Reply #5 on: October 13, 2009, 06:18:32 PM »
The base price is given, and the bonus % mean how much is that affected by vehicle maximal speed / bonus speed ratio.

Assuming bonus speed is 80 km/h and your vehicle does exactly 80, there is no difference in price, regardless of bonus %.

If bonus % are set to 0, you always get the same fee regardless of speed.



Or in different words. If one leaves out the various modes of payment that depend on how exactly is determined "distance", this remains for the simplest mode:

Code: [Select]
const sint32 ref_speed = welt->get_average_speed( get_besch()->get_waytype() );
const sint32 speed_base = (100*speed_to_kmh(cnv->get_min_top_speed()))/ref_speed-100;

// pay distance traveled
const long dist = koord_distance( start, end );
while( iter.next() ) {

const ware_t & ware = iter.get_current();

if(ware.menge==0  ||  !ware.get_zwischenziel().is_bound()) {
continue;
}

// now only use the real gain in difference for the revenue (may as well be negative!)
const sint32 grundwert128 = ware.get_besch()->get_preis()<<7; // bonus price will be always at least 0.128 of the real price
const sint32 grundwert_bonus = (ware.get_besch()->get_preis()*(1000+speed_base*ware.get_besch()->get_speed_bonus()));
const sint64 price = (sint64)(grundwert128>grundwert_bonus ? grundwert128 : grundwert_bonus) * (sint64)dist * (sint64)ware.menge;

// sum up new price
value += price;

// Hajo: Rounded value, in cents
// prissi: Why on earth 1/3???
return (value+1500ll)/3000ll;

OK, so what exactly are we looking at?

(The distance taken here is from last station, so it's the same for all items.)

const sint32 ref_speed = welt->get_average_speed( get_besch()->get_waytype() );
Just a complicated way of saying "gimme the bonus speed against which I will be compared"

const sint32 speed_base = (100*speed_to_kmh(cnv->get_min_top_speed()))/ref_speed-100;
My speed rating is: 100 * (my maximal speed / bonus speed) - 100 ; units are km/h

const long dist = koord_distance( start, end );
Calculate distance; how many tiles traveled

while( iter.next() ) {
   const ware_t & ware = iter.get_current();

cycle through all loaded goods

if(ware.menge==0  ||  !ware.get_zwischenziel().is_bound()) {
   continue;
}

skip items that are for some reason invalid

const sint32 grundwert128 = ware.get_besch()->get_preis()<<7
Lowest revenue per tile is 128 * goods' worth (later divided by 1000 so 0.128)

const sint32 grundwert_bonus = (ware.get_besch()->get_preis()*(1000+speed_base*ware.get_besch()->get_speed_bonus()));
Standard revenue per tile is 1000 + (my speed rating * my bonus %)

const sint64 price = (sint64)(grundwert128>grundwert_bonus ? grundwert128 : grundwert_bonus) * (sint64)dist * (sint64)ware.menge;
Take the one of the two revenues which is higher. Income from this particular pile of loaded goods is that * distance * quantity of goods

value += price;
Total income is sum of all incomes.

return (value+1500ll)/3000ll;
The final number that shows in finances is the (total income + 1500) / 3000
Aside: for the protesters, these not-11-but-LL-s at end of numbers make the literal evaluate explicitly as long long (aka sint32). I did have to look this up...
« Last Edit: October 13, 2009, 08:43:22 PM by VS »

knightly

  • Guest
Re: Speedbonus
« Reply #6 on: October 13, 2009, 08:04:27 PM »
Sorry, VS, but :

(1)
const sint32 speed_base = (100*speed_to_kmh(cnv->get_min_top_speed()))/ref_speed-100;
My speed rating is: 100 * my maximal speed / (bonus speed - 100) ; units are km/h
The translated formula should be (100 * my maximal speed / bonus speed) - 100

(2)
const sint32 grundwert128 = ware.get_besch()->get_preis()<<7
Lowest revenue per tile is 1/128 or 0.0078125 of goods' worth
Left-shifting bits by 7-bits should have the effect of multiplying by 128, meaning that grundwert128 is 128 times the base price. Edit : While the previous statement is correct, price is actually 1000 times larger than base price (see the formula for grundwert_bonus). Thus, in effect grundwert128 should be 128/1000 = 0.128 times the goods' worth.
« Last Edit: October 13, 2009, 08:41:20 PM by Knightly »

Offline VS

  • Senior Plumber (Devotee)
  • Devotee
  • *
  • Posts: 4855
  • Vladimír Slávik
    • VS's Simutrans site
  • Languages: CS,EN
Re: Speedbonus
« Reply #7 on: October 13, 2009, 08:43:40 PM »
Perfect, thanks! Updated. (Please check?)