5
\$\begingroup\$

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.

\$\endgroup\$
5
  • 1
    \$\begingroup\$ One of the guys who worked on Dungeon Siege (one of the earliest continuous world games) did a talk at GDC several years ago. His slides and other notes can be found here: scottbilas.com/games/dungeon-siege \$\endgroup\$
    – Tetrad
    May 6, 2012 at 0:41
  • \$\begingroup\$ Reading that article brings up an interesting point. How should I store coordinates in a world that huge? I don't think I want to handle transformations in relation to a region center, because that will muddle up for inter-regional interactions. \$\endgroup\$
    – jmegaffin
    May 6, 2012 at 0:52
  • 1
    \$\begingroup\$ @Boreal huge world coordinates is a totally separate question, you'll want to research and then post if you don't find any answers that match your situation =) \$\endgroup\$ May 6, 2012 at 1:20
  • \$\begingroup\$ @boreal could you maybe introduce a Quad-tree, and then if character in section X then load content l-s this way you get the same effect as streaming zones \$\endgroup\$
    – gardian06
    May 6, 2012 at 3:07
  • \$\begingroup\$ Have you taken a look at Background Loading in XNA, just instead of a Loading screen you'll be showing your game world? \$\endgroup\$ May 7, 2012 at 12:37

1 Answer 1

1
\$\begingroup\$

I think I have figured it out. I'll process the content using a job queue and send thread-safe messages to the main thread to tell when an asset has loaded. When the assets are needed, the engine will wait (if necessary) for all the required assets to load and then continue with business as usual.

\$\endgroup\$

You must log in to answer this question.

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