Game Development Community

Growing Trees, changing terrain, dynamic world.

by Shawn Hyde · in Torque Game Engine Advanced · 12/12/2006 (2:20 pm) · 22 replies

Now on week two of testing out TSE for a project I'm going to be working on and I see one potential issue with how the engine works. Maybe someone in the community can help me with this?

Is it possible to have tree's grow, chop them down,

Q1.
The only ways I can see this happening is to give the server a date where Dependant on the start date/ID of a tree vs the server date it has a different obj file with a set of object files for each tree type(ie, every day the obj is a bit bigger). In essence making it appear to grow. then have a set of object files with a falling animation for the chopping down of the tree(s). This should work in theory yes?

Q2.
Land mass movement, dynamic word... this one is a bit harder, the only way I see this working is some how having the terrain animate, for instance morph from one terrain status to another in essence creating a dynamic world. This could also be done in game? Bryce3d has the ability to do something like this where you can create one layout and then another and it will animate the change, however I'm not sure how to implement something like this in game? This would be great for areas where you have season changes, earth quakes, floods, snow/ice storms or glaciers, etc...

Any comments, notes contributions to this topic would be greatly appreciated.

Thank you!
Page «Previous 1 2
#1
12/15/2006 (5:05 pm)
You need some decimation code... which isnt in yet. Then in theory you just need to make the quadtree reflect any changes in the base mesh.

Hmm, wonder if the decimator would multithread... something to try.
#2
12/15/2006 (6:16 pm)
So this is something that will be added to TSE then?
#3
12/16/2006 (9:31 am)
Trees in this form would just be DTS shapes with some simple AIPlayer code behind them.
#4
12/30/2006 (7:12 am)
Trees growing wouldn't be too hard
Im a bad software architect, I never choose the best way to do things but heres my idea:
A schedule which calls a function to expand the tree size every few minutes/hours whatever
I dont know how easy it is to expand an object in code, i've never tried to do it before

Chopping down would be easier (maybe)
You would give the dts health, like a player
When the health has depleted you would do some rotation.
If you wanted the tree to split in half, that would be harder
You would need 2 models and you would need to mount one on the other, the split once the health has depleted

*I think*
#5
12/30/2006 (11:28 am)
@Shawn - Animating terrain and growing trees will not be TGEA features. These are highly specialized needs that no game engine i know of has. You need to consider the needs of your game and decide on the right way to implement them.

For tree growth i would go with James idea. I would have 2-4 different models for each tree type that goes from sapling to mature tree. I would then start with the sapling model, scale that up for a while then swap with the next model in the growth order. The transitions here will be abrupt, but depending on your game design you can hide this by only doing swaps when a tree is sufficiently far away and out of view from the player. Another idea is to use animation, but i don't know enough about DTS animation to know if it would work.

For chopping down trees i would change the tree from one static DTS into two when the chop event occurs. One static DTS would remain as the remaining trunk and another dynamic DTS is dropped using the simple physics in RigidShape (you can just shut off the physics after the fallen trunk settles).

This is a simple approach to tree growth... you can easily get bogged down into lots of code development with this if a more realistic appearance is needed.

For terrain that changes over time i don't see any easy solutions. Atlas is pretty much designed for static terrains, so significant work would need to be done to thread and gradually rebuild terrain chunks.
#6
12/30/2006 (2:23 pm)
Yea, if you look at my original post thats what I basically said. I was hoping someone had a better way of going abou this. As for current games that already do this; the black & white series has growing trees and the people chop them down.
#7
12/30/2006 (9:18 pm)
This is good idea for a content / function pak since the steak is already falling off the GG plate (overload).

I think the AI DTS objects like maybe turret type of code. Also maybe you could use the scale setting starting with a small model.
#8
12/31/2006 (12:03 pm)
I was thinking you could have 3-4 actual models for each tree and have them scale about 5 times per model, this should save resources but still give a rather realistic affect.
#9
01/06/2007 (5:17 am)
I think it would look cool if you added in some type of particle effects to hide some of the twitchy animation gaps in the growth cycle. Something like think smoke or green smoke even, like magic:)

just a thought:)
Bobby
#10
01/06/2007 (8:23 am)
Hum have you just tried asking the Black & White folks how they do it? :)
#11
01/06/2007 (11:15 am)
You can make some nice growing animations if you animate the bones' scale. Put a skeleton in your tree, and shrink down and move branches until they are hidden inside the trunk, then animate them coming out and growing.
#12
01/06/2007 (5:28 pm)
B&W is a stretch and enlarge but I'm looking for more detail.

@Manoel Neto
Not sure how to do that with TSE.
#13
01/06/2007 (7:11 pm)
I think he means using DTS animations in the model builder phase. Then with the engine you can just play the sequences.
#14
01/06/2007 (8:35 pm)
Hm.. That would be mighty heavy on the resources.
#15
01/09/2007 (9:13 am)
Surely, but a dynamic tree generator which generates growing geometry would probably be a lot heavier on the resources. There are high odds that Black & White uses simple animations to make the tree grow.
#16
01/10/2007 (3:30 pm)
Thanks for all the feedback guys it definitely gave me a few ideas.
#17
01/24/2007 (7:25 pm)
Most of what had been mentioned here are simple hacks. If you want to create a truely dynamic tree, then you do so with code. The basic idea is that you start with one branch (think of it as the trunk of the tree) out of that other dynamically generated models can branch off of it at semi-random rotations. Each new branch is instanced with a Y scale of 1 and "grows" linearly to 100%. At that point it can branch off to between 0 and 2 different branches. The function (say growBranch) should work recursively such that it can call itself to create further branches until some limit has been reached. Since the tree is generated in sepeate parts to begin with, you can easily "chop" it by just un-linking the child branch from the truck of the tree (and attaching it to a physics engine). Its not a very difficult concept, although I couldnt say how you would accomplish it using torque. Honestly, for generative 3d simulations you are better off going with a low-level solution like DirectX or a graphics library like Ogre.

For a visual referance of this technique, check this link (with actionscript source):
http://www.levitated.net/daily/levRootSystem.html
(note: you have to click the circle in the middle)
#18
01/24/2007 (7:49 pm)
Yes, thats more of what I was looking for.

Anyone interested in making a good tree generator for torque? :)
#19
01/24/2007 (8:33 pm)
Actually, you could probably script this out pretty easily.
#20
01/25/2007 (7:34 am)
If I were good at code, but thats why the scripters get paid the big bucks right ;)
Page «Previous 1 2