The optimization continues, this time with a focus on trains!
The previous update was all about optimizing mods and mod asset loading, and this one continues where that left off and includes a ton of background system improvements and changes to how the game handles trains.
Previously all the official trains in the game were actually stored as pre-made objects (and they have been like that since day 1) but now that the game has a full modding system and the ability to generate trains on the fly using raw data, it's finally time to convert all the old built-in trains from the old "object" system to the new dynamic "data" system.
This was a massive job, and essentially involved re-making all the official trains using the new modding system, but the trade-off is that now every single train in the game (whether its a mod, a livery, an old legacy QuickMod, or an official model) all share the exact same data structure.
This means making changes to how trains work, and adding new features, has just become infinitely easier and more efficient!
It also means that trains can finally receive some much-needed optimization.
Low-detail models for trains
You might have noticed in the past that Rolling Line already has some LOD (level of detail) effects for the trains, in the form of low-detail wheel models which show up at a distance. Well this update takes that a step further and fully re-works the LOD system for trains so that they now have full low-detail models and other optimizations in the distance.
Personally I really love the style of these low-detail models, so I've actually included a setting (in "pause menu -> graphics -> super low detail trains") which you can use to force the game to use the models at all times, not just in the distance.
Even custom livery versions of the trains have low-detail models now too!
Some of the official trains don't have finished low-detail models yet, though I will be including these in the next update. The trains that still dont have models are:
- most freight and passenger wagons
- most liveries
Low detail models for mods
You can also now include your own low-detail models to optimize your mods!
If you are a mod maker I highly, highly recommend doing this since adding these low-detail models will make your mod run with significantly better performance on peoples maps.
There are two different models you can include:
-
Body mesh - This model will replace the body of the train mod when the train is at a distance
-
Wheel mesh - This model will replace all of the couplers and wheel blocks at a closer distance than the body
You can also adjust how far away the train needs to be for the low-detail wheel model to be used, since some trains with more complex wheel arrangements (like steam engines) should use the low-detail wheel model at a larger distance since the switch between models is more visible.
You can find these new mod options in the "general options -> low detail models" menu:
While you have this menu open if you refresh the mod preview it will automatically show the model in its low-detail form:
You can find an example mod here on the Steam Workshop which makes use of the new low-detail model features:
https://steamcommunity.com/sharedfiles/filedetails/?id=2946255743
Addons (plows and pantographs) system re-work
One of the main reasons why I needed to convert all the old trains to the new data ssystem was so that I could finally re-work the addon system. This system has been poorly optimzied and a pain to deal with for a long time, but now it's vastly improved and is way more flexible for future updates.
Addons are loaded in a much more efficient way, and the game can now support the addition of new types of addons in the future (like hopefully custom plows/pantographs in modding one day!).
One nice little side-effect of this new system is that the spinning rotary plow can now be added on to any train, and is included as a new plow option:
Texture resizing for mods
During testing, by far the most major performance hit for the game is trying to use mods with excessively large textures. Some modders have chosen to scale up their textures to way beyond the expected range, and this causes an exponential amount of RAM usage and load time.
For example, a typical 2k texture (2048 x 2048) which is all a train model should really need, uses up about 30 MB worth of RAM when loaded into memory.
But compare that to a 6k texture (6000 x 6000) which some modders have been using, uses up a whopping 274 MB of RAM when loaded into memory!
As you can guess, it only takes a few of these large textures to soak up multiple gigabytes of RAM and eventually crash your game.
I don't want to put hard limits on what kind of assets modders can use, but I can at least make it so that the game automatically resizes these textures if they go over the 2k standard.
You can choose to turn this setting off if you want, but by default any textures that are over 2048 x 2048 will be re-sized when the mod is loaded (this only applies to mods downloaded off the workshop, it will not affect any textures you have created yourself!).
You can find this setting in the new menu "Pause menu -> Loading -> compress large mod textures"
When a texture is automatically converted, the file will be overwritten so that the conversion process doesn't need to happen every time.
A copy of the original file will be made just in case called "(Original) ... filename"
Texture resizing for thumbnails
A similar thing has been going with some modders manually increasing the resolution of their thumbnails by replacing the in-game captured thumbnails with their own 1080p ones.
For comparison, the normal resolution for thumbnails uses up only about 1.2 MB of RAM, meanwhile a resized 1080p thumbnail uses up about 15 MB of RAM.
These resized thumbnails were actually responsible for a lot of crashes when people were scrolling through their mod lists, since the large thumbnails were soaking up so much RAM it was crashing the game!
So the game now automatically resizes any thumbnails that go beyond the default size.
Since thumbnails are only shown on a tiny icon, the change is resolution is not noticeable at all, but saves a massive amount of RAM usage.
There is also now a much smarter system for unloading thumbnails from memory when they are no longer needed.
Thumbnails also now load asynchronously!
So instead of freezing the game until the whole drawer of thumbnails is loaded, they will load in one-by-one:
Mesh optimization for mods
Another common performance issue for mods is when the supplied model is split into lots of sub-meshes which results in way more objects being loaded into the game than needed.
For example, some rare mods would load in 50+ individual models for each "piece" of the train. This is simply due to the formatting used when exporting the model (using lots of individual objects instead of one single mesh).
The game now automatically combines any meshes loaded for mods into a single mesh, which avoids this issue entirely.
Though on a similar note, many people are noticing an annoying bug where textures on modded meshes are not appearing correctly like this:
This is caused by a frustrating issue inside the model importer that the game uses for mods, it occurs when a model has all of its UV data identical (all UV map points are applied to the exact same point on the texture). When a mesh has identical UV data like this, the model importer wrongly treats it as having no UV data at all, which is what causes the glitch.
The way to solve this (as a modder) is to shift at least one part of the UV map slightly, just enough that everything isn't all mapped to the same identical point. This will solve the issue:
In the future though I hope to upgrade this model importer, which will potentially fix the issue, but for now sadly the only solution is to modify the UV map to avoid this situation.
Other fixes
These optimization updates always end up resulting in a massive list of changes, since it's a good opportunity to fix bugs and make changes which are on the to-do list.
So this update also includes:
-
Files in the custom images folder are no longer case-sensitive (e.g. .png and .PNG are treated as the same and will both load correctly).
-
Fixed bug where the " character could be added into livery names using the copy-paste feature, which would cause issues with save data further down the line.
-
Fixed issues with creating legacy liveries out of QuickMods.
-
Fixed issue where some props were not being batched when they should have (which included lots of the new roadside props). Performance should improve for maps that used a lot of these props, like the "Slice of Wellington" map.
-
There is now an in-game warning if the player moves too far from the 3D world center of the map, since this will eventually cause graphical and visual glitches. These visual glitches are unavoidable for 3D games and it is a common issue, since floating point numbers eventually start to break at very large distances.
-
A similar warning is shown when the room bounds are extended too far. The room bounds now have a cap on how far the objects will scale, but you can increase the number higher anyway if you really want to, you just wont have any walls/floor beyond a certain distance.
-
Fixed strange shading on the V8 locomotive model.
-
Removed the "texture quality" setting from the game, since it didn't really have any effect, and also caused a lot of visual issues when used.
-
Fixed various minor issues with the golden trains.
-
Removed the "legacy paints" and "weka pass misc buildings" drawers from the "misc" category, since they dont have any purpose any more (the weka pass buildings are all re-located to the normal building drawers).
-
Fixed the keyboard headlight bindings for some trains (like the big boy and easter egg circuit loco) as they were not working correctly before.
-
Fixed missing mesh data for one of the lamp post props.
-
There is a strange lighting effect which happens if the sun is directly overhead (mid day sun and mid season) so the game now automatically bumps the season a small difference if the sun is directly overhead to avoid this issue.
-
Track scaling with the transform edit tool is now turned off by default, it can be turned on in the "Pause menu -> custom track" menu. This has been disabled since track scaling is only for visual purposes and is not officially supported. Snapping and train size will not change when you scale track.
-
The train mods drawer now refreshes its view correctly when viewing a group if you click the "refresh mods" button.
-
Fixed the "loading liveries" map loading step, it was not working as intended before. It now correctly preloads livery textures for any liveries used in the save file.
-
There are now addition error checking steps when saving a map, to help avoid saves failing for unexpected reasons. There is also an in-game popup which will tell you the save has failed, and an error message.
-
There is now an in-game warning if a file is read-only when trying to overwrite it (e.g. a save file or modding asset). You will see a message pop up and then a few seconds later the folder containing the read-only file will automatically open.
And that's everything for this update!
While these optimization updates aren't as exciting or interesting as a new feature update or new content, they are really important for the long-term stability of the game, and definitiely improve the quality of life for everyone playing.
I am always thinking about the future of this game, and features like dynamic freight loads, custom road numbers, more advanced train options, custom addons, more optimization, etc, all relied on this train system upgrade, so this new system really opened up the doors for lots of exciting things to come!
Changed files in this update