load objects in background

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
804
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm

load objects in background

Post 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.
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: load objects in background

Post 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
804
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm

Re: load objects in background

Post 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!
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
hendu
Posts: 2600
Joined: Sat Dec 18, 2010 12:53 pm

Re: load objects in background

Post by hendu »

begin()
render()
end()

...

if (needmoredata) loadmoredata()
804
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm

Re: load objects in background

Post by 804 »

hendu wrote:oadmoredata()
That is my biggest problem.
I don't know how to do this without a very low framerate.
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: load objects in background

Post 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
804
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm

Re: load objects in background

Post by 804 »

Ok, so i load One vertex everything drawcall !
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
Radikalizm
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: load objects in background

Post 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 ;)
shadowghost21
Posts: 56
Joined: Wed Nov 23, 2011 11:53 pm

Re: load objects in background

Post 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.
Cube_
Posts: 1010
Joined: Mon Oct 24, 2011 10:03 pm
Location: 0x45 61 72 74 68 2c 20 69 6e 20 74 68 65 20 73 6f 6c 20 73 79 73 74 65 6d

Re: load objects in background

Post 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!)
"this is not the bottleneck you are looking for"
804
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm

Re: load objects in background

Post by 804 »

OK, i will take a try and post some detailed questions...
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
Post Reply