Jump to content
  • Advertisement
Sign in to follow this  

putting files and textures in .paks or something?

This topic is 3721 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

Many games put their assetts in seperate folders with containers like .pak or .bak. I think it's called serialization or something similar? Can anyone point me in the right direction and recommend a good LGPL or similarly licensed libraries I could use to do something similar? Also how does it work? For example if I want to access a texture in a specific directory I just put in "../media/texture.bmp" or something like that, but if media has a .bak file which has the texture stored inside it would it mean I need to access it through a class? Or would I have to extract it during the loading time and place it in a temp directory then delete it once the game closed down? Sorry I don't know much about this topic so my questions might seem dumb.

Share this post

Link to post
Share on other sites
Usually you write some kind of virtual file system that you initialize with those *pak files in the beginning


Now when you load a file

Buffer buf;
it will first lookup the central directories of the archive files in the determined order
either last->first or vise verse (regarding the addPack order), last->first has the advantage of file versioning usefull for overwriting files with modified ones.

if the given file doesn t exist in the *.pkg files you provided it will look it up on the harddrive.

e.g pwd /somedir/filename.lol where pwd is your current working directory

I would advice you to get the .zip file format specification and write a loader for it. Its pretty simple and can be done within 1-2 hours and is a good learning experience if you have never done this before.

Some restriction on the file format:
- use only uncompressed files
- do not use password protection

Just to make life easier :)

Hope that helps.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!