0
\$\begingroup\$

I am building a prototype for a 2D tile based game and I have several sprite sheets in separate image files that in want to use for animation as well as game logic attributes associated each sprite sheet (such as the size of the spite and the start coordinates). The stumbling block I am running up against is how to properly store this data.

Opening several hundred image files as well as one or more files holding the attribute data is impractical even assuming the OS allowed for so many file descriptors for a single process. This lead me to think about designing some container format that contained all of the relevant game assets without superfluous metadata as well as game parameters for the logic. However before I design something on my own I wanted to see if there was a common standard people use. The only thing I could dig up was something like dooms WAD but I didn't find much about the file format itself.

Do games have something close to a standard for an asset container?

\$\endgroup\$
1
  • 3
    \$\begingroup\$ ´Do games have something close to a standard for an asset container?` No. Everyone does it different. \$\endgroup\$
    – tkausl
    Jul 19, 2022 at 4:57

2 Answers 2

2
\$\begingroup\$

No, there isn't. Every other game does it differently (some even keep their assets as individual files).


I am building a prototype

I would not bother about assets packaging just yet. It's a low-priority thing. 99 of 100 players will appreciate more fun game over the game that stores the assets "just right". At the prototype stage you are unlikely to bump into any file-management restrictions (unless you do something really stupid, OS will allow you to use like 10k+ files without a word). Sure, the I/O could be a bit slower due to fragmentation (on HDD), but you are going to load everything into RAM anyway, so don't bother yet.

Opening several hundred image files

Just make sure to open->load->close. Don't keep files lingering opened for no reason.

\$\endgroup\$
1
\$\begingroup\$

No, there isn't. Every game engine has a different solution for this problem.

But when you don't want to invest the time and energy into creating a homebrewed asset pack format, then you can simply get a library for reading a standard archive format like zip or tar and use that. I have also seen and used libraries which are able to combine both regular directories and archive files into a combined "virtual filesystem", so you can access all those files in the same way without having to bother if they are in compressed archives or regular files.

If you don't want end-users to peek at your asset files, then just giving those archive files a different file extension will deter the majority of users.

\$\endgroup\$
2
  • \$\begingroup\$ I'd be curious if you have a name for any of these virtual file system libraries to try. \$\endgroup\$
    – DMGregory
    Jul 19, 2022 at 11:09
  • \$\begingroup\$ tar is a bad idea - it's sequential-access. zip works better, although every file is compressed individually. It's also possible to do something custom, without a huge amount of difficulty \$\endgroup\$ Jul 19, 2022 at 17:33

You must log in to answer this question.

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