Skip to content

amytis25/Force_Cube_Runner

Repository files navigation

Force Cube Runner (Arduino Edition)

Force Cube Runner is a 3D obstacle-avoidance game built in Python and OpenGL with optional Arduino-based hardware controls.
Players navigate a cube across three lanes while jumping or crouching to avoid obstacles.

This project was built during StormHacks 2025 as a hardware–software integration demo.


Gameplay

  • Three-lane movement (left / center / right)
  • Jump and crouch to avoid obstacles
  • Increasing difficulty over time
  • Survival timer displayed during play

Demo & Hardware

Controls & Setup

Keyboard Controls Arduino Controls Arduino Setup
Image Image Image

Gameplay

Image Image
  • Python + OpenGL 3D rendering
  • Keyboard controls always available
  • Arduino joystick + ultrasonic sensor supported when detected at startup

Controls

Keyboard (Always Available)

  • Left / Right Arrow – Change lanes
  • Up Arrow – Jump
  • Down Arrow – Crouch

Arduino Controls (Only if detected at startup)

  • Joystick X-axis – Lane switching
  • Ultrasonic sensor distance – Jump / crouch

Arduino availability is checked during gameplay; behavior depends on connection state


Hardware Setup (Optional)

Components

  • Arduino Uno or Nano
  • Analog joystick module
  • HC-SR04 ultrasonic sensor

Wiring

Ultrasonic Sensor:
VCC  -> 5V
GND  -> GND
Trig -> Pin 9
Echo -> Pin 10

Joystick:
VCC -> 5V
GND -> GND
VRx -> A2
VRy -> A3

Upload:

game_controller_combined/game_controller_combined.ino
  • Baud rate: 115200

Project Structure

Force_Cube_Runner/
├── base_arduino.py              # Main entry point; initializes game loop and selects control mode
├── controls.py                  # Keyboard input handling and movement mapping
├── arduino_controls.py          # Serial communication and parsing of Arduino sensor input
├── shapes.py                    # OpenGL geometry definitions for player and obstacles
├── sphere_manager.py            # Obstacle generation, movement, and collision logic
├── lane_markers.py              # Rendering of lane guides and track visuals
├── game_timer.py                # Survival timer and on-screen time display
├── start_screen.py              # Start screen UI for keyboard-only mode
├── arduino_start_screen.py      # Start screen UI when Arduino is detected
├── button.py                    # Reusable UI button components
├── MrElectric.png               # Texture asset used for obstacle rendering
└── game_controller_combined/
    └── game_controller_combined.ino  # Arduino firmware for joystick + ultrasonic sensor input

Installation & Run

1. Install dependencies

pip install -r requirements.txt

2. Run the game

python base_arduino.py

Arduino joystick + ultrasonic sensor supported when available


Known Limitations

  • Arduino availability is checked during gameplay; behavior depends on connection state
  • Serial port is hardcoded (adjust in arduino_controls.py if needed)
  • No in-game calibration for sensor thresholds

About

3D Python + OpenGL obstacle game with Arduino controls

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors