Page 1 of 1

Load GRFs only when they are needed

Posted: 23 Apr 2006 12:04
by Jezulkim
This would improve the game loading time a lot. When I left only few files in my newgrf.cfg (TTO set, ttd patch files)the game loaded in ~10 seconds, but with full config file it can easily go to ~2 minutes.

So, my suggestion is this:

If you have files A, B and C in your newgrf.cfg like this and none of the use the grfid FF FF FF FF.

A ! (a big file 5mb, this one is not loaded in any saved game)
B !
C

And this is what should happen:

1) Title screen doesn't use any of those files so they are not loaded yet.
2) You load a saved game with file B activated. TTDpatch loads that file.
3) You decide to start a new game, because you finished that saved game. Now TTDpatch will only load file C.
4) The file A was loaded zero times and the size of file A was 5mb, because we didn't load it, we saved some time.

Posted: 23 Apr 2006 16:14
by Patchman
It's not possible. All files must be initialized first before any of them is activated. Therefore, once one file is activated (which happens when the title screen loads), no further files can be loaded.

The only thing I can suggest is that you make several newgrfw.cfg files, and select between them with the -Xn command line option, so you only load the one which you'll need in any one session.

Posted: 23 Apr 2006 17:41
by Redirect Left
To make it simpler is it possible to add a switch into the Patch that you can use to switch between them insted of editing the comand lines.

Posted: 23 Apr 2006 18:07
by Jezulkim
Patchman wrote:It's not possible.
Aww, that's too bad. I think I'll just have to clean my newgrf.cfg of the unused grfs. And I checked the loading time it was 1 minute and 1 second :).

Posted: 23 Apr 2006 18:23
by Patchman
Captain_Kirk76 wrote:To make it simpler is it possible to add a switch into the Patch that you can use to switch between them insted of editing the comand lines.
The "newgrfcfg" line does the same thing, but in ttdpatch.cfg.
Jezulkim wrote:
Patchman wrote:It's not possible.
Aww, that's too bad. I think I'll just have to clean my newgrf.cfg of the unused grfs. And I checked the loading time it was 1 minute and 1 second :).
Besides, even if it was possible to not load them, it's impossible to know whether it should activate without loading it. You wouldn't even know which GRFIDs correspond to which file, much less whether it's meant be active or not.

Posted: 23 Apr 2006 19:40
by Jezulkim
Patchman wrote:You wouldn't even know which GRFIDs correspond to which file, much less whether it's meant be active or not.
Well, if you could load only the action 8... but since it's not possible to load files after starting TTDP that'd be useless.

But anyway, I got my loading time reduced to 15 seconds after cleaning :)