Raw bridge data

Willkommen in der Transport Fever Community

Welcome to the fan community of Transport Fever and Train Fever, the economic simulators of Urban Games. The community is free for you to share and inform yourself about the game. We cultivate a friendly and objective interaction with each other and our team will be happy to answer any questions you may have.

 

Registration and use is of course free for you.

 

We wish you a lot of fun and hope for active participation.

The Team of the 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
    1. result = {
    2. railingModels = ...,
    3. pillarModels = ...
    4. }


    basic model elememt


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


    Code
    1. {
    2. id = "..." // mdl path
    3. transf = { ... } // coordinate transformation
    4. }


    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
    1. for i = 1, #pillarHeights do
    2. pillarModels[i] = fx(pillarHeights[i], railingIntervals, railingWidth)
    3. end

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


    Code
    1. function fx(height, railingIntervals, railingWidth)
    2. local result = fz(height, fy(...))
    3. return result
    4. 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
    1. for i = 1, #railingIntervals do
    2. railingModels[i] = fs(railingIntervals[i], railingWidth)
    3. end


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

    Code
    1. function fs(interval, railingWidth)
    2. local result = fx(interval.length, fy(...))
    3. return result
    4. 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)


Share