4
\$\begingroup\$

I'm working on a new game, and its related level editor, based on Ogre3D. I was thinking about how i could manage the game files, knowing that Ogre use .mesh files for models, .material for materials/texture information etc... . At first i thought about a common .zip folder decompressed at runtime (the same way Torchlight and Ogre samples do). But this way the game assets become a monolithic archive, loading takes time, and could be difficult to eventually patch them. So, let's say i have a game object named "Cube" i want to load in my program. Going for modularity, what if i create a compressed file (using zlib compression routines) named Cube.extname, containing its sub-files Cube.mesh, Cube.material and so on ? Are there any alternatives or should i stick with compressed objects?

PS: Just to clear things, the answer is unrelated to my program code, at the moment i'm using "resources.cfg" pointing to the OgreSDK media directory.

\$\endgroup\$

1 Answer 1

5
\$\begingroup\$

You can have the assets of the game organized with any structure. Ogre only needs to know a parent directory or more ( this depends if you separate the assets to use on different nivels or to load at different times ), this information is written to the file "resources.cfg".

This is a valid approach, but package the files in a zip archive has some advantages:

  1. It's open format.
  2. The virtual files within a ZIP archive "remember" their relative path.
  3. ZIP archives may be compressed: less space
  4. ZIP archives are modular: useful for localization, for example.

Obviously is faster decompress a large chunk of bytes that multiples small chunks. You should use streaming decompression and use a loading bar at first of a level.

You can see more about Resource Managers at the book:

Title: "Game Engine Architecture"
Author: Jason Gregory
Chapter: 6. Resources and the File System

\$\endgroup\$
2
  • \$\begingroup\$ Ok, you' ve got a point about the monolithic zip approach, loading all the files at startup is better than loading them at the moment. But what about modding and/or patching? \$\endgroup\$
    – Tibor
    Mar 7, 2011 at 14:15
  • \$\begingroup\$ Related to modding or modify assets on development, it would be a good approach give these tasks to the editor. Because the editor is the responsible of keep the resources management, the assets not necessarily have to be in a zip file when the editor uses them. You add a new resource on the editor and before to launch the game, it can pack the resources in a zip file. A patch can be a program that unzip the .pak with the assets, do the correct modifications and back to create the zip. \$\endgroup\$
    – momboco
    Mar 7, 2011 at 14:33

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .