YoRyan, on 22 August 2020 - 12:21 PM, said:
- James drew a distinction between the archive directory structure, with the package name as the top-level directory and the types of files as subdirectories, and the directory structure as it would be populated by OR, with the different file types as the top-level directories and the packages as subdirectories (so reversed). This would add technical complexity, as well as introduce a layer of indirection that might catch content creators off-guard, so I suggest sticking with the packages as the top-level directories.
I think there was a benefit to this, as you could anchor paths to the appropriate content type - e.g. a train file referencing a wagon would only be able to reference files in the approved location for wagon files (while still allowing content creators to add subdirectories).
I'm going to have a think about this as I am concerned this part of the proposal might be just a little bit too free-form, but the rest sounds good!
YoRyan, on 22 August 2020 - 12:21 PM, said:
- It should be possible to for OR content to reference MSTS content and vice-versa, because for the foreseeable future, we will all have to deal with MSTS content. The way this should work is that we would have top-level "ORTS" and "MSTS" namespaces in our virtual filesystem that both kinds of file formats could utilize.
Absolutely yes for cross-references, in both directions.
I would lean towards "OR" instead of "ORTS" but I'm not strongly opinionated about that - we have a long history of using OR and ORTS interchangeably, even though they might have meant different things at some point.
YoRyan, on 22 August 2020 - 12:21 PM, said:
- This would allow players to take advantage of the benefits of a modding-friendly virtual filesystem while still using their legacy MSTS content, by installing (or creating) zip packages that place files into the "/MSTS" namespace. For example, I could create a package that contains my XTracks assets, and then share that single copy among all of my MSTS installation profiles without having to resort to hardlinks or softlinks.
We will have to think about how we want the packages to interact; I know you've continued to talk about installation profiles, but I'd like to see that feature be less visible (certainly not forcing the user to pick one before they can pick anything else).
YoRyan, on 22 August 2020 - 12:21 PM, said:
- Speaking of, let's clarify how paths would work, because there should be a well-defined system (call it an "OR path") for files that take advantage of the new virtual filesystem. For this new system, I suggest deprecating relative paths altogether, as well as adopting the "/" character as the path separator. All paths would be absolute, insofar as absolute within the virtual filesystem ("/ORTS/SomePackage/Shapes/bungalow.s"), as opposed to on-disk ("C:\Users\Ryan\Open Rails\SomePackage.zip\SomePackage\Shapes\bungalow.s").
- The use of the ".." token would be prohibited - except for legacy MSTS files still using old-style paths, so long as they don't attempt to "break out" of the "/MSTS" namespace by chaining multiple ".."'s.
- An OR path would be distinguished from an old-style path by its leading "/" character.
:thumbup3:
YoRyan, on 22 August 2020 - 12:21 PM, said:
- For OR assets that are inextricably linked with other assets (paths and activities vis-a-vis routes), the link should be explicitly made through a JSON attribute with a file path ("'Route': '/ORTS/SomePackage/Routes/SomeRoute.route-or'") rather than a particular location in the filesystem (the "ROUTES\SomeRoute\ACTIVITIES" folder as defined by Kuju).
This is where I am very slightly concerned, that you could put that route-or file in
any directory inside the package. Maybe that's fine, and obviously certain file types will need to be in specific places for the game to auto-find them (like routes), but that's not true of everything.
YoRyan, on 22 August 2020 - 12:21 PM, said:
I am prepared to suspend my new consists project and work on the virtual filesystem first (hopefully, with some collaborators), but it will have to wait until after the Monogame merge, as this work would be just as invasive - all of the file I/O calls would have to be swapped for PhysicsFS calls, the launcher would have to be reworked, the command-line interface would have to be re-architected, etc. All of this would entail a massive amount of effort, but IMO it would be worth it to make the content-installing experience much more pleasant for players in the short-term, and to allow Open Rails to expand its horizons in the long-term. It would also open the door to a package management system, a centralized content repository, and multiplayer content sharing if we so choose to go down those roads.
Absolutely want this work, after MonoGame as you say. I've had the multi-player content sharing idea rattling around for a few years since I built the Content Manager contributed tool - it would be super cool to do, but that's a way off yet. :)
gpz, on 23 August 2020 - 01:03 AM, said:
However I would not be eager at all adding a C library like PhysicsFS as a reference for handling such a basic and essential task as reading from files. I would not even like to use a native 3rd-party C# library for this task either, given that the standard C# classes are more than capable of handling this. (See e.g. the ZipArchive class.) I would rather like to see a custom FileManager class with a GetFile() function, that could easily handle this stuff.
I would be okay with a 3rd party open-source library written entirely in .NET, but I am quite wary of adding a dependency on native code, no matter how high quality/battle-tested it is. It provides a sticking point for both 64bit support
and cross-platform support, two things I would like us to start addressing (or at least not making any worse!).
YoRyan, on 23 August 2020 - 08:02 AM, said:
Ultimately, the use of this library is a call for the management team - but given our extremely stretched resources, I would strongly advocate for a battle-tested solution, used by many other video game engines, that supports a vast array of archive formats (not just ZIP) rather than trying to homebrew something ourselves that might well turn out to perform worse. If only for my sake. :)
I would actually rather we didn't support a "vast array of archive formats" and only supported ZIP, because that makes everyone's life easier in the long-term. Yes, maybe the files won't be as small, but
everyone will be able to open them up and poke around inside without any 3rd party software.
gpz, on 23 August 2020 - 09:25 AM, said:
Most of those other archive formats are just proprietary garbage, OR cannot benefit from them. Not just the performance is my concern. (Although it is
also important.) Come on, is it really a good software design, to replace the standard MS-maintained, well defined, managed StreamReader, File.Open, ZipArchive class, etc. with an unmanaged C library, where 1-2 developers are fighting with the maintenance? For such a not too complex task of maintaining a dictionary of files, assigned to their containing prioritized package name? To me it is a big no-no. You may call for the management team, in this case I would especially interested in James's opinion about this. :)
I'm definitely with Peter here; the built-in .NET APIs should provide enough standardised, performant, and reliable basis on which to implement this.