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.

load objects in background

Postby 804 » Fri Dec 23, 2011 6:55 pm

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

Re: load objects in background

Postby Radikalizm » Fri Dec 23, 2011 7:03 pm

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
Radikalizm
 
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: load objects in background

Postby 804 » Fri Dec 23, 2011 8:09 pm

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

Re: load objects in background

Postby hendu » Sat Dec 24, 2011 10:22 am

begin()
render()
end()

...

if (needmoredata) loadmoredata()
hendu
 
Posts: 1620
Joined: Sat Dec 18, 2010 12:53 pm

Re: load objects in background

Postby 804 » Sat Dec 24, 2011 11:31 am

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

Re: load objects in background

Postby Radikalizm » Sat Dec 24, 2011 11:37 am

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
Radikalizm
 
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: load objects in background

Postby 804 » Sat Dec 24, 2011 7:54 pm

Ok, so i load One vertex everything drawcall !
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
User avatar
804
 
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm

Re: load objects in background

Postby Radikalizm » Sun Dec 25, 2011 12:34 am

804 wrote:Ok, so i load One vertex everything drawcall !


Loading one vertex per frame would be an approach I'd call naive ;)
Radikalizm
 
Posts: 1215
Joined: Tue Jan 09, 2007 7:03 pm
Location: Leuven, Belgium

Re: load objects in background

Postby shadowghost21 » Mon Dec 26, 2011 3:26 am

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

Re: load objects in background

Postby aaammmsterdddam » Mon Dec 26, 2011 4:13 am

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!)
(n^(n-n))-1
aaammmsterdddam
 
Posts: 529
Joined: Mon Oct 24, 2011 10:03 pm

Re: load objects in background

Postby 804 » Mon Dec 26, 2011 12:51 pm

OK, i will take a try and post some detailed questions...
///////////////////////////////////////////
My Forum: http://game-home.1x.de/
My Homepage: http://mediadesign.about.lc/
///////////////////////////////////////////
User avatar
804
 
Posts: 73
Joined: Thu Nov 10, 2011 7:07 pm


Return to Beginners Help

Who is online

Users browsing this forum: No registered users and 1 guest