Flapp-EEEEEG🧠 Bird

Playing the classic mindbuster — with your brain

I’m sure you’ve played this over a hundred times before.

Image for post
Image for post

Okay, maybe it went more like this 😂

Image for post
Image for post

Ignoring the bad cred it’s gotten for driving people to unimaginable levels of frustration and anger, Flappy Bird is game we’ve all come to know and love.

That’s why I decided to create the ultimate Flappy Bird 2.0, also known as … Flapp-EEEEEG Bird!!!

Now, you can make a bird flap with your brain using brain computer interfaces (BCIs for short)!

To learn how I did it, read on 😉

Brain Computer Interfaces

When the neurons in your brain fire, they release electrical impulses, also known as EEGs. We can record these electrical fluctuations with electrodes! BCIs can consist from just a couple to hundreds of electrodes to record your brain activity (click here to learn more about BCIs).

Using BCIs, we don’t only record EEGs. We can also detect EMG, electrical impulses coming from your muscle movements! When you blink, the BCI will pick up a sudden spike in activity.

That’s what an eye blink looks like in EEG data

I decided to incorporate this in my game of Flapp-EEEEG Bird!

1. Getting the Brainwaves

The game is played with the Muse headband. It’s usually used for meditation but it’s got support for developers too!

Image for post
The Muse Headband! It’s got 4 electrodes to measure your EEG brain activity.

It’s connected to the computer through Bluetooth and streamed to a python file with Muse Direct through an OSC stream (check out more on how to do this here).

2. Processing the Data

Great, now we got the data! The problem is, it looks like this:

b’Person0/notch_filtered_eeg\x00\x00,dddd\x00\x00\x00@\x89\xe2\xc2\xd8\x8f\xacT@\x8b\x1f\xff\x05Hs\xd7@\\g\xc9\x16\x96\xd2\xd2@\x8b\xec\xd1\xcf\x16\xd9\t’Do you speak gibberish? I sure don't! 😕

It’s actually not gibberish, it’s in hexadecimal! First, we have to process the string and then convert all the hexadecimal numbers to regular base 10. I’ll spare you the long, boring explanation and link the gist here.

3. Determining the Blinks

Now that we’ve got data we can actually understand, it’s time to figure out exactly when the user is blinking. To do this, we can use thresholding.

Since there’s a really big spike whenever you blink, if it’s a really high number in the brain activity, it’s likely a blink. Thresholding is figuring out how big that number has to be in order to qualify as a blink. I estimated the number from visualizing the waves and trial and error, and got it to work pretty well!

Pretty sick huh? Don’t be surprised if it hits top 50 on the app store 😄

The Future of Gaming

Sure, playing Flappy Bird with your brain is pretty cool, but this is barely scratching the surface of brain computer interfaces.

Take Neurable.

They’re working on merging Virtual Reality with BCIs to revolutionize not only gaming but training, human insights, and design! Imagine being fully immersed in a game and using your brain to control objects and manipulate them!

Think about all your favourite games. Now imagine not needing any controller, keyboard and mouse, or any input device of the sort, but rather using your brain to control everything! It would make the game so much more immersive and true to life! Think telekinesis 🤯

Brain computer interfaces are also being used for medical purposes with gaming! Havard’s BrainCo’s focus 1 is improving focus by tracking the attention level of children and teenagers with ADHD. Through gamification, the players are rewarded for greater focus which encourages them to stay focused for longer periods of time!

Image for post
Image for post
Playing a space game to improve focus before class!

The sky is really the limit here. Startups are using BCIs and gaming to get people over their PTSD, remind patients to take their medication, and assist with behavioural therapies!

And with more people working in BCIs, we can improve the lives of people around the world and make our planet a more fun place to live in, one flap at a time. 🐦

Key Takeaways

  • We can use BCIs to record brain activity
  • Blinks are detected with thresholding
  • BCIs are completely revolutionizing the gaming industry, which is in turn influencing a bunch of other areas as well
  • We need more people working in BCIs to fully realize the limits of this insane tech!!

Hope you enjoyed reading about BCIs and gaming! If you enjoyed this article, be sure to follow me and connect on LinkedIn! If you want to contact me, shoot me a message at albertlai631@outlook.com. Would love to talk :)

Have a good one and stay tuned for more! 👋

Written by

I’m a 17-year-old student who loves technology and life, and trying to get better at both!

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store