Line's length?

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


  • I take it you're looking for something more accurate than the straight line distance between stops.

    You could track the distance travelled by a unit as it covers the route.

    This would involve keeping track of its position and speed at each update, so that you could measure the distance travelled.

    I would start measuring when the vehicle first reached a station (any station.) Measure the distance travelled on each update until it next reaches that station.

    You would need to keep a table of information for each line that included the vehicle being tracked, last position, last time, accumulated distance, station at start, measurement status (not started, in progress, complete,) etc.

    A non-trivial exercise, for sure.

  • ...and it would involve measuring speeds at each point and integrating the resulting graph to obtain the distance travelled.


    Or you use the means the game gives to You. There is an indirect measurement of track distances on offer, it is given as construction costs. A meter of non-electrified track seems to cost 150 of whatever currency unit You use in Your game, so by just paralleling the track to be measured or noting the construction costs, obtaining the tracks length will require a simple division :)

  • Thanks for your input guys!


    Doug, if I could output a vehicle's speed with a time stamp , that could make it. [LightBulb] I'm gonna throw a rock and see where it lands.


    DH-106 (or Comet ?), you are damn right, I could lay another track and use the total price as a base. [InsertAThumbsUpHere]


    My goal is to measure line's length so I can determinate a vehicle/train's commercial speed. It probably could have other applications too though.


    What I do for now, "simply" is to look in the headquarters' stats the total track length, which is close enough (since trains does stop before track's end, hopefully).

    The wrecking ball element here is that it requires that the line you want to measure is the only one on the map, and thus would either require to destroy everything or keep track (!) of that total from the start.
    Both are kind of a pain when you jump in an ongoing save.


    Sadly GetLine doesn't provide much in that department.

  • Another method would be upgrading/downgrading a route. If the costs of electrifying/dieselizing a length of track are known (this can easily be achieved by building a basic rail line of 100m length = 15000 currency units and then checking for the price of an added catenary), it will be trivial to deduce the track distance from the costs of the applied alteration.


    This of course still requires some manual labour. If you were to use scripts to obtain the distance, there may be a geometrical method possible as well by using the coordinates of each track segments start and end point; possibly taking into account the curvature of the track as defined by the lanes directions that are most likely defined at each such point, yielding a curve between two of these coordinates respectively (they were in TPF1, but I did not check yet for TPF2). That way, you might be able to calculate the distance between two stations by tracing the route between them; there would be a bit of mathematics involved though.

    Einmal editiert, zuletzt von DH-106 ()

  • Dieselizing a track is free as far as I know, since it doesn't require any adaptation. Does it? Nevermind, I get what you mean now. ^^


    As for electrifying, the price is set in .\res\config\base_config.lua :


    game.config.costs = {

    (...)

    -- fraction of road/track cost

    railroadCatenary = .3,

    roadBusLane = .1,

    roadTramLane = .2,

    roadElectricTramLane = .4,


    That is +30% on track's cost, if I get it correctly.


    Thank you, I will test it out.


    PS: I try to stay as far as possible from mathematics since I would probably mess it up without even knowing it :D

  • Knowing what you're looking for, another possible solution comes to mind:

    On each update, call getVehicles()

    For each vehicle, add its current speed to an accumulator variable for its line.

    Increment a counter for the line.

    Dividing the accumulator by the counter should give you a pretty good indication of the overall speed of the line.

  • If you were to use scripts to obtain the distance, there may be a geometrical method possible as well by using the coordinates of each track segments start and end point; possibly taking into account the curvature of the track as defined by the lanes directions that are most likely defined at each such point, yielding a curve between two of these coordinates respectively (they were in TPF1, but I did not check yet for TPF2).

    Weißt du wie man an diese einzelnen Segmente rankommt?

BlueBrixx