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 / how to reposition objects if bunched up?

Author
Message
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 30th Jun 2006 04:24
hi,i have a for next loop that randomly positions my trees,rocks,etc on my island.

my problem is dbp is always positioning too many objects in the center of my island together.i have randomize at the beginning of my code.this is a problem because when my player gets to this area,frame rate drops considerably.

anyone know how i can reposition these bunched up objects away from each other??
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 30th Jun 2006 04:31
Break your island up into smaller chunks, and randomise the placement within those chunks. That way no 'chunk' can ever have too many objects in it.

Bite my shiny metal ass
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 30th Jun 2006 17:12
anyone else know any way? with code??

i dont want to break my island up,thats too much work.
Pincho Paxton
21
Years of Service
User Offline
Joined: 8th Dec 2002
Location:
Posted: 30th Jun 2006 18:54
Move a random distance in the X..repeat..Drop down in the Z, and keep doing that, making sure that the minimum distance in the X is not too close to a tree.

spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 30th Jun 2006 19:15
He didn't mean break up the island literally! He meant just break it up logically into squares and place a certain amount of each object in each sqaure.

Boo!
Richard Davey
Retired Moderator
22
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 30th Jun 2006 19:23 Edited at: 30th Jun 2006 19:23
Spooky speaks wise words I did mean that.

Say your island is 1000x1000 in size and you want to place 100 items.

Instead of picking a random number between 1 and 1000 - break it down into chunks 250 in size. So you'd place 25 items between 1,250. Then another 25 between 251,500 - etc until you've covered the whole island.

Then no one area can have more objects than another.

Bite my shiny metal ass
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 30th Jun 2006 22:58
ok,ill try that.but im not sure how to keep the objects inside a specific box.the way i did it for my whole island was to make another check to see if any objects were past the x,z of the island & to delete them if they were.
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 1st Jul 2006 02:08
Here's some simple code that splits an island up into equal sections. I have set 'split' to 4 which means split island up 4 times across and 4 times down, basically giving 16 sections. Then a couple more variables saying I want between 1 and 3 trees per section. Change the variables and you get different results.

The only thing missing is some distance code to stop you placing trees on top of each other.



Boo!
spooky
22
Years of Service
User Offline
Joined: 30th Aug 2002
Location: United Kingdom
Posted: 1st Jul 2006 02:21
Too hot to sleep, so added the distance check in aswell;



Boo!
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 1st Jul 2006 17:44
thanks spooky.ill try your code.
David iz cool
19
Years of Service
User Offline
Joined: 21st Sep 2005
Location: somewhere lol :P
Posted: 3rd Jul 2006 17:10
hey,i came up with a simple way of positioning trees without them getting bunched up(very much.)



but thanks for all the help guys!!

Login to post a reply

Server time is: 2024-11-27 15:46:20
Your offset time is: 2024-11-27 15:46:20