1. Rolling Line
  2. News
  3. Mod loading optimizations! v5.0

Mod loading optimizations! v5.0



This update begins "the great Rolling Line optimization" process I've been working towards for a long time! Over the course of the next few updates, I'm putting a ton of time towards improving the loading process for the game and heavily optimizing how the game loads assets and maps.

The first of these updates is focused on mods! (as well as a ton of other optimizations).
And the next update will be focused on specifically the scenery & track part of map loading.

This update completely changes how the game loads modded assets (textures, models, etc) and how it handles these files when loading maps. You'll now see much faster loading times when maps contain a lot of mods, as well as significant RAM usage reduction. The process of detecting mods on start-up and setting them up has also been sped up significantly.

The main benefit of this system is that loading mods is now entirely "synchronous" which means that it loads smoothly and doesn't freeze your computer while loading!
You can also see a real-time display of what is being loading (as shown above).

Another big part of this update is that it finally includes newly updated versions of all the software I use to make Rolling Line, which means the latest version of Unity (game engine), SteamVR (virtual reality framework) and more.
Up until now I have been essentially held hostage by very old versions of software since upgrading was causing so many problems, but i've finally dealt with those problems and this update brings the game forward on to fully up-to-date software.

There are lots of quirks of the new version changes, which will be explained more in detail later in this news post (mainly relating to VR).

[h2]Faster load times[/h2]

The mod loading process had lots of room for imrovement, so this update makes lots of changes to speed this up and do things much more efficently.

When you start up the game the first optimizations you'll notice is the "finding mods" stage, which has been sped up significantly and also displays how many mods have been found so far. The next stage is "setting up mods" which is performing some basic setup for mods (like figuring out what kind of mod it is, and how it should be categorised for loading later on).

The "Loading downloaded saves" step has also been sped up tons, since the game now only partially loads the save data for maps, and leaves the heavy-lifting for later on when the save is directly loaded.

When loading a save file, the whole process of finding packaged mods, preloading the mods in the save file (both trains and props) is all now displayed in realtime, so you can see which mods are taking longer to load compared to others. You can also see how many mods total are being loaded.

[h2]Memory management [/h2]

This update makes major changes to how modded assets (e.g. textures and models) are loaded into the game how they are managed in memory. You'll notice a big drop in RAM usage when loading maps with lots of mods!
I've been using maps like the "Beer Line" and "Blue Island" as benchmarks, since they both contain over 100 packaged train mods, and tons of prop mods. Maps like these now load much faster and consume way less RAM than before.

The memory management system also handles asset un-loading much better than before, so when you leave a map any mods that were loaded exclusively for that map will be properly un-loaded. This means that even if a map increases your RAM usage a lot, leaving that map should return things back to normal.

You can now even see in-game RAM statistic when loading maps. This shows how much RAM your system has left, and the overall percentage of usage.
Please remember that pushing your game too far into high RAM usage will result in pretty awful crashes, so you can use this as a metric for whether your are going too overboard with mods!



Old legacy QuickMods also now use the new asset management system and model importer.
This likley won't have any effect on how models are displayed, aside from some minor quirks that are caused by differences between the old and new model importers. The new model importer is MUCH faster though, so the change is definitely worth it!

Another useful feature of how assets are managed and loaded now is that when you are editing a mod inside the modding manager, pressing "refresh assts folder" (which will re-load any assets the mod is using) will also update all other copies of the mod on the map, so you will no longer end up with a confusing mix of old & new copies of the mod. All mods on the map will keep their assets in-sync.

[h2]Other minor RAM usage improvements[/h2]

In addition to the whole new mod asset loading system, the game also manages memory for a few other built-in assets a bit differently.
Mainly the photos on the walls used in official maps (only the older ones, like Paranapiacaba and Weka Pass) which use to be pre-packaged into the game, are now instead stored as image files and are loaded manually when needed.
You can find these files in the "Core" folder, which also contains tons of other files which the game loads while running, instead of being built-in:



And yes you can edit these files if you want, for some pretty interesting results (like changing the main-menu save file!) But If you do choose to edit these files then don't be surprised if you manage to break things, so make sure to keep a backup of any files you choose to change.

This update also adds a warning which will show up if for whatever reason the "Core" folder can't be found. If you see this error then make sure your game is fully downloaded. You may need to "verify files" inside steam.

[h2]New post-processing options[/h2]

Part of the software upgrade meant changes to how the post-processing system works. If you are playing on PC then everything is still the same (with the addition of some new options!) but in VR unfortunately the old post-processing features are no longer supported.

I've ended up finding a different post-processing tool that does still work in VR, but it is unfortunately not quite as advanced as what the game was using before.
For VR users, the current post-processing is limited to:
  • Color correction (contrast, exposure and vibrancy)
  • Sharpness
  • Vignette effect


Both the sharpness and vignette effects are available on PC too and can be used in addition to all the previous post-processing options:



[h2]Control trains without the controller[/h2]

After the last update added custom load-switching for mods by pressing the 1,2,3,4... etc keys when controlling trains, it became pretty obvious that needing to select each wagon one-by-one with the hand-held controller was a real pain, so now you can simply hover over a wagon/train and control it with the same keys!
Basically any controls that would normally require the controller, can now be performed by just pointing at the train you want to control.

e.g. to turn on a train's lights, simply point at it and press "L"
or to sound the horn, point at the train and press "capslock"



[h2]Copy colours directly from posters[/h2]

A neat new bonus feature that comes with this update is that you can now copy colours directly from posters! Simply point anywhere on a poster and press the "color clone" button (Enter) and the color that is directly under your cursor will be copied.



This is amazingly useful for getting colours for your maps from a photo reference!



[h2]VR changes[/h2]

One annoying side effect of upgrading the Unity Engine and SteamVR framework is that the system I was using to make the game launch in VR or PC mode no longer works!
So I've had to find a new way to toggle between VR and PC.

If you have a VR headset connected to your PC then you will notice that SteamVR auto-launches regardless of whether you launch the PC or VR version of the game (even though the game correctly ignores or uses the headset based on your chosen play mode).

Please note, if you don't have SteamVR installed, or a VR headset connected, then this won't affect you at all!

If you want to play on PC without SteamVR launching, then simply run the new launch option called "Disable SteamVR auto launch".
This will make some adjustments to make sure that SteamVR will no longer launch, no matter how you run the game.



If you want to play in VR again, simply run the other launch option for "Re-enable SteamVR auto launch".
After choosing either the enable/disable launch option, you can exit out of the window that appears and run the game as normal.



[h2]Other changes[/h2]

In addition to everything mentioned above, this update also rounds-up a ton of minor bugs and issues that I've had on my to-do list for a long time, and these are:
  • All cars are now set up to support snow plows:


  • The "Golden trains" that spawn from Christmas presents and Halloween pumpkins now include the full list of every train in the game, including cars! So you can now get golden versions of pretty much everything:


  • A new thinner triangle "road fill" prop added, to fill in gaps between road sections:


  • Wagons that would still make a horn sound when you press the "horn" keyboard shortcut will now no longer sound a horn.
  • Files in the "custom assets" folder no longer have case-sensitive file types, which means a file called "image.PNG" and "image.png" will both work fine without issues.
  • Fixed slightly different colours on one of the example road style groups.
  • Removed one of the two rectangle table props, since it was causing so much confusion and didn't really have any good use (each rectangle table was for a different size of snapping layer, but only one was really needed).
  • Fixed bug where the skybox would not update properly until the player moved after loading a map.
  • The color of the default pantograph painters is now grey (instead of red).
  • Moved the "pause menu action" setting out of the middle of the menu, since it was common for people to click it by accident when moving through the menus.
  • The custom camera is now blocked on the main menu.
  • Pressing "Insert" to toggle whether the cursor is locked to the game window will now also prevent camera movement. Press Insert again to re-lock the cursor and control the game again.
  • Auto-holster controllers is now off by default for VR (this setting makes dropped controllers automatically snap back to their holder when dropped, which in VR is a pain since you often want to rest controllers on the table while doing other things).
  • Fixed bug where the mod spawning drawer would have a unique category select option for liveries, which are supposed to be combined into the standard "train mods" category.
  • Fixed bug where the sun would update in a snappy way when moving around the map (especially noticeable when entering tunnels, the sun would go dark too fast).
  • Fixed the default VR controller bindings for the Oculus controllers to include the "use alternative control scheme" action when holding the trigger. This means that if you have directional movement enabled, the teleporting controls will only be usable when you hold down the trigger, to avoid overlapping controls.


And that's everything!
This update ended up being a massive undertaking, and huge parts of the games code have been cleaned up and improved. Spending time on things like this is really important, since games always get more bloated and slow over time, so eventually you've got to truly dedicate some time to cleaning things up and optimization.

While this update mainly focused on the mod loading process, the next one will be dedicated to the map loading part! which means faster scenery and track loading, and hopefully even smoother gameplay with less stuttering when loading new scenery. It's going to be great!