markus_GE, on 22 January 2014 - 09:34 AM, said:
Is there any chance this will once be improved to also show the loading bar when first loading something? (iThere is a quite low chance a savegame will be loaded twice, e.g.).
The long-term plan is to actually have loading progress generated by the code but this involves every (or nearly every) component that loads content to be hooked up in a reasonable way.
markus_GE, on 22 January 2014 - 09:34 AM, said:
For example, couldn´t the required byte-count to be loaded be recorded in a short pre-loading sequence, just reading the file sizes on disk and summing them up?
The main issue is that, to calculate this, you need to read a load of the files to get there. For example:
- You have to load the activity file to know what consists are in use.
- You have to load the consists to know what wagons are in use.
- You have to load the wagons to know what shapes are in use.
- You have to load the shapes to know what textures are in use.
Shapes and textures are the big things - and the above doesn't even begin to cover the loading work needed to figure out the scenery.
Now, sure, you can probably load these files in a "lite" manner (i.e. skipping most of the processing of the file) but you'd still need to read them off disk - and, as the current progress bar shows, the disk reads themselves actually present a pretty representative loading progress.
A more advanced solution might be to cache (in a similar way to how we cache the activities and save files) some of the different steps above, e.g. cache the loading needed for a given wagon, and for each consist, etc., and then the pre-load
might only have to do a quick check of which consists are active and which tile you are in. It'll still be a lot of work, though, as even if you have 10 trains (consists) in the saved game, how many of them need shapes/textures loaded because they are in view? Some extra data during save might help here, but it sure won't be simple. :)
Csantucci, on 22 January 2014 - 09:36 AM, said:
What could be done is what MSTS does, that is indicating the phases going on: Loading general files, loading world files, loading trainsets and so on.
Yeah, that still needs some instrumentation of loading but not as much as the goal I mentioned at the top.
markus_GE, on 22 January 2014 - 09:41 AM, said:
Even in ancient BASIC (which I´m learning on my own) there´s a function available to return the file of a size on disk in bytes. Assuming that from the activity, path etc. definition files it´s known which files will have to be read, wouldn´t it be possible to insert a maybe 3 second wait before actual loading will start? During these three seconds every required file would be called by such a "byte finder function" and the returns be added to find the total number of bytes to be loaded. This could replace the "recording" on first load, and three seconds only the route loading image will not do any harm :fiesta:
As mentioned above, the challenge is not getting the size of the files, it is knowing which files are needed.
Sid P., on 22 January 2014 - 12:49 PM, said:
I must be missing something. When ORTS saves a game, it has full knowledge of the size and contents of the saved file - would that not be enough to be able to show the load bar during the first resume (i.e. loading the saved game ) ? It seems to me it would be more difficult to show the animation when loading an activity that had not been saved than when resuming a saved game.
Loading the saved game file itself is a miniscule part of the loading process - it probably completes before the progress bar even appears. The problem is knowing what shapes and textures (and terrain heightmaps, etc.) are needed. This is information not encoded in the save game and in some cases it would actually be tricky to encode it.
Sid P., on 22 January 2014 - 12:49 PM, said:
I notice that if I resume the same saved game twice, I get the load bar the second time. But normally, I would only load it once, then save it (possibly) after running the activity for a while.
Yes, this limitation is very frustrating for saved games/resuming.
I have a variety of (mostly not evil) plots to improve this, both for initial loading of activities and for resuming saved games, but it will take some time and effort.