Jump to content


Sinsation

Member Since 30 Mar 2012
Offline Last Active Apr 30 2012 03:59 AM

Posts I've Made

In Topic: Random "Specific" Cluster Generation

20 April 2012 - 04:15 AM

Hey, watch the double posting. It's meant to be 48 hours between posts.

Well, I now know what the trunk of the tree looks like. :biggrin:

I'm not sure how to go about explaining this. You'll need to be pretty good with code.. it isn't really hard, but it's not exactly trivial.

O.k. say you want branches. You grab 2-3 +1 the very top block of the tree (references)

You then just extend out from there.

//with one of those pieces in the tree.

choose a direction (left,right)
create 3-4 blocks in that direction. Maybe also go up/down a little.. I'm not sure.
//do this with the other pieces.

Anyway, that's the basic gist for the tree 'top'.

You have the top part of the tree, right? You get a reference to it, we'll just refer to it as 'top_of_tree'

Well, there are only 3 places where he can create a leaf. Up, left, and right. And we probably want him to do all 3.

Say he creates a leaf block Just above him. He can now tell that leaf block 'check the 4 square around you. If there isn't a leaf block there,
then *randomly* decide whether or not to place a leaf there.

He does with with the the leaf he created to the left, and to the right.

You then end up with a small 'shrub' on top of the tree. Probably too small, but you can use the same idea to continue to 'sprout' more leaves from the end leaves that you've got.

Okay, so that's ONE way that I thought of.

The other way is, at top_of_tree, create 6 (more or less) objects.
These would be special objects. They only exist for this 1 step, and then they are destroyed.
What they would do is they each get a direction. (one pointing left-ish, one pointing right-ish)
They move randomly in that direction, sticking to a 32x32 grid. They do the movement 'instantly'.. all in 1 step.
Move, check if a leaf is there. If not, then create one. move again, repeat. If I've moved more than 6-8 blocks, then delete!

You'll end up with a random pattern, spreading out from the center of the tree. A bit rough, but.. well. :tongue:
This method is a bit 'easier' than the first one I mentioned. If you wish, you can even define a few paths in the path editor, which these objects could hop along (or at least ,a few of them) so you have control on how randomly created things are.

(you could, of course, not even use any objects at all, and just use pure code. But you may find using objects easier)



Im a fairly decent coder and can work most things out in my head but there are several things that just get me confused.
I suppose thats why they have sections like this though so if you get stuck on something you can ask the community for help.
Its been a few years since Ive worked with game maker, so some things are quite new to me. Anyways thanks for the help, Ill let you know how it turns out.

Edit: Got it working right now, fairly basic and I plan on making it a tad more advance but its completely random as is and you do get some silly leaf formations.
You can check it out right here: http://sandbox.yoyog...2d---my-version

In Topic: Random "Specific" Cluster Generation

20 April 2012 - 01:31 AM

*bump* any help guys?

In Topic: Random "Specific" Cluster Generation

19 April 2012 - 02:57 AM

Screenshot?

I've got an idea of how to go about doing something like that, but I'd like to see a pic. (I don't play minecraft, I've only got a general idea of what you're up to)


Sorry for the double post but I forgot to reply to let you know the screenshot had been posted.

In Topic: Random "Specific" Cluster Generation

17 April 2012 - 10:04 PM

Ill get the screenshot in a bit and edit this post with it in.

Edit:
Posted Image

In Topic: Random "Specific" Cluster Generation

17 April 2012 - 04:18 AM

All the blocks are 32 x 32 and I want it all to be connected to either a wood block or a leaf block.
The wooden blocks are all straight up and down.