Plants uses game development techniques but is not a game: It is a research-driven interactive simulation that encourages exploration and discovery through play. I was responsible for many of the app’s mini-simulations:
- Animal behavior
- Stars and moon phases
- Fire propagation
- OpenGL shader effects, including: Fire, Smoke, Ice, Grass & Cloud Animations
- Dynamic scene generation & object placement
Development used Objective-C, Cocoa Touch, the Cocos2D sprite framework, the Chipmunk2D physics library, and GLSL.
About the Animal Simulation
The animal behaviors had to conform to Tinybop’s research on each animal’s seasonal activities, as well as their nocturnal or diurnal behaviors. A data-driven behavior system was created that read in specially prepared data created in a spreadsheet.
At runtime, the simulation system created a dynamic finite state machine for each animal that adapted as days, seasons and weather changed. Randomness was added by assigning probabilities to actions, and a simple hierarchy of needs prioritized each animal’s need to eat, sleep, flee from predators, or escape natural disasters such as a fire.
Animal pathfinding is multi-level: At the first level, an underlying grid of tagged zones guides the animal’s, foraging and shelter-seeking behaviors using the A* algorithm. (This same grid also controls dynamic environmental effects such as the spread of grass fires in the Pampas.) Once a coarse path was plotted, ray casting handled local obstacle avoidance, allowing animals to walk around trees or jump over streams.