How to procedurally (create) grow an artistic (2D) tree in real-time (L-System?)

Recently I programmed an L-system module, It got me interested further. I am a Plants vs Zombies junkie as well, really liked the concept of Tree of Wisdom. Would love to create similar procedural art just for fun and learn more.

Question: How should I approach the process of creating an artistic tree (2d perhaps with fixed camera/perspective) dynamically?

Ideally I would like to start with a plant (only a stem with a leaf) and grow it dynamically using some influence (input/user action) over its structure. These influences may result in different type of branching, curves in branches, its spread, location of fruits, color of flowers, etc. Want it to be really full of life/spirit. :)

Plants vs Zombies: Tree of wisdom It would be great to dynamically grow a similar tree, but with lot more variation and animations happening.

My Background: Programmer, have used few game engines (Ogre3d, cocos2d, unity). Haven't really programmed directly using openGL, trying to fix that :).

I am ready to spend considerable time, Please let me know about the APIs? and how would an expert like you would take on this problem?

Why 2D? I think it's easier to solve the problem only considering 2 dimensions.

Artistic inspirations:

The large tree (visible branches, green leaves, flowers, fruits, etc) on the left, behind monkey.

PixelJunk's Eden (Art style inspiration).

Procedurally Generated Apple Tree using Fractals

Please let me know if it was easy for you to understand the question, I may elaborate further.

I hope a discussion of various approach would be helpful for everyone. You guys are awesome.

• I may not have an answer for you, but I'd definitely like to see where this goes. Awesome concept! – Bloodyaugust Mar 10 '11 at 5:15
• Great question, I've been interested in L-Systems for a while but haven't done anything with that interest :) – Luther Mar 10 '11 at 11:58
• One more reference art. jinsonathemes.com/demo3/wp-content/uploads/2011/02/… – lal Mar 31 '11 at 23:58
• @Stephen just so you know this question is from 2011 and got necro'd to the top by the user asking the question editing out Student/ from Student/Programmer – PeterT Sep 5 '13 at 21:21
• @lalan Please only make edits that are substantial to the question, the fact that you're not a student anymore is not a substantial change, or reason to edit. – MichaelHouse Sep 6 '13 at 0:19

Do take a look at ABOP (Algorithmic Beauty of Plants):

http://algorithmicbotany.org/papers/#abop

Its free online now, and has a very in-depth view of L-systems and plants.

• Promt the user for a name for his tree first. Use that name to generate a seed for the algorithm. So every name will have it's unique tree. The seed could also influence the type of foliage and fruit of the tree.
• You could implement some sort of "tree tamagotchi" where the tree grows bigger and nicer the more the user cares about it (fertilize, water, etc.)
• Create a highscore list of the highest trees. Another idea would be to show heights and names of other users next to your tree. So you can compare your tree height directly to other users. See this video as an example. The clouds indicate the height other users have accomplished.

There are lots of algorithms and papers for procedural tree generation out there (this thread might be interesting). A difficult task is to nicely blend the branches. 2D is definitely going to be easier in that regard, since you can solve that with alpha-blending.

Since you're experienced with Ogre3D, Unitiy and cocos2d you can go right ahead and implement that thing (no need to start learning OpenGL now IMHO). Personally I'd choose cocos2d and release for iPad and/or iPhone, so that everybody can carry his tree around with his mobile device.

• I'd by that game just to play with L-Systems in a social/competitive way. – deft_code Mar 10 '11 at 15:44
• Thanks for pointing me to gamedev thread.. Nice ideas, tamagotchi and goo-tower.. mobile application would be really cool. found a 3DS Max plugin video -- which is quite awesome link.. – lal Mar 10 '11 at 18:42

Context-Free and it's 3D counterpart StructureSynth could be an excellent basis or inspiration.

Examples:

These days you could write an online visualiser in WebGL!