I'm working on a platform game, and recently came across the idea of a random tree generator. Realizing that this could provide a really interesting look to my backgrounds, I thought it'd be fun to try to build one myself, but holy cow do I not know where to begin. Any ideas?
first off, make posts about getting help, in the HELP forum. your tutorials is made for tutorials obviously.
where to start?
well first off, do you know about the random expression?
random(VALUE) it a random number between 0 and what you input. remember that if you put a number, its not going to ever return the number you gave, but instead integer every number below it including 0. so random(10) would give you 0,1,2,3,4,5,6,7,8,9 but never 10.
after you know about that expression your gonna need an object for branches, that you spawn and then at its end you spawn more branches, always setting theyre length and angle to a random value.
then youd need some cutoff point and a leaf spawner. not gonna go into anymore detail you figure it out!
And so on...
Well I had this all wrong. I thought he wanted random trees for a side scroll-er. In that case I would have used the same tree and and had the game do the random(VALUE) as QuaziGNRLnose suggested and then have random sizes of the same tree.
Nice example SacceuS.
Thanks for the help guys, this is the idea, for sure, something I can use to generate different looking trees randomly, and then be able to use them in the background of a platformer. Sorry about posting in the wrong section, I'm still somewhat new to forums.
I've thought about using L-systems to make a screensaver, just haven't gotten around to it, hope that helps.
Wow, that's intense, but I'll be sure to give it a good read
so I'm reading about l-systems, and they're starting to make sense, but how do I implement them in Construct?
Weird. I hadn't seen this thread, but I started making random trees the same day it kicked off.
I was using an approach like the one Quazi was talking about - branches spawn smaller branches until you have a tree (using randomisation at each step).
Here's the cap:
And EXE, in case you have an older version (I'm on .84, the latest):
Press Q to grow the trees by one step. You should probably stop after about 8-12 steps, because the number of branches increases exponentially.
I haven't gotten foliage working yet. I had something that looked reasonably good, but it's ridiculously resource-intensive (and so I ended up having to paste it into a Canvas object after, which really reduces the amount of stuff like wind effects you could do). A lot of the fractal trees I've seen in 3d actually used a very similar method to make the foliage after the branches were done, so I might try that.
(If you like how this approach looks and want to use it, I'll see if I can make up a cleaner .cap so you can see how it works - there's a lot of crappy, leftover, and unrelated eventing in the current one.)
Develop games in your browser. Powerful, performant & highly capable.
your cap looks very cool, I'll be sure to have a better look at the workings and see what I can learn from it. Ultimately, what I want is to be able to have a set of randomized variables to control things like tree type, branch placement, foliage colour, bark colour, and things like that. But this looks like a good start for sure.