/iot-space-invaders

Space Invaders Game that uses a sensor device from Seeedstudio as a player controller.

Primary LanguagePythonMIT LicenseMIT

Space Invaders with grove.py

========

Build Status

Python library for Seeedstudio Grove Devices on embeded Linux platform, especially good on below platforms:



The Idea

The thought was to integrate some IOT-device into a small game. In this project, a distance sensor is used to track the player's physical position. This position is then applied to the game's space ship character, that way, the player can move a digital object with real life body movements.



Hardware setup

  1. Raspberry Pi
  2. Grove Ultrasonic Ranger
  3. Host
  4. USB-Ethernet Adapter + RJ45



Data Communication

The Raspberry (which is connected to the sensor) sends the sensor data through a socket connection to the host. When the host runs the game (grove/space_slide_invaders.py) it fetches the sensor data through the client script (grove/grove_client.py) and applies it to the game character.



The Final Look of the Game

When everything is up and running, the yellow space ship should be controllable by the player's body movements, by moving closer to or farther away from the Ultrasonic ranger sensor.



Installation on Raspberry Pi and Host

Install pygame

python3 -m pip install -U pygame --user

Install grove.py

git clone https://github.com/yruefenacht/grove.py
cd grove.py
# Python2
sudo pip install .
# Python3
sudo pip3 install .



Usage

Run grove server on Raspberry

python grove/grove_server.py 5 6

Run space slide invaders on Host

python grove/space_slide_invaders.py



API Documentation

Seeedstudio documentation is available here