Final Project

SURVIVE THE PLASTIC-ELAINE & TRACY- ANDY GARCIA

  • CONCEPT AND DESIGN

Our concept is to get people’s attention to marine plastic pollution. According to Seachange, worldwide, we produce ~400 million tons of plastic per year. Roughly 10 million tons end up in the sea. That’s a dump truck full of plastic added to the ocean every minute.  The marine plastic pollution is a problem needs to solve urgently. But many people haven’t notice this question. Every meal we are creating plastic trash.  The reason why we want to use this concept is, I interviewed a fellow of the Social Value Investment Alliance about the digial innovation in sustainability. He said some artists use plastic straws to build a whale-liked artifacts in order to arouse people’s attention to micro plastic pollution under the sea. The facts really shocked me, so we want to also raise people’s attention and prevent sea environment. 

For the preparatory research, me and Elaine found some sources desparately.  I found that there are more than 165 million tons of plastic in our ocean. Plastic makes up 80% of all marine debris found from surface waters to deep-sea sediments (“Marine Plastic Pollution.” IUCN, 17 Nov. 2021, https://www.iucn.org/resources/issues-briefs/marine-plastic-pollution) (Marine plastic pollution)

 The number realy shocked ue. We want to make people know this issue is sever by creating a game that everyone can play. And since this is a interactive project, we make it a two-player game. People can control his/her own fish to avoid the floating plastic trash to eat the shrimp. Each fish has five counts, which means if you touch trash five times, you will lose the game. When the fish eat the shrimp, it will grow bigger. If seems who touch the plastic less will win the game. But actually, the plastic will increase and no fish can really survive in the awful sea environment.  Boh fish will die at last. And the plastic will occupy the sea. This can show the sacring fact: At least 14 million tons of plastic end up in the ocean every year. Plastic debris is currently the most abundant type of litter in the ocean, making up 80% of all marine debris found from surface waters to deep-sea sediments (Marine Plastic Pollution).  people can feel interaction during playing. They control fish to avoid and eat. Fish will follow the potentiometer floating chaning.  We tested with Andy. He recommeded that the shrimp can appear in the random position of screen instead of bouncing because the sea is limited. And if we use prills to be micro plastic, players might don’t understand what it is. So first we need to have a brief introduction at beginning. Second we we can change the prills to bottle, bag, etc. And it is better if we give the life counts to fish. We think all of these recommendations are useful and helpful. And we received better feedback from some test participants after revising.

 

  • FABRICATION AND PRODUCTION

The first significant step is making the shrimps and plastic bouncing in the screen. And made the number of plastic increasing with time passing by. 

Then Andy suggested that we can make it shrimp not bounce since it was looked weird. So I adjust the “if (x[i] < = 0 || x[i] >= 800) to larger than the screen. 

 

  for ( int i=0; i < x.length; i++) {
    if ( x[i] <= -300 || x[i]>= 1500) {

The code below is the first version of the boucing shirmps.

int  count =20;
float x[] = new float[count];
float y[] = new float[count];
float  xspeed[] = new float[count];
float  yspeed[] = new float[count];
float size[] = new float[count];
PImage photo1;
void setup(){
 photo1 = loadImage(“shrimp.png”);
  size(800,600);
  background(0);
 for ( int i=0; i < x.length; i++) {
    x[i] = random (100, width-100);
    y[i] = random (100, height-100);
     xspeed[i] = random (1, 2);
     yspeed[i] = random (1, 2);
 }
}
    void draw() {
      background(#3FA8C4);
    for ( int i=0; i < x.length; i++) {
      image(photo1,x[i], y[i],30,20);//x, y length 10;//  Flower(x[i], y[i], size[i], flowerColor[i]);
}
  move();
  bounce();
    }
     void move() {
  for ( int i=0; i < x.length; i++) {
    x[i] += xspeed[i] ;
    y[i]  += yspeed[i] ;
  }
}
 void bounce() {
  for ( int i=0; i < x.length; i++) {
    if ( x[i] <= 0 + size[i]/2 || x[i]>= width - size[i]/2-80) {
      xspeed[i] = -xspeed[i];
    }
    if ( y[i] <= 0+ size[i]/2 || y[i]>= height - size[i]/2-60 ) {
      yspeed[i] = -yspeed[i];
    }
  }
 }

 

Then I found the shrimps only swim towards one direction. I want to make it towards to different direction. I asked Andy and Skye. This seems a tricky problem. Finally, I add a reverse shrimp photo, simplify this question. 

 

  • We also made the plastic increase with time passing:
int nShrimp;
int nPlastic;
long Startgame;

  for ( int i=0; i < u.length-nPlastic; i++) {

nPlastic = int (map(abs(Startgame-millis()), 0, 50000, 30, 0));
println(nPlastic);
nPlastic = constrain(nPlastic, 0,30);

 
  for ( int i=0; i < u.length-nPlastic; i++) {
    plastic(u[i], v[i], 5, 255, trans[i]);
  }

  

void mousePressed(){
  Startgame = millis();
}

 There were also some mistakes:

forget to use png

 

disappear magic:

We originally planed to use joy stick to make this game more interesting and interactive. But then we find it is hard to control the fish. The fish will back to the center of then screen once we release the sticker.  So we changed it to potentiometer.

 

We want to use a rasing black screen raising to be the timing. It represents plastic deposited in the bottom of the sea. When the plastic raise to the top, the game will finish. This will show if people continue use plastic, this is a lose-lose game. 

Eliane makd the fish eat shrimp and plastic then bigger or disappear, counts, beginning switch. I made the shrimp randomly appear, the plastic increase, the bottle and bag floating, and the end switch. 

 

  • CONCLUSIONS:

Our concept is to get people’s attention to marine plastic pollution and appeal to increase the usage of plastic. I think our project achieve the goal since we create a scene under the sea. So it has visual effect.  I invited my rommate play with me. She thinks it was a good game and really have fun with it. And she thinks it is good for the fish has three counts that she can play longer in one set.  And eating when avoiding is  fantastic rather than just eating.  At the end we have a picture to restate our concept. people lose the game but will get a deeper understand of saving ocean. 

The interaction is people can control two potentiometers to move his/her fish to eat shrimp and avoid plastic. This is a exciting game because you might lose when touch plastic more than five times. 

I think if we have more time, we would add the black plastic screen rasing from the bottom.  But now we have done a interesting game! Me and Elaine completed this game separtely because of COVID. And we don’t have chance to use 3D cut. But I really learned a lot and really enjoy the process!

 

Processing

int num = 1;
import processing.serial.*;
import processing.sound.*;
SoundFile sound1;
SoundFile sound2;
SoundFile sound3;
SoundFile sound4;
int NUM_OF_VALUES_FROM_ARDUINO = 2;   /** YOU MUST CHANGE THIS ACCORDING TO YOUR PROJECT **/
int sensorValues[];      /** this array stores values from Arduino **/
String myString = null;
Serial myPort;
int  count =10;
float x[] = new float[count];
float y[] = new float[count];
float u[] = new float[count];
float v[] = new float[count];
float  xspeed[] = new float[count];
float  yspeed[] = new float[count];
float  uspeed[] = new float[count];
float  vspeed[] = new float[count];
float size[] = new float[count];
float r[] = new float[count];
float g[] = new float[count];
float b[] = new float[count];
float d1;
float d2[]= new float[count];
float d3;
float d4[]=new float[count];
float pred2;
float pred4;
//float m=mouseX;
//float n=mouseY;
float x2, y2;
float x3, y3;
float heartx1=680;
float hearty1=25;
float heartx2=700;
float hearty2=25;
float heartx3=720;
float hearty3=25;
float heartx4=740;
float hearty4=25;
float heartx5=760;
float hearty5=25;
float heartX1=20;
float heartY1=25;
float heartX2=40;
float heartY2=25;
float heartX3=60;
float heartY3=25;
float heartX4=80;
float heartY4=25;
float heartX5=100;
float heartY5=25;
boolean touch1=true;
boolean fishalive1=true;
boolean touch2=true;
boolean fishalive2=true;
int counter1=5;
int counter2=5;
int lastCircle1;
int lastCircle2;
float fishSize=20;
color faceColor[] = new color[count];
PImage photo1;
PImage photo2;
PImage photo3;
PImage photo4;
void setup() {
  size(800, 600);
  //fullScreen();
  background(0);
  sound1 = new SoundFile(this, "broken-string-bounce.wav");
  sound2 = new SoundFile(this, "wah.mp3");
  sound3 = new SoundFile(this, "bite.wav");
  sound4 = new SoundFile(this, "lose.mp3");
  imageMode(CENTER);
  photo1 = loadImage("shrimp.png");
  photo2 = loadImage("fish1.jpg");
  photo3 = loadImage("fish4.png");
  photo4 = loadImage("plose.jpeg");
  setupSerial();
  printArray(Serial.list());
  for ( int i=0; i < x.length; i++) {
    x[i] = random (100, width-100);
    y[i] = random (100, height-100);
    size[i]=random (50, 80);
    xspeed[i] = random (0.05, 0.1);
    yspeed[i] = random (0.05, 0.1);
  }
  for ( int i=0; i < u.length; i++) {
    u[i] = random (100, width-100);
    v[i] = random (100, height-100);
    uspeed[i] = random (0.05, 0.1);
    vspeed[i] = random (0.05, 0.1);
    r[i] = random(0, 255);
    g[i] = random(255);
    b[i] = random(255);
    faceColor[i] = color(r[i], g[i], b[i]);
  }
}//random size and speed for shrimps and the plastic, random color for the plastic
void draw() {
  getSerialData();
  // printArray(sensorValues);
  background(#3FA8C4);
  for ( int i=0; i < x.length; i++) {
    d1=dist(x[i], y[i], x2, y2);
    d2[i]=dist(u[i], v[i], x2, y2);
    d3=dist(x[i], y[i], x3, y3);
    d4[i]=dist(u[i], v[i], x3, y3);
    if (d1 < (2 + size[i]/2)) {
      fishSize+=10;
      sound3.play();
      x[i]=-100;
      y[i]=-100;
    }
    if (d3 < (2 + size[i]/2)) {
      fishSize+=10;
      sound3.play();
      x[i]=-100;
      y[i]=-100;
    }//the shrimp will disappear when the fish touches it, and the fish will grow bigger
    plastic(u[i], v[i], 10, faceColor[i]);
    if (d2[i] < (5+size[i]/2) && touch1==false &&counter1 !=0) {//i
      touch1=true;
      counter1=counter1-1;
      lastCircle1 =i;
      sound1.play();
      //heartx1=-100;
      //hearty1=-100;
    }
    if (d4[i] < (5+size[i]/2) && touch2==false &&counter2 !=0) {//i
      touch2=true;
      counter2=counter2-1;
      lastCircle2 =i;
      sound1.play();
    }
    //if(counter==4){
    //  heartx1=-100;
    //  hearty1=-100;
    //}
    //else if(counter==3){
    //  heartx2=-100;
    //  hearty2=-100;
    //}
    //else if(counter==2){
    //  heartx3=-100;
    //  hearty3=-100;
    //}
    //else if(counter==1){
    //  heartx4=-100;
    //  hearty4=-100;
    //}
    //else if(counter==0){
    //  heartx5=-100;
    //  hearty5=-100;
    //   fill (#DE4848);
    //heart(heartx1, hearty1, 0.3);
    //heart(heartx2, hearty2, 0.3);
    //heart(heartx3, hearty3, 0.3);
    //heart(heartx4, hearty4, 0.3);
    //heart(heartx5, hearty5, 0.3);
    if (d2[lastCircle1]>(5+size[lastCircle1]/2)) {
      touch1 =false;
    }
    //if (counter==0) {
    //if (counter == 0 && fishalive == true){
    //     sound2.play();
    //     break;
    //    }
    // fishalive=false;
    //sound2.play();
    //touch=true;
    //   }
    //  if (fishalive=false){
    if (counter1 == 0 && fishalive1 == true) {
      x2=-200;
      y2=-200;
      heartx5=-100;
      hearty5=-100;
      sound2.play();
      fishalive1=false;
      break;
    }
    if (d4[lastCircle2]>(5+size[lastCircle2]/2)) {
      touch2 =false;
    }
    if (counter2 == 0 && fishalive2 == true) {
      x3=-200;
      y3=-200;
      heartx5=-100;
      hearty5=-100;
      sound2.play();
      fishalive2=false;
      break;
    }
    if (counter1==0 && counter2 == 0) {
      switch( num ){
      case 1:
      size(800,600);
        photo4 = loadImage("plose.jpeg");
        break;
      }
    print(counter1);
    print("   ");
    println(counter2);
    move();
    bounce();
    x2=sensorValues[0];
    y2=sensorValues[1];
    //  x3=sensorValues[2];
    // y3=sensorValues[3];
    x2=map(x2, 0, 1024, 0, width);
    y2=map(y2, 0, 1024, 0, height);
    x3=map(x3, 0, 1024, 0, width);
    y3=map(y3, 0, 1024, 0, height);
    if (fishalive1==true) {
      image(photo2, x2, y2, fishSize, fishSize);
    }
    if (fishalive2==true) {
      image(photo3, x3, y3, fishSize, fishSize);
    }
    image(photo1, x[i], y[i], 20, 20);
  }// the fish will disappear when touches the plastic five times.
  //pred2=d2[;
  if (counter1==4) {
    heartx1=-100;
    hearty1=-100;
  } else if (counter1==3) {
    heartx2=-100;
    hearty2=-100;
  } else if (counter1==2) {
    heartx3=-100;
    hearty3=-100;
  } else if (counter1==1) {
    heartx4=-100;
    hearty4=-100;
  }
  fill (#DE4848);
  heart(heartx1, hearty1, 0.3);
  heart(heartx2, hearty2, 0.3);
  heart(heartx3, hearty3, 0.3);
  heart(heartx4, hearty4, 0.3);
  heart(heartx5, hearty5, 0.3);
  //println(counter);
  if (counter2==4) {
    heartx1=-100;
    hearty1=-100;
  } else if (counter2==3) {
    heartx2=-100;
    hearty2=-100;
  } else if (counter2==2) {
    heartx3=-100;
    hearty3=-100;
  } else if (counter2==1) {
    heartx4=-100;
    hearty4=-100;
  }
  fill (#DE4848);
  heart(heartX1, heartY1, 0.3);
  heart(heartX2, heartY2, 0.3);
  heart(heartX3, heartY3, 0.3);
  heart(heartX4, heartY4, 0.3);
  heart(heartX5, heartY5, 0.3);
  //println(counter);
}
    }
void move() {
  for ( int i=0; i < x.length; i++) {
    x[i] += xspeed[i] ;
    y[i]  += yspeed[i] ;
  }
  for ( int i=0; i < u.length; i++) {
    u[i] += uspeed[i] ;
    v[i]  += vspeed[i] ;
  }
}
void bounce() {
  for ( int i=0; i < x.length; i++) {
    if ( x[i] <= 0 + size[i]/2 || x[i]>= width - size[i]/2-40) {
      xspeed[i] = -xspeed[i];
    }
    if ( y[i] <= 0+ size[i]/2 || y[i]>= height - size[i]/2-30 ) {
      yspeed[i] = -yspeed[i];
    }
  }
  for ( int i=0; i < x.length; i++) {
    if ( u[i] <= 0 + size[i]/2 || u[i]>= width - size[i]/2-40) {
      uspeed[i] = -uspeed[i];
    }
    if ( v[i] <= 0+ size[i]/2 || v[i]>= height - size[i]/2-30) {
      vspeed[i] = -vspeed[i];
    }
  }
}
void plastic(float u, float v, float size, color c) {
  fill(c);
  noStroke();
  circle(u, v, size);
  fill(c);
  noStroke();
  circle(u+10, v, size/2);
  fill(c);
  noStroke();
  circle(u-10, v-5, size-7);
  fill(c);
  noStroke();
  circle(u-10, v+4, size-8);
  fill(c);
  noStroke();
  circle(u-10, v+8, size-7);
}
void heart (float x, float y, float size) {
  pushMatrix();
  translate(x, y);
  scale(size);
  noStroke();
  beginShape();
  vertex(50, 15);
  bezierVertex(50, -5, 90, 5, 50, 40);
  vertex(50, 15);
  bezierVertex(50, -5, 10, 5, 50, 40);
  endShape();
  popMatrix();
}
void setupSerial() {
  printArray(Serial.list());
  myPort = new Serial(this, Serial.list()[ 2 ], 9600);
  // WARNING!
  // You will definitely get an error here.
  // Change the PORT_INDEX to 0 and try running it again.
  // And then, check the list of the ports,
  // find the port "/dev/cu.usbmodem----" or "/dev/tty.usbmodem----"
  // and replace PORT_INDEX above with the index number of the port.
  myPort.clear();
  // Throw out the first reading,
  // in case we started reading in the middle of a string from the sender.
  myString = myPort.readStringUntil( 10 );  // 10 = '\n'  Linefeed in ASCII
  myString = null;
  sensorValues = new int[NUM_OF_VALUES_FROM_ARDUINO];
}
void getSerialData() {
  while (myPort.available() > 0) {
    myString = myPort.readStringUntil( 10 ); // 10 = '\n'  Linefeed in ASCII
    if (myString != null) {
      String[] serialInArray = split(trim(myString), ",");
      if (serialInArray.length == NUM_OF_VALUES_FROM_ARDUINO) {
        for (int i=0; i<serialInArray.length; i++) {
          sensorValues[i] = int(serialInArray[i]);
        }
      }
    }
  }
}
  }

Arduino

void setup()
{
  Serial.begin(9600);
}
void loop()
{
//  int sensor1 = analogRead(A0);
//  int sensor2 = analogRead(A1);
  int sensor3 = analogRead(A2);
  int sensor4 = analogRead(A3);
  //int sensor3 =  digitalRead(9);
//  Serial.print(sensor1);
//  Serial.print(",");  // put comma between sensor values
//  Serial.print(sensor2);
//  Serial.println(,); // add linefeed after sending the last sensor value
  Serial.print(sensor3);
  Serial.println(",");
  Serial.print(sensor4);
  Serial.println();
  delay(1000);
}

 

Leave a Reply

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