Monday, January 20, 2014

Project demo



import processing.serial.*;            
import java.awt.Rectangle;


Serial myPort;  
                     
String portNumber = "";  

int xPos = 100;
int yPos = 100;
float xAccel, yAccel;
int shipHeight = 50;
int shipWidth = 60;
float shipAngle = 0;

Rectangle ship;
int bulletCount = 5;
Bullet[] bullets;
int rateOfFire = 0;
int nextShot = 0;

void setup()
{
 
  size(displayWidth, displayHeight);
  ship = new Rectangle(xPos, yPos, shipWidth, shipHeight);

  println(Serial.list());
 
  myPort = new Serial(this, Serial.list()[0], 9600);
  myPort.bufferUntil('\n');
 
  bullets = new Bullet[10];
  for(int i = 0; i < bullets.length; i++)
  {
    bullets[i] = new Bullet();
  }
 
}

void draw()
{
  //ellipseMode(CENTER);
  background(255);
  //fill(255);
  rectMode(CENTER);
  fill(100);
  translate(ship.x,ship.y);
  rotate(shipAngle);
  translate(-ship.x,-ship.y);
  rect(ship.x, ship.y, ship.width, ship.height);
  translate(ship.x,ship.y);
  rotate(-shipAngle);
  translate(-ship.x,-ship.y);
 
  bulletUpdate();
}




void bulletUpdate()
{

  for(int i = bullets.length-1; i >=0; i--)
  {
    if(bullets[i].alive == true)
    {
      bullets[i].update();
      bullets[i].display();
      print("bullet "+i+" is "+bullets[i].alive);
    }
    else
    {
      nextShot = i;
    }
  }
 
}

void serialEvent(Serial thisPort) {
 
   String inputString = thisPort.readString();
 
   inputString = trim(inputString);
 
   int sensors[] = int(split(inputString, ','));
 
   if(rateOfFire > 0)
   {
     rateOfFire--;
   }
   //if(thisport == myPort && myPort != null)
   //{
     if (sensors.length == 5) {
          ship.x = ship.x + (-1*int(map(sensors[0], -200, 220, -5, 5)));
          ship.y = ship.y + int(map(sensors[1], -180, 220, -5, 5));
          shipAngle = atan2(sensors[2],sensors[3]);
          //print("button press: " + sensors[4]);
          if(sensors[4] == 0)
          {
            bullets[nextShot].fired(ship.x,ship.y,shipAngle);
            rateOfFire = 500;
          }
     }
   //}
 
}


class Bullet
{
 
 int xPos = 0;
 int yPos = 0;
 float angle;
 int speed = 10;
 int lifeSpan = 200;
 int bulletSize = 10;
 boolean alive = false;


  void update()
  {
    if(alive == true)
    {
      xPos = xPos + int(cos(angle)*speed);
      yPos = yPos + int(sin(angle)*speed);
      lifeSpan--;
      if(lifeSpan <= 0)
        alive = false;
    }
  }
   
  void fired(int x, int y, float ang)
  {
      alive = true;
      lifeSpan = 200;
      xPos = x;
      yPos = y;
      angle = ang-(PI/2);
  } 
  
  void display()
  {
    if(alive == true)
    {
      ellipseMode(CENTER);
      translate(xPos,yPos);
      rotate(angle);
      translate(-xPos,-yPos);
      ellipse(xPos, yPos, bulletSize, bulletSize);
      translate(xPos,yPos);
      rotate(-angle);
      translate(-xPos,-yPos);
    }
  }
}

Timeline

January 21 - February 28: Work 3D printer design design for controllers and test builds.

March 1 - March 20: Construction of game engine and enemy AI.

March 21 - March 31: Level 1 Design and Story implementation.

April 1 - April 15: Level 1 Design and Story implementation.

April 15 - April 31: Level 1 Design and Story implementation.

May 1 - May 31: Bug fixing, balancing, polishing and general adjustments for quality control.

The Story

The story begins with the protagonist, Tobi, out in his ship salvaging wreckage from a recent battle between the mighty Circle and Square armies. Suddenly Tobi’s ship’s sensors detect a large explosion not far from where he’s working. Tobi pack up his equipment and goes to check it out. Upon arriving, he finds a damaged escape pod and brings it aboard his ship. Inside the pod is an old man who looks like he’s on the verge of death.

Tobi: Who are you? You shouldn’t be here.

Old Man: I know, but you must understand that time is not simply something that can be played with. It’s all arranged in a very specific way, and to upset that balance causes entire systems of the world to break. Nothing is meant to exist in the same place at the same time. You can’t keep anything if what want what was lost. There are no victories to be had in the past. Promise me! Promise me you won’t do anything to upset that precious balance!

Tobi: Uh… what?

Old Man: PROMISE ME!

Tobi: All right I promise.                 

Old Man: Good.

The Old Man dies the next moment leaving Tobi standing there wondering what he meant. Suddenly the ship’s sensors are going off again over another nearby explosion.

Tobi: Well today is off to a good start. I swear if it’s another dying old guy in a pod I’m letting nature take its course.

As Tobi appeared the second explosion he’s hailed by another ship.

Bennet: Hi, was just passing through the area when I noticed your ship. I’m looking for an escort to the safe zone in the direction of Alpha Centauri.
Tobi: Who are you? You shouldn’t be here.
Bennet: What? Ya I was just wandering through trying to make my way to that safe zone. I’m Bennet by the way.

Tobi: You were wandering through an area of space that’s an active battlefield. That seems like a poor decision. Well I’m about finished with my salvage work so I suppose I can head there with you.

As Tobi and Bennet begin to head towards the safe zone they detect a large number of ships approaching from the rear. A fleet of Circle ships is retreating from another battle and is catching up to them. The pair must fight as they flee towards the safe zone.

Level 1

After Tobi and Bennet hold off the retreating Circle army they continue to make their way to the safe zone.

Tobi: So How did you end up in the debris field? And before I found you I had detected an explosion. What was that?

Bennet: …I have no Idea.

Tobi: You don’t know how you ended up there or what the explosion was?

Bennet: Both, the last thing I remember was stealing this ship to flee as the army surrounded us.

Just as Tobi was going to ask who Bennet was with, the two receive a message from a stranger.

Stranger: Please turn around and go back the way you came. This area is off limits as per the order of the Square empire. The way ahead is not safe.

Bennet: We’re just heading to the safe zone. We’re not combatants.

Stranger: Who are you? You don’t belong here.

Bennet: I know, we’re just trying to trying to get through this sector to get to the safe zone.

Stranger: There is no safety this way. Turn back and leave.

Tobi: The Circle army has been chasing us this entire way. We can’t go back.

Stranger: Really? Fine then, proceed.

The two continue onward to the safe zone. However as they go they realize they’re being tracked. Tobi realizes why they were allowed to proceed. They had become the bait for a Square trap to catch the retreating Circle army. The Square army has surrounded them. They prepare to fight their way through.

Level 2

After surviving the ambush, Tobi begins to wonder if the safe zone is even real.

Tobi: How do you know about this safe zone? So far all we’ve heard is that there’s anything but safety ahead. What makes you so sure this is where we should be heading?

Bennet: I just do, but let me ask you something. Why are you following me? I didn’t make you, you came along of your own free will. You trusted me so quickly, why?

Tobi: Because you asked me for help to get to the damn safe zone!

Bennet: I did? I don’t remember that?

Tobi: What the hell is wrong with you? You remember nothing about who are you or what your purpose is. You appear out of nowhere and are now likely leading me to my death and your only response is I don’t know?

Stranger: I warned you two that the way forward wasn’t safe but you insisted on continuing.  This guy is still with them?

Tobi: You tried to use us as bait to catch the Circle forces and were going to have us killed. I don’t know if your with the Square army but at the very least you sold us out to them.

Stranger: Then turn back if you’re afraid, because the way forward will only be more of the same. Repetition of events just like that one. Turn back and you’ll be spared all of it.

Bennet: We can’t do that. We won’t be safe until we get to the safe zone.

Stranger: Have it your way.

The pair realize that during their conversation, enemy ships have moved in and caught them in a tractor beam. Unable to break free they’re brought the forward base of the Square army. However once they’re through the force field surrounding the base, Bennet activates an EMP to break free of the tractor beam. However they’re now trapped inside the force field and will need to deactivate it if they hope to make it to Bennet’s fabled safe zone.

Level 3

As the pair fight through the base (the force field?) they encounter Commandant Cube who explains to them that this day was meant to be the day the Square army defeated the entire first fleet of the Circle army however Tobi and Bennet’s actions have ruined everything. According to the Commandant, they had perfect intel about how everything was to play out with the exception of Tobi and Bennet.

After defeating the Commandant, a ship approaches the two.

Stranger: You have ruined everything I worked for, everything I sacrificed, and for what? For a rumored safe zone that doesn’t even exist?!

Tobi: Who are you?

Stranger: My name is Howard and I’m from a different universe entirely. I had come to build a truly incredible world but the two of you have ruined everything. All the secret information I gave these Square fools was all for nothing because a couple of idiots though they’d be safe by heading towards a military base.

Tobi: The truth is that I don’t care about your stupid plan. But you’ve now tried to have me killed twice and plan to conquer this world. You won’t leave the base alive.

Howard: Ha! You think the two of you can really defeat me? You think I came this far unprepared? My plan is still salvageable but the two of you no longer have any place in my new world. I will remove the stain that you two are from my world.

Bennet: I told you before that I wouldn’t let you get away with it.

Howard: Even if you defeat me here and now it doesn’t matter. I’ve been traveling through time and space to arrange everything going on around you right now. My plans will go forward regardless of whether or not I’m there to see them. There is nothing you can do to stop any of this. I won a long time ago, and I’m just waiting to finish now.

Tobi and Bennet fight, and by the end of it all their ships are damaged beyond the point where they can fight anymore.

Bennet: Tobi you must get on his ship, his ship is programmed to automatically try to travel through time and space just like he did to get here. You have to stop him. My ship is too damaged and has no propulsion.

Tobi quickly boards the ship however he is unable to stop the ship from warping.

New Stranger: Ah, a new traveler seeks to make the voyage!

Tobi: What? Who is that? Where am I?

New Stranger: I am Father Time and this is the timeless void that everyone must cross through if they wish to make a voyage in time. Are your prepared to pay the fare?

Tobi: The fare?

Father Time: As per the rules of time nothing may be duplicated. That man Howard was not always Howard, just as you Tobi may no longer be Tobi. You may not be you, around you. You may not know what you know.

Tobi: Your saying in order to travel through time I have to literally become another person?

Father Time: Indeed, your friend and you had more in common than you’re ever capable of knowing.

Tobi: Wait so Bennet was…

Father Time: It’s irrelevant as to whether he is you or you are him. There is the original soul and its derivatives. So are you prepared to try again, to see if you’re capable of overcoming the challenges you faced this time?

Tobi: I’m ready.


Father Time: Then go Bennet, Godspeed.

The Game then begins back at the beginning, allowing the player to start a new game. 

Wednesday, October 9, 2013

Annotated Bibiliography

"Arduino - ArduinoBoardEsplora." Arduino. 09 Oct. 2013 <http://arduino.cc/en/Main/ArduinoBoardEsplora>.
The Arduino Esplora microcomputer is the perfect micro computer to build a custom housing for. It's design is flat but with far more inputs than the standard controller has. This site has links to the related libraries along with general Arduino information.


"FTL: Faster Than Light." FTL. 09 Oct. 2013 <http://www.ftlgame.com/>.
Faster than Light is a 2D space strategy game. While the game has very simple graphics it's still a ton of fun and a great story. im using it's primaryily as a reference for creating the space ships for the game.

"Oculus Rift - Virtual Reality Headset for 3D Gaming | Oculus VR." Oculus VR Home Comments. 09 Oct. 2013 <http://www.oculusvr.com/>.

"Reference. The Processing Language." Language Reference (API) Processing 2. 09 Oct. 2013 <http://processing.org/reference/>.

"Steampunk Xbox 360 Controller Will Rejuvenate Your Gaming." Bit Rebels RSS. 09 Oct. 2013 <http://www.bitrebels.com/technology/steampunk-xbox-360-controller-will-rejuvenate-your-gaming/>.


"Super Meat Boy." Team Meat. 09 Oct. 2013 <http://supermeatboy.com/>.

Project Proposal

Super Awesome Galactic Fighter: Rise of Super Mega Evil Man

Super Awesome Galactic Fighter Game was a game I made a few years ago that was a top down space battle game. It was relatively simple and not really interesting but it was mildly amusing and I'd love to turn it into a true game that has a story, cut-scenes and most of all is fun. I would like to make the game at least semi 2D, by which I mean there can still be depth but I would like to make it 2D. So many modern games focus on graphics to the point where they take a front seat to the game play. Super Meat Boy & Faster Than Light are two examples of modern games that don't need high end graphics to communicate a good story and fun game play.  They both rely on a retro 8-bit graphics style and because of how both games play up their own styles it makes the experience better.

The Game: I would code the game using processing and eventually try to port the to android. To create the art style I'm looking for I'll have to research just how both the a fore mentioned games and other similarly styled games create their style. The game will be a scrolling space fighter game.

The Story:

Tobe, a ordinary Salvager, has his life changed one day when a massive explosion happens near where he'd be working. When he goes to investigate he realizes that there was a very rare and strange ship a the center of the blast. As he approaches a life pod is fired, the shock of which causes the ship to break apart.

Main Characters:

  • Tobe: Pessimistic salvage dealer who one day meets Bennet and the two begin an adventure together to make it to a distant quadrant of space to find Bennet's lost ship. Tobe remains blissfully ignorant of  much of whats going on or even his reasoning for trusting Bennet. 
  • Bennet: A scatter brained optimist who finds himself suffering from memory loss for an unknown reason. In reality the ship that Bennet believes he is seeking is not a ship at all but a time machine. Tobe and Bennet (To be and Be not) are the same person. The reason the two are unable to figure this out is because (in this universe) memories can't exist in the same place at the same time. Because of this as the game Bennet becomes less and less informed about whats going. On top of this, whenever Bennet meets a new person they always say the same line of "Who are you? You shouldn't be here". This is because even though people are unaware of who Bennet is or why they say this, every person instinctually can tell someone who is not from their reality and understand that they are Braking a rule not meant to be broken. As Bennet loses his grasp on reality (as Tobe experiences things Bennet forgets them) Tobe becomes more aware of whats going on. The reason the characters can be the same person with opposite personalities is because of this. The idea is simple: the consciousness is the only thing that may remain constant through out time.
  • Howard: Cold, calculating and seemingly uncaring Howard is the antagonist of the story. Howard is a false consciousness. He is from a stream of time which no longer exist and he escaped from. Howard's purpose in the story is a guardian of time. Howard knows that the price for his still being alive is that someone else's timeline must end. Because death is not the end (at least in this universe) Howard uses his time machine to send Tobe back in time and have Bennet become lost time thus ending their single timeline paying off Howard's "debt".
  • Circle & Square Army: The Circle & square armies is one of two factions the player will face in the game. They are currently engaged in a massive war against the Circle army that has been on going for 10 years. The war began when a massive explosion happened during a diplomatic visit of the President of Circle Space, killing the President. On the day that Tobe and Bennet meet the two armies were meeting not far from where Bennet appears. When the Circle Army picks up readings that match the ones of the explosion 10 years prior that started the war. 


Thesis Statement:

The goal of this project is to build a simple game that uses modern technologies to create a unique gaming experience by measures more aspects of the real world in real time that can be brought into the game world. By doing this the game will have a greater amount of immersion for players by making the real and virtual worlds more connected.



List of Materials:
2 Arduino Esplora Boards


I had originally planned to make the housing for the controllers out of wood. However after some consideration I believe that using a 3D printer would be a much more effective and simpler way to construct the housing. By using the printer I will be have a greater amount of control and precision over what the final product will look like. Also, while the controller does have



While I do hope to be able to port the game from processing to android the process for this is not as proven as I'd like it to be. In addition to this there's no guarantee that once the game has been port that an android processing sketch will work with a no proprietary Bluetooth connection. The reason the Bluetooth receivers used won't be proprietary is because Arduino's only micro computer with Bluetooth lacks many of the sensors and convenience that the Esplora has.

On top of using a 2D art style I'm going to build two controllers to play the game using Arduino Esplora board which is a micro computer with a four buttons, a joystick and a variety of sensors which include an accelerometer, a temperature and light sensor.

Timeline: