Jump to content
  • Advertisement
Nierkool

Algorithm I need help in the creation of "tree felling"

Recommended Posts

I make a one game, and i want to do a sistem of tree feling, like in Lumber Tycon 2.But i do not know how do this.

If anyone has any ideas how to do this, please write!

Share this post


Link to post
Share on other sites
Advertisement

Start by breaking down the "system" in smaller pieces, then tackle each piece separately. (ie Divide and Conquer holds very much in computer programming).

 

For tree felling, start with having a tree, and displaying it. If "displaying it" is too complicated for you, study how to display 3D objects first (ie again apply Divide and Conquer).

With a displayed tree, add making a cut at some point in the tree, and splitting a tree in 2.

Then add physics so the tree (or parts of it) fall down as you'd expect.

 

Share this post


Link to post
Share on other sites

Thanks, but i want the tree to split up where the character beats,that is, the vertices of the cut appear where the character beats.(Look at Lumber Tycon 2 in Roblox) 

Share this post


Link to post
Share on other sites
1 hour ago, Nierkool said:

Thanks, but i want the tree to split up where the character beats,that is, the vertices of the cut appear where the character beats.(Look at Lumber Tycon 2 in Roblox) 

Re-read @Alberth post. What have you achieved so far? Can you display a tree? 

There's no point in people going into a detailed discussion of how to break up a tree if they don't know your starting point.

Share this post


Link to post
Share on other sites
Posted (edited)
10 hours ago, Nierkool said:

Thanks, but i want the tree to split up where the character beats,that is, the vertices of the cut appear where the character beats.(Look at Lumber Tycon 2 in Roblox)

Then you also saw the little crosshair that points to that position.

 

Staring at the total picture and then expecting you will find a solution is not going to work, it's just too big to comprehend. The only working tactic I found so far is what I said, decompose into smaller sub-problems until they seem solvable, then solve each sub-problem.

Edit: Thus if my second step is not solvable for you, decompose it further.

Edited by Alberth

Share this post


Link to post
Share on other sites

Ok.Then the last question:how to divide an object into two parts during the game?

I know how this should happen, but the problem is that I can not write this script.
 

Share this post


Link to post
Share on other sites
Posted (edited)

You need to know that cutting a object for real isn't only difficult but games don't like doing it in real time; that is why Metal Gear Rising was so special when it released.

Often breaking objects in games is fake. The object is replaced by broken pieces that don't actually break realistically.

So the question is do you want the "Fake" or "Cut" way of doing this.

 

To Fake it.

Create your tree model. Then make broken tree parts. When the tree is hit, just destroy it and load in the broken pieces.

 

To Cut it.

Make the tree model.

Most commonly a ray trace is done to slice the mesh. The points where the mesh intercepts is calculated using vector math. Using these stored points and the original mesh you make two new meshes. You need to know VectorsDotProduct and CrossProduct to do this.

After the two new meshes is made you need to fill any holes because meshes are just shells, You also need to calculate there UV map again. The filling should also be UV mapped.

Apply physics to the new meshes and done. Don't keep them in the memory long because these kinds of meshes can quickly use up resources.

 

Edit:

Looking at Lumberyard Tycoon, they faked it. The model isn't 1 model it is lots of small models and when you hit one it breaks at that point.

So where it breaks was decided before you chop the tree.

Edited by Scouting Ninja

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!