Archived

This topic is now archived and is closed to further replies.

File Resource Management

This topic is 5013 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Can someone point me to some tutorials or resources on game engine file management? My only point of reference is the Quake3 engine, and from looking at it''s logs I''m guessing that at load time it goes through all files in its folders, and all files in the pk3 archives, to build a list of files for use. Then, at runtime, whichever file it needs to access, it knows exactly where to grab it from. As far as I know this means that the engine maintains a complete list of filenames in memory, as well as the names of the archives they are located in. But this seems like such a waste of memory, there must be a more efficient way of referencing them. I don''t know how other engines implement this, but I''m sure this is pretty standard stuff. Any ideas or references would be appreciated.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I store all my files for each level in Mac OS X bundles (effectively the same as pk3 archives). At start up I go through my resources folder and find and keep track of all the file paths for all the bundles. I only delve into a bundle for the files inside once the player selects a level to play. Nice and easy.

Share this post


Link to post
Share on other sites
Perhaps create a text (or other more advanced) file containing an index of all the files and their relevant package files. Or simply handle each package as a subdirectory (1 way of getting rid of double files). Then your only overhead is speed lost searching through this index file, and compiling it when your program/game starts.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
You don''t have to store the filenames once the package file is loaded. Calculate a hash-value for each filename, then you can sort the list of hash-values. Each time you want to get the index of a file, you calc the hash of the wanted filename and do a binary search.
Also, you could put this in an array where each entry represents one package file, so you don''t need to store a reference to the "parent" package file in each file entry record.

Share this post


Link to post
Share on other sites