Game Development Community

Object streaming from disk ?

by Jimmy R Armes · in Torque 3D Beginner · 10/31/2012 (5:45 pm) · 7 replies

Just a quick question. Can objects be streamed from disk ? Say I want object to be unload and loaded depending on the proximity to the play in the world.

#1
11/01/2012 (2:23 am)
Hmm doesn't sound that hard to code yourself. I don't think it is implemented, I think all the necessary objects is loaded initially. But you could make a load distance similar to the ghost distance (see Vince Gee's resource)
You have to bear in mind tho that while saving memory, it hurts performance.
#2
11/01/2012 (4:06 am)
In single player it might be easier because an unloaded object isn't in the world for anyone, so it doesn't matter as long as the one player cannot see it. Networked complicates this because it would have to be added and removed client-side or with a ghost-like system (server instructs client to load/unload) as Lukas mentioned.
#3
11/01/2012 (4:41 am)
@ Lukas Ok I'll look into it. As for performance it would actually help since not everything is loaded. Think it like this in terms of the Elder Scrolls series all objects are steamed in from disk to memorey and then back out. It will cut load times in half....well depending on how dense you make the world.

@ Kenneth Client side should do almost everything expect for combat,ai, and maybe physics if your doing simulations.
#4
11/01/2012 (2:16 pm)
Understood. A good start would be looking into ghost always objects. Server sends them at mission load. You might want to cache that data indexed by sector, and have a function keep an eye on sectors based on location. Sounds like 1 terrain per sector plus statics. Dynamics like mobs and characters already load/unload based on distance.

Resource Manager will need work. Unless it changed, resource manager keeps all art assets in RAM after first load. Your object cache daemon might be used to tell resource manager when something needs unloaded.

Overall, it doesn't sound hard to write.
#5
11/01/2012 (5:01 pm)
Actually, this requires some extensive changes.

You'd want to do loading on demand in the background as otherwise you'd get some pretty noticeable bumps in gameplay. Currently all resource loading in Torque is non-threaded and almost all of the SimObject stuff is expected to run on the main thread. This means that shuffling stuff over to threads actually requires a pretty decent amount of work.

If someone wants to tackle this, I'd recommend concentrating on getting all resource management and loading thread-safe first and actually do the SimObject registration in steps on the main thread (for example, when queueing up 20 new objects, register them in steps of 5 per frame).

What's more easily done is to load and unload in chunks and actually pause the game for the duration. Like, player steps into new "area" or something and the game briefly pauses (with some visual feedback) and unloads and loads some stuff. Not quite state-of-the-art but if done right, IMO it's not too bad.
#6
11/01/2012 (5:25 pm)
@Rene I was thinking it would require a more extensive changes to the way Torque handles object.

The only pause I had playing games like the Elder Scroll series was when first zoning into a city. Of course that's hundreds of smaller items being loaded at once.

I think Orger has a system similar to that I'm going to check out the code and see if it's too extensive for me to do on my own.
#7
11/01/2012 (7:54 pm)
I didn't know resource loading wasn't threaded. Good info, thanks.