# a place where one brach comes off another class junction: def __init__(self, branch): self.generation = branch.generation self.theta = branch.theta self.phi = branch.phi step = 1.0/junctions_per_branch
def mainloop(): global branches global leaves branches =  junctions = 
current_generation = 1
while current_generation <= max_generation: #for every junction add a branch for i in junctions: branches.append(branch(i)) junctions = 
#for each branch keep adding junctions until they all have the right number repeat = True while repeat: found_one = False for i in branches: if i. generation == current_generation and i.number_of_children <= junctions_per_branch - 1: junctions.append(junction(i)) found_one = True if not found_one: repeat = False
current_generation += 1
leaves = 
for i in junctions: leaves.append(leaf(i))
running = True while running: for event in pygame.event.get(): if event.type == pygame.QUIT: running = False elif event.type == KEYDOWN: if event.key == K_ESCAPE: running = False if event.key == K_SPACE: mainloop()
Posts : 188 Reputation : 7 Join date : 2013-01-29 Age : 16 Location : Houston, Texas
Subject: Re: Proceedural Tree Generator Sat Feb 21, 2015 2:20 pm
Neat! It might not work for Thrive if plants will be alive (heh rhymes), since the player's supposed to have the chance to actually play as them if they take that direction in the Multicellular Stage. Then again, this COULD be applied to them growing, since not all the player's plants'll turn out the same, with evolution limited to certain parameters (general shape, etc.). Stats could be attached to them and have the organism procedurally change accordingly. I dunnno.
Subject: Re: Proceedural Tree Generator Sat Feb 21, 2015 2:56 pm
I think the game will look very different if you are playing as a tree. This prototype is more like a tiny step towards being able to procedurally generate a landscape for your animal to wander around in. We're going to need whole forests of different trees.
He's working on a game, I can't really say too much about it but suffice to say your dragons can get shot down by Tesla coils, so it's going to be awesome and crazy.