Jump to content
  • Advertisement
Sign in to follow this  
Samurai Jack

Resources, Memory Managers, ZIP Licence?

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

Greetings! I have some questions regarding resources. First of all, ZIP files. Is it alloud to use .ZIP files in any kind for your project? I mean ZLIB does not automaticaly mean PKWARE ZIP, but on the other hand ZLIB does not support .ZIB byitself you need some kind of a wrapper. Ok. Let us say, you have the wrapper, is it: 1) Is it alloud to use .ZIP in commercial games without paying a fee? 2) Memory manager Is there any memory manager allready available that would have this functionality: a) ONE POOL size and no dynamic allocations, for example i would like to say: OK, my game will require at most 10 Megabytes of ram for resources. I could extract my .zip file as required to that pool without calling "new" just one single time, except for the pool creation. The other thing is, what if you do have 10 megs available, and first you load your system resources at offset 0 (let us say we have 3 megs of system resources), 2 megs for first part of the level and 4 megs for the second part of the level (3+2+4 = 9 megs total). What about the situation, where part 1 of the level is no longer required, and we would like to load 3 megs of additional textures? Whet this means is: (3 Megs + 4megs = 7 megs) but we can not "append" the next 3 megs at the trail, we need to defrag the memory? Is something like that allready available or do I have to write one for myself? 3) Resource bindings Let us say we have a class CResourceFile which holds information about offset in .zip file and maybe information to memory manager whenever it is allready loaded or not. In case it is allready loaded and not required it might free memory space for other resources, in case it is required but not loaded it shall transfer itself to memory. The problem now is CTextureReference, whic is basicaly a CResourceFile with D3DXTEXTURE. What kind of design pattern shall I use to join CTextureReference with CResourceFile? I can not just extend/derivate it. Maybe I will require a factory or something like that. I'm very interested in your ideas. My most common problem is, am I allowed to use ZIP files in my project or do I have to pay fee? For eaxmple you might not use MD3 or MD5 files from Quake or Doom, because they are property of ID. I recall that .GIF files were sometimes also required to pay for etc... Thank you in advance!

Share this post


Link to post
Share on other sites
Advertisement
1) You can use ZIP files freely in your application. I's suggest you to use the excellent zlib library, which is open-source and uses a very liberal license (something along the line of 'you can use it, I swear').

2) You want a very specific memory manager. It is not difficult to integrate this kind of memory manager in an application (you'll have to overload the global new and delete operators). I don't know any manager that wok in the way you specified (but I obviously don't know everything [smile]).

3) I'd suggest a composition (CTextureReference holds a pointer to a CResourceFile). In fact, I'd suggest a CResource class, which would own a pointer to a CResourceFile + some other reated informations, a CTextureReference should inherit CResource.

GIF files are now free from any patent (they expired in the beginning of the year). I'm still not sure whether there is a (c) on ID file formats. But ZIP files are really free to use.

Regards,

Share this post


Link to post
Share on other sites
Quote:
Original post by Samurai Jack
2) Memory manager

Is there any memory manager allready available that would have this functionality:

a) ONE POOL size and no dynamic allocations, for example i would like to say: OK, my game will require at most 10 Megabytes of ram for resources. I could extract my .zip file as required to that pool without calling "new" just one single time, except for the pool creation.

The other thing is, what if you do have 10 megs available, and first you load your system resources at offset 0 (let us say we have 3 megs of system resources), 2 megs for first part of the level and 4 megs for the second part of the level (3+2+4 = 9 megs total). What about the situation, where part 1 of the level is no longer required, and we would like to load 3 megs of additional textures? Whet this means is: (3 Megs + 4megs = 7 megs) but we can not "append" the next 3 megs at the trail, we need to defrag the memory? Is something like that allready available or do I have to write one for myself?

Doug Lea's Malloc is a good replacement if you want to do your own memory management code. It's very configurable (via a whole bunch of compile time #defines), IIRC you want the USE_MEMORY_SPACES (or is it USE_M_SPACES?). This lets you pass in an already allocated chunk of memory, you can then use this custom malloc to allocate and deallocate from this fixed size pool.

Share this post


Link to post
Share on other sites
Use the PhysFS lib, it allows you to access multiple archive formats (*.zip, *.pak, *.mix, *.WAD, etc..) as a regular file system structure using their file IO, as well as the directory structure.

./data.zip
->data
->data\image.png

File System:
data\texture.png

Mapped FS:
data\image.png
data\texture.png

Share this post


Link to post
Share on other sites
Quote:
Original post by PumpkinPieman
Use the PhysFS lib, it allows you to access multiple archive formats (*.zip, *.pak, *.mix, *.WAD, etc..) as a regular file system structure using their file IO, as well as the directory structure.
The thing I like about PhysFS, is that you can seperate all of your level data into *.pak files (level1.pak, level2.pak, etc) and still have it appear in sorted folders when programming.

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!