Jump to content

Compile all of those text files to binary


Recommended Posts

Before I start: I'm no expert. I have a degree in a relevant field, which basically means I know enough to be dangerous, but Shigeru Miyamoto I am most certainly not.

That said, I notice that a lot of the resources in KSP take the form of text-based files. These will all have to be parsed before being loaded into memory. So, once they are loaded, is there any reason that the big blob in RAM can't just be dumped to disk for a faster load next time? A rudimentary check to see if any part files have changed or added, and then loading the game can be one big (and more efficient) stream-into-RAM operation. Hell, you could even cheese the checking by just having a "changed.cfg" or something that gets deleted if you've added a mod or want to refresh the blob.

Am I preaching to the choir and that's already what's going to happen later in development, or is this a half decent idea?

Link to comment
Share on other sites

The idea is sound, we do it with a couple of tools we've built at work. In order to detect if anything new needs to be loaded we just write out a simple text list of loaded files (the cache inventory.. text so a programmer can read it too if necessary) with their last modified date times and the last cached date time in the header (ie, "now" after loading) along with the binary disk cache itself. When the tools initialize they check the cache inventory first before loading a file. New or changed files aren't matched to the inventory and are thus reloaded from the plain-old-text when needed.

Not sure whether something like this is already planned.

Link to comment
Share on other sites

Was suggested way back, in form of game reading this binaries, and separate exe that goes over all config files and re-compiles where necessary producing new binaries. Not sure if it got any response.

But the principle is sound and could cut a lot of time from loading, i think that text parsing is one of the slowest things one can do when storing data.

On the other hand, we're still in beta so it's nice to have option to easily change part config without any additional hassle.

Link to comment
Share on other sites

On the other hand, we're still in beta so it's nice to have option to easily change part config without any additional hassle.

As far as I this is exactly the reasony why this is implemented this way as it is now.

But as far as I know Squad is working on new ingame resource managment system which would be storing all tha data inside a local database and also alow changing most of the values even while the game is already running. Athleast that was the original idea.

Link to comment
Share on other sites

This thread is quite old. Please consider starting a new thread rather than reviving this one.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...