Depends on what sits behind the door, the accumulated points and the remaining time in timer can go up with happy dog or down with angry dog.
A
B
Starter
Enterprise
Training motion data: "punch" and "flex".
Pre-trained data is classified and logged as "punch" or "flex" with respective accuracy levels.
Pre-trained data is classified with respective label which outputs with respective emoji.
Integrate the gesture classification with the leprechaun character in Unity and trigger it to open the door animation.
Out of 13 playtesters, 62% preferred the Punch prototype to the Turn prototype, mainly because of its unique interaction style. The Turn prototype highlighted some gaps in gameplay. Both prototypes revealed important areas for further development.
Below character development process is documented. The leprechaun controller was scripted in Unity to work with mouse, keyboard, and physical controllers, including a pull-up button and joystick, via Arduino.
Utilized open-source 3D asset and Blender and Mixamo for character development. Uploaded T-pose rigged asset onto Mixamo to skin pre-made animations onto the character.
Leprechaun animator setup for prepped animations on Unity
public class animationStateController : MonoBehaviour
{
Animator anitor;
int isWalkingHash; // for performance optimization
int isRunningHash;
}
voidStart(){
animator = GetComponent<Animator>();
isWalkingHash = Animator.String("isWalking");
isRunningHash = Animator.String("isRunning");
}
void Update(){
bool isrunning = animator.GetBool(isRunningHash);
bool isWalking = animator.GetBool(isWalkingHash);
bool forwardPressed = Input.GetKey("W");
bool runPressed = Input.GetKey("f");
if( !isWalking && forwardPressed)
{
animator.SetBool(isWalkingHash, true);
}
if( isWalking && !forwardPressed)
{
animator.SetBool(isWalkingHash, false);
}
if( !isrunning && runPressed)
{
animator.SetBool(isRunningHash, true);
}
if( isrunning && !runPressed)
{
animator.SetBool(isRunningHash, false);
}
}
Testing controlling the Leprechaun by mouse
Used Arduino Nano 33 IoT to control leprechaun using 2 pull-up buttons.
#include "Keyboard.h"
// set pin numbers for the five buttons:
const int oneButton = 2;
const int twoButton = 3;
const int threeButton = 4;
const int fourButton = 5;
const int fiveButton = 6;
const int otherButton = 7;
void setup() {
// initialize the buttons' inputs
// instead of "INPUT", we're using "INPUT_PULLUP"
// this uses internal pull up resistors for the inputs
pinMode(oneButton, INPUT_PULLUP);
pinMode(twoButton, INPUT_PULLUP);
pinMode(threeButton, INPUT_PULLUP);
pinMode(fourButton, INPUT_PULLUP);
pinMode(fiveButton, INPUT_PULLUP);
pinMode(otherButton, INPUT_PULLUP);
Keyboard.begin();
}
void loop() {
// use the pushbuttons to control the keyboard
// note how we are checking for LOW instead of the usual HIGH
// this is how we check to see if a button is pressed when using INPUT_PULLUP mode
if (digitalRead(oneButton) == LOW) {
Keyboard.write('w');
}
if (digitalRead(twoButton) == LOW) {
Keyboard.write('f');
}
if (digitalRead(threeButton) == LOW) {
Keyboard.write('s');
}
if (digitalRead(fourButton) == LOW) {
Keyboard.write('d');
}
if (digitalRead(fiveButton) == LOW) {
// Keyboard.write(' ');
Keyboard.write('f');
}
if (digitalRead(otherButton) == LOW) {
Keyboard.press('q');
} else {
Keyboard.release('q');
}
}
Joystick is effectively taking over the mouse input.
#include <Mouse.h>
// Global varibles:
const int mouseButton = 3;
const int buttonPin = 2;
const int ledPin = 6; // Mouse control LED
int lastButtonState = LOW; // state of the button last time you checked
boolean mouseIsActive = false; // whether or not the Arduino is controlling the mouse
// joystick
const int xAxis = A0; // joystick X axis
const int yAxis = A1; // joystick Y axis
// parameters for reading the joystick:
int range = 512; // output range of X or Y movement
int responseDelay = 5; // response delay of the mouse, in ms
int threshold = range / 4; // resting threshold
int center = range / 2; // resting position value
void setup() {
// initialize serial communication:
Serial.begin(9600);
// make pin 2 an input, using the built-in pullup resistor:
pinMode(buttonPin, INPUT_PULLUP); // switch function
pinMode(mouseButton, INPUT_PULLUP); // mouse left click input pin
pinMode(ledPin, OUTPUT); // the LED pin
// initialize mouse control:
Mouse.begin();
}
void loop() {
// read the first pushbutton:
int buttonState = digitalRead(buttonPin);
// if it's changed and it's low, toggle the mouse state:
if (buttonState != lastButtonState) {
if (buttonState == HIGH) {
// if mouseIsActive is true, make it false;
// if it's false, make it true:
mouseIsActive = !mouseIsActive;
digitalWrite(ledPin, mouseIsActive);
Serial.print("Mouse control state" );
Serial.println(mouseIsActive);
}
}
// save button state for next comparison:
lastButtonState = buttonState;
int xReading = readAxis(A0);
int yReading = readAxis(A1);
// print their values. Remove this when you have things working:
Serial.print(xReading);
Serial.print(" ");
Serial.println(yReading);
if (mouseIsActive == true) {
Mouse.move(xReading, yReading, 0);
}
// read the mouse button and click or not click:
// if the mouse button is pressed:
if (digitalRead(mouseButton) == LOW) {
// if the mouse is not pressed, press it:
if (!Mouse.isPressed(MOUSE_LEFT)) {
Mouse.press(MOUSE_LEFT);
}
}
// else the mouse button is not pressed:
else {
// if the mouse is pressed, release it:
if (Mouse.isPressed(MOUSE_LEFT)) {
Mouse.release(MOUSE_LEFT);
}
}
delay(responseDelay);
}
/*
reads an axis (0 or 1 for x or y) and scales the analog input range to a range
from 0 to <range>
*/
int readAxis(int thisAxis) {
// read the analog input:
int reading = analogRead(thisAxis);
// map the reading from the analog input range to the output range:
reading = map(reading, 0, 1023, 0, range);
// if the output reading is outside from the rest position threshold, use it:
int distance = reading - center;
if (abs(distance) < threshold) {
distance = 0;
}
// return the distance for this axis:
return distance;
}
Playtest results showed a strong preference for the Punch prototype, guiding the focus for future iterations.
The user test provided valuable insights into gameplay improvements, identifying critical areas for development.