Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This improves startup performance significantly, in my case reducing it from 15 seconds to 2. However… This is naïve in several ways, and has various serious failure modes and as such should not be used as-is in a release version. It does however lend itself to a much faster development cycle. This does not take any changes to model-related files into account: - If models.txt is extended, it will likely crash - If models are reordered, the models displayed in-game will be wrong in potentially hilarious ways. - If model file references are changed, the changes will not be taken into account and the files used at cache generation time will be used. - If model files are modified, the changes will not be taken into account. All of these issues can be remedied by removing the model.cache file generated in the user data directory when any model files are altered. As a hack for development purposes, the models.cache file could be created and set to be neither readable nor writable by the user running the game in order to prevent it from being used. In addition, the file format is dumb and an incorrect models.cache file will likely crash the game. It may also introduce security vulnerabilities, so models.cache should never be loaded from an untrusted source. To improve on this, it would probably make sense to use a hash-based data structure to map the contents of an input model file to its polygon representation consistently. This would allow handling changes to the models transparently while still providing a significant performance boost. Adding compression may also be worthwhile, as the cache file ends up being around 44MB with the data from the current release.
- Loading branch information