It might not be very glamorous or exciting, but optimization is a REALLY important part of game development and it's great to spend some time making improvements every now and then.
This update is entirely focused on optimization, specifically around RAM (memory) usage and speeding up the map loading process!
These changes especially improve loading large maps with a lot of track, and when testing some famously large maps (like Beaumont, Nevada Arizona & Utah, Continental United Sates V2, Thunder Mountain Line) the improvements have been amazing:
Nevada Arizona & Utah:
RAM usage: 3.4gb -> 1.6gb of (52% reduction)
Load time: 15 seconds -> 10 seconds (33% reduction)
Beaumont:
RAM usage: 7.3gb -> 3.4gb (53% reduction)
Load time: 57 seconds -> 41 seconds (28% reduction)
Continental United Sates V2:
RAM usage: 4.2gb -> 2.5gb (40% reduction)
Load time: 41 seconds -> 20 seconds (51% reduction)
Thunder Mountain Line:
RAM usage: 5.3gb -> 3.4gb (35% reduction)
Load time: 45 seconds -> 31 seconds (31% reduction)
That's a massive 45% average reduction in RAM usage and 35% average reduction in load times!
These optimizations come from two main places:
Changes to how track is loaded. Only the bare minimum track data is loaded when opening a map (just waypoint position data for the trains to use) and no visual meshes or textures are loaded. Instead the visuals for track are dynamically loaded as you move around the map in the same way props are. Basically track can now exist in either a "partially loaded" or "fully loaded" state.
Changes to how mesh data is stored and managed. I've done a huge deep-dive on where mesh data is being duplicated and improperly handled, and I found several great optimizations where mesh data could be reduced. This kind of "unnecessary mesh duplication" bloat builds up in the background and can be hard to spot, so tracking this down and improving it makes a big difference on large maps.
Aside from these two main points, I've also made a ton of smaller improvements here-and-there which affect how the game loads meshes, textures and handles RAM.
Here is a full list of all the changes in this update:
Improved RAM management for loading screen custom images
Loading screen images can now have any aspect ratio and will correctly scale to fit any sized screen
Fixed flickering/flashing when loading in distant chunks while moving around the map
Improved map startup loading in several ways
Fixed bug where people using the old inventory selection system would experience issues when saving the game from the menu
The item held in your hand is now correctly re-equipped when exiting a 2D menu
Added new loading screen step for "reading save data file" when loading very large save text files
Over on the Patreon I've also made a devlog video going into detail about how all of these optimization features work under-the-hood, and talking about how Rolling Line loads maps:
You can join the Patreon and view the video here!
And thank you to all my Patreon supporters!
GaugeGang: SmokeStream
Rolling Line enjoyers: Helga Nordgren
Model railroaders: Lutz, Jayton Hawkins, TheAmazingRyry, CAMOGUY54321, Jonathan Ginsburg
Railfans: TrainTiny, Thomas Merolla, Don Willis, Leto Gloas, Outertoaster, Nathan Perez, TrainMann, Railraider, Garst, Richard Prior, Joblogh, Detroit_, Ben Burch, Gustavo Sanchez, Michelle chan, Jack Fruh, Lynk_Wyland, KathalLasagna
You can join the Patreon to help support me to keep making free updates!
Changed files in this update