Cross-Platform FileManager #449

Closed
opened 2025-04-25 01:30:51 +02:00 by SakulFlee · 1 comment
SakulFlee commented 2025-04-25 01:30:51 +02:00 (Migrated from github.com)

The current Loader system is highly flexible, but hard to implement and use.
A simpler way would be to have a FileManager that handles file reads (& writes?) independently, no matter on which platform.
Currently, we can read (& write) only on Desktop platforms, for mobile and web there needs to be some special logic anyways.

Should the FileManager be part of WorldChanges or independent?

I feel like both could makes sense.
WorldChanges would allow for some very easy file import (e.g. glTF) like so: WorldChange::LoadFile("path-to-file").
However, we might need to load other files that aren't supposed to be imported into the world in a cross-platform way. Say save games, level data, etc.

So maybe both would be an option:
Have FileManager be independent by-default to be used whereever, whenever, needed, but also provide an easy way to load "world imports" via WorldChanges.

File type imports

Another concern would be different file types to be loaded (and written?).
Say we load a glTF file ... we need a "glTF loader".
But who provides that?
Can it be dynamically added to the pool?

My idea would be to have some file types directly supported (e.g. something like loadGLTF), but always have an option to load as binary or ASCII text or something like it.
This way, the data can be manually passed on to a parser.

Alternatively, a trait could be used to have a template function like: parseAs<gltfParser>(path).

The current `Loader` system is highly flexible, but hard to implement and use. A simpler way would be to have a `FileManager` that handles file reads (& writes?) independently, no matter on which platform. Currently, we can read (& write) only on Desktop platforms, for mobile and web there needs to be some special logic anyways. # **Should the `FileManager` be part of `WorldChanges` or independent?** I feel like both _could_ makes sense. `WorldChanges` would allow for some very easy file import (e.g. glTF) like so: `WorldChange::LoadFile("path-to-file")`. However, we might need to load other files that aren't supposed to be imported into the world in a cross-platform way. Say save games, level data, etc. So maybe **both** would be an option: Have `FileManager` be independent by-default to be used whereever, whenever, needed, but also provide an easy way to load "world imports" via `WorldChanges`. # File type imports Another concern would be different file types to be loaded (and written?). Say we load a glTF file ... we need a "glTF loader". But who provides that? Can it be dynamically added to the pool? My idea would be to have _some_ file types directly supported (e.g. something like `loadGLTF`), but always have an option to load as binary or ASCII text or something like it. This way, the data can be manually passed on to a parser. Alternatively, a trait could be used to have a template function like: `parseAs<gltfParser>(path)`.
SakulFlee commented 2025-09-16 19:39:10 +02:00 (Migrated from github.com)

Sunset, see #4

Sunset, see #4
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
SakulFlee/Orbital#449
No description provided.