ENCODED BEHAVIOUR 200 Lines of Code and a Video
Instructor - Shajay Bhooshan Cheolyoung Park | Jamil Al Bardawil | Jonathan Zisser | Pin-ju Wang
TABLE OF CONTENTS INTRODUCTION: ENCODED BEHAVIOUR
4
CHAPTER 1: ATTRACT/REPULSE, FORCE TRACE AND GRID BASED BEHAVIOUR
6
CHAPTER 2: FLOCKING AND PATH FOLLOWING
22
CHAPTER 3: STIGMERGY
42
CHAPTER 4: MESH GENERATION
54
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
ENCODED BEHAVIOR Through the exploration of coding and programming, we tested how a particle with no intelligence could be converted into an object with behavior and intelligent movement. What was achieved in this workshop was a set of explorations of multiple sets of behaviors and settings of forces on single and sets of particles and how the changing of behavioral attributes even in small amounts on certain parameters could impact the entire simulation. The simulations started with based behavioral control on a low quantity set of particles and then the exploration moves into defined patterns which are inspired by nature like flocking and stigmergy as well as some force field manipulations and as shown below, each chapter will exhibit what was used as far as parameters to achieve each behavior as well as the changing behaviors correlating to the changing parameters. In most of our scripts, it mainly consist of the following parameter: 1 - The position(p), which defines the location of the agent, and the velocity(v) which defines the speed and direction of the agent. 2 - The range of vision (RangeofVis), according to which the agents can sense their surrounding and sense each other. 3 - Upon sensing each other, the agents can act in different ways: They can collide(coh), separate(sep), wander(wan), align(ali), or follow each others trails.(tra) The above parameters are local rules, which when changed could provide a coherent smart system of the swarming behavior. The main objective of the scripts below are the following: -To change the local parameter (bottom-up design approach), learn and possibly create stigmergy patterns. Therefore, each script has a unique factor for the range of vision, the number of agents, and starting points of these agents. The agents also are given different velocities and forces. Moreover, the cohesion, separation, alignment, and wander vectors are also manipulated in many of the codes to provide possible different interesting combinations. In some of the codes, the types of agents change according to a specific set of rules which are defined.
4 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 5
CHAPTER 1: ATTRACT/REPULSE, FORCE TRACE AND GRID BASED BEHAVIOUR
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
ATTRACT AND REPULSE LOGIC Attract and repulse is a study of force fields applied on a set of particles. Different outcomes can be achieved through the alteration of parameters below: -Rates of repulsion and attraction of the core controllers -Rates of repulsion and attraction amongst the particles The simulations exhibit the behavior of the particles when such force fields are applied, also the different results of patterns when the force fields and the class particle properties are manipulated.
TYPE 1
TYPE 2
TYPE 3
particle number: 500 attraction range: 0 repulsion range: 20
particle number: 500 attraction range: 30 repulsion range: 20
particle number: 1500 attraction range: 30 repulsion range: 20
TYPE 4
TYPE 5
TYPE 6
particle number: 200 attraction range: 30 repulsion range: 20
particle number: 500 attraction range: 30 repulsion range: 0
particle number: 500 attraction range: 40 repulsion range: 20
DIAGRAM
8 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 9
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 1
TYPE 2
CODE
CODE
Particle number of 500 and repulsion magnitude of 0.2 and attraction magnitude of 2.5 are given as fixed variables.
Particle number of 500 and repulsion magnitude of 0.2 and attraction magnitude of 2.5 are given as fixed variables.
The parameters of this code are:
The parameters of this code are:
for (int i = 0; i < totalNum; i += 1) { float d = pos. quareDistanceTo(chargePoints[i]); if (d < 1e-6) continue; dir += ((chargePoints[i] - pos) / d) * -1; }
for (int i = 0; i < totalNum; i += 1) { float d = pos. quareDistanceTo(chargePoints[i]); if (d < 1e-6) continue; dir += ((chargePoints[i] - pos) / d) * -1; }
Frame 1
Frame 45
Frame 97
and
and
for (int i = 0; i < totalNum; i += 1) { float d = pos. squareDistanceTo(allStoredPoints[i].pos); if (d < 1e-6) continue; if (d < 5 * 5) dir += ((allStoredPoints[i].pos - pos) / d) * -1; }
for (int i = 0; i < totalNum; i += 1) { float d = pos. squareDistanceTo(allStoredPoints[i].pos); if (d < 1e-6) continue; if (d < 5 * 5) dir += ((allStoredPoints[i].pos - pos) / d) * -1; }
Frame 127
Frame 155
Frame 32
Frame 67
Frame 98
Frame 125
Frame 148
Frame 197
Frame 258
The agents are affected by the attraction and repulsion range of the core controllers
The agents are affected by the attraction and repulsion range of the core controllers attraction range: 0 repulsion range: 20 trail size: 200
Frame 196
Frame 9
attraction range: 30 repulsion range: 20 trail size: 200 Frame 243
10 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
Frame 297
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 11
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 3
TYPE 4
CODE
CODE
Particle number of 1500 and repulsion magnitude of 0.2 and attraction magnitude of 2.5 are given as fixed variables.
Particle number of 200 and repulsion magnitude of 0.2 and attraction magnitude of 2.5 are given as fixed variables.
The parameters of this code are:
The parameters of this code are:
for (int i = 0; i < totalNum; i += 1) { float d = pos. quareDistanceTo(chargePoints[i]); if (d < 1e-6) continue; dir += ((chargePoints[i] - pos) / d) * -1; }
for (int i = 0; i < totalNum; i += 1) { float d = pos. quareDistanceTo(chargePoints[i]); if (d < 1e-6) continue; dir += ((chargePoints[i] - pos) / d) * -1; }
and
Frame 13
Frame 42
Frame 70
for (int i = 0; i < totalNum; i += 1) { float d = pos. squareDistanceTo(allStoredPoints[i].pos); if (d < 1e-6) continue; if (d < 5 * 5) dir += ((allStoredPoints[i].pos - pos) / d) * -1; } The agents are affected by the attraction and repulsion range of the core controllers attraction range: 30 repulsion range: 20 trail size: 200
12 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
Frame 140
Frame 182
Frame 66
Frame 93
Frame 133
Frame 172
Frame 228
Frame 251
Frame 274
and for (int i = 0; i < totalNum; i += 1) { float d = pos. squareDistanceTo(allStoredPoints[i].pos); if (d < 1e-6) continue; if (d < 5 * 5) dir += ((allStoredPoints[i].pos - pos) / d) * -1; }
Frame 103
Frame 31
The agents are affected by the attraction and repulsion range of the core controllers attraction range: 30 repulsion range: 20 trail size: 200
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 13
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 5
TYPE 6
CODE
CODE
Particle number of 500 and repulsion magnitude of 0.2 and attraction magnitude of 2.5 are given as fixed variables.
Particle number of 500 and repulsion magnitude of 0.2 and attraction magnitude of 2.5 are given as fixed variables.
The parameters of this code are:
The parameters of this code are:
for (int i = 0; i < totalNum; i += 1) { float d = pos. quareDistanceTo(chargePoints[i]); if (d < 1e-6) continue; dir += ((chargePoints[i] - pos) / d) * -1; }
Frame 17
Frame 56
Frame 97
for (int i = 0; i < totalNum; i += 1) { float d = pos. quareDistanceTo(chargePoints[i]); if (d < 1e-6) continue; dir += ((chargePoints[i] - pos) / d) * -1; }
and
and
for (int i = 0; i < totalNum; i += 1) { float d = pos. squareDistanceTo(allStoredPoints[i].pos); if (d < 1e-6) continue; if (d < 5 * 5) dir += ((allStoredPoints[i].pos - pos) / d) * -1; }
for (int i = 0; i < totalNum; i += 1) { float d = pos. squareDistanceTo(allStoredPoints[i].pos); if (d < 1e-6) continue; if (d < 5 * 5) dir += ((allStoredPoints[i].pos - pos) / d) * -1; }
Frame 129
Frame 152
Frame 177
The agents are affected by the attraction and repulsion range of the core controllers
The agents are affected by the attraction and repulsion range of the core controllers
attraction range: 30 repulsion range: 0 trail size: 200
attraction range: 40 repulsion range: 20 trail size: 200 Frame 199
14 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
Frame 217
Frame 34
Frame 59
Frame 79
Frame 103
Frame 142
Frame 173
Frame 195
Frame 217
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 15
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
FORCE TRACE DIAGRAMS
LOGIC By setting a relationship between Particles points and Charging points a curvilinear movement is created. The Charging points can be either attractive or repulsive with respect to Particle points. Thus, choreography of movements leads to different behaviors according to different settings. In this code, the key press features have been added in order to have greater control on chronology and directions of moving points.
REPULSE
REPULSE
ATTRACT
16 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 17
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
CODE Class moving points(); Add Force NearestNeighbor(); Add Force ElectricCharge(); else if ..(compute == #num of point) Add Force Repulsion(); Reset();
FRAME 12
KEY PRESS ‘A’
FRAME 27
FRAME 38
addForce_ElectricCharge: *10 Repulse: 2
KEY PRESS ‘D’
FRAME 61
addForce_ElectricCharge: *5 Repulse: 2
18 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
FRAME 79
KEY PRESS ‘D’ addForce_ElectricCharge: *5 Repulse: 2
KEY PRESS ‘S’
FRAME 49
addForce_ElectricCharge: *7.5 Repulse: 2
FRAME 92
FRAME 125
KEY PRESS ‘A’
FRAME 147
addForce_ElectricCharge: *10 Repulse: 2
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 19
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
GRID BASED BEHAVIOUR LOGIC
DIAGRAMS
The Grid is a feedback mechanism simulating an enviorment in which Class of Particles behave under different forces. Particles affect the environment by creating chemical reactions whenever they collide withe the Chemichal Grid. Sabsequently, the chemicals affect the direction of neighbour particles , later a point in time. the direction which has the higher amount of chemical created will be the most likely by the Particles to take, as more attracting forces are applied. (thus, the shortest path is chosen because it is the one who is less affected by degeradation of chemichal emmitted - the Particles more frequently renew the chemical created in the shortest path).
TYPE 1
TYPE 2
TYPE 3
nearest attraction: 0 repulse: 1.75 self repulse: 0
nearest attraction: 0 repulse: 1.75 self repulse: 0.1
nearest attraction: 1.35 repulse: 1.75 self repulse: 0
TYPE 4
TYPE 5
TYPE 6
nearest attraction: 1.75 repulse: 1.35 self repulse: 0
nearest attraction: 0.5 repulse: 0 self repulse: 1.5
nearest attraction: 0.7 repulse: 0.6 self repulse: 0.6
CODE Class Chem_Grid(); Class Particles(); Void Check points inside cells(); For (...) {map value} Add Force Chem_Grid();
20 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 21
CHAPTER 2: FLOCKING AND PATH FOLLOWING
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
FLOCKING LOGIC Flocking is the behavior exhibited when a group of particles, called a flock, are foraging or in flight. It is considered an emergent behavior arising from simple rules that are followed by individuals and does not involve any central coordination where each particle takes position in relation to the position of the next one. The parameters that are used for the simulation are: alignment, repulse rate, cohesion rate and number of particles. The agents follow the following rules: -If a corner, be attracted to the three other corners very slightly. -If not a corner, be attracted to the two closest corners with great, but equal, strength. That is, the output force vector of this rule is the sum of two vectors of magnitude f. Note that when an agent is on the line formed by its two closest corners, the forces cancel each other out. -Avoid any agents that get too close.
TYPE 1
TYPE 2
TYPE 3
particle number: 700 alignment value: 1 separation value: 0.12 cohesion value: 0.15
particle number: 500 alignment value: 0.8 separation value: 0.5 cohesion value: 0.15
particle number: 300 alignment value: 0.8 separation value: 0.12 cohesion value: 0.8
TYPE 4
TYPE 5
TYPE 6
particle number: 250 alignment value: 0.8 separation value: 1 cohesion value: 0.15
particle number: 500 alignment value: 2 separation value: 0.12 cohesion value: 0.15
particle number: 500 alignment value: 0.1 separation value: 0.12 cohesion value: 0.1
DIAGRAM
24 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 25
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 1 CODE Particle number of 700 and rangeOfVis of 20 is given as a fixed variable. The parameters of this code are: For (int I = 0; i<700; i++) { Vec3D p= new Vec3D(random(30,90), random(30,70), 0); Vec3D v= new Vec3D(random(-10,10),Random(-10, 10), 0); The agents start from a central box and then spread over the whole simulation. The velocity is a high range between 10 and -10 which means the agent could continuously move in both directions. coh.scaleSelf(0.15); sep.scaleSelf(0.12); ali.scaleSelf(1); wan.scaleSelf(0.3);
26 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
Frame 27
Frame 43
Frame 62
Frame 93
Frame 112
Frame 137
Frame 169
Frame 188
Frame 221
Frame 277
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 27
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 2
TYPE 3
CODE
CODE
Particle number of 500 and rangeOfVis of 20 is given as a fixed variable.
Particle number of 300 and rangeOfVis of 20 is given as a fixed variable.
The parameters of this code are: For (int I = 0; i<500; i++) { Vec3D p= new Vec3D(random(30,90), random(30,70), 0); Vec3D v= new Vec3D(random(10,10),Random(-10, 10), 0);
The parameters of this code are: For (int I = 0; i<300; i++) { Vec3D p= new Vec3D(random(30,90), random(30,70), 0); Vec3D v= new Vec3D(random(10,10),Random(-10, 10), 0);
The agents start from a central box and then spread over the whole simulation. The velocity is a high range between 10 and -10 which means the agent could continuously move in both directions.
The agents start from a central box and then spread over the whole simulation. The velocity is a high range between 10 and -10 which means the agent could continuously move in both directions.
Frame 22
Frame 59
Frame 77
Frame 94
coh.scaleSelf(0.15); sep.scaleSelf(0.5); ali.scaleSelf(0.8); wan.scaleSelf(0.3);
Frame 11
Frame 35
Frame 72
Frame 85
Frame 107
Frame 128
Frame 158
Frame 179
coh.scaleSelf(0.8); sep.scaleSelf(0.12); ali.scaleSelf(0.8); wan.scaleSelf(0.3);
Frame 133
Frame 169
28 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
Frame 202
Frame 254
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 29
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 4
TYPE 5
CODE
CODE
Particle number of 250 and rangeOfVis of 20 is given as a fixed variable.
Particle number of 500 and rangeOfVis of 20 is given as a fixed variable.
The parameters of this code are: For (int I = 0; i<250; i++) { Vec3D p= new Vec3D(random(30,90), random(30,70), 0); Vec3D v= new Vec3D(random(10,10),Random(-10, 10), 0);
The parameters of this code are: For (int I = 0; i<500; i++) { Vec3D p= new Vec3D(random(30,90), random(30,70), 0); Vec3D v= new Vec3D(random(10,10),Random(-10, 10), 0);
The agents start from a central box and then spread over the whole simulation. The velocity is a high range between 10 and -10 which means the agent could continuously move in both directions.
The agents start from a central box and then spread over the whole simulation. The velocity is a high range between 10 and -10 which means the agent could continuously move in both directions.
Frame 7
Frame 25
Frame 44
Frame 67
coh.scaleSelf(0.15); sep.scaleSelf(1); ali.scaleSelf(0.8); wan.scaleSelf(0.3);
Frame 27
Frame 66
Frame 107
Frame 152
Frame 198
Frame 244
Frame 260
Frame 288
coh.scaleSelf(0.15); sep.scaleSelf(0.12); ali.scaleSelf(2); wan.scaleSelf(0.3);
Frame 86
Frame 102
30 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
Frame 127
Frame 156
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 31
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 6 CODE Particle number of 500 and rangeOfVis of 20 is given as a fixed variable. The parameters of this code are: For (int I = 0; i<500; i++) { Vec3D p= new Vec3D(random(30,90), random(30,70), 0); Vec3D v= new Vec3D(random(-10,10),Random(-10, 10), 0); The agents start from a central box and then spread over the whole simulation. The velocity is a high range between 10 and -10 which means the agent could continuously move in both directions. coh.scaleSelf(0.1); sep.scaleSelf(0.12); ali.scaleSelf(0.1); wan.scaleSelf(0.3);
32 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
Frame 17
Frame 42
Frame 71
Frame 99
Frame 131
Frame 165
Frame 199
Frame 227
Frame 250
Frame 287
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 33
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
PATH FOLLOWING LOGIC The inputs are agent-based, meaning the column starts at certain coordination points and ultimately moves to end points (ie. targets) following specific paths. These paths can also be described as the desired velocity. The code guides the agents through so called steering to stay inside of the cylinder measurements. The agents are, as a response, attracted to the middle of the column. The Data Dam collects the agents with the network between adjacent points. After that, the velocity lines can become visible as well as the network lines. As soon as the multi-agent column is built up, the Variable Sweep makes the growing towers apparent. These multiple towers together create the column. The growing of the column happens in a bottom up manner.
TYPE 1
TYPE 2
TYPE 3
Particle Path: 1 Particle Number: 400 Trail Size: 200 Rotation Trigger: 6
Particle Path: 2 Particle Number: 300 Trail Size: 200 Rotation Trigger: 8
Particle Path: 3 Particle Number: 400 Trail Size: 200 Rotation Trigger: 6
TYPE 4
TYPE 5
TYPE 6
Particle Path: 4 Particle Number: 200 Trail Size: 200 Rotation Trigger: 3
Particle Path: 5 Particle Number: 500 Trail Size: 200 Rotation Trigger: 4
Particle Path: 6 Particle Number: 400 Trail Size: 200 Rotation Trigger: 3
The input of the data guides the agents to go randomly to the top, but to be kept inside a radius of 20. The output is that the randomness is combined with the steering and the velocity.
DIAGRAMS
34 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 35
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 1
TYPE 2
CODE
CODE
400 agents are initialized from the bottom of the cylinder. Type one agent move in z-axis within the given environment of cylinder with rotation trigger of 6.
300 agents are initialized from the bottom of the cylinder. Type one agent move in z-axis within the given environment of cylinder with rotation trigger of 8.
Type two agents are influenced by the movement of Type one agents, with a range of vision of 200, and traverse the environment following the trails of Type one.
Type two agents are influenced by the movement of Type one agents, with a range of vision of 200, and traverse the environment following the trails of Type one.
The agents eventually begin swarming around in clumps, without ever really setting down due to their increasing wander.
FRAME 15
FRAME 35
FRAME 56
FRAME 17
FRAME 42
FRAME 82
FRAME 102
FRAME 135
FRAME 164
if (type == 1){ coh.scaleSelf(0.3); sep.scaleSelf(0.4); wan.scaleSelf(0.2/(frameCount)); } if (type == 2{ sep.scaleSelf(0.5); tra.scaleSelf(0.7); }
FRAME 78
36 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
FRAME 98
FRAME 125
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 37
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 3
TYPE 4
CODE
CODE
400 agents are initialized from the bottom of the cylinder. Type one agent move in z-axis within the given environment of cylinder with rotation trigger of 6.
200 agents are initialized from the bottom of the cylinder. Type one agent move in z-axis within the given environment of cylinder with rotation trigger of 3.
Type two agents are influenced by the movement of Type one agents, with a range of vision of 200, and traverse the environment following the trails of Type one.
Type two agents are influenced by the movement of Type one agents, with a range of vision of 200, and traverse the environment following the trails of Type one. FRAME 18
FRAME 92
38 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
FRAME 42
FRAME 110
FRAME 65
FRAME 134
FRAME 23
FRAME 98
FRAME 45
FRAME 127
FRAME 72
FRAME 150
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 39
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 5
TYPE 6
CODE
CODE
500 agents are initialized from the bottom of the cylinder. Type one agent move in z-axis within the given environment of cylinder with rotation trigger of 4.
400 agents are initialized from the bottom of the cylinder. Type one agent move in z-axis within the given environment of cylinder with rotation trigger of .
Type two agents are influenced by the movement of Type one agents, with a range of vision of 200, and traverse the environment following the trails of Type one.
Type two agents are influenced by the movement of Type one agents, with a range of vision of 200, and traverse the environment following the trails of Type one. FRAME 12
FRAME 92
40 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
FRAME 52
FRAME 109
FRAME 72
FRAME 144
FRAME 18
FRAME 89
FRAME 38
FRAME 102
FRAME 65
FRAME 132
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 41
CHAPTER 3: STIGMERGY
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
STIGMERGY 2D LOGIC
DIAGRAMS
Stigmergy is a communication method used in decentralized systems in which individuals communicate with each other by changing the surrounding environment. Stigmergy was first observed in social insects and then applied at artificial intelligence system. Ants exchange information by laying down pheromones (the trace) on their way back to the nest when they have found food, in this way they collectively develop a complex network of trails, finding the shortest path to a food source and connecting the nest in the most efficient way.
FRAME 27
FRAME 52
FRAME 78
FRAME 102
FRAME 135
FRAME 175
When ants come out of the nest searching for food, they are stimulated by the pheromone to follow the trail towards the food source. The network of trails functions as a shared external memory for the ant colony.
44 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 45
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
STIGMERGY 3D LOGIC The goal of this assignment was to define and apply stigmergic environment on a box with a width and length of 20cm and height of 50cm. The Stigmergic environment is developed by applying vector and Forces on the 3-Axis. The agents respond to the environment by moving around on the box with the force on the 3-axis.Changing the variable such as the separation, cohesion and particle numbers could result in various forms of the design; but following the same concept, the Stigmergic Environment.
TYPE 1
Cohesion Magnitude: 5 Cohesion Range: 30 Separation Magnitude: 0.2 Separation Range: 20 Particle Number: 500
TYPE 4
Cohesion Magnitude: 6 Cohesion Range: 60 Separation Magnitude: 0.2 Separation Range: 20 Particle Number: 600
46 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
TYPE 2
TYPE 3
Cohesion Magnitude: 4 Cohesion Range: 30 Separation Magnitude: 0.2 Separation Range: 60 Particle Number: 400
Cohesion Magnitude: 2.5 Cohesion Range: 75 Separation Magnitude: 0.2 Separation Range: 20 Particle Number: 300
TYPE 5
TYPE 6
Cohesion Magnitude: 10 Cohesion Range: 30 Separation Magnitude: 0.2 Separation Range: 20 Particle Number: 400
Cohesion Magnitude: 2.5 Cohesion Range: 30 Separation Magnitude: 0.2 Separation Range: 20 Particle Number: 1500
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 47
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 1
TYPE 2
CODE
CODE
For a number of 500 agents, which starts at random positions of the box width and box height:
For a number of 400 agents, which starts at random positions of the box width and box height:
for (int i = 0; i<500; i++) { Vec3D p=0 Vec3D((random(boxWidth), random(boxHeight), 0);
for (int i = 0; i<400; i++) { Vec3D p=0 Vec3D((random(boxWidth), random(boxHeight), 0);
Vec3D v=new Vec3D(random(-4,4); random(-3.5, 3.5), 0);
Vec3D v=new Vec3D(random(-4,4); random(-3.5, 3.5), 0);
coh.ScaleSelf(5); sep.ScaleSelf(0.2); ali,ScaleSelf(0.2); wan.ScaleSelf(0.3); } if (neighborList.size()<30) traScaleSelf(0.9);
FRAME 12
FRAME 52
FRAME 97
FRAME 135
FRAME 189
FRAME 255
coh.ScaleSelf(4); sep.ScaleSelf(0.2); ali,ScaleSelf(0.2); wan.ScaleSelf(0.3); } if (neighborList.size()<30) traScaleSelf(0.9);
FRAME 9
FRAME 52
FRAME 99
FRAME 147
FRAME 188
FRAME 227
In this code, which the agent identifies more that 30 neighbors in the range of vision it becomes more attracted to the traits of those agents and gives the following pattern.
48 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 49
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 3
TYPE 4
CODE
CODE
For a number of 300 agents, which starts at random positions of the box width and box height:
For a number of 600 agents, which starts at random positions of the box width and box height:
for (int i = 0; i<300; i++) { Vec3D p=0 Vec3D((random(boxWidth), random(boxHeight), 0);
for (int i = 0; i<600; i++) { Vec3D p=0 Vec3D((random(boxWidth), random(boxHeight), 0);
Vec3D v=new Vec3D(random(-4,4); random(-3.5, 3.5), 0);
Vec3D v=new Vec3D(random(-4,4); random(-3.5, 3.5), 0);
coh.ScaleSelf(2.5); sep.ScaleSelf(0.2); ali,ScaleSelf(0.2); wan.ScaleSelf(0.3); } if (neighborList.size()<75) traScaleSelf(0.9);
FRAME 10
FRAME 48
FRAME 76
FRAME 107
FRAME 152
FRAME 197
50 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
coh.ScaleSelf(6); sep.ScaleSelf(0.2); ali,ScaleSelf(0.2); wan.ScaleSelf(0.3); } if (neighborList.size()<60) traScaleSelf(0.9);
FRAME 28
FRAME 67
FRAME 89
FRAME 115
FRAME 138
FRAME 188
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 51
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
TYPE 5
TYPE 6
CODE
CODE
For a number of 400 agents, which starts at random positions of the box width and box height:
For a number of 1500 agents, which starts at random positions of the box width and box height:
for (int i = 0; i<400; i++) { Vec3D p=0 Vec3D((random(boxWidth), random(boxHeight), 0);
for (int i = 0; i<1500; i++) { Vec3D p=0 Vec3D((random(boxWidth), random(boxHeight), 0);
Vec3D v=new Vec3D(random(-4,4); random(-3.5, 3.5), 0);
Vec3D v=new Vec3D(random(-4,4); random(-3.5, 3.5), 0);
coh.ScaleSelf(10); sep.ScaleSelf(0.2); ali,ScaleSelf(0.2); wan.ScaleSelf(0.3); } if (neighborList.size()<30) traScaleSelf(0.9);
FRAME 2
FRAME 29
FRAME 49
FRAME 81
FRAME 111
FRAME 148
52 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
coh.ScaleSelf(2.5); sep.ScaleSelf(0.2); ali,ScaleSelf(0.2); wan.ScaleSelf(0.3); } if (neighborList.size()<30) traScaleSelf(0.9);
FRAME 5
FRAME 37
FRAME 55
FRAME 78
FRAME 100
FRAME 157
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 53
CHAPTER 4: MESH GENERATION
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
Workshop 2 - “200 Lines of Code and a Video” | 06.01.2021
MESH GENERATION LOGIC
CODE
The mesh generation simulation is based on the path following principle. The code directs the agents from start to end and through the specified path, and radius of rotation as well as distancing from the main core. Throughout the creation of the basic pattern that later on is transformed to mesh through visual scripting, the agents decide their own paths based on the behavioral attributes allocated to them by the code. Where multiple intersections of paths are visible, the mesh is the result of the agents responding to a certain situation during their movement from start to end. As well, as shown in the visuals, the mesh is made of interwoven patterns which depict the manner in which the agents where rotating around the axis of direction and weaving the geometry as the simulation runs.
200 agents are initialized at the base of each of the paths. The agents from a weaving behavior around the path directions while moving from start to end, while doing so the agents move in a rotation based on the trigger specified in the code and are projected from the main path therefore they remain within the limits of the parameters set while never coming in contact with the core. the trails from the waving curves that later transformed into the geometry
DIAGRAM
Initial.pos corerandom(-50:50); particle number:200 Weaving settings: if{ Rot.trigger(6.0); Rad. scale(20.0); Sep.scaleSelf(20); } Multipath tracking if { projection.rad(13.75); projection.Dis(15); } After the trails are generated visual scripting comes into play where the trails are transformed into geometries where the trails are deconstructed into vertices placed equidistantly along the trailDiv=500, and these data list are connected to form the nurbs curves that are later transformed into meshes and joined together to form the mesh shown in the visuals.
56 | ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang
ENCODED BEHAVIOUR - Cheolyoung Park, Jamil Al Bardawil, Jonathan Zisser, Pin-ju Wang | 57
THANK YOU
Instructor - Shajay Bhooshan Cheolyoung Park | Jamil Al Bardawil | Jonathan Zisser | Pin-ju Wang