Transport Fever 2

Transport Fever 2

103 ratings
LineManager
3
3
2
   
Award
Favorite
Favorited
Unfavorite
Misc: Script Mod
File Size
Posted
Updated
271.552 KB
Aug 22, 2021 @ 4:50am
May 1, 2023 @ 11:05am
65 Change Notes ( view )

Subscribe to download
LineManager

Description
A mod for Transport Fever 2 to automatically manage the number of vehicles on lines


Taking into account usage, demand, rate, frequency, capacity, and other factors, this mod will automatically add/remove vehicles to lines according to configurable rules (comes with sensible default rules out-of-the-box).
This mod will greatly assist in reducing/eliminating vehicle micro management, and will let you focus on the overall design of your transport network(s) instead.




Code and credits
Source code is available on the GitHub repository[github.com].
Mod created by TommyC81[github.com] with contribution from RusteyBucket[github.com].
This mod uses:
  • lume[github.com] created by rxi[github.com], with additional updates made by idbrii[github.com] available on GitHub[github.com].
This mod is inspired by and uses code snippets from:
Popular Discussions View All (18)
9
Aug 25, 2023 @ 10:57pm
Enlarge the UI Please?
MaxCheng95
4
Mar 4, 2023 @ 10:41pm
Can you force the depot used to clone a vehicle?
GordonDry
4
Feb 26, 2023 @ 9:29am
Changing line rate very slow
GordonDry
223 Comments
CARTOK  [author] Aug 20, 2023 @ 12:31am 
Congestion control will take care of that, it will however not fix the problem for you. However, feel free to amend the 'rules.lua' file to add additional parameters and the processing thereof. For instance, see line 30 in 'rules.lua', you can add an optional additional parameter named, say, 'max_vehicles' (check adjacent rules for guidance), and then simply add a check in the 'function rules.moreVehicleConditions(line_data_single)' function under 'if rule == "P" then'. You need to fetch the parameter first, then do a simple 'if line_vehicles > max_vehicles then return false'. Note that you'll have to add two parameters to the line name in this case e.g. [P:0:25] where the first parameter corresponds to the aggressiveness level of adding vehicles (0 is the default), and the second parameter corresponds to the new parameter 'max_vehicles' you just created, in this case maximum 25 vehicles. Let me know how it goes.
Quad Tentacle Aug 16, 2023 @ 1:23pm 
Please add abilty to set maximal amount of vehicles on line. If something block movement (ex. traffic) of vehicles, LM will spawn infinite amount of them.
CARTOK  [author] Aug 13, 2023 @ 5:37am 
To follow-up: Please check what the console is showing, and send a copy (past it into a comment).
CARTOK  [author] Aug 12, 2023 @ 5:18am 
No, no dependency. Create some lines and add at least one vehicle per line. If there is at least some demand, it will work over time. When you say that nothing happens, I have a feeling that you expected it to immediately start adding vehicles - this is not how it works. The mod assesses supply vs demand over time and gradually add/removes vehicles.
mr. faster Aug 11, 2023 @ 10:59pm 
Is there any dependecy for the mod to work?
at first i thought it conflicts with another mod - created a new game, only added this mod - still nothing happens.
galaxy055 Aug 9, 2023 @ 11:15am 
@CARTOK I use timetables mainly to unbunch traffic on certain lines, as to not have a whole line of vehicles and then a long time nothing.
Anyway I've checked the console (forgot all about that), and saw that I set the rate to high. Above the maximum allowed rate, I didn't even know that there was a max.
I struggle understanding how rates actually work, so I set some very high to provoke more vehicles, which obviously didn't work.
CARTOK  [author] Aug 9, 2023 @ 9:41am 
@galaxy055 I don't use the timetable mod, so can't tell. Try removing and running without it. As the timetable mod directly interacts with vehicles, it's not unlikely that unpredictable things can occur - even more so as the vehicle timetabling disturbs/disrupts the vehicle/line load numbers.

Come to think of it, I'm not sure why you would run the mods at the same time, as the timetable mod is more targeted towards 'simulating realistic traffic patterns' (I think?), whereas LineManager strictly only optimizes vehicle numbers. Maybe it will work by using timetables for trains only i.e. disable automatic management of (passenger) trains, and let everything else be managed automatically?

Either way, LineManager should work with most mods due to the design - it's essentially only undertaking the same actions as the user would, albeit with a bit of processing and analysis in the background to determine the right action i.e., add or remove vehicles as required.
galaxy055 Aug 9, 2023 @ 7:40am 
@CARTOK Thanks for the info. I was wondering because it seems that lately LM isn't working properly. Could it be because of the timetable mod?
CARTOK  [author] Aug 9, 2023 @ 7:26am 
@galaxy055 LineManager will automatically locate any available depot. LineManager will reassess the used depot for every line over time as well, so the depot used can change. In summary: LineManager will use any available depot that will allow a vehicle to join a line. If a previously used depot has been removed, or connectivity has changed, then a new depot (as close as possible) to the existing line will be located. Sometimes, depending on the exact network, a seemingly less than ideal depot may be used temporarily - this will normally correct itself over time.

Having said that, to make things work as good as possible, make sure to place depots so they are indeed accessible to/from all directions - this is extra important for train depots as they need to follow tracks (unlike buses/trucks/ships/aircraft that can route relatively freely).

You will get repeated warning messages in the console if LineManager is unable to locate a depot for new vehicles.
galaxy055 Aug 9, 2023 @ 6:58am 
@CARTOK
Does a depot have to be in direct connection to a line or can I place it anywhere? For example does the line manager use one road depot in a city or do I need to place one where a line passes?