2
\$\begingroup\$

In my game, a RTS game, the units are all wavefront obj. all their animation frames are each seperate wavefront obj file. ie. without any skeletal animation; fully rigid models. So when many units are loaded before a game starts, it takes too much time. for example, if 20 types of units are loaded, they take approximately 700/800MB in memory, take atleast 3 minutes to load.

Can it be done in an efficient way somehow?

Solutions I have already used:

  • As obj parsing take too much time. I have stored each obj as memory dump and load that dump. This helped a lot atleast reduced to 3min from 10min, for above example.

Further Possible solution I tried:

  • I tried loading the anination frames on runtime, when they are accesessed. But this is making the game slow at some crucial time. Like when fighting, all units' fighting frames are loaded together. thus making the game slow.
  • loading the units in different threads. Makes no improvement
\$\endgroup\$
  • 5
    \$\begingroup\$ 1) your choice to use a custom game format preconverted from the source format is standard procedure; no game loads raw source assets like .obj at runtime. 2) 700MB for 20 units is ridiculous, likely you've poorly optimized your meshes; game artists typically need to know how to make relatively low-poly characters that still look good and animations with as few key frames as possible. You likely have a data optimization issue, not an engineering issue, and it's up to your content folks to fix it. \$\endgroup\$ – Sean Middleditch Feb 12 '14 at 20:39
  • \$\begingroup\$ @SeanMiddleditch I am aware of that.... actually I really dont have any artists working on my project...so I design or download free models and edit them myself........ I am I an not good enough I designing low poly models....most of my models have mostly 500-1000 for normal human/animals & 1000-2000 for bigger elephant/chariot type models. \$\endgroup\$ – Rakesh Malik Feb 13 '14 at 10:27
2
\$\begingroup\$

800 MB / 3 minutes = 4.4 MB/sec—a far cry from peak disk bandwidth, which is in the hundreds of MB per second (exact value depends on what kind of disk interface you have). So you're definitely not saturating I/O bandwidth. You should be able to load 800MB into memory in a few seconds.

You mentioned converting from .obj to a binary representation, but it sounds like you still have many small files. A standard solution for I/O issues is to put all the units/frames into one large file and load the whole thing in one go, rather than loading many small files. This will reduce disk seek time and allow disk caching to work better. You should see much higher I/O bandwidth this way.

\$\endgroup\$
  • \$\begingroup\$ Yes you are right i've been using many small file.............thanks I would try that \$\endgroup\$ – Rakesh Malik Feb 13 '14 at 10:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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