20 April 2025

Surfboard Controller - Group 22

 Surfboard Controller

Leonardo Vento, Kylie Welch, Jasmine Tookes


This is our custom controller for the game Haste. We designed it with the goal of enhancing player immersion and creating a direct connection between the physical experience and the in-game mechanics. Instead of relying on traditional keyboard inputs, we wanted to offer something more engaging and intuitive. Our controller is built using a Circuit Playground Express, embedded inside a 3D-printed surfboard. This surfboard acts as the main interface, allowing players to physically tilt, shift, and move it in space to control their in-game character. The movement of the board corresponds directly with the WASD directional inputs, so players can steer their character by leaning left or right. This control scheme enhances immersion by mimicking the character’s high-speed movement through real physical motion. In Haste, the player runs at breakneck speed, dodging obstacles and staying ahead of a dark, ominous energy wave chasing them, which is destroying the world around them. To add more layers of control, we implemented a rotary dial on the board. Turning the dial left makes the character dive down and hug the terrain, allowing for quick downhill momentum. Turning it right provides a temporary boost, allowing the player to surge forward. This motion-based setup adds a physical element to gameplay and brings the fast-paced game of Haste to life in a unique way.

Do you feel as though having two inputs on 1 dial would confuse the player and what could an alternative been, without using buttons?


#include <Adafruit_CircuitPlayground.h>
#include <Adafruit_Circuit_Playground.h>
#include <Mouse.h>

#include <Keyboard.h>
#include <KeyboardLayout.h>
#include <Keyboard_da_DK.h>
#include <Keyboard_de_DE.h>
#include <Keyboard_es_ES.h>
#include <Keyboard_fr_FR.h>
#include <Keyboard_hu_HU.h>
#include <Keyboard_it_IT.h>
#include <Keyboard_pt_PT.h>
#include <Keyboard_sv_SE.h>

const int debounce = 100;
//int thresh = 400;
int dial = 1000;
float X;
float Y;

void setup()
{
  pinMode(A8,INPUT);
  pinMode(CPLAY_SLIDESWITCHPIN, INPUT_PULLUP);
  Serial.begin(9600);
  CircuitPlayground.begin();
}

void loop()
{
  if(digitalRead(CPLAY_SLIDESWITCHPIN))
  {

    X = CircuitPlayground.motionX();
    Y = CircuitPlayground.motionY();
    int lightval = analogRead(A8);
    int p5 = A5;
    int p6 = A6;
    int d = CircuitPlayground.readCap(p6);
    int t = CircuitPlayground.readCap(p5);
   
    d = d + 5;

    //Serial.print("X: ");
    //Serial.println(X);
    //Serial.print("Y: ");
    //Serial.println(Y);
    //Serial.print(t);
    //Serial.print("\t");
    Serial.print(" LightVal: ");
    Serial.println(lightval);
    Serial.print(" Dial Measure: ");
    Serial.println(d);

  if(X >= 1) //tilt left to turn Left
    {
      Keyboard.press('a');
      //delay(debounce);

    }
    else{
      Keyboard.release('a');
    }

    if( X <= -1) //tilt right to turn right
    {
      Keyboard.press('d');
      //delay(debounce);
    }
    else{
      Keyboard.release('d');
    }

    if( Y <= -1) //tilt forward to walk forward
    {
      Keyboard.press('w');
      //delay(debounce);
    }
    else{
      Keyboard.release('w');
    }

    if( Y >= 1) //tilt down to walk back
    {
      Keyboard.press('s');
      //delay(debounce);
    }
    else{
      Keyboard.release('s');
    }
   
    if(d < 1020)
    {
      Keyboard.press(' ');
      //delay(1000);
    }
    else
    {
      Keyboard.release(' ');
    }

    if(d == 5)
    {
      Mouse.press(MOUSE_LEFT);
     
    }
    else
    {
      Mouse.release(MOUSE_LEFT);
    }

    if(lightval <= 30 )
    {
      Keyboard.press(KEY_LEFT_SHIFT);
      delay(debounce);
    }
    else
    {
      Keyboard.release(KEY_LEFT_SHIFT);
    }

  }
  else{// forces gyro number to 0 to stop system and pause events
    X = 0;
    Y = 0;
      Keyboard.release('a');
      Keyboard.release('d');
      Keyboard.release('w');
      Keyboard.release('s');
      Keyboard.release(KEY_LEFT_SHIFT);
      Keyboard.release(' ');
      Mouse.release(MOUSE_LEFT);
   
  }

}






Leonardo- code, 3d model, printing Kylie- 3d model, printing, blog post Jasmine- 3d model, blog post, printing





No comments:

Post a Comment

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