Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

A good example is let's say I'm making a pong game. I have a PNG image for the ball and another PNG image for the paddles. Now which would be better, loading the PNG images with a PNG loader, or loading them in a separate program, serializing it, and de-serializing it in the game itself for use?

The reason why this may be good to know is because it seems like game companies (or anyone in the long run) build all of their resources into some sort of file. For example, in the game Fallout: New Vegas the DLCs are loaded as a .ESM file, which includes everything it needs, all the game does is find it, serialize it, and it has the resources. Games like Penumbra: Black Plague take a different approch and add a folder which contains all the textures, sounds, scrips, ect that it needs, but not serialized (it does this with the game itself, and the DLC).

Which is the better approch and why?

share|improve this question
    
Both are better and both are worse. It depends on what your goals are. –  Byte56 Jul 3 '13 at 17:03

1 Answer 1

up vote 4 down vote accepted

As with so many things, the answer is "Depends"

Do you need to load a couple of hundred megs of data quickly? Are you streaming data in as the player traverses the level? Are you reading from optical media?

If the answer is "yes", then pre-packed resource streaming is for you.

If you're just making pong. It's not really a big issue, loading flat resources is more than likely OK. If you're making commercial games, then yes, you want to minimise your level loading times and use pre-packaged data.

It boils down to this:

  • A lot of the time in file I/O is simply opening files. If you're opening a lot of small files, you're going to be spending more time opening files than you'll spend reading them.
  • Loading game ready data is typically a linear disk read. This is optimal for the way that our physical storage media works (aside from SSD's). You'll get better read performance loading one big file than many small files.
  • When you're streaming the level, you want predictable load times, having a single file gives you far better predictability with disk performance than many small files. Different level "segments" may have vastly different asset requirements, and vastly different "load" times.

TL:DR - For pong, no. For commercial, or semi-serious games, yes.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.