Loading content (meshes, textures, sounds) in the background

Posted by Boreal on Game Development See other posts from Game Development or by Boreal
Published on 2012-05-06T00:27:15Z Indexed on 2012/06/01 4:50 UTC
Read the original article Hit count: 270

Filed under:
|
|

In my game, I am aiming for a continuous world, that is, a world where you can go anywhere without breaking the immersion through load times and "virtual seams".

My world is broken up into regions, which are nodes in a graph. A region is considered adjacent to another if it can be travelled to or seen from that region. In order to keep this continuous, I want to preload the assets needed in the adjacent regions (such as world meshes, textures, and music) before they are actually used.

As for actually loading the content, I use a manager that keeps at most one copy of each asset in memory at a time, accessible by its filename. When I try to access an asset, it loads it (if necessary) and then returns it. I can then unload any asset that is currently loaded to save memory.

Clearly, I want to do this in the background so there are no hiccups. I assume I have to use threads in some way, but I'm not sure how.

© Game Development or respective owner

Related posts about c#

Related posts about multithreading