Mind games has a single control input, jump, which allows the brain sprite to avoid the enemy sprites.
The streaming LSL chosen was muselsl. Neurofeedback.py, located in the examples folder of the github repo, was adapted to produce eeg_boiler.py, which contains the functions setup_eeg() and run_eeg(). run_eeg() streams the raw channel data, with no fourier transforms. A simple jump_boolean is returned by run_eeg() which constantly analyzes the channel data and detects if the eeg data is over a certain threshold, which is turned to true when the user blinks. Before running game.py, a separate terminal window must be running first with the command stream muselsl, which provides the stream data utilised by setup_eeg() and run_eeg().
A server is used (MQTT broker) as the intermediate controller to communicate between the two scripts. The EEG_boiler script is responsible for publishing the output signal to the server in the channel named “JUMP”. The game.py script is responsible for subscribing to the same signal and using it to control the player movement. The server is used to handle the eeg data stream as a digestible signal that will not overwhelm the game refresh rate and cause lag.
game.py is the pygame script, creating a simple two player side-scrolling game with players fixed in the x-axis and the ability to dodge incoming enemies by jumping (or not jumping). The game begins with a Start Screen, where the player can initiate gameplay by sending a practice jump signal with the Muse device. The same jump signal is used during gameplay to avoid enemies with the run time displayed as the score. The game is ended when a player collides with an enemy, taking the users to the end screen where the score is displayed and the opportunity to start another round.
Built With
- mqtt
- python
Log in or sign up for Devpost to join the conversation.