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.

DarkBASIC Discussion / Placing many trees and rocks

Author
Message
bergice
17
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 3rd Mar 2008 21:49
Hi all!
I am making a matrix for my RPG adventure game.
I need to place many rocks and trees and set collision for each of them and get the ground height at that position they are placed.

How do i do this?

I think i would have to use the FOR NEXT commands but i dont know how to make the objects non-global.

bla bla bla...
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 4th Mar 2008 00:13
Sorry, but your question it far too general for anyone to answer on here - it would take a massive reply to explain it all to a level that you would understand.

It's a bit like asking "how do I do shooting"?

Go and read the help files and a few tutorials so you learn some of the 'basics' first.

If you have any less-general questions about specific aspects of object placement and/or collision feel free to ask again.

TDK_Man

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 4th Mar 2008 17:42 Edited at: 4th Mar 2008 17:43
If you're asking how to place many trees realistically (not totally random) you'd need some sort of algorithm for placing the trees.
Here's a simple one I knocked up, it generates a new position using the previous, so the trees stay pretty close to each other.
If the coords go out of bounds the routine starts again from a random point so you avoid that nasty square look.


For the collision you'll want to SET COLLISION TO BOXES because there are so many objects it's best to use a quick detection method. That would go inside your FOR loop too; you'd make the object, then set its collision method and then position it.

bergice
17
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 4th Mar 2008 20:22
Thank you!

bla bla bla...
jason p sage
17
Years of Service
User Offline
Joined: 10th Jun 2007
Location: Ellington, CT USA
Posted: 4th Mar 2008 21:39
OBese - that's slick.

Bergice - And others reading this... TDK Is right but I recently have been doing some tree research myself and have not SOLVED my issues but I'm on to a solution I HOPE!

These are IDEAS to consider nothing more. (I'm considering them LOL)

1st: Many Objects? Rendering? Can get SLOW! Learn Frustrum culling, and to get started - try to implement the OBJECT IN SCREEN function - its not perfect but the idea is HIDE object if its not IN SCREEN. This helps frame rates.

2nd: Many Objects sometimes (forget rendering) can slow down the code. CONSIDER Making an object that is made of OBJECT-LIMBS. (Must be clear are dicussing tress) where EACH OBJECT LIMB is a COMPLETE tree. Now the idea here is to get maybe 30 trees randomly positioned in a smaller area kinda... but its REALL ONE OBject.

(Making long trunks and random tree heights would make placing "into a hill easier" but you would want these limbs to match terrain height of where they will sit ideally.)

By having multiple trees in ONE object - easy (faster) to hide them all at once if you want, also I think better to have 30 objects (with limbs..each for their part in the world) then 500 objects scattered about or whatever.

3: Combine these techniques - especially because of the kind of thing OBese descirbed. Need a cluster of trees? Then the limbed object (many trees in one object) might be the way to go. Need a tree in the middle of no where? Just toos an object.

I don't know a perfect solution and I'm fighting this one myself HOWEVER I think these ideas have merit.

Libervurto
18
Years of Service
User Offline
Joined: 30th Jun 2006
Location: On Toast
Posted: 5th Mar 2008 00:55
I would make a tree cluster object and use it when you are far away from the trees, as you get closer switch to the individual tree objects. That way you can have a lot of "trees" so it's still visually good but you also save power by having fewer objects.

Paul08
17
Years of Service
User Offline
Joined: 20th Feb 2008
Location: Oxford, UK
Posted: 5th Mar 2008 23:01
i like the idea of a group then up close go to individual objects

Paul
Stig Design Stig Magne
19
Years of Service
User Offline
Joined: 23rd Mar 2006
Location: Norway
Posted: 15th Mar 2008 07:08
i Alsoe have Working on this time to time. iven tryed to Copy the Code From the (MonsterHunt tutorial) With The Camera Collision But i havent figure it out.
so i have typed tree`s for tree`s in my RCManiac Game Yess i cud youse that 1 Object Menny Tree`s But Sudently i have problemes with the bulding`s nere by.
so Good Luck Buddy

Stig Design (Free Games,Sources,Textures,Photo`s)
Lisence Free at http://dashboard.filefront.com/StigDesign/
Latch
18
Years of Service
User Offline
Joined: 23rd Jul 2006
Location:
Posted: 15th Mar 2008 09:09
Don't rule out having single plains textured with multiple trees for a forest at a distance, or even up close for that matter. Or how about the inside of cylinder for a clearing surounded by a texture of multiple trees?

Enjoy your day.
bergice
17
Years of Service
User Offline
Joined: 5th Jun 2007
Location: Oslo,Norway
Posted: 15th Mar 2008 13:06
I have fixed it, guys!
The game creates a number of trees around the map, not underwater, and they will match the terrain height at their x and z positions.
I am considering doing one object trees too.

---:GAME MAKING IS BEST:---

Login to post a reply

Server time is: 2025-06-04 03:11:49
Your offset time is: 2025-06-04 03:11:49