Yes, the title is quite ironic. Virtual files. Isn’t any file virtual?
Say that I write a file format used for 3D models, which combines the 3D
files with the textures, AO, …
How would I be able to read that file without have to create temporary
files out of that.
5 files into 1 file to write
to read: load them all during runtime while not having to create 5
actual files (so some sort of buffer system)
EDIT: Forgot to mention which language, dumb me.. It’s C++
Please log in or register to post a reply.
Why would you need to create temporary files? Just read the file into
one big memory buffer, then set up pointers to the individual resources
within that, and access them as you please.
Yes, that was my question.
I have never had that much experience with file streaming,
and I didn’t know that that was possible.
But now that I think of it..
Thank you :)
You can actually manage the whole harddisk from your own program just
out of one file, set up access pointers, defragment, find writable
positions… thats how sparse voxel octrees work, being able to find all
the exact information out of one file so it quickly streams.
You can do the same thing with ram, just allocate it all into a single
static buffer, then manage the internals yourself with your own code.
So basically write it all into one file
And then when reading, read it into one buffer, and then (possibly)
Set up multiple pointers pointing to positions in the buffer which
beginnings & endings of files within the “master” file.
Or am I mistaken?
You could do it like that, but think, how are you going to reduce access
times from just iterating through the list of files until you hit the
right string comparison? :) Remember, this is how all “file packs” or
“file wads” (like from doom) work, but you need to be able to extract
the right information as quick as possible.
If you wanted to release a game, its good to do, its tacky (carmageddon
was sold with about 10 million separate files in the program hehe)
releasing a game with all the media in separate files people can just
import into editors so simply, if you pack them all away you can add
compression whilst copy protecting your media, visual studio can pack
media in with the exe file, also.
[EDIT] actually, if you just wanted to load the whole thing, what
reedbeta said would be all you need to do, but if you wanted to say load
each level one at a time, you need the extra searching pointers.[EDIT]