[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


  • Cost & Price Balancer ist ein Script, das sämtliche Preise Und Wartungskosten mithilfe einer Formel neu berechnet.
    Das Thema ist nicht neu und einige andere Modder haben sich auch schon der Sache angenommen.


    Die Berechnung erfolgt durch die unten angehängte Formel.
    Zur leichteren einstellen habe ich Anpassungsfaktoren für jede Variable eingefügt die schnell und einfach innerhalb des Scripts geändert werden können.
    Leider konnte ich diese nicht in einer "config.lua" auslagern. Aber ich hoffe dass mir da bis Ablauf der Testphase ein erfahrener Scripter weiterhelfen kann.


    Ich würde mich freuen, wenn Ihr mir Eure Erfahrungen mit dem Script hier mitteilen könntet. Es befindet sich noch absolut in der Testphase und viele Änderungen sind möglich.


    Download

    2 Mal editiert, zuletzt von Steve ()

  • Als Train Fever rauskam hatte ich mich auch intensiv mit dem Thema Wartungskosten beschäftigt. Ich habe für mich via Excel einige Formeln zusammengeschustert, die ich allerdings händisch in TF-Edit eintragen muss.


    Wie funktioniert deine Formel in Bezug auf die Personenwagen? Wäre eine Berücksichtigung von der Kapazität nicht auch sinnvoll?

  • Waggons bleiben im Moment noch unangetastet. Aber wenn es soweit ist wird die Kapazität sicherlich eine Rolle spielen.
    Im Moment gilt es erstmal die bisherige Formel zu testen um herauszufinden ob das so überhaupt praktikabel ist.
    Sollte ein vernünftiges Testen jedoch nicht möglich sein werde ich natürlich vorher noch die Waggons einbeziehen.

  • Hello,


    I didn't have time for a full test but just two thing that i notice, why in the attached screen the BB26000 cost 697k/year vs 707k/year for the BB7200 which is less powerful, less tractive effort, and same max speed?


    It seems to me that high speed trains will be unusable with the current formula, i have a TGV with a cost of 10M/year. Seems a bit over the top :)


    Edit : about the high speed train, you shoud cap the max speed in your formula. Some mod may have a max speed above 300km/h even if the track doesn't allow to go faster.

  • The reason why BB7200 is more expensive per year than BB2600 is the power/weight ratio which is worse. A good ratio benefits running costs. The thought was, an hard working engine needs more maintenance. But i see this can cause inexplicable differences. Ill work on it.


    I like the idea to implement a cap for the speed. But this is not the problem. Its the way the script works. I have to find a way to calculate multiple units correctly.


    Thx

  • Ok. I understand the logic in "real life" but isn't it counterproductive in terme of game balance? I mean a loc with a bad power/weight ratio is already less interesting because they have less excess power. It seems to me that if they also cost more they become almost useless in term of gameplay (as they would irl actually ;)).


    I will try to translate the formula as i don't understand it in german to see if i can think about something that may help you with multiple units.


    Hello again,


    Sorry for the double post but as the previous one is 9 hours old i prefer to do a new one.


    I have been thinking a bit about it, and i'm pretty sure that removing the weight from the equation would solve your problem with EMU. Most recent EMU have multiple powered boggies instead of all the power on the loc. Which mean that the price will skyrocket because the "power/weight" ratio will always be bad as the weight of the whole train will be taken into account. Anyway i don't think the engine on a lighter loc will be less working than on an heavy loc, because the extra available power on the former will probably be used to add more weight on tow.


    On the other hand it may be interesting to take into account the availability date. It seems to me that modern trains tend to not necessarily be more powerfull but to be more cost effective. It probably should not be linear but the maintenance price by kw should start to slowly decrease around the 90s or 2000 (totally made up numbers :)). It would then be an incentive for players to replace a 6400kw Eurosprinter by a 6400 kw Vectron made 10 years later, for example.

  • I agree and have removed the power/weight ration of the formula. I´ve adjusted the formula as well. See the image attached above.


    I also did find TGV-bug´s reason. The waggons do have a array "engines = {}" but without any value so the sript calculated it like a loco. I´ve fixed it.


    In very early versions i did try to implement "year.from" value but it would be too complicated to balance it with really old locos. Maybe i´ll give it another try later.

  • I'm not a specialist of formula but from a scripting PoW it seems to me that you can make your life easier by using conditionnal statement instead of a big one for all formula.


    I mean, the cost from year could decrease only after a fixed year (which should go with factors declaration for easy modification) from a small value each years. So lets say for example than before 1990 you use the formula above and after you can just modify it to something like (leistung²/(100+(year.from-1990)*factor). You could use the factor to have the price decrease more or less slowly. The cost will eventually tends towards a price of (Kaufpreis/4)*faktor.kosten if someone add a loc really far after 1990 but it should not really be a problem for the vast majority of players. What do you think?

  • i would really like to enter the age into the formula. But after many tries in early versions i decided to keep it as much simple as possible because the more variables there are, the more unexpected issues are possible.


    But if you create a simple solution i will implement it.

  • Hello,


    After a bit of brainstorming and headaches, i came up with the following formula :


    running.costs = (buying.cost / 4 + (power ^2 / (60 + yearFactor ^(YearFrom - 1849)) * PowerFactor) * CostsFactor


    A yearFactor of 1 will eliminate influence of the year, slowly upping it will make the price decrease faster with years. A value around 1.022 seems to be a sweet spot. I also added a foolproof check of the year, in case someone made a vehicule with an availability date inferior to 1850.
    I have attached the modified version if you want to give it a try.


    While working on this i noticed a few things with your formula in the current state of the mod :
    The buying price tend to be higher than the buying price of the original material, and it can cause some trouble for the first years. For example, the D1/3 is now at 337k $ instead of 201k $. The General 4-4-0 go from 270k to 404k.
    On the other hand, the running costs seems too low for the first hundred years. For exemple the General 4-4.0 running cost get cut in half from 162k/year to ~80k/year or the EP2 goes down to 404k /year (453 with my modification) from 757k.


    I guess we will need to go through the first years of a game to find how it plays out.

  • Hello,


    I've tried the last version of your script. From a quick test, the price seems a lot better. Modern loc seems to cost more than in the original game but it is probably a good thing.


    I've notice one thing though, some model files are ignored by your script. Material with both "multiple unit only", an engine and passengers don't meet any of your conditions.

  • Im working hard to find a way to implement the calculation of MultipleUnits. If there wouldnt be these conditions the TGV´s or other MU´s price would be too much unbalanced. The reason is:
    -there are MU-waggons with/without "engines" entry and with/without power,
    -there are MU-locos with/without "capacity" entry,
    -and in all MultipleUnits are different numbers of each kind,
    These things, and the fact im a script-newb, makes it hard for me to code. But i think i found a way.


    So feel free to delete the conditions you want and tell me your experience. (Maybe its ok. Couldnt test it.)

  • At the end, a multiple unit is just a preconfigured "train"... So in fact it is like a normal train that you compose yourself. I don't see a problem in handling all parts of a multiple unit seperately. Especially, as some parts of multiple units can also be bought as a single parts.
    It should not matter if you buy a multiple unit which consists of models A,B,C or create a train manually out of A,B,C. The file defining the multiple unit has no information about costs, power, etc of the multiple unit. These information are just taken from each individual model file.


    I'm currently at work so I can't test it but isn't it possible to just loop through all models and calculate there prices regardless if there have a multipleUnitOnly tag or not?

  • After a more thorough look at your script i noticed a few things :


    - You have made the price/kw increase through the years where it should be the other way around. A loc B with the same stat as loc A but available 10 years later will cost more. It seems to me that it make no sense for the reason i explained a few posts ago. As technology evolve, maintenance cost for the same power should decrease, or we are running backward.



    - If you want an "universal" script it seems to me that you will have to avoid using the multiple unit condition. Because there is some mods with multiple units available as single units and the price would be wrong.


    I think loc with capacity entry should not be treated differently than loc without. I mean, a loc with 4000kw, a vmax of 200 and 50 passengers should be treated as a loc with the same power + a coach with a capacity of 50.
    It can be easily be done from your script with something like that :


    You should exclude everything that is not vehicleType == "RAIL" from the start to avoid any error and accelerate script execution.



    - The problem with the TGV price is not related to the fact that this is an EMU, but because of the max speed. If my quick calculation are right, having the max speed go from 200 to 300km/h make the maintenance cost skyrocket. And the TGV being nothing more than two loc with a bunch of coaches in between you double an already really high price. This is related to the fact that the major part of your cost calculation is based on speed instead of power. This mean that a 4400kw/300km/h loc will cost almost the same price as a 8800kw/300km/h loc.
    An idea to solve this problem would be to use a ratio between power and max speed. A loc working alone would have high power / speed ratio while engine for EMU would have a low power / speed ratio. We would need a formula that tend toward 1 when the ratio is high and toward 0 when the ratio is low. The ideal would be that for the TGV example, the price of the two 4400kw / 300km/h loc cost a just a bit more than a single 8800kw/ 300km/h loc. In the case of my Z8100 the price of the 4x 700kw engine should also be a bit more than a single 2800kw loc.



    Zitat von Xanos

    At the end, a multiple unit is just a preconfigured "train"... So in fact it is like a normal train that you compose yourself. I don't see a problem in handling all parts of a multiple unit seperately. Especially, as some parts of multiple units can also be bought as a single parts.
    It should not matter if you buy a multiple unit which consists of models A,B,C or create a train manually out of A,B,C. The file defining the multiple unit has no information about costs, power, etc of the multiple unit. These information are just taken from each individual model file.


    I'm currently at work so I can't test it but isn't it possible to just loop through all models and calculate there prices regardless if there have a multipleUnitOnly tag or not?


    Sorry i didn't see your post before posting mine. I agree with you. The problem in the current formula, as i tried to explain above, is that the part of the formula not proportionnal to power is too important, making multiple low power units a lot less interesting than a single high power unit. Multiple Unit being often in the first case, it make their price skyrocket very quickly.

    4 Mal editiert, zuletzt von Anachron13 ()

  • I'm currently at work so I can't test it but isn't it possible to just loop through all models and calculate there prices regardless if there have a multipleUnitOnly tag or not?


    No, its not a problem. Thats the only way it works. The current problem with pre-configured trains is to know how much motored units are in there to adjust its price. But probably its the better way to get the balanced price at the time its calculated and then let the game add them together.


    I think loc with capacity entry should not be treated differently than loc without. I mean, a loc with 4000kw, a vmax of 200 and 50 passengers should be treated as a loc with the same power + a coach with a capacity of 50.


    Im confused because Im not sure if we mean the same when we are speaking about multiple units. The german translation can be "Triebwagen", which is a single motored vehicle with capacity, and "Triebzug" which is the whole Train :S . Just for me to understand:


    There are at least 4 variants of multiple units (train) possible:


    1. Loc + Coach + Coach + Coach + Coach + Coach (i.e. RE450)
    2. MU(Loc) + Coach + Coach + Coach + MU(Loc) (TGV)
    3. MU(Loc) + Coach + MU(Mid) + Coach + MU(Loc) (ETR 1000)
    4. MU(Loc) + MU(Mid) + MU(Mid) + MU(Mid) + MU(Loc) (BR 423)


    If it all got same stats (TopSpeed, Power, Capacity,...), should it really have the same price?


    A loc B with the same stat as loc A but available 10 years later will cost more. It seems to me that it make no sense


    I agree, its not logical.
    I´ve tried many, many formulas and with TopSpeed as a basic value i´ve got the best results. Please let me know what you think:


    A 1965 BR 103 (200km/h, 5940kW),
    a 1972s Re 6/6 (140km/h, 7237kW) and
    a 2010 Vectron (200km/h, 6400kW)


    What prices/costs would you expect, just about?


    The ideal would be that for the TGV example, the price of the two 4400kw / 300km/h loc cost a just a bit more than a single 8800kw/ 300km/h loc.


    Hm, another good question. Hmm....


    If my quick calculation are right, having the max speed go from 200 to 300km/h make the maintenance cost skyrocket.


    Yes, skyrocket is the right term! :D Thats why i disabled multipleunits and implement a kind of dimishing return for MaxSpeed in the next version.


  • From a game balancing point of view, i think so yes (not necessarily exactly the same price but not too far off at least). Otherwise the one that will cost less would always be the best if the stats are the same for each one. What would be the point of the three others?


    Zitat

    I´ve tried many, many formulas and with TopSpeed as a basic value i´ve got the best results. Please let me know what you think:


    A 1965 BR 103 (200km/h, 5940kW),
    a 1972s Re 6/6 (140km/h, 7237kW) and
    a 2010 Vectron (200km/h, 6400kW)


    What prices/costs would you expect, just about?


    Well, for buying price the result of your current formula seems quite right to me (respectively, 2.10M, 1.72M, 2.38M).
    Maintenance cost is another story. I think the BR 103 should cost more to maintain than the Re 6/6 (because it slow - the result is alreay good with your script) and than the Vectron (because of technology advance).
    There are two problem that i think need to be solved with your current script :
    a 2010 Vectron (200km/h, 6400 kW) : 2.38M, 1.11M / year
    a 2000 loc A (200km/h, 6400 kW) : 2.33M, 1.08M/year
    a 2010 loc B (200km/h, 4200 kW) : 2.22M, 1.03M/year
    From a balance perspective, nobody in is right mind will ever choose the Vectron or the loc B. The Vectron because it cost more than the older one so there is no point to upgrade whatsoever, the second because for half the power you get almost the same price. Even i you don't need all the power of loc A, you will be better of with it because the difference in maintenance will be overcome by the travel time gained anyway.
    Something like that would be more logical :
    a 2000 loc A (200km/h, 6400 kW) : 2.33M, 950k/year
    a 2010 Vectron (200km/h, 6400 kW) : 2.38M, 900k / year (you pay more for less maintenance than the 2000 version)
    a 2010 loc B (200km/h, 4200 kW) : 1.5M, 550k/year (if you have a line that don't need a loc with 6400kW because there is few passengers using it, it would probably be more interesting to reduce the maintenance cost by 400k/year, even if the maintenance by kW is higher, and it would still be more interesting to have one 6400kW loc than two 4200kW)
    If you can achieve this kind of result, you also probably mostly solved all you trouble with multiple units that have more than one engine.

    Einmal editiert, zuletzt von Anachron13 ()

  • If you can achieve this kind of result, you also probably mostly solved all you trouble with multiple units that have more than one engine.


    Hm, ill try to achieve it.


    From a game balancing point of view, i think so yes


    Im afraid its impossible. Let me do some math.


    If the second case is true, it is complete irrelevant how emus can be organized


    Das script greift auf jede .mdl einzeln zu. Das Spiel rechnet also automatisch den Gesamtpreis usw. aus. Das eigentliche Problem ist leider erst erkennbar wenn man das alles mal durchrechnet. Lass mich kurz ein paar Zahlen vorbereiten.

  • If you can more or less achieve the first one, the second one should follow. MU with more engine will cost a bit more than MU with only one but it should be more reasonable. The only way to perfectly achieve it would be to have the maintenance price directly proportionnal to power given a certain speed (and same for passengers).


    It would be a perfect solution for balance, probably less from a realistic perspective.


    I will try to see if i can come up with something.

BlueBrixx