Description
For our controller we went with the PIPBOY from Fallout New Vegas specifically. Its conceptual relationship with our game is that the character you play as in the game uses the PIPBOY for most gameplay mechanics like equipping items, looking at their inventory, looking at quests and maps, and so much more. The main mechanics of the controller working using motions controls to look around and navigate menus, a light sensor to as the interact button, the 3 different buttons to go to different menus in the PIPBOY like how the character does in the game, a switch to turn on and off to attack, a potentiometer to start the auto walk, and we also have a way to use vats by turning it on by hitting a certain audio threshold with the mic. The visual design and our controller inputs connect well with our game especially the physical design of it, most controls work like the PIPBOY works in game, but we had to make some changes and add some things so we can get the controller to work in game.
Sketch
Schematic
Pseudocode
In void setup
Start FUNCTION initializeController()
Put in CircuitPlayground library
Put in HID/Keyboard library
FOR each configured button
SET the pinMode(button.pin, INPUT_PULLUP)
END FOR loop
END FUNCTION
// THRESHOLDS and CONSTANTS
LIGHT_THRESHOLD = 150 // below this lux value → Interact
TILT_DEADZONE = 0.3 // ignore small accelerometer drift SOUND_ACTIVATE_SPIKE = 300 // mic amplitude spike → Vats on/off
POTEN_THRESHOLD = 150 // Walk on/off threshold
Inputs
//In void loop
READ light_sensor // Interact button
READ ax, ay, az FROM accelerometer // UP, DOWN, LEFT, RIGHT
READ if pressed FROM button_A // PIPBOY category 1
READ if pressed FROM button_B // PIPBOY category 2
READ if pressed FROM button_C // PIPBOY category 3
READ if Walk_switch is on or off // Main Attack
READ mic amplitude (Mic_Amp) FROM microphone // Vats turn on/off
READ if potentiometer pasts certain threshold // turn on walking
FUNCTION to read inputs readInputs()
FOR each configured button
READ state = digitalRead(button.pin)
END FOR loop
read analog and motion inputs for aiming and potentiometer for menu
analogControlEnabled THEN
button.analogValue = analogRead(analogPin)//poteniometer
motionControlEnabled
motionData = CircuitPlayground.motionSensor.read()
END FUNCTION
// Mapping to Fallout Actions
FUNCTION mapInputsToActions()
CREATE empty actionList
IF light_sensor.state <= LIGHT_THRESHOLD
ADD actionList ← “Interact”
END IF
IF Walk_switch.state == Pressed
ADD actionList ← “Main Attack”
END IF
IF buttonA.state == Pressed
ADD actionList ← “Pipboy button 1”
END IF
IF buttonB.state == Pressed
ADD actionList ← “Pipboy button 2”
END IF
IF buttonC.state == Pressed
ADD actionList ← “Pipboy button 3”
END IF
IF Mic_Amp.state <= SOUND_ACTIVATE_SPIKE
ADD actionList ← “Vats On/Off
// analog mapping
IF analogControlEnabled THEN
IF analogValue > threshold THEN
ADD actionList ← “TURN_RIGHT”
ELSE IF analogValue < -threshold THEN
ADD actionList ← “TURN_LEFT”
END IF
IF analogValue > threshold THEN
ADD actionList ← “Look_UP”
ELSE IF analogValue < -threshold THEN
ADD actionList ← “LOOK_DOWN”
END IF
END IF
IF PotenWalk.state <= POTEN_THRESHOLD
ADD to actionList ← “Walk on”
END IF
RETURN actionList
END FUNCTION


No comments:
Post a Comment
Note: Only a member of this blog may post a comment.