Jump to content
  • Advertisement
Sign in to follow this  
murdock

Loading Resources from pak files

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

What are the pros/cons of loading resources from pak files into Memory during game initialization vs loading them when needed? I've decided I want to use pak files to store my resources, but I am trying to determine when to load them into the game.

Share this post


Link to post
Share on other sites
Advertisement
Pros/cons of preloading:
- Resources available when you need them, no stalls due to unavailable resources.
- Simplified resource handling, just load on start and drop at the end.
- Level load times.
- All resources must fit into memory, whether their usage overlaps or not.

Pros/cons of on demand loading:
- Short/no wait time on level loading.
- Levels can contain more resources than would fit into memory.
- Complicated implementation, some form of multitasking is needed for the loader, system should be able to predict resource usage, loading should be prioritized (textures often not as important as geometry).
- Need to handle cases where resources are unavailable (show blank/low-resolution textures, freeze if required geometry is not available).

Share this post


Link to post
Share on other sites
Well the pros and cons are pretty obvious. If you load everything in one go, all of your resource loading code gets executed in one place and then you never have to worry about it again. The problem is this can take up a lot of memory, and also means the user may have to sit through a long loading period. On the other hand if you stream things, you have to be continuously loading resources while your gameplay is running. This means you need some sort of heuristic to determine when a resource is needed, and some sort of non-blocking loading mechanism that will handle the I/O, decompression, and data manipulation so that there's no latency in the running game. The upside is you can potentially use less memory, and you can reduce up-front loading times.

Share this post


Link to post
Share on other sites
It sounds like loading on demand would be a better idea based on what I'm seeing. Does it vary from game to game what people use or is one pretty much standard over the other?

Share this post


Link to post
Share on other sites
Your implementation will probably have to be pretty much custom-tailored for the needs of your game, since there can be wide variations in how large your game world is, how far you can see, how fast the camera moves, how many things you need to load in, what platform you're running on, what specs you're aiming for, etc.

There may be some specific techniques for certain cases, for example id's MegaTexture for terrain rendering. However I'm not really familiar with any other ones (doesn't mean they don't exist! [smile]).

Share this post


Link to post
Share on other sites
I've shipped AAA title games that had used pack files and had no loading screens/load times. Loading screens and installations are, in my opinion, for lazy developers.

A combination of streaming and packfiles are best in my opinion. I am of the opinion the best way to handle it is that you stream in all your data from a packfile for a section of a level, thats not visible yet, decompress and do initialization in the background. Then from there until the next level is loaded you do 0 memory allocations.

-= Dave

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!