26 April 2026

Finals Controller Team 20 - Sonic

Final Controller



Video Link: https://www.youtube.com/watch?v=z_nKT3N6RUU

For our project, we chose to create a controller for classic Sonic due to its simplistic inputs and heavy flow-based gameplay. We wanted to develop a controller that would allow players to physically immerse themselves in the fast paced experience in some way. For our controls, we wanted to create two white gloves, inspired by Silver's gloves and powers from the Sonic franchise, that would allow the player to interact with the game world. One hand uses a color sensor, having players grab different-colored gems, paying homage to the chaos emeralds from within the game, with each tied to an input. Players quickly grab and swap different gems to help them control Sonic's movement within the level. But this is not the only form of input we have. On the alternate glove, we have two “rings,” a reference to Silver's power displayed through white or Silver’s rings  in the Sonic franchise. The two rings can come together to complete a circuit, causing Sonic to jump in-game. Through these two forms, players will rapidly move their hands across the surface in front of them to grab at different emeralds, connect rings, and soar through the various fast-paced levels found within the game. From each glove come wires connected to its internal circuits, which go back to a central housing unit that houses the circuit playground. We hoped the gloves would serve as a strong signifier when developing the project, being associated with grabbing and holding, which naturally led to the idea and relationship of grabbing the emeralds. During the primary test, we felt that the motion of bringing the thumb and pointer finger felt natural, and with the two “rings” providing a visual indication, we thought they would work well. Players get the physical feel of grabbing and dropping the emeralds with one glove and the sensation of bringing their fingers together creates tactical senses in the other. Through our controller, we wanted to create a fast-paced, tactile experience that would engage the player in varied ways through their hand, hoping to generate a sense of flow not only in the game but also through the controls. Do you feel that alternate controls in fast-paced games, with more involved elements, would enhance or detract from the experience?

Circuit


Programming

#include <Keyboard.h>

#define S2 A1
#define S3 A2
#define OUT_PIN A3
#define TOUCH_PIN A4
#define SLIDE_SWITCH 7

bool upHeld = false;
bool rightHeld = false;
bool leftHeld = false;

void setup() {
  Serial.begin(9600);

  pinMode(S2, OUTPUT);
  pinMode(S3, OUTPUT);
  pinMode(OUT_PIN, INPUT);

  pinMode(TOUCH_PIN, INPUT_PULLUP);
  pinMode(SLIDE_SWITCH, INPUT_PULLUP);

  Keyboard.begin();
}

unsigned long readColor(bool s2, bool s3) {
  digitalWrite(S2, s2);
  digitalWrite(S3, s3);
  delay(50);
  return pulseIn(OUT_PIN, LOW, 200000);
}

void loop() {

  // Slide switch OFF = everything disabled
  if (digitalRead(SLIDE_SWITCH) == HIGH) {
    Keyboard.releaseAll();
    upHeld = rightHeld = leftHeld = false;
    return;
  }

  // Jump input
  bool jumping = (digitalRead(TOUCH_PIN) == LOW);

  // Read colors
  unsigned long red = readColor(LOW, LOW);
  unsigned long green = readColor(HIGH, HIGH);
  unsigned long blue = readColor(LOW, HIGH);

  // DEBUG 
  Serial.print("R: "); Serial.print(red);
  Serial.print(" G: "); Serial.print(green);
  Serial.print(" B: "); Serial.println(blue);

  // yellow detec
bool isYellow =
  (green > red + 20) &&
  (blue > red + 20) &&
  (green > 130 && green < 200);

  bool isRed = (red < green && red < blue);
  bool isBlue = (blue < red && blue < green);
  bool isGreen = (green < red && green < blue);

  // PRIORITY: JUMP FIRST
  if (jumping) {

    Keyboard.releaseAll();
    upHeld = rightHeld = leftHeld = false;

    Keyboard.press('S');

  } else {

    Keyboard.release('S');

    // YELLOW = ENTER
    if (isYellow) {
      Keyboard.releaseAll();
      upHeld = rightHeld = leftHeld = false;

      Keyboard.write(KEY_RETURN);
      delay(300); // prevent spam
      return;
    }

    // UP (RED)
    if (isRed) {
      if (!upHeld) {
        Keyboard.press(KEY_DOWN_ARROW);
        upHeld = true;
      }
    } else if (upHeld) {
      Keyboard.release(KEY_DOWN_ARROW);
      upHeld = false;
    }

    // RIGHT (BLUE)
    if (isBlue) {
      if (!rightHeld) {
        Keyboard.press(KEY_RIGHT_ARROW);
        rightHeld = true;
      }
    } else if (rightHeld) {
      Keyboard.release(KEY_RIGHT_ARROW);
      rightHeld = false;
    }

    // LEFT (GREEN)
    if (isGreen) {
      if (!leftHeld) {
        Keyboard.press(KEY_LEFT_ARROW);
        leftHeld = true;
      }
    } else if (leftHeld) {
      Keyboard.release(KEY_LEFT_ARROW);
      leftHeld = false;
    }
  }

  delay(50);
}

Credits

Building of the Gloves: John and Charlotte

Creation of Emeralds: Charlot

Programming: Charlot

Writing: John

Video/Photo: Charlotte

Circuit Schematics: John



No comments:

Post a Comment

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