Skip to content

A single-player game where you control the spaceship using your eyes, fingers, and mouse.

Notifications You must be signed in to change notification settings

farisdurrani/SpaceshipBattle

Repository files navigation


🚀
Spaceship Battle

A multi-gesture input space-shooting game

A single-player game where you control the spaceship using your eyes, fingers, and mouse.

Source: https://github.com/farisdurrani/CS6456Project
Authors: Faris Durrani, Rishabh Ghora
Developed: Aug 24, 2021 – Nov 23, 2021

The reader may read more about the literature review, proposal, and implementation details of this project in this research paper (also available in this repo).

How to run

  1. Install the dependencies in requirements.txt. Runs on Python 3.6.8.
  2. Run the spaceship_battle.py file.

Running in a virtual environment

To reduce possible build problems, you may build the code in a virtual Python environment by entering the following code in the Terminal:

  1. python3.6 -m venv venv
  2. source venv/bin/activate
  3. pip install -r requirements.txt

Main libraries (from requirements.txt)

  1. cmake
  2. dlib==19.16.0
  3. numpy==1.16.1
  4. opencv_python==4.5.4.58
  5. pygame==2.1.0

How to play

Eye Gaze for Main Control

Use your eyes to move the ship around. The program tracks the coordinates of your right eye and translates those coordinates to positions on the game screen, where the spaceship (center, in white) will be pointed at.

Evil ships (in red) will continuously attack you until they are out of range or until they die.

One Finger Controls

This game also allows finger gestures (some systems detect a mouse pointer to be equivalent to a single finger gesture).

Left (<)

Using a finger, a user can draw a "<" symbol anywhere on the screen to pull up the settings. You can change the color of the spaceship's bullet by clicking on the button (using your mouse or your finger). The program recognizes the shape by employing a 9-square recognizer.

Right (>)

Using a finger, a user can draw a "<" symbol anywhere on the screen to pull up friends to request support from. These friends are blue with the same health as evil ships. Their behavior is random.

Up (^)

Using a finger, a user can draw a "^" symbol anywhere on the screen to pull up the market. The market is filled with random items with random prices (within appropriate ranges). Hence, the user can benefit from trading by buying when prices are low and selling when high. Additionally, the market provides shield and bullet power to upgrade the ship. Shields are temporary as described below.

Shield (O)

Using a finger, a user can draw an "O" symbol anywhere on the screen to make a temporary shield around the spaceship (assuming at least one shield has been bought). While the shield is up, no damage will be sustained.

Strike (/)

Using a finger, a user can draw an "/" symbol over an asteroid to destroy it before it hits the ship

Four finger control

Slide to first view (or vice versa)

Using four fingers, a user can slide their fingers over the screen to change the view from third-person view to first-person view, and vice versa. The spaceship's bullets will deviate slightly to the left or to the right to show the ship's rotation.

The first-person view depends on the third-person view, i.e., the eye's coordinates determines where the ship points to in first-person view and this is translated to third-person view to see if the ship is turning right or left. The first-person view only sees the 180 degrees view in front of the ship.

Attribution

Almost all the code are original with only a small number of borrowed code from StackOverflow or other code-sharing platforms for less intuitive mathematical or Pygame operations. They are included below.

  1. Calculating if ship is within the 180-degree angle of view
  2. Translucent Pygame Surfaces
  3. Translucent Pygame circle
  4. Calculating Euclidean distance
  5. Drawing with fingers on Pygame

Creative Commons

Creative Commons License
This work is licensed under a Creative Commons Attribution 4.0 International License.

References

  1. Inspiration: https://github.com/LukeGarrigan/spaceheir
  2. Eye Tracking Software: https://github.com/RishabhGhora/EyeTrackingGame

About

A single-player game where you control the spaceship using your eyes, fingers, and mouse.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages