mach: Add a cross-platform filesystem layer #906
Labels
No labels
CI
all
basisu
blog
bug
build
contributor-friendly
core
correctness
deferred
dev
direct3d-headers
docs
driver-os-issue
duplicate
dxcompiler
editor
examples
experiment
feature-idea
feedback
flac
freetype
gamemode
gkurve
glfw
gpu
gpu-dawn
harfbuzz
help welcome
in-progress
infrastructure
invalid
libmach
linux-audio-headers
long-term
mach
mach.gfx
mach.math
mach.physics
mach.testing
model3d
needs-triage
object
opengl-headers
opus
os/linux
os/macos
os/wasm
os/windows
package-manager
priority
proposal
proposal-accepted
question
roadmap
slipped
stability
sysaudio
sysgpu
sysjs
validating-fix
vulkan-zig-generated
wayland-headers
website
wontfix
wrench
www
x11-headers
xcode-frameworks
zig-update
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
hexops/mach#906
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Related: https://github.com/hexops/mach/issues/357, https://github.com/hexops/mach/issues/864
Prior to working on a full asset pipeline (to be discussed), Mach needs an interface for loading file streams from a project. I'm most familiar with PhysFS as an off-the-shelf solution, but per discussion in https://github.com/hexops/mach/issues/864, we'd want a Mach solution to be a fresh project written in Zig. I'm happy to get started here. Loading game resources is a foundational part of any engine, so the sooner there's a way to do it, the better.
The design I had in mind (feedback would be very helpful) involves a file "server" of sorts which depends on a list of asset sources. When you request a file from the server, it polls each source in turn to see if it can find the appropriate file. If it can't, it moves to the next in the list; otherwise, it opens the data as a stream and returns it. PhysFS does something similar: you can "mount" directories or archives into the PhysFS instance, then when looking for a file, the filesystem polls each one.
Doing it this way would enable developers to read from multiple archive sources (https://github.com/hexops/mach/issues/864) or e.g. the executable base directory at runtime, and it would also make polling for mods that overwrite assets transparent. In extreme (read: non MVP) cases, this approach could even be used as a means to download game assets as-needed, with an asset source pointing to the project's save directory and another higher up to retrieve assets from a server if they're not yet cached.
Concerns:
io.StreamSource(or equivalent; I need to do some research here)Other projects that I'm planning on looking into for inspiration:
Relevant: Bevy just merged this massive rewrite of their asset system that we could probably learn a lot from. https://github.com/bevyengine/bevy/pull/8624