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 / Ahhhhhh Levels,Trees, Ahhh.....

Author
Message
DBAlex
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 7th Dec 2004 02:40
How do will i add trees to my FPS at positions that i want without creating different objects each time? i am using the load terrain from bitmap to make my terrains for my game, is this the best way? i dont want to buy CShop....

Dark Basic Roxxs (when i dont get error... )
monkeyboy
20
Years of Service
User Offline
Joined: 24th Oct 2004
Location: England
Posted: 7th Dec 2004 05:23
Im not sure how but i think some how you can random place the same object over and over within a limit. There is a driving in manhattan script in the code snippits where they duplicate a cube over and over in a set layout try reading that but im not sure
DBAlex
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 7th Dec 2004 05:47
Ok. I want to put the trees in specific lacations though...

Dark Basic Roxxs (when i dont get error... )
DBAlex
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 8th Dec 2004 00:46
I still need help.... Anyone? i need help with my terrains...Its impossible to make proper levels in Dark Basic Pro

Dark Basic Roxxs (when i dont get error... )
lickuidstylz
20
Years of Service
User Offline
Joined: 13th Aug 2004
Location: MD in USA
Posted: 8th Dec 2004 04:35
Make an array. In that array store all your xyz coordinates for your trees. make a for-loop function. Then in that function call an array. Then type "load object "tree.x", n"(or clone object), and "position object n ,x,y,z". Tell the for-loop to repeat until all the coordinates in the array have been read. That way, you'd only have to type "load object "tree.x", n" one time. You will however have to put in several different xyz coords depending on how many trees you have. Sorry I can't give you an exact answer, but it's NOT an extremely complicated thing to do. I hope I've pointed you in the right direction, read a few tutorials on arrays, search the codebase and forums (code snippets preferably) for arrays and for loop...also in DB or DBPro, use the help file and they have all the commands and how to use them (that's one of my best friends). GOOD LUCK!

The only limits we have are those we set.
DBAlex
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 8th Dec 2004 04:43
Thanx, Can u fix my code? (the other thread) it would be great if you could...

>_0
lickuidstylz
20
Years of Service
User Offline
Joined: 13th Aug 2004
Location: MD in USA
Posted: 8th Dec 2004 05:05
Here's an example, I'm going to try to do this from out of my head...

sync on
sync rate 20

type objpos
x as integer
y as integer
z as integer
endtype

dim tree(i) as objpos
tree(1).x = 0
tree(1).y = get ground height(i) + 1 `*or whatever that command is
tree(1).z = 0
tree(2).x = 3
tree(2).y = get ground height(i) + 1
tree(2).z = 2

do

for i = 1 to 2
load object "tree.x", i
position object i, x(i),y(i),z(i)
`The print commands are a way to see if this little bit of
`pulled-out-of-my-butt code actually works.
`NOTE: The tree.y positions won't work because there's no matrix
` to get the ground height from, you'd have to add that.
`print tree(i).x
`print tree(i).y
`print tree(i).z
next i

sync
loop


now... I hope THAT helps

The only limits we have are those we set.
DBAlex
20
Years of Service
User Offline
Joined: 4th Oct 2004
Location: United Kingdom
Posted: 8th Dec 2004 06:19
OK. Thanks for that

>_0
Phaelax
DBPro Master
21
Years of Service
User Offline
Joined: 16th Apr 2003
Location: Metropia
Posted: 9th Dec 2004 22:04
Look up this command:
instance object

Load an object once, then create instances of it. Each instance can have its own position and rotation, but they all share the same mesh data, drastically cutting down on memory when you have a lot of objects.

"eureka" - Archimedes

Login to post a reply

Server time is: 2024-11-11 22:15:52
Your offset time is: 2024-11-11 22:15:52