Transport Fever 2

Transport Fever 2

57 ratings
[VPC] Vehicle power control
2
   
Award
Favorite
Favorited
Unfavorite
Asset: Track Asset
Misc: Script Mod
File Size
Posted
5.743 MB
23 Dec, 2024 @ 1:51am
1 Change Note ( view )

Subscribe to download
[VPC] Vehicle power control

Description
The VPC mod introduces a dynamic system for managing train behavior by using control markers placed on tracks.

What is VPC?
In Transport Fever 2, train speeds were previously limited only by track speed limits, and trains always used maximum power to reach these speeds.
The VPC (Vehicle Power Control) mod offers a completely new way to manage train behavior.
With this mod, you can:
  • set power to 20% for smooth acceleration from a station
  • limit speed to 80 km/h, even if the track limit is 120 km/h
  • reduce power to 0, allowing the train to safely coast downhill
  • apply smooth braking to slow down to 40 km/h before a station or a tricky section
  • and so much more
Key Features
Control markers allow you to define specific train behaviors, giving you greater flexibility. Trains dynamically respond to these markers as they pass through them, enabling unique and precise route management.
Available behaviors include:
  • Set Power: Specify a power level for the train (e.g., throttle position).
  • Accelerate Until Speed: Set a power level to be used until a specific speed is reached, then drop to 0.
  • Brake Until Speed: Apply a specific braking force until the train slows to the desired speed, then drop to 0.
  • Cruise Control: Apply max power or braking until a specific speed is reached, then automatically adjust power to maintain it.
How to Use
  • In the assets menu, find and place a control marker on the track for the locomotive you want to control with the desired command. For example: Set position 0 for VL8M-1585.
  • Purchase (if not already purchased) a train with this locomotive.
  • Click the refresh button at the bottom of the screen to apply the changes. This button needs to be pressed each time you buy/modify a train or add/modify a marker.
  • Right next to it you can find the number of trains and markers the mod is currently tracking. It also includes two buttons that allow you to highlight these trains and markers, making it easier to find them.
  • Now, when the train with VL8M-1585 passes the marker, its power will be set to 0 until a new command is given.
How It Works
The VPC mod operates by using multiple preconfigured copies of the same locomotive, each with different power levels.
When a train passes a control marker, the locomotive is dynamically replaced in-flight with a version that matches the specified power or braking setting.

For this reason VPC does not work with all locomotives by default, as each engine requires a dedicated configuration to support these dynamic replacements.

Because the game calculates locomotive costs and maintenance fees dynamically based on attributes such as power, players may notice fluctuations in their budget as trains are replaced. For instance:
  • If a locomotive costs $70M, switching to a low-power version (e.g., power 0) will return $70M to your account.
  • Replacing it again with a high-power version will deduct $70M back.
These fluctuations are normal and are a side effect of the game's cost calculation system. Keep this in mind when using the VPC mod to manage your locomotives.

Global Acceleration Modifier
As an experimental feature, you can adjust the global acceleration factor for all trains on the map. For example, reducing it to 0.5 makes train acceleration more realistic.
Keep in mind that this setting affects all trains, not just those using VPC.

Important Notes
  • This mod provides the core functionality for VPC but does not include any locomotives.
  • This mod does not allow to control any vehicle in the game.
  • Install compatible locomotive [VPC] mods to use this system.
  • Make sure to click refresh button after adding or changing vehicles and control markers.
  • It is possible to add several vpc locomotives on one train, but only if they are the same (model and livery).
13 Comments
N0neGiv3N 18 Feb @ 10:00am 
That looks correct, but change "industry_floor.lua" to "none.lua" so that nothing shows up.

There should also be another section either right above or below this one that says terrainAlignmentLists.

You should make it say this:


result.terrainAlignnentLists = { {
type = "EQUAL",
faces = { }
} }

With that changed, we should be able to place these markers on tracks underground without issues.
Metathron  [author] 18 Feb @ 9:37am 
result.groundFaces = {}
result.groundFaces[1] = {
face = {{0.01, -0.01}, {0.01, 0.01}, {-0.01, 0.01}, {-0.01, -0.01}},
modes = {{
type = "FILL",
key = "industry_floor.lua"
}}
}

return result

This is what I have right now in mod, is it the same what you suggested?
N0neGiv3N 18 Feb @ 9:12am 
Ah yes you are correct, however collision can be disabled while still retaining the attributes needed for configurable constructions. You only need a very small ground texture to make an asset do this (something small like 0.1 unit for X Y and Z). It doesn't need terrain alignment. That should fix the issue with underground placement. There are many asset mods that do this.
Metathron  [author] 18 Feb @ 8:19am 
I'm not sure this can be done. As far as i remember it allows it to be reconfigureable construction, which is a key mechanic
N0neGiv3N 13 Feb @ 4:15pm 
Do you think you could remove the terrain alignment on the markers that can be placed? It restricts them from being usable in tunnels. Thanks!
potzep 25 Dec, 2024 @ 4:27am 
:steamthumbsup:
Metathron  [author] 23 Dec, 2024 @ 11:51am 
Anyone can add compatibility to any loco.
Furthermore, in mod files I've left guide how to add support for any loco you want.
And generally I'm hoping that other people or mod creators will add support for a locos they want. Because it's impossible for me to cover everything in the game.
As a test, as a first step, I added support for one freight, one passenger loco and the MU, to cover every type. And these are Ukrainian trains just because I can use them on my Ukrainian styled map.
But once again anyone can add support for anything.
Elje0ett 23 Dec, 2024 @ 11:24am 
Is like only russian loco compatible? Do creator or you have to make compatible?
mandigritsch 23 Dec, 2024 @ 8:27am 
Thanks
Metathron  [author] 23 Dec, 2024 @ 8:25am 
Sorry, I don't understand your question.
But I guess you should just install this and some vpc compatible loco and try it.
Or please rephrase your question.
Or read again through mod description carefully, maybe it has answer already