18 April 2021

Project - Game Controller

 Game: Root Beer Tapper

https://archive.org/details/arcade_rbtapper 



Arcade games were simple, but a highly enjoyable form of entertainment for their time. Controls were the bare minimum, usually featuring around three inputs. Some machines were more unique and had thematic controls. “Root Beer Tapper,” or “Tapper,” had a physical tap or lever players had to use to fill the in-game mugs. For my controller, I sought to recreate this concept utilizing the class materials. 

The controls consist of two potentiometers and a lever. The lever is used for filling the mugs while the potentiometers control the character’s movement. Much like an arcade cabinet, the inputs are laid out side by side, primarily due to the limitations of how far the wires inside would reach. The lever was a much more complicated control. I initially wanted to use a plastic water tap, but I realized it would be much too small and not work how I wanted. I decided to build my own tap out of soap boxes. The CPE is mounted to a piece of cardboard that is suspended by a thread. The thread is also attached to the upper portion of the lever, so that when the player lowers it, the CPE is tilted to the right. All materials are recycled, utilizing objects I had around the house to save on costs and reduce waste. 

Neat and clear mapping allows my inputs to easily signify they are meant for the player to interact with. The lever has a visible joint, which acts as a major signifier that it is meant to be bent in that direction. Additionally, the potentiometers resemble screws, both of which twist. Feedback is present through immediate visual changes and sound effects from the game. It would have been possible to use LEDs or a tone from the CPE to enhance user experience. My controller was meant to pay homage to older games and to try and recreate a gimmick input. It was challenging, since I do not have much experience in terms of “engineering” a product, but I believe my custom lever allowed me to step out of my comfort zone and to create a highly unique controller that is more than just converting inputs to different types of inputs. 


For my peers: What could I have possibly used to create a better tap/lever input? Should I have used a different input instead?



//Libraries

#include <Adafruit_CircuitPlayground.h>

#include <Adafruit_Circuit_Playground.h>

#include <Keyboard.h>


//Code by Paulina Weintraub 2021


//Variables

int moveVert = 0;

int moveHor = 0;


int moveHorizontal = 0;

int moveVertical = 0;


boolean pressed = false;

boolean mug = false;


void setup() {

  // put your setup code here, to run once:


  Serial.begin(9600);

  delay(1000);

  CircuitPlayground.begin();

}


void loop() {

  // put your main code here, to run repeatedly:


  //Receive analog values from the accelerometer

  float x = CircuitPlayground.motionX();


  //The value r which is from 0 to 255, mapped to the value x, which is from -10 to 10

  int r = map(x, -10, 10, 0, 255);


  //Potentiometer input

  moveVert = analogRead(A2);

  moveHor = analogRead(A3);

  

  //Potentiometer mapping

  moveVertical = map(moveVert, 0, 1023, 0, 10);

  moveHorizontal = map(moveHor, 0, 1023, 0, 10);


  //Potentiometer 1

  //If turned to the left, move tapper left (hold left arrow key)

  //If turned to the right, move tapper right (hold right arrow key

  //There is a "middle" zone where the player can turn the potentiometer back to "release" the key


  if(moveHorizontal == 10){

    Keyboard.press(216);

    delay(500);

  }


  if(moveHorizontal != 0 && moveHorizontal != 10){

    Keyboard.releaseAll();

  }


  if(moveHorizontal == 0){

    Keyboard.press(215);

    delay(500);

  }


  //Potentiometer 2

  //If turned to the right (clockwise), move tapper down one space (tap down arrow key)

  //If turned to the left (counterclockwise), move tapper up one space (tap up arrow key)

  //There is a "middle" zone where the player can turn the potentiometer back to "release" the key

  //Used a "pressed" boolean to ensure the key is pressed only once, but I kept the release as a precaution


  if(!pressed && moveVertical == 10){

    pressed = true;

    Keyboard.press(217);

    delay(500);

  }


  if(moveVertical != 0 && moveVertical != 10 && pressed == true){

    pressed = false;

    Keyboard.releaseAll();

  }


  if(!pressed && moveVertical == 0){

    pressed = true;

    Keyboard.press(218);

    delay(500);

  }


  //Tilting on the x-axis

  //Tapper must be standing against the tap 

  //While the CPE is tiled to the right, begin filling a mug (hold left ctrl)

  //Release to send mug to customer (release left ctrl)

  //If released too early, mug won't be full

  //Used a "mug" boolean to ensure the key is pressed only once

  

  if(!mug && r >= 180){

    mug = true;

    Keyboard.press(128);

    delay(500);

  }


  if(r <= 180 && mug == true){

    mug = false;

    Keyboard.release(128);

    delay(500);

  } 




No comments:

Post a Comment

Note: Only a member of this blog may post a comment.