ChiraEngine icon indicating copy to clipboard operation
ChiraEngine copied to clipboard

Virtual Filesystem

Open craftablescience opened this issue 3 years ago • 0 comments

Component to Improve

Core Engine

Describe Your Suggestion

The current resource system is fine, and works well imho, but it's also unwieldy to work with the filesystem directly. I was a bit shortsighted when making the resource system, in trying to abstract it to work with any kind of file sources like zip and vpk I didn't realize that raw filesystem operations would be so crucial. The resource provider system needs to be refactored into a virtual filesystem. It should know what filesystem providers are read-only, what filesystem providers can provide raw file paths (which are sometimes necessary!), and perhaps one day provide additional operations like watching for file or directory changes.

  • Make a wrapper over the fs called Filesystem
  • Basically using the source path system, but better
  • Can add directories or archives to paths
  • When accessing a file, they are assumed to be read-only unless the search path is marked as writable
  • GAME path is read-only by default, can be overridden by tooling, the engine folder and game-specific folder are automatically added
  • CFG path is writable, %APPDATA%/Chira/ProjectName/ on Windows

There needs to be a distinction between running games from raw files versus exporting games on certain platforms, but we don't need to worry about that yet.

craftablescience avatar Dec 29 '22 17:12 craftablescience