Zelimir Fedoran
email zelimir.fedoran@gmail.com

Asynchronous Resource Loading

Posted on
May 11th, 2010
, ,

One thing that bothered me for a while now was that the game could not handle very large map sizes. A map of 128x32x128 voxels was enough to stall the Xbox 360. This was because all index and vertex buffers would be created at the start. If a map was big enough it could very easily use up too much memory on the graphics card and crash. To fix this problem I reduced the rendering distance, added some fog, and added an asynchronous graphics resource loader.

How it Works

If you cannot possibly see a region of voxels, it should not be using up graphics resources. Therefore, I only create the index and vertex buffers for a region when it is close enough to be seen. Creating these buffers can take a few frames on the Xbox 360, so this task is done on a separate thread. Once a region is too far to be seen, its graphics resources are disposed. This allows new regions, which come into view, to use the memory the old regions used. Now map sizes of 512x128x512 are no problem for the Xbox 360.

Bottom View of a Large MapTop View of a Large Map