Tuesday, January 26, 2010

Nature Of Code: Flowers and Wind


For our first week in Nature Of Code, we were asked to do the following:

Find an example of real-world "natural" motion and develop a set of rules for moving the Walker. Can you do it without using any random whatsoever? Without changing how the square looks at all (changing size or rotation is ok), can you give it a personality or make it appear to have an emotional quality? Create a second version with the same behavior, but with your own non-square design. Feel free to design an environment for the Walker to live in as well. We'll compare the versions in class next week. Can we create something natural through algorithmic behaviors alone? How much does visual design play a part?

Inspiration.
I took my inspiration from the PlayStation 3 game Flower (see video above), and attempted to model flowers (namely, dandelions) being detached and floating in the wind.  As per the request, I created two versions, one that used pure geometrics, and one with more visualization.

Implementation.



The first visualization uses squares and lines (along with modeled wind) to gradually harvest the dandelion buds from their stems.  While the representation is geometric, I actually think the visualization has enough clarity, or familiar layout, that it's pretty clear what's happening.


 
 
The second animation uses the same code, but with color and small dandelion gifs to create a better sense of what's going on.  While the original visualization creates a semi-clear representation, the second implementation unquestionably does a slightly better job.  The colors and gifs create and animated, cartoony feel that successfully portrays the objects in question.

Challenges.
Both implementations use the same modeling for the wind, which uses vectors and random numbers to specify when buds disconnect, and how they move once disconnected.  Coding the disconnect was simply a matter of randomly disconnecting at a pace that was seldom enough to feel natural.

The wind was far more of a challenge, and required figuring a pace of wind change that didn't seem too fast, or too slow.  I eventually managed to stumble upon a combination of changing acceleration, changing direction, and avoidance of downward wind, that seemed to grasp the idea well.

My main challenge (which I still have yet to solve) is that the iteration over the flower array to update each vector results in an occasional pause in the motion which is highly unnatural, and definitely not desirable.  I need to investigate this further, and determine if there's a more efficient way to update the objects, or if I need to reduce something algorithmically within the update.

Takeaway.
Short version: making things move naturally is hard.

Long version: I had difficulty implementing any kind of movement that felt natural without using randoms.  Even once I started using randoms, the implementation was largely one of trial and error, seeing what looked and "felt" natural, and elaborating on that.

Source Code: Zip File with Source Code and gif (Please note that the sketch is done in eclipse, and will not work in a regular Processing environment.)

No comments:

Post a Comment