Skip to content

Brain-Computer-Interface device (Emotiv) integration for the desktop-based Pygame game with Emotiv Cortex API and Twisted framework for asynchronous WebSocket interaction

License

Notifications You must be signed in to change notification settings

olgawoschitz/bci-emotiv-pygame-fruitrally

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

License: MIT

Fruit Rally

This project demonstrates how to integrate a Brain-Computer-Interface device (Emotiv) with a desktop-based Python game implemented with pygame. The integration is based on the Emotiv Cortex API and uses an implementation with the Twisted framework for asynchronous WebSocket interaction. With this integration, the game is able to receive mental commands and it can be controlled completely with brain signals from a BCI device.

Besides, the project can be simulated with a virtual brain wear device (Emotiv) or a keyboard.

Game

This is a simple memory game. All you have to do is to remember the shopping list and recall it during the game in the correct order by putting the items into the shopping cart. You will have only 7 seconds to memorize the shopping list. For collecting items that are not on the list you will get 5 seconds additionally to your score time. The goal is to catch all items on your list as fast as possible.

Since mental command training is quite complicated. You can have a strong signal for right-command and a weak signal for left-command, in the game you will get tested on your command power. Based on this score you will get specified minimal power of the signal for the move.

game in action

How to run this project

To run this project it is recommended to setup a virtual environment by using requirements.txt file.

  1. python3 -m venv .venv

  2. source .venv/bin/activate

  3. pip install -r requirements.txt

  4. For using BCI(Emotiv) add your user credentials into user_credentials.py under

     `"client_id": "<your id>",
     
     "client_secret": "<your secret>"`
    

    if you don't know your credentials visit https://www.emotiv.com/my-account/cortex-apps/ and/or register a new application.

  5. run the game:

    python src/mainGameLoop.py

Credits

Sounds:

Images:

Fonts:

  • verdana.ttf - Copyright © Microsoft Corporation. Designer: Matthew Carter

About

Brain-Computer-Interface device (Emotiv) integration for the desktop-based Pygame game with Emotiv Cortex API and Twisted framework for asynchronous WebSocket interaction

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages