Raw bridge data

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


  • The article describes the expected result data for bridge construction, in a raw way.

    In Transport Fever 2, bridge are constructed by UpdateFn, the game supplies bridgeutil.makeDefaultUpdateFn to generate an updateFn but you can ignore it and make you own bridge form.


    params


    The params are in the following structure:


    If you want to make your customized updateFn for bridge, the important information are pillarHeights, railingIntervals, railingWidth


    The state.models table stores some mdl size information, which maybe useful


    result


    The result table requires two elements:


    Code
    result = {
      railingModels = ...,
      pillarModels = ...
    }


    basic model elememt


    A model element is expected in the following structure, we call it an M in the following text


    Code
    {
      id = "..." // mdl path
      transf = { ... } // coordinate transformation
    }


    pillarModels


    pillarHeights describes the pillars of different heights requires by the game, so you need to give the answer in pillarModels for each height


    pillarModels can be obtained by mapping pillarHeights subElements

    Code
    for i = 1, #pillarHeights do
      pillarModels[i] = fx(pillarHeights[i], railingIntervals, railingWidth)
    end

    The internal structure of each pillarModels[i] element is expected as a 2-order table


    Code
    function fx(height, railingIntervals, railingWidth)
        local result = fz(height, fy(...))
        return result
    end

    in which


    fy(z, ...) returns a list of M arranged in horizontal direction, according to railingIntervals and railingWidth, z is the Z-axis displacement given by fz (only 1 M in case of a column pillar, or many in case of a wide pillar. nothing is case no pillar is needed)


    fz(...) calculats the number and type of .mdl needed to stack the pillar in Z-axis and gives fy(...) needed information



    Attention:

    The heights given in pillarHeights are heights of the top of pillars


    Assertion

    #pillarModels == #pillarHeights


    railingModels


    railingModels describes the arrangement of railing models in forward direction, as X-axis, in each case, the railing many be divided into several segements


    railingModels
    can be obtained by mapping railingIntervals subElements


    Code
    for i = 1, #railingIntervals do
      railingModels[i] = fs(railingIntervals[i], railingWidth)
    end


    for each segment, like the pillarModels, the railingModels[i] are expected to be a 2-order table

    Code
    function fs(interval, railingWidth)
        local result = fx(interval.length, fy(...))
        return result
    end


    in which


    fy(x, offset, ...) returns a list of M arranged in horizontal direction, according to offset and railingWidth, x is the X-axis displacement given by fx, the offset is interval.lanes.offset, a list of each track/street arranged on Y-axis


    fx(...) calculats the number and type of .mdl needed to arrange the railing X-axis and gives fy(...) needed information, based on the length given by the interval


    The x = 0 point is aligned to the start of the track/street and the x = length point is the end of end.


    Assertion

    #railingModels == #railingHeights


    Other requirements

    If you are suffering from strange rotation of model on curves, try to set its pivot on x = 0, and the rest part of model on the positive x side


    Attention:

    For if the left and right railings are on the same mdl file, use X-aixs flipping rather than Z-aixs rotation by 180°, since the game will flip the normals of flipped models automatically.


    Code example

    (from Ventabren viaduc)


Teilen