Game Development Community

Game world disk streaming

by Kyrah Abattoir · in Torque 3D Beginner · 10/23/2012 (6:32 pm) · 8 replies

I wanted to know if anyone here had experience on torque with streaming the game world. Basically, instead of keeping the entire game world loaded in memory (which could be a whole lot if very large and detailed), divide it in "tiles" and load/unload the tiles to keep the game world manageable by the client.

From my understanding, the terrain is not so much of a problem, it's very efficient, even a really large one.
However having all the buildings, entities (openable doors, monsters, players) that are located in the next city should obviously not be loaded (or synchronised) on a client that is nowhere near it.

Thoughts?

#1
10/23/2012 (9:09 pm)
The closest I've seen to tiling is the zone system in T3D. Objects in another zone do not get rendered. However, leaving a zone might not free the memory.

Another is the scoping mechanism. Static objects are marked as ghost always (not affected by scoping). If this could be changed, they would only load when they come inside scoping distance. I don't know if the memory used by an object is freed when it falls out of scope.

Unless it's changed since TGEA, I think once an object gets loaded, the resource manager keeps a cache of the object in RAM. That sort of works against the idea of loading and unloading on the fly.

edits: cleaned up a couple times
#2
10/24/2012 (5:01 am)
Apparently winterleafentertainment is working on a terrain streaming system but i dont know if it is an in-house project.
Also take a look at Bill Vee's terrain work. Hes streaming voxel terrain, I believe that could be used for streaming stock terrain aswell.
#3
10/24/2012 (7:21 am)
it is my understanding that terrain is one of the only 2 reasons why this isnt possible with torque in its current state, the other being a single world coordinate system that limits actual size of the game world.

Other than that, torque has built in zones and portals that disable rendering, i'm presuming this could be modified to load and unload data as well as render, it may already do so, i dont actually know.
#4
10/24/2012 (10:11 am)
@Lukas
The terrain streaming will be included with OneWorld... if not v1 then v2 very likely. We are looking at OneWorld being at an inhouse testing stage come the end of year.
#5
10/26/2012 (8:43 am)
For a single-player game the world coordinate issue can be overcome by "moving the world around the player" instead of moving the player around the world, but streaming is still an issue.

I was thinking - a mission is only a SimSet. SimSets can be saved to and loaded from disk at any time. There is no real reason you can't have multiple groups of objects broken into sets and use triggers (primitive, I know) to cause loading and unloading of buildings, characters, ambient objects, etc from their saved SimSets. Not exactly streaming, but it should work as a starting point.
#6
10/26/2012 (1:49 pm)
My problem is sort of similar to minecraft, i CAN create a very large world in torque, no doubt about it, but for performance reasons, i would like to restrict client synchronisation to what is directly around it (for the client/server part).

I also wouyld like to unload assets outside the player's vicinity (not just hide them to boost rendering, unload them entirely from memory.

Minecraft is voxel based but, in essence, the server (and client) are only simulating (and rendering) in a 300 meter radius around each players, allowing a very low server processing footprint that is pretty much unaffected by the world size, and only the player count.
#7
10/26/2012 (1:53 pm)
Ah Kyrah take a look at this resource from Vince Gee
That might be what you are looking for.
(For the client part anyway)
#8
10/27/2012 (9:01 am)
Quote:
My problem is sort of similar to minecraft, i CAN create a very large world in torque, no doubt about it, but for performance reasons, i would like to restrict client synchronisation to what is directly around it (for the client/server part).

To be perfectly honest: nothing is stopping you. When the object falls out of scope, see if the datablock has any objects referencing to it. If not, unload it.

That solves half of the problem. The rest is making sure instead of loading datablocks on preload, you load them the first time they're used. Keep a Job Queue up and let those stream the data from disk. You'll have to change a few GameBase derived objects to take this into account and not bomb when there's no data available. Let them wait for the worker to finish instead.