Categories
Nature of Code

Grow a Wheat Field

📌 Assignment

Using the random walker as a model, develop a sketch that experiments with motion.

✍️ Process

For this week’s assignment, I began by just playing around with the random walker base code that we were given.

Walker with random colors

I tried changing the stroke weights, stroke colors, and the step amount. This was all well and good but I decided I wanted to create a sketch that emulated something found in the real world. I recalled having watched this video (which I think is just a rip-off of a coding train video) for a project last semester and wanted to attempt to create a tree generator using random walkers.

I decided to utilize randomGuassian to create a random walker that will most often increment its y position but will occasionally trail left or right. (shown above)

I then played around with mapping the standard deviation to the y-value so that it was more likely for the line to travel left or right as it traveled up the ‘tree.’

Here, I got kind of stuck on my tree idea. I was having trouble figuring out the best way to generate realistic branches. The problem with the random walkers I was using is that they had an equal chance of going left as going right, meaning they double back on themselves and created a generally straight line with a few curves. I needed to create some sort of variable that allowed the stroke to favor one direction or the other.

This screenshot is from when I only had one grower (taking several minutes to generate)

I decided, in the interest of time, to shift ideas. In some of my earlier tests I realized that the wobbly vertical lines looked a lot like grass or wheat stalks. So, I limited the height of the lines and added a grower object so that multiple stalks could be growing at one time. The amount of objects is limited to 10 just because I felt that if it was too high, you kind of missed out on the fun generation action.

🤭 Final Project

My main constraint with this project was time. I started it with not enough time to fully build out the tree grower and had to settle for a quicker simulation. I do, however, feel I have a strong grasp of how random walkers function and how randomGaussian works. Using the growers as an array of objects was also a good refresher for how that process works in p5.

Future Developments

  • User control – sliders to manipulate the height/amount of grass
  • Wind simulation – wind that blows the grass left or right in a realistic manner
  • Tree grower – finish the tree grower and find a way to make it look realistic

Questions

I had a small issue with randomGuassian: If I set the mean value to 10 and used 9 and 11 as the two limits for switching between movement directions, the wheat favors growing right.

Thus, I had to use the limits of 8 and 11, which doesn’t seem to make sense, but this makes the wheat grow equally left and right. Why would this be happening? Also, sorry if this makes no sense!

Leave a Reply

Your email address will not be published. Required fields are marked *