Page 1 of 1

load objects in background

Posted: Fri Dec 23, 2011 6:55 pm
by 804
i want to load the forest of my map while the player walks around, but i have no idea how to do something like this, because irrlicht isn't threadsafe.

Re: load objects in background

Posted: Fri Dec 23, 2011 7:03 pm
by Radikalizm
You can implement content streaming which runs in your main loop, you just load content every frame depending on how big your time budget is
Not an easy task though

Re: load objects in background

Posted: Fri Dec 23, 2011 8:09 pm
by 804
What is "content streaming" ?
My time budget is high, but i don't know anything about how content streaming works, so i need help there!

Re: load objects in background

Posted: Sat Dec 24, 2011 10:22 am
by hendu
begin()
render()
end()

...

if (needmoredata) loadmoredata()

Re: load objects in background

Posted: Sat Dec 24, 2011 11:31 am
by 804
hendu wrote:oadmoredata()
That is my biggest problem.
I don't know how to do this without a very low framerate.

Re: load objects in background

Posted: Sat Dec 24, 2011 11:37 am
by Radikalizm
804 wrote:
hendu wrote:oadmoredata()
That is my biggest problem.
I don't know how to do this without a very low framerate.
That's why I said it's not an easy task
I'd try to build a system based on so-called loading jobs, you just create a queue of these jobs containing a description of what needs to be loaded. You should be able to split these jobs up into smaller jobs so you can adjust them to your time budget as to avoid any noticeable lag. You could eventually do some kind of priority-based sorting so crucial elements of the scene get loaded first, but this could get nasty if done naively, so really plan this out

Re: load objects in background

Posted: Sat Dec 24, 2011 7:54 pm
by 804
Ok, so i load One vertex everything drawcall !

Re: load objects in background

Posted: Sun Dec 25, 2011 12:34 am
by Radikalizm
804 wrote:Ok, so i load One vertex everything drawcall !
Loading one vertex per frame would be an approach I'd call naive ;)

Re: load objects in background

Posted: Mon Dec 26, 2011 3:26 am
by shadowghost21
It's all about balancing load. I don't know if it has a technical term but I would call it "Time Slicing" If you have played any MMO games they usually have a little stutter depending on the speed of your system when you start to move quickly in one direction. But having worked on a system that stream loads, what I would recommend is that you split your world in the chunks and see what chunk the camera is in and load forward chunks one at a time in the direction they are moving and unload chunks in the opposite direction. From that you can optimize your chink size. As the chunk size is what will cause it to stutter.

Shoot for a target framerate on a low end machine and then use that to determine how much data you can load, and if you use a faster system it will be much more seemless.

Re: load objects in background

Posted: Mon Dec 26, 2011 4:13 am
by Cube_
yes. splitting the scene into chunks would be the preferred way of doing it (Any game with a high load will do that for example minecraft)
First load the chunk the player is in, then load surrounding chunks in a priority system (be it closest to the player or maybe the most important game element... let's say a turret that is designed to attack whent he player is within ten chunks)

Just don't make the chunks to small! (So the player exits the current chunk before the next one is loaded!)

Re: load objects in background

Posted: Mon Dec 26, 2011 12:51 pm
by 804
OK, i will take a try and post some detailed questions...