Dynamically changing industries/vehicles etc

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

  • Howdy.

    I have taken intrest in TPF2 again and I want to recreate my TPF1 mod - extended gameplay -> Extended Gameplay and Immersion

    Just, of course, more better. The central premise of the thing is going to be procedurally generate/modify generate train cars and locomotives from stock assets ( with some repaits added to the mix, because why not ). Giving literally hundreads of vehicles to choose from. Anyhow.

    I have some ideas which I'd like to try. I've been reading into the api documentation, but it is really terse on the subject. Some things are mentioned, but I haven't found examples.

    Is it possible to modify industry production cap dynamically? - I want to make industries in 1850 to have lower production cap then in 1950 and I want this cap to raise steadily over the years. So - for example - coal mine starts at a 100 production in 1850, but raises to 1000 in 2000.

    Likewise - is it possible to alter vehicle data dynamically? - To better simulate steam engines, I want to tie their power output to speed at which they travel at a given moment. API mentions that simulations is pinged forward 5 times per second. This should give me enough resolution. There are some callbacks available, supposedly, but no examples.

    In the same vein - I'd like to tie running costs to actual energy usage of a vehicle.

    How about payment rates. Can I change the money paid for a service using scripts?

    Lastly - has anyone tried to generate *.mdl files procedurally during game load?

    The api reference suggests that these things are possible-ish but it also is very terse on the subject.

  • Bummer, really. Especially for the increasing of production over time.

    Regarding the procedural generation. I gather I can provide a pool of blank mdl files and fill them with data before they are read. The only requirement would be to load "proper" files before the pool.

    I am thinking of this as means to create variants of vehicles provided by mods. I _can_ provide variants of stock vehicles, but I have no control over mods.

    The workaround I am thinking are two mods and reliance on load order. First mod would load models and create variants, the second one, run after it, would just load them.

  • At one point, I asked UG directly if there were any plans to allow the creation of .mdl files dynamically, and they said no. It wouldn't hurt to send them a request for this feature -- perhaps if they get enough requests, they will at least consider it.

    If you make your modifications to the blank models in PostRunFn, you will at that point have the complete list of loaded vehicles, both mod and stock. You could at this point also generate more blank model files if you didn't have enough. These new files wouldn't be loaded into the game unfortunately, but they would be available on the next game load. With the new API's, you could presumably pop up a window advising the user to save the game and reload if you ran out of blank models.

    You could have a look at this mod:


    It increases production over time, although the increases are based on use, rather than the actual passage of time. As the author points out, this mod uses a custom version of industryutil.lua, which is less than ideal, but it can be made to work.

    You can generate your own cash transactions. See my Taxes & Subsidies mod (actual title is 'Revenue Adjuster'). The only downside is that they show up on a separate line on the financial statement. If you're willing to live with that, then you can adjust the income on a given delivery or maintenance transaction to be whatever you wish by generating a new transaction for the difference between the game generated amount and the amount you want to target.

  • So I played around with it. Turns out that generating vehicles during game load is, in fact, impossible. So I'll need a separate tool for this. For now I'll settle for a static list of vehicles.

    Anyhow - I'd also like to report that the game takes 10k rail vehicle definitions like a champ. Gui gets borked though if there are more then, say 10, grouped on a list.

    On a totally unrelated note. Did anyone figure out how to add particle effects to road vehicles?

  • It's impossible to add particle effects to road vehicles and planes, they get disabled by the game.

    The borked menu for too many vehicles in one group is something that bothers me, too. it get's better if you drag the window bigger ingame, but I would be interested in a proper soloution, too

  • Well. Sucks about the particle effects. I thought UG could make that work at this point.

    Anyhow - regarding the depot UI - I am working around this by using the small icons for the grouped vehicles and a large one for the group root. It looks well with 5-7 vehicles, gets to "fair" with 20+. If there are more then two vehicles in a group at all times, then group root icon is the one that is going to be seen. examples below.

    EDIT: What bothers me now is how to get new-lines into the vehicle description