[script]Cost & Price Balancer

Willkommen in der Transport Fever Community

Wir begrüßen euch in der Fan-Community zu den Spielen Transport Fever und Train Fever, den Wirtschaftssimulatoren von Urban Games. Die Community steht euch kostenlos zur Verfügung damit ihr euch über das Spiel austauschen und informieren könnt. Wir pflegen hier einen freundlichen und sachlichen Umgang untereinander und unser Team steht euch in allen Fragen gerne beiseite.

 

Die Registrierung und Nutzung ist selbstverständlich kostenlos.

 

Wir wünschen euch viel Spaß und hoffen auf rege Beteiligung.

Das Team der Transport-Fever Community


  • [quote='Steve','http://www.train-fever.net/index.php/Thread/3388-script-Cost-Price-Balancer/?postID=56223#post56223']


    Lets say the all trains may have the same price and same power(lets say 6000kW), what is the price for MU if the loc is 2.00M and the coach is 20k?


    1. Loc + Coach + Coach + Coach + Coach + Coach =
    The price overall is 2.1M for 1 x loc and 5 x coaches.


    2. MU(Loc) + Coach + Coach + Coach + MU(Loc)
    The price for the coach is the same because nothing changes. (3 x 20k = 60k). That means the price of both MUs together is the difference betwenn 2.1M and 60k. (2.04M).
    So each MU cost 1.02M at 3000kW (340cr./kW)


    3. MU(Loc) + Coach + MU(Mid) + Coach + MU(Loc)
    Now we have 2 coaches (40k) and 3 MUs (2.06M). MU Price: about 687k at 2000kW (343,5cr./kW)

    4. MU(Loc) + MU(Mid) + MU(Mid) + MU(Mid) + MU(Loc)
    And now? MU Price: 420k at 1200kW (350cr./kW)



    What do i want to say?
    If you calculate the whole train, its no problem using the cr./kW value. It probably still work with variant 2.
    But for variant 3 and 4 its not possible. Thats why all 4 variants can not have the same price at same stats.




    .....wait, am i completly wrong now?! i need a coffee.....:D

    2 Mal editiert, zuletzt von Steve ()

  • The price per kW should be the same for each one. The difference is because of passengers, not power.


    1. Loc + Coach + Coach + Coach + Coach + Coach = The price overall is 2.1M for 1 x loc and 5 x coaches.
    let say 100 passengers, 20 for each coaches, so 1k by passengers.


    2. MU(Loc + 20passengers) + Coach + Coach + Coach + MU(Loc + 20p) = Let use what i say earlier, and treat MU as a loc + a coach. It means that the engine part cost 1M each + 20k each for the 20 passengers. add 3 coaches at 20k each and you got the exact same price as above.


    3. MU(Loc + 20p) + Coach + MU(Mid+20p) + Coach + MU(Loc+20p) = just as above, 667k for each engine + 20k each for passengers + 2*20k for coaches, again same price.


    4. MU(Loc+20p) + MU(Mid+20p) + MU(Mid+20p) + MU(Mid+20p) + MU(Loc+20p) = 400k for each engine + 20k * 5 for passengers = 2.1M


    In each case, you have 333cr/kw + 1k cr / passenger.


    It is really easy to do from a scripting perspective, you just have to treat MU as a loc AND a coach, like in my script example.


    Edit : to be honest i think the most important thing is the maintenance cost. The buying cost is mostly relevant at the start of the game where there is usually not so much multiple unit available. It tend to be less and less relevant as you have more and more available cash. The maintenance cost on the other hand have a big impact on line profit.

    2 Mal editiert, zuletzt von Anachron13 ()

  • God damn. I need holidays, or sleep. :S
    Youre right. I must have been blind. X/


    With power as a basic value its much easier to handle MUs because power gets added unlike speed.


    to be honest i think the most important thing is the maintenance cost.



    Yes thats true. But runningCosts are better to handle i guess. TF takes nearly every loc 60-63% of price. I think this can be well used as a basic value.

  • I would sugest that the costs should be based in power and capacity, and other values like speed modify those base values in a relative way.


    Simply because capacity and power add up using multiple vehicles, those should be the values that contribute to the cost in an absolute way. (Costs obviously also add up when buying multiple vehicles).


    Not using real values, only as an idea:
    Using Capacity and Power as base values, modifiex by speed:


    costs = (capacity * factorC + power * factorP) * ( ( speed / 625 + 0.52) * factorS)
    With all factors equal to one (for simplicity of showing my idea, of course those have to be adjusted):
    costs = (capacity + power) * ( speed / 625 + 0.52)
    A few examples:

    Code
    Railcar A: capacity = 20, power = 10, speed = 100 kph, costs = (20 + 10) * ( 100 / 625 + 0.52) = 20.4
    Railcar B: capacity = 10, power = 5,  speed = 100 kph, costs = (10 +  5) * ( 100 / 625 + 0.52) = 10.2
    Railcar C: capacity = 10, power = 5,  speed = 200 kph, costs = (10 +  5) * ( 200 / 625 + 0.52) = 12.6
    Loco A:    capacity = 0,  power = 10, speed = 100 kph, costs = ( 0 + 10) * ( 100 / 625 + 0.52) = 6.8
    Loco B:    capacity = 0,  power = 5,  speed = 100 kph, costs = ( 0 +  5) * ( 100 / 625 + 0.52) = 3.4
    Loco C:    capacity = 0,  power = 5,  speed = 200 kph, costs = ( 0 +  5) * ( 200 / 625 + 0.52) = 4.2
    Wagon A:   capacity = 20, power = 0,  speed = 100 kph, costs = (20 +  0) * ( 100 / 625 + 0.52) = 13.6
    Wagon B:   capacity = 10, power = 0,  speed = 100 kph, costs = (10 +  0) * ( 100 / 625 + 0.52) = 6.8
    Wagon C:   capacity = 10, power = 0,  speed = 200 kph, costs = (10 +  0) * ( 200 / 625 + 0.52) = 8.4


    Combinations for capacity = 20, power = 10, 100 kph:

    Code
    1*Railcar A: 20.4
    2*Railcar B: 2*10.2 = 20.4
    Loco A + Wagon A: 6.8 + 13.6 = 20.4
    Loco A + 2*Wagon B: 6.8 + 2*6.8 = 20.4
    2*Loco B + Wagon A: 2*3.4 + 13.6 = 20.4
    etc...

    As you can see, the combinations doesn't matter as long as the resulting train has the same properties.


    200 kph trains with same power and capacity are only slightly more expensive (as seen from the above stats).
    Of course, if possible, other values like the length of a model can also be included into the calculation: The smaller the vehicle, the more expensive a vehicle with the same capacity. Why? Because smaller vehicles result in more capacity per area (can use smaller train stations etc). Also, other metadata can be applied as factor. Either to the overall price (as speed) or only to one of the absolute values (currently speed and power). E.g load speed can be used as factor for capacity, but should not be used as factor for power, as they are not related. Or as loadspeed adds up in the resulting vehicle, it can also be used as another absolute value (power + capacity + loadspeed). This is up to the modder ;) Some modders may want to make e.g. vehicles with high loadspeed much more expensive (absolute or relative with high factor), some only want to adjust the value slightly (relative with small factor). The possibilities of implementing this are nearly endless.



    I established these equations in the last 10 minutes, without looking at the equations you guys currently use. I only want to show that it is definitely possible to create working equations quite easily :) As soon as I have a bit more free time I will also take a look at the equations you guys currently have and/or create my own implementation in a way I would use it.


    The simple rule: All values that add up when using multiple vehicles per train should be absolute (added) in the equation), all values that don't add up in the resulting train must not be absolute in the equation but should only modify those values using multiplication.

  • Hey Guys,


    for last days i worked out this formula. Im not 100% fine with it but its the best one so far and with you help it can be the final one.


    For the price:

    Code
    $/kW = 450 - (year.from - 1850)
    
    
    price =  (power * $/kW) + 200000


    The price for 1 kW starts at 450$ and decreases by 1 per year (300 @ 2000). Multiplied with power, the Spanisch-Brötli-Bahn would cost 22.500$ so i added 200.000$.
    For me it works fine through the years with some exceptions.


    For the running.costs its more complicated a bit:

    Code
    rated.Vmax = year.from - 1800
    
    
    if rated.Vmax < 100 
     then cost.amount = 60 / 100 * rated.Vmax
     else cost.amount = 60
    end
    
    
    running.costs = price / 100 * cost.amount


    To take the top.speed into account i created the value "rated.Vmax". It simulates a rough direction how fast a train can be for each year.
    Then i set a fix percentage to calculate the costs in dependency of the price (60%). This percentage is reduced by the rated.Vmax value in percentage if it is less than 100.


    Here are some examples:


    D 1/3 Spanisch-Brötli-Bahn (40km/h, 50kW) $222.500 / $106.800 per year
    2-8-2 Mikado (80km/h, 1173kW) $671.546 / $328.920 per year
    BR 103 (200km/h, 5940kW) $2.189.900 / $1.313.940 per year
    HHP 8 ( 217km/h, 6000kW) $1.940.000 / $1.1640.000 per year


    Im ok with that so far. The only problem i see is, high powered but slow locos can be way too expensive as:


    Re 6/6 (140km/h, 7237 kW) $2.573.736 / $1.256.941 per year



    What do you think?



    edit: damn it, i forgot the capacity for multiple units. just keep in mind its added to the price.

    Einmal editiert, zuletzt von Steve ()

  • Version 1.7 ist ab sofort online.


    Im großen und ganzen bin ich zufrieden mit den Berechnungen und den Zahlen die raus kommen.
    Zur Zeit teste ich das Script in allen Epochen auf verschiedenen Maps und Schwierigkeitsgraden.


    Dazu habe ich den Testmodus eingefügt der in der config.file de-/aktiviert werden kann. So werden nützliche Daten als Beschreibung eingefügt.


    Calculations: Errechnete Werte die zur Berechnung benötigt werden
    Vanilla Finance: Ursprüngliche Werte mit Vergleich zu den gemoddeten in %.
    Data: Zusätzliche Werte zum besseren Vergleichen

  • Ja, zu 95%. Dafür ist der Wert "ratedVmax". Er gibt quasi an was zur Zeit die zu erwartende Höchstgeschwindigkeit ist. Liegt ein Zug darunter wird er billiger und umgekehrt.
    Beispiel: ratedVmax liegt um 1920 bei 120. Ein Zug der so schnell fährt wird mit 100% bewertet. Fährt er nur 60km/h --> 50%.
    Um 2000 ratedVmax --> 200. Zug(200km/h) --> 100%, Zug(120km/h) --> 60%

  • Hello,


    I've been a bit busy lately so i didn't have the time for a thorough test of the last version of your script. It seems indeed a lot better on price range.


    They are still two things that i noticed :


    - you didn't take into account train with a max speed superior to 300km/h (like the ice 3 or the etr1000). As there is no gain for a max speed above 300km/h, they should cost the same as a 300km/h train. A simple check like the one used for year would solve this.


    - I didn't read your script in detail but depending on the configuration of multiple unit trains there is still big result discrepancies, which defeat the purpose of the script. See the attached screen for an exemple. Same weight, same stat for both, big price difference. From a quick scan of your script i guess this is because you add a static value to engine price.



    Edit : i forgot to say something important ... It's still a really nice work!

  • Yes, in the first case i have distributed the power among the train, while in the second case the power is only on the two loc. The static value break the proportionality when there is more than one engine. It make some trains like the ETR1000 unusable ingame because of their configuration.

  • Hello,


    Sorry for the double post but the last one is 13hours old so i prefer to make a new one,


    I don't know if they are actual mods with this kind of configuration (the orka maybe), but for your script to be as much universal as possible, you should take into account the case of a model with both freight capacity and an engine.

  • Very interesting topic since I am trying to make a universal formula for running costs for a while now. (I want to include buses, trams and trucks too)


    If a train has multiple powered units, they need to be put together as one virtual unit. Non powered parts need to be added seperately like wagons. Buses and trams are always considered as one vehicle.
    For now I have come up with this formula:


    Running Cost = T + C*Capacity*Speed^V + Speed^V*(S*Steam^P+D*Diesel^P+E*Electric^P)*0,5^((IntrDate-1850)/HT)


    T = term depending on type of vehicle. For locomotives = 110 K ; for wagons, buses and trams = 5 K
    C = factor for capacity = 0,13
    V = number to reduce the effect of increasing speed (otherwise high speed is to expensive) = 0,59
    P = number to reduce the effect of increasing power (otherwise high power becomes to expensive) = 0,68
    S = factor for steam vehicles = 0,30
    D = factor for Diesel vehicles = 0,28
    E = factor for electric vehicles = 0,26
    HT = halftime to make equal vehicles with later introduction date cheaper to run = 125 year (every 125 years the price of an equal vehicle will be halved, excluding capacity and fixed cost ofcourse)


    Capacity = in-game capacity of a vehicle
    Speed = Max speed of the vehicle
    Steam = power of a steam vehicle
    Diesel = power of a diesel vehicle
    Electric = power of an elektric vehicle
    IntrDate = introduction date


    I didn't include weight because I think it is better to make that only influence the purchase price (heavier is cheaper to buy)



    examples from vanilla game (mainly big changes):
    - D 1/3 Spanisch-Brötli-Bahn: 120 -> 148
    Spanisch-Brötli-Bahn car: 16 -> 13 A standard 5 car train will be 13K more expensive, so no real difference
    - Class 53 Prussian G 3: 295 -> 192 This locomotive will now be a real upgrade to the Borsig
    - A 3/5: 690 -> 473
    Three axcle car: 28 -> 32,5 A standard 5 car train will be 194,5K cheaper to run. (too cheap? pls give feedback)
    - Class 75.4 Baden VI c: 480 -> 336,5 too cheap? pls give feedback
    - Ce 6/8 II Crocodile: 550 -> 336 This train is now a good upgrade for freight
    - RABDe 12/12: 990 -> 729 This train is now a viable alternative to a Re4/4+BC4 wagons.
    - TFV small: 1600 -> 1818
    - TFV normal: 2160 -> 2184
    - TFV large: 2720 -> 2550 The large TFV is now cheaper and the small more expensive, as IMO it should be
    - Re450: 1360 -> 867 This train badly needed a big reduction in price
    - Class V 100: 500 -> 318 This loco now can be usefull for light freight transport.



    I have included an ODS file (libre office), so you can see all new running costs for ingame vehicles (no mods included).
    (Pioneer Zephyr should be 15K more and TFV should be 10K more because I didn't seperate all the wagons from the engine)
    Some of the buses/trams are vey expensive, but that's because they use unrealistic values. F.e. The Halle tram and the Ce2/2 have way to much power for their time. If you change them to represent a more realistic value (as in the US DLC), it works a lot better. Also some of the trams should have a much higher passenger capacity, especially Mirage and Cobra, so they would cost slightly more than in the attached file, but they would also have a much higher possible income and it would make them usefull compared to buses (tram for high capacity, buses for lower capacity).

  • Thx for your reply.




    If a train has multiple powered units, they need to be put together as one virtual unit. Non powered parts need to be added seperately like wagons. Buses and trams are always considered as one vehicle.

    Thats true. But unfortunately its not that easy as it looks like for me to scipt it because there are different layouts like i posted before. But its just a problem for me because im not a programmer and im learning scripting by myself.




    When i have more time ill check your formula. Maybe ill get inspired. Thx for sharing it.


    There are many ways to calculate the costs. But remember, there a some restrictions:


    The formula must be programmable
    It must work for all types of trains (check)
    It must work for all ages (check)
    It must work in every level of difficulty and should match it
    It must be adjustable relatively easy
    It should not break game mechanics



    Im sorry, i cant compare your numbers with mine or wether they are well balanced or not right now. But i will do in the near future. But keep in mind that if its well balanced or not decides everybody by himself.

  • Ich würde mich freuen, wenn Ihr mir Eure Erfahrungen mit dem Script hier mitteilen könntet.

    Ich habe es mal angetestet (noch nicht über einen kompletten Zeitraum von 1850-20XX, sondern Anfang des 20. Jhds). Ich bin positiv überrascht davon, so machten meine kürzeren Eisenbahnlinien auch wieder Profit (wenn auch vermutlich etwas zu viel, aber da lässt sich ja noch an den Variablen schrauben :) ).
    Nur ein einziges Manko an deinem Mod habe ich gefunden: Straßenfahrzeuge und Straßenbahnen sind leider noch nicht integriert. Deswegen habe ich mich mal reingelesen in deine Mod und nach langem Tüfteln eine Lösung mit einer eventuell optimalen Balance dafür gefunden. Ich werde diese modifizierte Mod mal einem Langzeittest (1850 - 2000+) auf schwer unterziehen, bin auf die Ergebnisse gespannt :D

  • Ja, die Werte sind noch nicht final. Ich selbst dreh alles um das 1,3 fache hoch. Und selbst das ist oft noch zu wenig.


    Busse und Trams sind aus Zeitgründen noch nicht implementiert. Wenn du dich der Sache annehmen möchtest würde ich das sehr begrüßen.
    Das sind meine ersten Schritte mit LUA aber gerne kannst du mich jederzeit anschreiben wenn du wissen möchtest was zur Hölle ich mir da gedacht habe. ;)

  • Wenn du dich der Sache annehmen möchtest würde ich das sehr begrüßen.

    Bereits geschehen, Busse und Lastkraftwagen sind bereits fertig, preislich sogar einigermaßen in Ordnung (habe mich an den Standardpreisen orientiert, dass die neuen Preise nicht allzu weit daneben liegen, eben halt nur gebalanced ;) ). Trams werde ich morgen noch einfügen (eigentlich komplett gleiche Berechnung wie Busse) und dann wird der Langzeittest gestartet :)


    gerne kannst du mich jederzeit anschreiben wenn du wissen möchtest was zur Hölle ich mir da gedacht habe

    Dein Code ist sehr übersichtlich. Zwar habe ich eine Weile gebraucht, um das ganze zu verstehen, aber das liegt eher an meinen mauen LUA-Kenntnissen :D
    Demnach wird es genau anders rum sein wenn ich dir die neuen Dateien zuschicken sollte :P

  • dann wird der Langzeittest gestartet

    Den ich mittlerweile (so gut wie) abgeschlossen habe (bin schon bis über die Jahrtausendwende gekommen). Meine Ergebnisse:


    Pros:
    + Das Balancing ist wirklich gut, so sind vormals zu teure Loks / Waggons auch wieder attraktiv zu benutzen.
    + Über die gesamte Zeit sind Loks und Waggons immer recht gut aufeinander abgestimmt. Es gibt keine gravierenden Sprünge von Kosten wie es standardmäßig der Fall ist.
    + Die Straßenfahrzeuge passen preislich auch gut dazu.


    Neutral:
    +- Bei einem Multiplikator von 1,0 ist das ganze doch recht billig im Vergleich zum Standard. Um wirklich dem schweren Schwierigkeitsgrad Tribut zu zollen sollte man mindestens mit Multiplikator von 1,2 oder 1,3 spielen :)


    Kontras:
    - Moderne E-Loks sind einfach übertrieben teuer! Das steht mit den anderen Loks in keinem Verhältnis mehr. Lieber benutze ich dann eine BR 218 für meine InterCity-Verbindungen als eine BR 101, weil die mitunter dreimal teurer ist, da lohnt sich sogar eine Doppeltraktion von zwei BR 218! :D
    - Gerade wenn man über das heutige Datum hinaus ist, merkt man schon Unterschiede in den Kosten, denn es gibt immer noch Fahrzeuge aus der zweiten Hälfte des 20. Jahrhunderts, welche natürlich mit niedrigerer Höchstgeschwindigkeit bewertet wurden und mit einem höheren Preis pro KW-Motorleistung. Das ist ein wenig schade, da diese Fahrzeuge dann meist nicht mehr rentabel sind bzw. sind sie schon, aber andere Fahrzeuge eben mehr ^^
    - Güterzugloks sind evtl. vielleicht schon etwas zu billig. Die Berechnung der Kosten anhand der angenommenen Durchschnittsgeschwindigkeit finde ich gut, aber dadurch werden diese Loks schon wirklich sehr billig (gerade im späteren Spielverlauf). Vielleicht könnte man da eine untere Grenze einbauen, die das Ganze ein wenig eindämmt.


    Fazit: Auch wenn sich die Argumente in der Summe ausgleichen, so hat es doch sehr viel Spaß gemacht mit dem Balancer zu spielen. Mit ein paar Optimierungen könnte man sogar alle negativen Aspekte auf ein Minimum runterschrauben :)


    P.S.: Für meine derzeitige Kreativwelt habe ich noch eine zusätzliche Option eingebaut: Und zwar habe ich die Kapazität von jedem Waggon um den Faktor 1,5 heruntergeschraubt, sodass längere Züge notwendig werden. Um die Preise aber nicht in die Höhe schießen zu lassen habe ich auch diese um den selben Faktor gekürzt. Somit hat man mehr Optik für den gleichen Preis, was ich wirklich gut finde, wobei es aber schlecht ist 1,5 als festen Faktor zu wählen. Zu Spielbeginn sind die Züge wirklich schon sehr lang (was schon wieder fast unnatürlich aussieht), später sind sie dann wieder zu kurz, da moderne Waggons immer noch eine zu hohe Kapazität haben. Das müsste man dann noch flexibel gestalten.

BlueBrixx