Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / world loading by distance to player example?

Author
Message
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 31st May 2009 22:12
hi i have the idea to load my world as my player gets close enough to each object but im not sure how to code it.

heres my idea.

load my world 1st
make an array to record all the xyz of each object (tree rock etc)
then delete everything and as my player gets close enough to each object load it ,using the array to set its position.
anyone know how to code this??
or anyone have a better way??
im trying to make a huge world kind of like morrow wind.
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 31st May 2009 22:14
i dont want to just hide the objects because i (think) thats not as fast it would slow the game down wouldnt it?

wouldnt the game run faster if they were deleted??
bobbel
15
Years of Service
User Offline
Joined: 5th Jan 2009
Location: In my DBPro case xD
Posted: 1st Jun 2009 08:44 Edited at: 1st Jun 2009 08:45
yes it would, but deleting an object takes more than hiding, and loading even more than unhiding. how i would do this is check every loop if the object position => 1000 or omething. if it is, than hide the object. if it isn;t, unhide the object. you can also set the fog on, so it doesn;t like the box is disapearing, but slowly fades away.

how you could code this? make an array with no items (something like ObjStreamer()) and make a function to load objects in it (something like StreamObj(ObjNum)). in that function, you increase the array by one and fill the newly created array with the object number. to make it all work, you can make a gosub in your loop that looks like this



Hope this helps :p

*ding ding*
CuCuMBeR
21
Years of Service
User Offline
Joined: 11th Jan 2003
Location: Turkey
Posted: 1st Jun 2009 11:41
instead of hiding, you can use exclude object on or off command which is supposed to be better.

There is always one more imbecile than you counted on.
ShaunRW
DBPro Developer
16
Years of Service
User Offline
Joined: 7th Jan 2008
Location: Brisbane, Australia
Posted: 3rd Jun 2009 07:44 Edited at: 3rd Jun 2009 07:46
what if you just hide the object under the map so its not visable to the camera? would that be faster?

EDIT:
Even if its hidden beyond the camera view? i think you can do that


KISTech
16
Years of Service
User Offline
Joined: 8th Feb 2008
Location: Aloha, Oregon
Posted: 3rd Jun 2009 19:01
Do a forum search for LOD or Level of Detail. You'll find threads on solutions for this type of thing.

The basic idea is,

- Load area where player is
- At distance X replace objects with lower poly versions
- As player moves closer to objects, replace them with the high poly version
- At distance Y hide the objects

Loading an object will require disk access, and setting up the new object in memory. This takes a fair amount of time. Hiding the object is much quicker, and removes it from the render pipeline speeding things up.

Login to post a reply

Server time is: 2024-09-28 06:20:39
Your offset time is: 2024-09-28 06:20:39