Train Simulator Classic 2024

Train Simulator Classic 2024

Not enough ratings
[How to] Stop the game crashing when 'Updating scenario database' / 'Saving scenario database'
By Grawpy
A guide on how to find and remove corrupted scenarios / routes. This is important because any scenarios or routes past the point of corruption will not show up in-game, even if you have them installed.
   
Award
Favorite
Favorited
Unfavorite
Intro
There's been an issue with the scenario database for years now and as dtg don't seem to have any intention of fixing it, I decided to put this guide together to help those facing it.

If you've got a lot of corrupted files, this can be a really major issue and I'm surprised dtg haven't made fixing this a priority as it's pretty difficult and time consuming to solve.

Even though the game will still start and can still be played if you encounter this issue, you'll have many missing scenarios and routes, because the database could only be compiled to a certain point.

The cause of this issue isn't totally reproducible, but it seems the more workshop items you subscribe to in a short period of time, the more likely some are to become corrupt. To avoid it happening in the future, subscribe to one workshop item at a time, that way, you know the scenario / route that's causing you problems straight away if your game crashes.

I'd recommend unsubscribing from all workshop scenarios before continuing, as if you don't, steam will automatically reacquire them. If steam does reacquire them, they may be corrupt or they may not be, it seems to be completely random.
Program
I've made a program that will diagnose and solve your database issues for you.

Warning: While I've tested it thoroughly over the last few days, it may cause issues for some people as I can only test it in so many situations. While it's extremely unlikely there'll be any big problems, make sure you backup your 'Content/routes/' folder just in-case.

Source code[github.com]

Download[github.com]

Steps the program takes to try and fix your database:
  • Finds and moves all workshop scenarios to the backup folder if found.
  • Checks for scenario editor corruption and moves the files to the backup folder if found.
  • Checks if the steps above fixed the issue, if they didn't: has a redundancy that moves route folders out of the routes folder 1 / 5 at a time, loading up the game in between, until coming across the faulty route, then goes through each scenario in that route until it finds the corrupt one. This step is really finicky, sometimes it works and sometimes it doesn't, the steps above should always work though.
  • If there's still problems after the step above, it will go through all logmate files that have been created and find all the errors, outputting them to Railworks/Error-(time).txt

The folder the program backs up your content to is C:/Users/YourUser/TSFixCorruptedScenarioDatabase/

I'd recommend using the program as I haven't found a reliable way to check if a scenario is a workshop scenario by yourself. (The way the program does it is by scraping all steam workshop train sim content then comparing scenario names in the xml files to the scraped ones, this would be really tedious to do yourself, especially with a lot of scenarios.)

If you really don't want to use the program, follow the guide below.
1. The easy way
This method is the easiest, but by doing this, you'll need to re-download train sim entirely, including all of your purchased dlcs; you'll also have to re-install any third party dlcs and unsubscribe from all of your workshop items. While this seems always work, I'd recommend the other methods, especially if you have a lot of dlc, as they'll probably end up being less time-consuming.

  • Unsubscribe from all train sim workshop content.
  • Uninstall train sim.
  • Install train sim and any dlcs / third-party dlcs.
  • Only subscribe to one workshop item at a time from now on, as the more you subscribe to at once, the greater chance there is of the content becoming corrupted.
  • If you do run into this issue again and have only been downloading one workshop item at a time, you can search for 'ScenarioProperties.xml' as described in the next part, order by 'Date modified', then right click 'Open file location' and delete the folder.
2. File size / scenario editor corruption
To check if this is the problem in your case, go to your Railworks/Content folder and search for 'ScenarioProperties.xml', hold control and zoom in with the scroll wheel twice until you see something like this:


If you don't have the 'Size' header, right click on the header and tick the 'Size' box.

Order the files by Size and if any are over 500kb or so, they're more than likely corrupt. I have tons of scenarios and the largest non-corrupt one in my case is 300kb.

Make sure you let windows finish searching completely before continuing, it will take a while if you have a lot of scenarios.

To remove the corrupted scenarios, right click on the ScenarioProperties.xml files that are corrupted and 'Open file location'.

Delete the scenario folders that the files are inside.
3. LuaCreator
Download LuaCreator[www.hollandhiking.nl].

When you start it up, you'll see something like this:



The only things you need to input are the 'TrainSimulator directory' and the 'LuaCreator directory'.

The train simulator directory being your Railworks folder and the LuaCreator directory being the place you installed the program to.

Once you've done you should get a screen like this:



Under 'Tools', click Routes/Scenarios and you'll see something like this:



Find and delete invalid routes

Scroll to the bottom on the 'Routes' side and if any have a Red mark next to them, it means they're corrupted. Click on any that are corrupted and press 'Delete route'.

Find and delete invalid scenarios

Click on each route you have and scroll to the bottom of the scenarios section. Click and 'Delete Scenario' on any which have a name that includes 'InvalidProperties' with a Red mark next to them.

Example of a corrupted scenario:

4. Resetting your cache (Always do this after removing routes/scenarios)
After doing the steps above, you need to clear your scenario database cache.

To do this, go to Railworks/Content and delete the following files:
  • RVDBCache.bin
  • RVDBCache.bin.MD5
  • SDBCache.bin
  • SDBCache.bin.MD5

Make sure LuaCreator is closed and start up Train Sim and after a long wait for 'Updating scenario database', your game should start up with no issues.

If the game still crashes it means the game ran into another corrupted scenario/route. You have to keep repeating step 3 and deleting the files above until the game starts up correctly. Make sure you restart LuaCreator after each game crash so it can reload your routes / scenarios and make sure LuaCreator is closed when you're starting up the game.

It may take many tries, especially if you've subscribed to a lot of workshop items at once, as that seems to be the main way corruption like this happens.

A good thing to keep track of during all of this is the size of the SDBCache.bin file when train sim crashes. This is good because you know if you're making progress. For example, if I remove some corrupted scenarios when my SDBCache.bin is 9446kb, then I delete the cache and start the game again, SDBCache.bin may now be a higher file size (eg 10000kb) when it crashed. This means the game managed to compile more of the scenarios and it means you're making progress.

If you can't find anymore corrupted scenarios or routes, go to step 4.
5. If all else fails
If you've tried all of the steps above and the game is still crashing, you'll need to use LogMate to try and diagnose the problem yourself.

To run train sim with LogMate, add the following to your launch options (Library -> Right click train sim -> Properties -> Set launch options): -LogMate -SetLogFilters=all

Make sure to reset your cache as shown in step 4 before continuing.

Start the game and don't do anything with the LogMate window, just let it run in the background.

Once the game crashes, find the latest log file in your Railworks directory. Note: Don't use the 'Open' button on LogMate as that doesn't seem to open the correct log file most of the time.

First, press Control + F and search for 'error'.

Those error messages will give you a clue to the route/scenario that's causing you problems. An example in my case being:

(The error shown above isn't actually a problem, as the game and mountain pass route both run fine, it's just an example of what an error looks like)

If there are no errors, scroll to the bottom of the log file and see the last actions that the game made, these could give you a clue to the scenarios causing the issue.

If you can't figure out how to fix the errors, leave a comment and I'll give some pointers and add those to the guide.

If you still have issues after fixing the errors:
  • Restart your game a couple of times and go through the steps again.
  • LuaCreator doesn't seem to always pickup the corrupt properties files, so you may also want to try restarting it a couple of times to make sure you've removed them all.
  • Restart your computer.
Conclusion
This seems to be a really common issue for people and it's a shame that dtg don't seem to have any intention of fixing it (there are posts regarding this going back 3+ years).

Thanks for reading and I hope this guide helped :)
13 Comments
Grawpy  [author] 27 Nov, 2023 @ 9:05am 
@D&HGuy1147 If you've exhausted all steps, the only way I could fix it in the past was by fully uninstalling, unsubbing to all workshop items, then reinstalling.
D&HGuy1147 2 Jan, 2023 @ 7:58pm 
I've gone through the steps a couple of times now and I'm still facing the same issue.
DakotaDreamer 15 Jul, 2021 @ 3:54pm 
I worked this out in 2018 as well. It's a real shame that they don't fix it. I sure wish I knew what was being altered in the ScenariopProperties.xml between the workshop copy and the final copy installed in the game folder. I'd write a cleanup utility. You can easily detect the corrupted XML with an XML editor like Liquid or VIsual Studio or ??? by validating the ScenarioProperties.xml. If it's bad, zap the whole route folder and try letting RW re-install it. Repeat until you get an installation with a ScenarioProperties.xml that validates.
dknowles801 31 Mar, 2021 @ 11:29am 
Anyone know how long it takes to do the whole process started the programme 10 minutes ago..1915 Hours GMT
Felix.AVMP 26 Jun, 2020 @ 2:17am 
In my case, the problem was triggered by purchasing some new routes and locos from DTG on Steam... I subsequently did some pruning of my install (it was long overdue anyway, so no harm done),
but before I did so, my install back then reached sort of quasi equilibrium, I was able to stabilize it just by removing one or two official add ons.

This tells me, that workshop, while it can amplify this issue, is not the sole culprit and that the problem is hidden somewhere deep in RW/TS datastructrure and therefore it is indeed possible to trigger it even without using the workshop itself.

So other viable alternative could be just to get rid of some of the official DLCs, especially those, which are probably not played by the player anyway.
Grawpy  [author] 25 Jun, 2020 @ 11:13pm 
And yea, it's always a good idea to backup the files, I stated that in the guide in the Warning section. Even if the program doesn't run into any issues and fixes the problem, it's always a good idea to have a backup just in-case. Also, the only reason I mention fully re-installing at the start is because that is the only other thing that has fixed the issue 100% of the time for me. It's definitely not the best way, just the easiest (if you don't have tons of external dlc).
Grawpy  [author] 25 Jun, 2020 @ 11:04pm 
Everything i've explained in this guide is related to only my experience with the problem. It might be that there is just a 'hardcap' on the number of scenarios, but i've removed over half of mine while testing this with no improvement at all. The steps i've described in this guide fixed the problem for me sometimes, but not others, it's very strange. The program I posted has fixed the issue for me 100% of the time however, so i'm almost certain, at least in my case, it were corrupt scenarios causing the issue.
Felix.AVMP 25 Jun, 2020 @ 10:45pm 
Bottom line - I strongly advise pruning workshop items
(there are always things that can go away), but I do not recommend getting rid of everything, as sometimes items are being pulled from workshop (either for good or bad reasons),
also, I would strongly recommend making a backup of current install - this way, in case you delete something you really want to keep, you can easily salvage it from the backup
(also, some mods/patches are completely oblivious to this issue, yet, by deleting everything you lose them as well, so making a backup before doing anything is REALLY a good idea).
Felix.AVMP 25 Jun, 2020 @ 10:44pm 
The problem is, that -contrary to popular belief, pushed by some self-proclaimed advanced users- CORRUPTED FILES are NOT THE ONLY CAUSE of this condition...
it has been empirically observed, that this can happen even on an otherwise very healthy installation, which just happens to exceed some critical number of scenarios etc.
(there are obviously some hard limits in Railworks/Train simulator program - yes, these can be more easily triggered by corrupted scenarios etc. because of their obvious bigger memory consumption, but this is not the only cause - this is also the reason why it is so difficult to track down the real problem).