23 October 2023

Scaffolding: Progress Review

    My controller design is for the browser game Poptropica. Its main components are a play base with distance lasers, and a harness connected to that base by a bungee cord and a long micro-usb cable. In order to control player movement in the game, the player runs back and forth in front and behind the stand, while wearing the harness. This movement is mapped to the x plane movement of the mouse. The further the player is from the play stand (measured by the distance laser), the further their cursor will be from the center of the screen. This distance is what controls movement speed and direction in Poptropica. In order to actually begin moving in the indicated direction the player will need to jog in place, which will be detected by measuring small changes in the z accelerometer value. This action is mapped to the left click and will result in the player character beginning to move in the indicated direction. When the player jumps, the Y value of the mouse will change and the left click will be triggered, which will translate to an in-game jump (jump detection is achieved using extreme changes in the z accelerometer). By directly mapping the real life movement of the player to the in-game character’s actions it should feel as if the player character is directly copying the player’s movement.

    The purpose of the bungee cord is to allow the player to look sideways while walking, and not accidentally walk out of range of the device. Since the player and player character share the same orientation, the player will have to look sideways as they play, so the cord provides safety by preventing them from moving too far forward and walking into someone or something. In order to prevent the device from simply being dragged along with the player, the large cylinders on the sides of the base will contain bottles filled with sand, providing added weight.





PseudoCode

//include Adafruit and Mouse.h libraries

//create variable for low accelerometer z value to trigger walking
//create variable for high accelerometer z value to trigger jump
//create variable for jump height (y increase for jump trigger)

//configure mouse sensitivity and speed for x axis
//configure mouse sensitivity and speed for y axis

void setup() {
  //Initialize libraries
  //set up slide pin
  //set up IR distance laser #1 (forward facing)
  //set up IR distance laser #2 (rear facing)
}

void loop() {
  //Killswitch conditional -  this conditional reads the slidepin and
  //only executes if flipped; all other logic is nested within as a failsafe
    //if accelerometer z is greater than walking trigger value
      //activate left click
      //delay 100ms for debounce
    //else
      //release left click

    //if accelerometer z is greater than jumping trigger value
      //increase mouse y value by jump height variable value
      //delay 500 ms - this delay provides some in-game air hang time
      //reduce mouse y value by jump height variable value
      //delay 500 ms - extra delay to debounce input (assumes player
      //will reach apex of their real life jump within one second)

    //if IR laser #1 distance is increasing
      //increase mouse x value proportionally
      //short delay to debounce input
    //else if IR laser #1 distance is decreasing
      //decrease mouse x value proportionally    
      //short delay to debounce input

    //if IR laser #2 distance is increasing
      //decrease mouse x value proportionally
      //short delay to debounce input
    //else if IR laser distance #2 is decreasing
      //increase mouse x value proportionally
      //short delay to debounce input
}

No comments:

Post a Comment

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