Chapter 0

Getting Started

Understanding life-like behaviour is a fascinating pursuit of the sciences that tries to characterise the qualities of physical entities which helps us to distinguish between life and non-life. This pursuit has major implications in various fields of science. For example, when we model life through some known characteristics, it allows us to observe patterns that can guide progress in discovering more characteristics of the biology of life; it also helps us confirm observations/behaviours we see as a natural consequence of the model. Which is not only useful to understand ourselves better, but could also help us better search for life outside our planet.

Note about the primary resource:

All the phenomena that are simulated in this project are heavily influenced and inspired by the Nature of Code [Schiffman 24] online book. Therefore, both the progression of concepts in chapters, and ideas of the simulation possess resemblance to Schiffman’s book.

But this project also wishes to depart and go further than the book in a few aspects.

  1. The main goal of Schiffman is to teach (creative) coding techniques and algorithms and how to develop models in a basic object-oriented manner, through examples in natural phenomena. The main goal of this project is to understand motion phenomena better, and therefore, I focus on building up from every previous step to larger and larger models till the end of the project.
  2. This causes the implementation of ideas/algorithms to look different. Although Schiffman also builds on ideas previously visited, each topic/technique is itself isolated where there are references made to other parts, but the code is rewritten (sometimes changed to better suit the context). While code in this project is written with the intention of being modular/reusable, and if a piece of code needs to be rewritten, we will go back to the initial creation of it, and make it more general.
  3. Schiffman also ignores some coding conventions (for eg: variable naming), as the focus is to inculcate algorithmic thinking. But, in this project such conventions are more strictly followed because of the following reasons:

Therefore, in this project we are approaching the question of “What makes life, life?” through the lens of motion phenomena of physical entities and with the eyes of computer simulation. We take interest in motion phenomena because natural phenomena cover a broad area of topics, therefore focusing on a particular section of it lets us dive deeper into more elaborate models. Hence, providing further insight into the various characteristics (or components) of natural phenomena. Motion is also chosen because it integrates with animated simulations (i.e. the visualisation aspect) and Object Oriented Programming easily, which is the core engine of the simulations in this project, especially the p5.js library that we will be using.

Flow of content:

We will try to understand what makes motion phenomena natural-looking / life-like by looking at three specific components of such phenomena - physics of motion, randomness, and autonomy. One can think of this as creating an environment with a set of governing rules (the physics), and allowing the entities in it to act (autonomy), but also allow for uncertainty within the environment and the actions of the entities (randomness).

In the 1st chapter, we explore how to animate and model our required physics for motion simulation with the help of vectors and Euler integration to simulate the laws of physics. The chapter also discusses how such models often look at the limitations of the modelling environment (here computers) but also accounts for limitations of the viewer which allows us to reduce the complexity of the model.

In the 2nd and 3rd, we study how randomness is generated in computers and how to simulate entities that move randomly but also with other desired characteristics. For example, we try to achieve ‘smooth’ walkers by both restricting parameters of the distributions and applying the generated random numbers to different quantities. But, also introduce an algorithm (Perlin Noise) specifically intended to achieve this quality. Lastly, the chapters also elaborate on how one can use these simulations in order to better understand the distribution and algorithms which produced them.

Then we define what autonomy is and provide a hierarchical classification of autonomous agents in the 4th chapter. A key coding technique called Inheritance is explored, to showcase the relationship between how both nature and code evolve. We also simulate a wandering autonomous agent and compare it with other randomly moving entities created previously, and make observations trying to distinguish one from another - autonomous and not.

Finally, in 5th chapter we devise a model for multi-agent systems based on the particle system introduced in 2nd chapter and the implementations given by [Reynolds 99], [Schiffman 24]. Using the model and all the components of natural motion that have been explored until now, we create a flock of entities each acting based on their individual perception and we observe the emergent behaviours of the entire system.

0.1 Prerequisites

0.2 p5 Basics

0.2.1 p5.js terminology

Sketch

Canvas

Look at Appendix to learn how to run the code written in this project.

0.2.2 Common functions

0.3 Assumptions