Developing an academic Video Game that can be used in

Page 1 of 76
Developing an academic Video Game that can be used in
Neurofeedback to treat Children with ADHD
Presented
To the Faculty of Effat University
Jeddah, Kingdom of Saudi Arabia
In Partial Fulfillment of the Requirements
for the Degree of Bachelor of Science in
Computer Science
Written by: Yumna Muhammad Amir Aziz
Supervised by: Dr Nighat Mir
Spring 2015
Page 2 of 76
Project Title
Developing an academic Video Game that can be used in Neurofeedback to treat
Children with ADHD
Name of Student: Yumna Aziz
Date: May 10th 2015
Approved by the Project Reviewing Committee:
Course Instructor
______________________________________
Dr. Nighat Mir
Committee Member
______________________________________
Dr Wadee Halabi
External Supervisor
______________________________________
Dr. Susanne Karam
Chair of Department
______________________________________
Dr. Nighat Mir
Dean of the Engineering College
_______________________________________
Dr. Akila Sariete
Page 3 of 76
Acknowledgments
To Allah, The Most Gracious, The Most Merciful, without whom this project
would be non-existent.
To my Mother and Father, for their unwavering support and guidance.
To my advisor and supervisor, Dr Nighat Mir, who always believed in me, even
when I didn’t believe in myself.
To Dr Annechien Helsdingen, for suggesting I look into Neurofeedback
To my sister, Sundus Ansari for doing the graphics of the game, and for
providing invaluable feedback. I owe you big time.
To my friend, Sondos Azzous, for helping me design and program the game.
To my friend Fadya Maghrabi, for translating the surveys into Arabic.
To all my professors, Dr Houria, Dr Wadee, Dr Akila, for their encouragement
and support.
To my brother, Abdallah for testing out my game.
Thank you.
Page 4 of 76
Table of Contents
Acknowledgments .................................................................................................... 3
Abstract ..................................................................................................................... 6
Chapter 1: Introduction ............................................................................................ 6
Attention Deficient Hyperactivity Disorder/Attention Deficient Disorder (ADHD/ADD) ............ 6
Problems with ADHD ............................................................................................................. 7
Neurobiology of ADHD .......................................................................................................... 9
Treatments of ADHD ............................................................................................................11
Supportive/Alternative Treatments........................................................................................12
Neurofeedback training ........................................................................................................13
Chapter 2: Literature Review: ................................................................................ 15
Previous researches .............................................................................................................15
Limitations of Neurofeedback ...............................................................................................17
System Comparisons: Brain Computer Interfaces ................................................................17
Muse Development Tools: ....................................................................................................19
Development Environment: Unity3d .....................................................................................20
Research Question and Purpose: .........................................................................................21
Research Project Scope: ......................................................................................................22
Objective: .............................................................................................................................23
Chapter 3: Current Research ................................................................................. 24
Methodology and Current Research: ....................................................................................24
Data Collection: ....................................................................................................................25
Visit to Hope Center: ............................................................................................................25
Observation Results: ............................................................................................................26
Visit to King Faisal Specialist Hospital: .................................................................................26
Interview Discussion: ............................................................................................................27
Online Surveys: ....................................................................................................................28
Survey Results: ....................................................................................................................28
Discussion: ...........................................................................................................................30
Chapter 4: Project Requirements and Design ...................................................... 30
Function Requirements: .......................................................................................................30
Other functional requirements: .............................................................................................31
Non-Functional Requirements: .............................................................................................32
User Requirements: .............................................................................................................32
Game Development Document For Bunny Trouble ..............................................................32
Game type and Genre ......................................................................................................32
Short Description ..............................................................................................................33
Philosophies .....................................................................................................................33
Audience ..........................................................................................................................33
Innovation .........................................................................................................................33
Fun/Challenge ..................................................................................................................34
Mood ................................................................................................................................34
Comparison Games..........................................................................................................34
Scenario/Setting ...............................................................................................................34
Plot ...................................................................................................................................35
Game Progression:...........................................................................................................35
Each level in the game has a different operation. For this project, only one level and one operation
(addition) will be implemented. ................................................................................................35
Graphics: ..........................................................................................................................35
Page 5 of 76
Audio: ...............................................................................................................................35
Mechanics ........................................................................................................................36
.........................................................................................................................................36
Neurofeedback: ................................................................................................................36
Software Requirements: ...................................................................................................37
Hardware Requirements: ..................................................................................................37
Diagrams: .............................................................................................................................37
Use Case Diagram ...........................................................................................................37
Game Architecture............................................................................................................38
Game Flow Diagram.........................................................................................................39
Sequence Diagram ...........................................................................................................39
Chapter 5: Implementation .................................................................................... 40
Installing MuseIO..................................................................................................................40
Unity3D ................................................................................................................................42
Pairing the Muse with Laptop ...............................................................................................42
Receiving data through the terminal .....................................................................................43
.............................................................................................................................................43
Receiving Data in MuseLab ..................................................................................................44
.............................................................................................................................................44
Sending data to Unity ...........................................................................................................45
The Muse Data .....................................................................................................................46
Receiving data in Unity .........................................................................................................46
Data Flow Diagram ...........................................................................................................48
Compiling Unity Scripts ........................................................................................................48
Determining the channel and threshold value .......................................................................49
Code Definitions: ..................................................................................................................49
OSC Receiver Script ........................................................................................................50
Enemy Movement Script...................................................................................................53
Screenshots and Testing ......................................................................................................55
The above screen is presented to the user if the game is not receiving any data. ................56
Chapter 6: Final Remarks ...................................................................................... 58
Limitations ............................................................................................................................58
Challenges Faced ................................................................................................................59
Future Work .........................................................................................................................60
Conclusions ..........................................................................................................................61
References .............................................................................................................. 62
Appendix A.............................................................................................................. 66
Appendix B.............................................................................................................. 68
Page 6 of 76
Abstract
Neurofeedback shows great promise for children who suffer from ADHD.
Unfortunately, there isn’t enough research that looks at the increase in
academic performance due to neurofeedback. This project will attempt to design
and develop a mathematical video game that can be used in neurofeedback and
will attempt to answer the following question: Will using neurofeedback in
conjunction with an academic video game (catered towards children with
ADHD) result in improvements in academic performance in the classroom? This
paper will develop the game using data collected through surveys and
interviews about ADHD children.
Chapter 1: Introduction
Attention Deficient Hyperactivity Disorder/Attention
Deficient Disorder (ADHD/ADD)
ADHD or ADD is a psychiatric and neurobiological condition that has three
main symptoms. These symptoms include serious difficulties in either
inattentiveness, hyperactivity and impulsiveness or even a combination of all
three.
Inattentiveness or a lack of attention can include being easily distracted by
external stimuli, losing items, missing of important meetings, poor performance
Page 7 of 76
in reading comprehension and excessive daydreaming (Bokor & Anderson,
2014).
Hyperactivity includes an uncontrolled rate of speech and motor activity while
impulsivity is exhibited in making poor decisions due to lack of prior thought,
blurting out answers before a question is finished, a low frustration tolerance
and a short temper (Bokor & Anderson, 2014). Although each of these
symptoms are present in almost all children and adults to a certain degree, what
makes them distinct in children with ADHD is the intensity, persistence and
patterning of these symptoms.
According to Bokor & Anderson (2014), ADHD is the most commonly studied
and diagnosed psychiatric disorder, with symptoms showing up before the age
of twelve and a 50% chance of cases continuing into adulthood and even
affecting one’s working and personal lives (Smith & Segal, 2014 & FrankBriggs, 2011). The disorder occurs two to four times more frequently in boys
than in girls (Frank-Brigss, 2011).
Problems with ADHD
According to Dopfner, B., et al., (as cited in Homidi, Obaidat & Hamaidi, 2013(,
ADHD can be considered a major public health issue because of its prevalence
Page 8 of 76
and its persistent nature as well as its potential to interfere with different areas of
development.
According to data and statistics collected on ADHD in the United States, the
number of diagnosed cases of ADHD is rising among children, with 11% of
children aged 4- 7 being diagnosed with ADHD in 2011 (“Data & Statistics”,
2014). The same studies show that there has been a 1.3% increase in the intake
of medicine as treatments for ADHD from 2007 to 2011 with 17.5% of children
not receiving any kind of treatment (“Data & Statistics”, 2014). In other studies
conducted around the world (Homidi, Obaidat & Hamaidi, 2013), there was a
prevalence of 9.7% participants with clinical ADHD in Tabriz, Iran in 2010;
8.1% in Turkey in 2004, and 9.4% in Qatar in 2006. In studies conducted in
Saudi Arabia, there was a 2.7% prevalence of ADHD among primary school
children in the Assir reigon (Alqahtani, 2010), 16.4% in Dammam in 2008 (Al
Hamed, Taha, Sabra, & Bella, 2008) and 11.6% in Jeddah in 2013 (Homidi,
Obaidat & Hamaidi, 2013) All of these percentages indicate the extent to which
ADHD is present and even increasing around the world.
The main problem with ADHD is that it affects all aspects of a person’s life,
including social, academic and home life. Difficulties in attention in school, can
lead to underperformance and even academic failure (Bokor & Anderson, 2014).
According to Scuitto, Nolfi and Bluhm (as cited in Frank-Brigss, 2011), almost
Page 9 of 76
half of all ADHD students never finish high school. Research shows that around
20% to 30% of children with ADHD also have learning disabilities (Wender,
2001). ADHD children with learning disabilities will oftentimes have weak
cognitive skills such as impaired problem solving, short term memory and
processing speed (Zentall & Ferkis, 1993). This can result in problems in
academic subjects such as math, reading and writing.
ADHD can also cause a child to become frustrated, angry or disruptive.
According to Wender (2001), more than 35% of students with ADHD have
opposition defiant disorder and 25% of them have conduct disorder. This shows
that children with ADHD usually exhibit their symptoms in a way that comes
out as being disastrous to themselves and the people around them.
Neurobiology of ADHD
As mentioned above, ADHD is a neurobiological condition. This is because
there are certain areas of the brain that have been linked with ADHD such as the
frontal lobe and in particular the prefrontal cortex (Bokor & Anderson, 2014).
The prefrontal cortex lobe is the part of the brain that is involved in tasks such as
planning and organising. The frontal lobe can be viewed in the image below.
Page 10 of 76
Frontal Lobe
Figure 1: Image taken from Wikipedia [Frontal
Lobe]. (n.d.)
There are certain theories regarding neurological causes of ADHD. One such
theory is that ADHD could involve abnormal regulations in large scale networks
in the brain such as the brain default network. The brain default network is a set
of areas in the brain that are active when an individual is not focusing on the
outside world and is in a rest state. When a goal oriented task is being carried
out, the default network is suppressed and this prevents internal distractions and
the mind from wandering (Bokor & Anderson, 2014). Another theory suggests
ADHD is caused by an imbalance of dopamine. Dopamine is a neurotransmitter
that is associated with reward, attention, short-term memory tasks, planning and
motivation (Bokor & Anderson, 2014).
According to studies, the most
commonly reported EEG abnormality is the increased frontal theta activity.
Theta refers to brain wave frequencies between 4 - 8 Hz (Lofthouse, Arnold,
Hersch, Hurt, & Debeus, 2012).
Page 11 of 76
Treatments of ADHD
The most effective treatment for ADHD is the use of psychostimulants.
Psychostimulants are drugs such as methylphenidate, also known as Ritalin that
can decrease the symptoms of ADHD by increasing the activity of dopamine
and norepinephrine (another transmitter associated with ADHD) in the
prefrontal cortex. (Bokor & Anderson, 2014).
Although medication is
extremely effective it is not a permanent cure. The patient has to keep taking the
medicine to keep the symptoms under control. Once the medication wears off,
the symptoms re-emerge. There are also instances where the medication does
not work and according to Lofthouse, Arnold, Hersch, Hurt, & Debeus (2012),
almost a third of children with ADHD do not fully benefit from the medication.
Therefore, alternative treatments need to be looked into.
There are also several non-medical treatments for ADHD that can be taken
alongside medication; these include psychoeducation, group therapy, individual
psychotherapy, training in concrete skills, work and school accommodations and
coaching. According to Bokor & Anderson (2014), Accommodations in school
can include one-one sessions, tutoring, having another student record the lecture
and take notes, providing extra time on tests and allowing the ADHD student to
take their exam in a quieter area (Bokor & Anderson, 2014).
Page 12 of 76
Psychotherapy involves correcting self-esteem issues as well as anger and
relaxation issues. One example of psychotherapy is cognitive behaviour therapy,
also known as CBT. CBT is an approach that deals with dysfunctional emotions,
maladaptive behaviour and cognitive processes by using goal-oriented
techniques. It is also used to improve one’s social skills (Bokor & Anderson,
2014).
Supportive/Alternative Treatments
As discussed above, there is a need for alternative long-term treatments for
ADHD. One possible solution is Neurofeedback. Neurofeedback is a method
through which the brain is trained directly in order to gain self control over
certain brain activity patterns, derive self-regulating strategies and then
implement these strategies in one’s daily life (Meisel, Servera, Garcia-Banda,
Cardo, & Moreno, 2014). The theoretical foundation of neurofeedback depends
on the idea that brainwaves can be consciously modified (Lofthouse, Mcburnett,
Arnold, & Hurt, 2011).
The training is carried out by monitoring one’s brain waves in real time through
an EEG device, presenting this information in real time to the user in the form of
video, audio or tactical form and then providing a real-time response to the user.
This can be described as a closed loop between sensing the brain waves and real
Page 13 of 76
time feedback as seen in the diagram below. The response can be either negative
or positive depending on which state the brain is
currently in. By being presented one’s brain state
through visuals or audio, one can change their
state of mind from a less desired one to a more
desired one. This can condition the user to
achieve and stay within a certain state of mind
(Lofthouse, Mcburnett, Arnold, & Hurt, 2011)
Figure 2: [Neurofeedback Loop]. (n.d.)
Neurofeedback training
There are different protocol that can be used in neurofeedback training when
dealing with ADHD. For the purpose of this research, and due to limited time
and resources, a single protocol will be looked at; namely TBR Neurofeedback
also referred to as theta/beta training. Theta/beta training involves regulating the
brain’s electrical activity shown as brainwaves on an EEG device. The brain
waves are said to change according to the function state of the brain. They are
described in terms of rhythmic activity and are measured in hertz which can also
be known as the frequency of the wave or the number of waves per second
(Lofthouse, Mcburnett, Arnold, & Hurt, 2011).
Page 14 of 76
EEG or electrical activity can be divided into specific frequency bands: delta,
theta, alpha, and beta. Delta, also called the slow wave, goes up to 4 Hz and
usually occurs during deep sleep. Theta is between 4 - 8 Hz and is emitted
during a drowsy, inattentive state. Alpha is between 8 - 12 Hz and is emitted
when one is in a relaxed or wakeful state. Beta is between 12 - 30 Hz and is
emitted during an active or an attentive state (Lofthouse, Arnold, Hersch, Hurt,
& Debeus, 2012).
Figure 3: Diagram taken from Lofthouse, N., Arnold, L. E., Hersch, S., Hurt, E., & Debeus, R.
(2012)
Research has shown that many patients with ADHD have more slow wave (theta
in particular) activity in their resting EEG spectral analysis than normal controls,
and they also have less beta wave activity especially in the central and frontal
regions (Lofthouse, Arnold, Hersch, Hurt, & Debeus, 2012).
Page 15 of 76
There are two types of beta frequencies, lower (12 - 15 Hz) and higher (>15).
Higher beta frequencies have been shown to be associated with focusing on a
task or other situations requiring attention (Lofthouse, Arnold, Hersch, Hurt, &
Debeus, 2012). The idea behind theta/beta training is to induce beta-band EEG
rhythms (either lower or higher) and to suppress theta rhythms by using visual
and auditory feedback (Lofthouse, Mcburnett, Arnold, & Hurt, 2011).
Chapter 2: Literature Review:
Previous researches
Neurofeedback is a relatively new field in research with the very first
randomised study being presented in 1994. In recent years, there have been a
number of well-controlled studies conducted in order to evaluate the
Neurofeedback treatment of ADHD. One such research concluded that NF
treatment can be considered “efficacious and specific” and results in a large
effect size for inattention and impulsiveness, and a medium effect size for
hyperactivity (Arns, Ridder, Strehl, Breteler, & Coenen, 2009). Several other
studies have reported a decrease of behavioral problems and improved cognitive
performance in ADHD after theta/beta training (Meisel, Servera, Garcia-Banda,
Cardo, & Moreno, 2014)
There have also been several studies that compared the efficiency of
Neurofeedback to stimulant medication and resulted in comparable effects in all
three symptoms. These studies concluded that stimulant medicine such as
Page 16 of 76
methylphenidate are not superior to Neurofeedback, however, the sample size of
these studied was small and therefore more research needs to be carried out to
prove this (Arns, Heinrich, & Strehl, 2014).
One particular study carried was out by Meisel, Servera, Garcia-Banda, Cardo,
& Moreno (2014) stands out because it not only looked at NF in comparison to
medical treatment but also if the treatment would cause any gains in academic
performance. The study was a randomized control trial where behavioral
measures were carried out at different points: pre and post treatment, a two
months follow up, and a six month follow up. The participants were both boys
and girls ages 7 - 14. The pre-assessments were carried out around a week
before the treatment began. The post treatment was given five months after
medication had been started and after completing 40 neurofeedback sessions.
The theta/beta training consisted of two sessions per week. Each session
involved six runs of four minutes each with breaks in between. The training was
presented in the form of a computer game in which the child had to concentrate
in order to win. The child was encouraged to develop and adopt strategies that
best help them win the game. The child would receive visual and auditory
reinforcement whenever he/she would successfully control their theta or beta
levels.
Page 17 of 76
The results obtained were very interesting. After completing the final
assessment after six months, there were no significant difference found between
the two group in inattention, hyperactivity, functional impairment or ODD.
Significant improvements in all areas of academic performance except for math
and oral expression were observed in the participants receiving neurofeedback
but not in the pharmacological group.
Limitations of Neurofeedback
The main two limitation of neurofeedback is that it is not easy to perform as it
requires multiple sessions in order to see results and EEG devices are expensive
and not easily accessible. Also, there are a limited number of researches that
address if there is an increase in academic performance after neurofeedback
treatment (Meisel, García-Banda, Servera, Cardo, Amengual, Arroyo et al. 2011
& Meisel, Servera, Garcia-Banda, Cardo, & Moreno 2014). Problem solving
issues also seem to be a problem for ADHD children (Zentall, & Ferkis, 1993).
System Comparisons: Brain Computer Interfaces
A brain computer interface is a device which allows a direct communication
pathway between the brain and an external device. Research regarding BCI first
began in the 1970 and the EEG is the most studied device in this field (Brain–
computer interface, n.d.).
Page 18 of 76
Recently, there has been an emergence of cheap BCI devices released for
entertainment that have the potential to be used as treatments for mental
disabilities. Researches have and are being conducted to validate their use. Due
to their low expense, a commercial BCI device can be used in the development
of this project. Therefore, two specific devices were compared and contrasted:
Muse and Emotive. The table below summarizes their differences and
similarities:
Category
Muse
Emotive EPOC
Price
$299
$699
Shipping
Ships within two days
NA
Research
Limited research
Heavily research based
available
Support
Online Forum
Online Forum
SDK
Android, Libmuse
Mac, Linux, Windows,
Library
iOS, and Android API
MuseIO
Sensors
7 channels of EEG data
3 base sensors and 4
EEG channels.
Table 1 - Muse Vs Emotive EPOC
14 channels of EEG data
Page 19 of 76
Although the Emotive EPOC seems like a better choice between the two, due to
limited time, Muse was the better option.
Muse Development
Tools:
In the Muse SDK, there are two
methods
of
developing
applications using the Muse data:
by using the Libmuse library and
through MuseIO. Libmuse is the
android library that allows the
Figure 4 - Muse
developer to develop applications in native code. On the other hand, MuseIO is
a Mac and Windows driver that sends out Muse data as OSC messages and can
be integrated within different programs. MuseIO also comes with two other
programs: MuseLab and MusePlayer. MuseLab can be used to view brainwave
and other types of data. It works by receiving data form MuseIO in real time and
allows one to record and apply digital signal-processing functions onto it. The
MusePlay is used to replay recorded data as an OSC stream and it can also be
used to output the stream into different formats.
Due to the limitations, this project will be using MuseIO as it’s primary way of
receiving data from the Muse. This is so that the Muse data can be used in
programs other than Android Studio. This allows the developer the freedom to
Page 20 of 76
choose the best-suited development environment based on the limitations of this
project, the main one being time.
Although research data related to Muse is limited, below is a graph that
illustrates the data collected from Muse, against data collected from a clinical
grade EEG device called Actichamp. The data was collected from the same
location by both devices. As it can be seen, the data from Muse and Actichamp
are very similar. For the purposes of this research, this is validation enough to
consider the muse as part of the development process.
Figure 5 - Diagram taken from Advice using Muse in my Senior Project (2014).
Development Environment: Unity3d
The chosen development environment for this project
will be Unity3D. Unity3D is a game engine that can be
Page 21 of 76
used to develop both 2D and 3D games. The programming languages used in
Unity3D are C#, Javascript, and Boo. Unity also supports deployment to
different platforms including but not limited to Windows, Mac, Android, and
iOs. Unity provides tons of resources in the form on online tutorials, books and
game walkthroughs, which can be used to learn the environment while
developing the game.
Research Question and Purpose:
After understanding how neurofeedback works and it’s potential of being used
as a treatment for ADHD, this research will now propose a research question:
Will using neurofeedback in conjunction with an academic video game (catered
towards children with ADHD) result in improvements in academic performance
in the classroom? This question arises after viewing the limited number of
researches that address an increase in academic performance after undergoing
neurofeedback treatment. It was also noticed that none of the researchers looked
into the use of an academic video game in neurofeedback training. Therefore,
the purpose of this research is to develop an academic video game that can be
used in neurofeedback treatment and then have the game tested among various
control groups. The chosen academic subject will be mathematics as this seems
to be a problem among ADHD children. According to Zentall, & Ferkis (1993),
evidence suggests arithmetic performance on the WRAT (Wide range
achievement test) decreases over time doing the age of 8 - 16 years for children
Page 22 of 76
with ADHD and learning disabilities. This research will hypothesise the
following: associating an academic subject such as mathematics with a
neurofeedback
session
that
improves
concentration,
impulsivity
and
hyperactivity, will result in an improvement of problem solving skills among
ADHD children.
Research Project Scope:
The scrope of this research project is to develop an academic video game that
can be used in neurofeedback to treat children with ADHD. The project can be
divided into two distinct parts:
1) Developing the academic video game
2) Using data from the Muse in the video game to monitor the player’s state
of mind
Each of these parts can be divided further:
1) Developing the academic video game:
a. Collecting data and game specification through interviews,
observation and surveys
b. Outlining the game specifications
c. Designing the game using the specification
d. Developing the game
Page 23 of 76
2) Using data from a BCI device and incorporating it within the game to
monitor the player’s state of mind.
a. Receiving brain waves from the Muse.
b. Processing the brain waves received to obtain the information
needed
c. Sending the information to the game and having the game react
accordingly
Objective:
The main objective of this research project is to understand the target audiences,
which are in this case children with ADHD. This needs to be done in order to
design an academic game that caters to their interest. The main learning
objective is to learn how to make a video game from scratch – this includes
coming up with an original idea, writing the game design document, and
programming the game. The other learning objective is to understand which
signal processing technique should be used in order to obtain the necessary
information from the brain waves.
Page 24 of 76
Chapter 3: Current Research
Methodology and Current Research:
This project will follow the following steps:
1) Collect data on ADHD children
2) Create a persona to understand the target audience
3) Design a game using the data collected and the personas
4) Use data from a BCI device to develop the game
6) Test the game to make sure it’s working as expected
The approach that will be used when designing and developing the game will be
the Iterative and Implementation development process. This is because the
project requires one to go back and edit previous stages of the project, such as
the requirements and design state.
Figure 6 - Iterative and Implementation Development Process
Page 25 of 76
Data Collection:
The first step to developing the video game was to gather data on the likes and
dislikes of the intended audience, in this case, children with ADHD. There was
also a need to better understand the target audience in order to make it specific
to their needs. In order to collect this data, the following tasks were carried out:
1) Visit to Hope Center (Observation)
2) Appointment with Dr Shamshad, Assistant Consultant Pediatric
Neurology (Interview)
3) Online Surveys (Questionnaires)
Visit to Hope Center:
The visit to Hope center was carried out in order to get a chance to observe
children with ADHD and to gather data on the requirements of the game. After
contacting Hope Center and explaining the research project, they informed me
they did not have purely ADHD children, but instead had children with both
ADHD and Autism. It was decided, that I would visit the center anyway with
hopes of being able to gather some kind of data.
During the visit, a total of four children were observed, Khadijah, Omar,
Abdusamad and Zakariyah, all of whom had ben diagnosed with both ADHD
Page 26 of 76
and autism. When asked, the center informed me said that they were not the
ones in charge of diagnosing the children, but instead were provided with
hospital reports by the parents.
Observation Results:
Though it was difficult to recognize at first, all children seemed to exhibit some
form of ADHD behavior. This behavior included being distracted easily and not
being able to sit still for very long.
The following question resulted from the visit:
1) All the children that were observed had some sort of speaking
impairment, therefore, would a child with only ADHD be able to speak
and comprehend what I was saying to them?
The following specification were concluded from my visit:
1) Background Music or sounds catches the attention of children with
ADHD
Visit to King Faisal Specialist Hospital:
In order to answer the prebious question, an appointment with Dr Shamshad,
Assistant Consultant Pediatric Neurology, was scheduled. The following are the
more important questions that were asking during the interview:
1. At what age are is a child diagnosed with ADHD?
2. Have you heard of Neurofeedback therapy?
3. What is the level of understanding of ADHD children?
Page 27 of 76
Interview Discussion:
Dr Shamshad was kind enough to take some time out of her extremely busy
schedule to meet for the interview. During the interview, the answers of each
question were discussed in depth. For the first question, I was informed that it is
difficult to diagnose children at a very young age. This is because most children
exhibit some form on inattentiveness, hyperactivity and impulsiveness. The
signs appear most clearly when a child begins school as their academic
performance lacks in comparison to other students. Also, as mentioned in the
introduction of this research, the symptoms and their consequences need to be
present in more than one situation. (For example, at home and in school)
Several treatments of ADHD were also discussed, including medical treatments,
and behavior therapy. Dr Shamshad was asked if she’d heard of Neurofeedback.
She informed me that she had, but that it is not performed at King Faisal
Specialist Hospital. Finally, I asked about the level of comprehension and
understanding of ADHD children. I was told that their comprehension and level
of understanding is perfectly fine but due to an inability to concentrate, ADHD
children are weaker in skills such as verbal communication skills and basic
reading skills. This is proven in a research conducted by Brown, Reichel &
Quinlan (2011), where giving extended time to children with ADHD resulting in
higher mean scores on both the verbal and reading comprehension tests.
Page 28 of 76
Online Surveys:
The last method of collecting data was in the form of surveys that were sent out
to students at Effat University. The questions on the survey were phrased in such
a way that the responder could respond based on whether they themselves had
been diagnosed with ADHD or on the behalf of someone they knew that had
been. This arrangement was done due to limited time and resources. The survey
was sent out in both Arabic and in English, although majority of the respondents
responded to the Arabic survey. (A copy of the survey is available in the
appendix)
Survey Results:
The purpose of the survey was to obtain an idea on the kinds of video games
ADHD children play and the features that they find attractive. Although
additional information on the symptoms and treatments were also collected - the
results for those will not included, as it is not an accurate representation of the
ADHD population in Jeddah.
There was a total of 28 responses (61% male, 39%), all of whom live in Jeddah,
Saudi Arabia. The following three pie charts give an idea of their gaming habits.
Survey
Results
Page 29 of 76
Figure 9 - Amount of hours played
None
Less than an hour
1 - 2 Hours
3 - 4 Hours
5 - 6 Hours
7 - 8 Hours
8+ Hours
14% 14%
4%
11%
21%
25%
11%
Figure 8 - Genres played
Action (ex. Drake's Deception)
Adventure (ex. Myst)
Massively Multiplayer Online Role Playing Games
Puzzle games (ex. Tetris, Soduko)
Platformer type (ex. Subway surfer)
First person shooters (ex Call of Duty)
None
6%
18%
34%
10%
8%
4% 20%
Figure 7 - Features that are appealing
Bright colors
Fast gameplay
Background music
Background sound
Intuitive gameplay (no instructions - learn to play by trial)
Good graphics
Having a goal to work towards
Gaining rewards
The storyline
Nothing
3%
8%3%
7%
24%
17%
12% 10%
7%
8%
Page 30 of 76
Discussion:
From the data that was collected, it can be seen that majority of ADHD children
enjoy playing action games and adventure such as Drake’s Deception and Myst.
First person shooters were also very popular even among children aged 4 - 6.
The features they find most attractive are fast gameplay and having a goal to
work towards. Goal oriented play can be connected to the previous theory
mentioned related to the brain’s default network. It can be assumed that
performing goal oriented tasks in a game, will suppress the brain’s default
network and allow the ADHD child to focus better, thereby resulting in longer
time spent playing the game.
Chapter 4: Project Requirements and Design
This part of the project will go over some of the elements the game will have
based on the data collected. It will specifcy the function and non-functional
requirments of the game. It will also contain the GDD (game development
document) of the game designed.
Function Requirements:
The main functional requirement for this game is for it to measure the player’s
theta and beta waves and respond appropriately. Some techniques that can be
used to ensure the beta and theta waves are in the right range is to provide
Page 31 of 76
feedback each time the theta waves or beta waves increase above or decrease
below a certain threshold.
Previous methods include decreasing the visibility of the playing screen. This
was previously used by Mandryk, Dielschneider, Kalyn, Bertram, Gaetz,
Doucette et al. (2013) on commercially available games to improve the interest
of children with Fetal Alcohol Spectrum Disorder FASD in the neurofeedback
game. An image of this method can be seen below:
Figure 10 - Picture taken from Mandryk, Dielschneider,
Kalyn, Bertram, Gaetz, Doucette et al.
Other methods that can be implemented to ensure the theta and beta values do
not exceed beyond a particular threshold can be to change the background music
or the visuals displayed on screen. The enemies in the game can also become
faster or slower depending on which state the brain is in.
Other functional requirements:
2D Graphics
Rewards the player (score keeping)
Provides in-game goals to word towards
Intuitive to learn
Page 32 of 76
Includes arithmetic within the gameplay
Provides the player with choice
Played using the mouse
Non-Functional Requirements:
There should be a minimum delay in the real-time feedback loop
The game should run smoothly
There should be background sounds and music
User Requirements:
The player should be able to turn the game on
Interact with the game through a series of mouse clicks:
Pause the game
Return to the main menu
Exit the game
View High Score
Game Development Document For Bunny Trouble
Game type and Genre

Educational, Real Time Strategy Game

Medium: Computer Game
Page 33 of 76
Short Description

The goal of this game is to defeat the enemy by planting magical
plants on a grid using a specified operation (Addition, Subtraction,
Multiplication or Division). Once all the enemies have been
“defeated” the player wins the level. If a certain number of enemies
reach the player’s base, the game ends.
Philosophies

The game is trying to help ADHD children to increase their focus
by engaging them in a fun interactive game that will also increase
their problem solving skills at the same time.

Therefore, the game will provide the player with negative or
positive feedback based on the player’s state of mind. If the player
is concentrating, they will be rewarded, if the player is not
concentrating, the game will catch their attention by blurring the
screen.
Audience

The game’s main audience will be children with ADHD, aged 10 –
12.
Innovation

The idea of the game is taken from plant vs zombies but with a
mathematical twist. Although the idea of including mathematics in
the gameplay has been done before, this game will be innovative
because it provides the player with choice.
Page 34 of 76
Fun/Challenge

The challenge is in creating the mathematical formulas. The fun
includes the fast gameplay and coming up with different strategies
to defeat the enemy.
Mood

Feeling of accomplishment and fun factor
Comparison Games

Math vs Zombies

Game Over Gopher
Scenario/Setting
Setting: A vegetable garden (gird), which is outside the main
character’s house.
Scenario: A magical scarecrow has a scroll which contains a
magical spell that allows him to create magical plants. The evil
witch of the west is trying to steal this knowledge by sending her
evil bunnies to infiltrate the scarecrow’s base (which is his house).
The scarecrow plants magical vegetables (carrots and turnips) in his
garden that when eaten, will turn the evil bunnies into good bunnies
so they are no longer under the witch's control.
Page 35 of 76
Plot
Figure 11 - How the level will progress
Game Progression:
Each level in the game has a different operation. For this project, only one level
and one operation (addition) will be implemented.
Graphics:
The graphics will be simple 2D graphics that will attempt to make the game
appealing and interesting to the player. The graphics for the actors, background
and artifact will either be outsourced or non-copyrighted images will be used
(with credit given to the artist)
Audio:
The game will include background music as well as different sound effects. The
sound effects include providing the player with feedback as to whether their
answer is correct or not and playing a sound at the end when the player wins or
loses the game.
Page 36 of 76
Mechanics

Select any tile on grid.

Select the numbers that add up to the number on the grid

Select the vegetable you wish to plant

Click plant

Vegetable is planted on the chosen tile
Figure 12 – User Interface
Neurofeedback:
In order to provide the player with feedback, the player’s level of concentration
will be presented to the player between the range of 0% to 100%. In order to
encourage the player to concentrate, the speed of the enemies will be modified
based on whether or not the player is concentrating above a certain threshold. If
the player’s concentration is above the threshold, the enemies will come into the
Page 37 of 76
scene at a slower rate, allowing the player more time to calculate. If the player’s
concentration is below the threshold, the enemies will come into the scene at a
fast rate, forcing the player to increase their concentration in order to win the
game.
Software Requirements:
The player will need to have the game in a format that is compatible with their
operating system. The player will also need the Muse SDK installed.
Hardware Requirements:
The player will need to have a computer (Windows or Mac) with at least 2GB of
RAM and a hard disk of 200GB memory. The player will also need the Muse,
brain computer interface in order to carry out neurofeedback.
Diagrams:
Use Case
Diagram
As seen in the
user
Figure 13 - Use Case Diagram. The main two actors are the developer
and the player.
case
Page 38 of 76
diagram, the user can interact with the game in a number of ways. On the other
hand, the developer can add levels, edit current levels and view the player’s
brainwaves as they are playing the game.
Game Architecture
Figure 14 - The red lines show a clear
feedback loop from the player's brain state to
feedback presented to the player on screen.
Page 39 of 76
Game Flow Diagram
Figure 15 - The Game Flow Diagram. If the player's beta falls below or above a threshold value, the speed of the
enemies is modified.
Sequence Diagram
Figure 16 - Sequence Diagram.
Page 40 of 76
Chapter 5: Implementation
The first step was to set up the development environment. This included
installing MuseIO and Unity3D.
Installing MuseIO
Page 41 of 76
Below is a screenshot that displays the files that were installed, the main ones
being muse-io, muse-player and museLab.
Page 42 of 76
Unity3D
Unity3D was already installed. Below is a screenshot displaying the interface.
Pairing the Muse with Laptop
In order to pair muse with a laptop or any other device, the muse needs to be
turned off. With the muse turned off, press and hold the power/pairing button for
five seconds. This
will make all five
LED lights flash
together at the same.
Then turn on the
Bluetooth on the
computer you want
muse to connect to,
Page 43 of 76
search for nearby devices, and select “Muse” or “Muse-XXXX” from the list.
Then click connect. This will pair the muse with the device.
Receiving data through the terminal
Once the muse is paired with the laptop, turn the Muse on by pressing
power/pairing button for a second. This will set the lights blinking – indicating
that the Muse is looking for a device to connect to. Making sure that the
Bluetooth is turned on, type the following command into the terminal and press
enter:
muse-io
This command tells the muse the start sending data to port number 5000 (which
is the default port) using the TCP protocol. The screenshot below shows that the
muse has successfully connected and is sending data to the laptop.
Page 44 of 76
Receiving Data in MuseLab
Now that the muse is sending data, this data can be received by a program made
available within the SDK called MuseLab. MuseLab receives (and sends) data
by listening on the port specified when making the connection. In this case, the
port number is 5000. The screenshot below shows how this port can be opened
through Muselab.
Once the port is open, data starts streaming in. This data is of two types: raw
EEG data, and data that has had Digital Signal Processing (DSP) applied to it.
Page 45 of 76
For this project, we will be concerned with the DSP signals because they have
already been processed to some degree.
Sending data to Unity
In order to send data to unity, click on the “outgoing” tab shown below and
specify the address to which the data will be sent as well as the port number and
the protocol. In this case, the address 127.0.0.1, along with port number 5001
will be selected. Make sure the protocol is set to UDP. Once the necessary fields
are specified, click the “add” button and a list of possible data to forward will be
listed. In this case, we’re going to filter out two types of data:
1. /muse/elements/touching_forehead,
Page 46 of 76
2. /muse/elements/beta_relative
The Muse Data
All of the data provided by the Muse has been documented on their website and
can
be
found
at
https://sites.google.com/a/interaxon.ca/muse-developer-
site/museio/osc-paths/osc-paths---v3-6-0. For the purpose of this project, only
the two fields selected above will be explained. The touching_forehead is a
boolean value which can either be 1 or 0. It indicates
if the base sensors are touching the forehead. This
value can be used to determine if the game is
receiving muse data. The second type of data,
beta_relative is the data that is of interest in this
project. Beta_relative has four values and each value
indicates how much beta is present in each channel.
Its value falls between 1 and 0. Beta_relative is what
is going to be used to measure the player’s level of
concentration while playing the game.
Receiving data in Unity
In order to receive data in Unity, there needs to be
an OSC plugin and scripts that set up the OSC receiver. Fortunately, there is an
open source project which we can use for this exact purpose. The project can be
found at https://github.com/heaversm/unity-osc-receiver. The project includes
Page 47 of 76
several scripts, including two plugins scripts, one receiver script and one sender
script. In order to use the OSC receiver within our own project, the unity-oscreciever was imported as an asset into our project. The assets that are imported
include a “Main” scene. The main scene has a Cube, and a “Script Object”. In
order for scripts to run in Unity, they need to be attached to a game object,
therefore, the Script Object is an empty game object has all four scripts attached
to it. (As can be seen in the screenshot above) The OSCReceiver script can be
used to indicate the address and port number on which to listen for the data. As
shown in the screenshot, the address and the port are the same as the ones
specified earlier. This means that when the Unity project is run, the OSC
Receiver script start receiving data on the 5000 port using the UDP protocol.
Below is a screenshot displaying the data received in the console.
Page 48 of 76
Data Flow Diagram
This entire flow of data from the Muse to the Unity project can be visualized in
the diagram below:
Figure 17 - Data Flow Diagram
Compiling Unity Scripts
Scripting in unity can be done in three languages: C#, JavaScript and Boo.
When it comes to compiling and accessing scripts written in different languages,
Unity needs to have the scripts placed in a specific hierarchy in the assets folder.
All the scripting for the game, Bunny Trouble, was done in C#, while the OSC
receiver script was written in JavaScript. The OSC Receiver needed to be able to
access the game code in order to update the game with the information received
from the Muse. Therefore, Unity has to compile the plugins and the C# scripts
before compiling the JavaScript scripts. The hierarchy of the scripts are outlined
below:
Page 49 of 76
/BunnyTrouble/Assets/Plugins/Scripts/C#Scripts
/BunnyTrouble/Assets/Scripts/JavaScript Scripts
According to the documentation, any scripts in /Assets/Plugins are compiled
first, then the scripts in the /Assets/Plugins/Scripts folder are compiled next and
finally, the scripts in /Assets/Scripts folder are compiled last. This ensures the
Javascript scripts can refer to the C# scripts without throwing any errors.
Determining the channel and threshold value
As mentioned earlier, Muse has four different channels, each with a different
beta_relaitive value. In order to determine which of the four channels to use in
the comparisons, the beta_realtive of each channel was recorded while doing an
activity that requires concentration, such as reading. The four values were then
compared manually. After several comparisons, it was noticed that the
beta_relative from the right forehead sensor was the highest when concentrating.
In order to determine the threshold value, the game was played several times,
and the level of concentration level was observed. The threshold value was
chosen based on the range of values the game displayed while playing. When
the player wasn’t concentrating, the value always seemed to fall below a certain
number. That number was chosen as the threshold.
Code Definitions:
Page 50 of 76
OSC Receiver Script
//Attatched to an empty game object called “OSR Messages”. Receives the OSC messages
being sent by the Muse.
#pragma strict
public var RemoteIP : String = "127.0.0.1"; //127.0.0.1 signifies a local host (if testing locally
public var SendToPort : int = 9000; //the port you will be sending from
public var ListenerPort : int = 8050; //the port you will be listening on
public var controller : Transform;
private var handler : Osc;
private var concentration: float; //Variable to store the beta value
private var rotation: float; //Varaible by which to rotate the cube
private var yRot : int = 0; //the rotation around the y axis
public function Start ()
{
//Initializes on start up to listen for messages
//make sure this game object has both UDPPackIO and OSC script attached
var udp : UDPPacketIO = GetComponent("UDPPacketIO");
udp.init(RemoteIP, SendToPort, ListenerPort);
handler = GetComponent("Osc");
handler.init(udp);
handler.SetAllMessageHandler(AllMessageHandler);
Page 51 of 76
}
Debug.Log("Running");
function Update ()
{
}
//These functions are called when messages are received
//Access values via: oscMessage.Values[0], oscMessage.Values[1], etc
public function AllMessageHandler(oscMessage: OscMessage){
var msgString = Osc.OscMessageToString(oscMessage); // The message and value combin
ed
var msgAddress = oscMessage.Address; // The message parameters
concentration = oscMessage.Values[0]; //The first value of the message
Debug.Log("Concentration: " + concentration);
Debug.Log(msgString);
if(msgAddress == "/muse/elements/touching_forehead")
{
if(concentration == 1)
Page 52 of 76
{
DeviceManager.instance.device = true; //Device Manager is a C# script. It has a varia
ble called deivce.
Debug.Log("Device Connected");
}
else
{
Debug.Log("Please adjust the headset so that all channels are receiving data");
DeviceManager.instance.device = false;
}
//FUNCTIONS YOU WANT CALLED WHEN A SPECIFIC MESSAGE IS RECEIVED
switch (msgAddress)
{
case "/muse/elements/beta_relative":
concentration = oscMessage.Values[2]; //Store the beta value from the right forehea
d channel and impli change
// the type of oscMessage.Values[2] from object to float
if(concentration >=0)
{
DeviceManager.instance.previousBeta = DeviceManager.instance.beta; //Keep tr
ack of the previous beta value
DeviceManager.instance.beta = concentration*10; //Keep track of current beta va
lue
}
Page 53 of 76
default:
Debug.Log(concentration);
break;
}
}The OSC receiver handles the data that is received through the Muse. There are
two important functions in this script:
1) Start function: starts up the UDP connection
2) AllMessgeHandler: takes in OSC messages as its parameter. It then
checks to see if the msgAddress of the osc message is of type
“/muse/elements/touchingforehead”. If it is, it sets the variable called
device within the device manager script to true. (Device Manager script
can be found in the Appendix) It then checks to see if the msgAddress is
/”muse/elements/beta_relative”. If so, the value of beta is stored in the
variable called concentration which is of type float. The variables called
beta and previous beta in the device manager script are updated with
whatever the current beta is.
Enemy Movement Script
//Changes the enemy’s speed based on the player’s concentration level
using UnityEngine;
using System.Collections;
public class enemyMovement : MonoBehaviour
{
//CharacterController controller;
Page 54 of 76
public float speed;
//Min = 0.4 Max = 1.5
void Update ()
{
//12 is the threshold value.
//If the player is not concentrating, then increase the speed movement
if (DeviceManager.instance.beta * 10 < 12) //
{
if (speed >= 1.5)
{
speed = 1.5f;
} else
speed += 0.01f;
} else
{ //Else decrease the speed movement
if (speed <= 0.4)
{
speed = 0.4f;
} else
speed -= 0.1f;
}
if (GetComponent<bunnyHealth> ().dead == false)
{
transform.Translate (-Vector2.right * speed * (Time.deltaTime));
}
}
}
The enemy movement script has a single function called Update. The update
checks to see if the value of beta is below a certain threshold such as 12. If it is,
it changes the variable called speed so that it increases by 0.01f. At the same
time, it ensures that the value of speed does not go above 1.5f. If the value of
beta is not below the threshold value, the speed is decreased by 0.1f. The speed
is also checked to ensure it does not go below 0.4f.
Page 55 of 76
Screenshots and Testing
Page 56 of 76
The above screen is presented to the user if the game is not receiving any data.
Page 57 of 76
Recorded data is sent to muse-player using the command: muse-player –f
reading.muse –s osc.udp://localhost:5000, where reading.muse is the recorded
muse data and it is being sent to port number 5000 using the UDP protocol.
Once the data is received, the black screen is replaced with the playing screen.
The text on the top left of the screen is being updated to show the player’s level
of concentration.
This screen shows the enemy’s speed being updated along with the player’s beta
levels.
Page 58 of 76
Chapter 6: Final Remarks
Limitations
One of the main limitations in this project was time. Although two semesters
were given to work on this project, the idea was considerably changed during
the second semester. This meant everything had to be redone within the last four
months, including the literature review, data collection and project design. The
implementation also had to be done within the last four months.
The other limitation was the issue of collecting data. As part of the game
development process, data needed to be collected from children with ADHD. In
order to do this, an attempt to get permission for data collection from King
Faisal Specialist Hospital was initiated. Unfortunately, the request took too long
to process. This meant the game could not be tested out on actual ADHD
children.
The final limitation was the lack of knowledge. Before this project was
undertaken, little to no knowledge was known about signal processing. There
was also a lack of practical knowledge on building a game from scratch. This
meant a lot of the four months was spent learning about signals, understanding
the Muse SDK, understanding how OSC works, and learning how to build a
game from scratch. This means that the currently implemented neurofeedback is
Page 59 of 76
a very crude version of neurofeedback and needs to be tested and improved
further.
Challenges Faced
The challenges that were faced were many. Research is a process that involves
questioning, asking and reconfirming what you’ve read/ already know. There
were times when I had doubts about where this project was headed. This lead to
more questions, and more answers until I was satisfied with my research
questions. Therefore, the hypothesis of this project went through a lot of
changes.
Programming the game had it’s own set of challenges. I had decided to combine
the final project of my Game Development course with this course. This came
with a different set of requirements including having to work with a team.
Although this had its advantages, it also had its disadvantages. Team working
has never been one of my strongest factors, especially since I have a tendency to
want to do everything on my own. This meant I had to learn to depend on my
team member especially in critical moments of the project.
Understanding and working with the muse SDK was a challenge of its own.
Seeing as the Muse was released quite recently, the tools, data and resources
available were limited compared to other BCI devices. Although the Muse
Page 60 of 76
developers were quite helpful on their forums, they also took a long time to get
back to answering my concerns and questions.
Finally, working with OCS messages for the first time meant having to
understand how to modify the OSC receiver to obtain the data I needed. I also
ran into a couple of issues when changing data from one type to another.
Future Work
The finished game of this project is nothing more than a prototype. For this
project to go further, the following additions need to be implemented:
1) Testing the game out on ADHD patients and taking their feedback into
consideration
2) Adjustable threshold value depending on the ADHD patient
3) Providing an adjustable level of difficulty
4) Adding in more levels
5) Providing an interactive tutorial instead of the written one
6) Adding in Arabic as a language
7) Improving the graphics of the grid
8) Improving the animations within the game
9) Finding out how to combine the amount of beta from multiple channels to
provide better feedback to the player
Page 61 of 76
Conclusions
This project was a journey that involved a lot of simultaneous learning and
implementation. The challenges I faced were many, such as managing time in
order to finish on schedule and working with something I had little to no
knowledge of. Although, I was the one who chose to undertake this project, I
was provided a lot of help and feedback from friends and family whose
contributions were extremely beneficial and vital for the completion of this
project. (A complete list of acknowledgement can be found in the beginning)
Page 62 of 76
References
Advice for using Muse in my senior project. (n.d.). Retrieved from
http://forum.choosemuse.com/forum/main-forum/4616-advice-forusing-muse-in-my-senior-project
Al Hamed, J. H., Taha, A. Z., Sabra, A. A., & Bella, H. (2008). Attention Deficit
Hyperactivity Disorder (ADHD) among Male Primary School Children
in Dammam, Saudi Arabia: Prevalence and Associated Factors. J Egypt
Public Health Assoc, 83. Retrieved from
http://adhd.org.sa/en/publication/attention-deficit-hyperactivitydisorder-adhd-among-male-primary-school-children-in-dammamsaudi-arabia-prevalence-and-associated-factors/
Alqahtani, M. M. (2010). Attention-deficit hyperactive disorder in school-aged
children in Saudi Arabia. European Journal of Pediatrics, 169(9),
1113-1117. doi:10.1007/s00431-010-1190-y
Arns, M., Heinrich, H., & Strehl, U. (2014). Evaluation of neurofeedback in
ADHD: The long and winding road. Biological Psychology, 95, 108115. doi:10.1016/j.biopsycho.2013.11.013
Arns, M., Ridder, S. D., Strehl, U., Breteler, M., & Coenen, A. (2009). Efficacy
of Neurofeedback Treatment in ADHD: The Effects on Inattention,
Impulsivity and Hyperactivity: A Meta-Analysis [Abstract]. Clinical
EEG and Neuroscience, 40(3), 180-189.
doi:10.1177/155005940904000311
Page 63 of 76
Bokor, G., & Anderson, P. D. (2014). Attention-Deficit/Hyperactivity Disorder.
Journal of Pharmacy Practice, 27(4), 336-349.
doi:10.1177/0897190014543628
Brain–computer interface. (n.d.). Retrieved from
http://en.wikipedia.org/wiki/Brain%E2%80%93computer_interf
ace
Brown, T. E., Reichel, P. C., & Quinlan, D. M. (2011). Extended time improves
reading comprehension test scores for adolescents with ADHD. Open
Journal of Psychiatry, 01(03), 79-87. doi:10.4236/ojpsych.2011.13012
Data & Statistics. (2014, December 10). Retrieved from
http://www.cdc.gov/ncbddd/adhd/data.html
[Frontal Lobe]. (n.d.). Retrieved from
http://en.wikipedia.org/wiki/Frontal_lobe#mediaviewer/File:L
obes_of_the_brain_NL.svg
Frank-Briggs, A. I. (2011). Attention deficit hyperactivity disorder (ADHD).
Journal of Pediatric Neurology, 9, 291-298.
Gevensleben, H., Holl, B., Albrecht, B., Schlamp, D., Kratz, O., Studer, P., . . .
Heinrich, H. (2010). Neurofeedback training in children with ADHD:
6-month follow-up of a randomised controlled trial. European Child &
Adolescent Psychiatry, 19(9), 715-724. doi:10.1007/s00787-010-01095
Homidi, M., Obaidat, Y., & Hamaidi, D. (2013). Prevalence of Attention Deficit
Page 64 of 76
and Hyperactivity Disorder among Primary School Students in Jeddah
city, KSA. Life Science Journal, 10(3), 280-285. Retrieved
January/February, 2015, from http://adhd.org.sa/wpcontent/uploads/2014/05/Life-Sciences-Journal-2013-Homidi.pdf
Lofthouse, N., Arnold, L. E., Hersch, S., Hurt, E., & Debeus, R. (2012). A
Review of Neurofeedback Treatment for Pediatric ADHD. Journal of
Attention Disorders, 16(5), 351-372. doi:10.1177/1087054711427530
Lofthouse, N., Mcburnett, K., Arnold, L. E., & Hurt, E. (2011). Biofeedback and
Neurofeedback Treatment for ADHD. Psychiatric Annals, 41(1), 4248. doi:10.3928/00485713-20101221-07
Mandryk, R. L., Dielschneider, S., Kalyn, M. R., Bertram, C. P., Gaetz, M.,
Doucette, A., . . . Keiver, K. (2013). Games as Neurofeedback Training
for Children with FASD.
Meisel, V., García-Banda, G., Servera, M., Cardo, E., Amengual, L., Arroyo, A.,
. . . Aggensteiner, P. (2011). Is neurofeedback able to improve
behaviour and academic performance in children with Attention
Deficit/Hyperactivity Disorder? A comparison with pharmacological
intervention. Neuroscience Letters, 500, E46.
doi:10.1016/j.neulet.2011.05.203
Meisel, V., Servera, M., Garcia-Banda, G., Cardo, E., & Moreno, I. (2014).
Reprint of “Neurofeedback and standard pharmacological intervention
in ADHD: A randomized controlled trial with six-month follow-up”.
Page 65 of 76
Biological Psychology, 95, 116-125.
doi:10.1016/j.biopsycho.2013.09.009
[Neurofeedback Loop]. (n.d.). Retrieved from http://synaptitude.me/blog/wpcontent/uploads/2015/01/neurofeedback-smile.png
Smith, M., & Segal, R. (2014, December). Adult ADD / ADHD. Retrieved from
http://www.helpguide.org/articles/add-adhd/adult-adhdattention-deficit-disorder.htm
Wender, P. H. (2001). ADHD: Attention-deficit hyperactivity disorder in
children, adolescents, and adults. New York: Oxford University Press.
Zentall, S. S., & Ferkis, M. A. (1993). Mathematical Problem Solving for Youth
with ADHD, with and without Learning Disabilities. Understanding
Individual Differences in Mathematical Problem Solving, 16, 1st ser., 618. Retrieved from http://www.jstor.org/stable/1511156k
Page 66 of 76
Appendix A
Data Collection on ADHD children and video games in
Jeddah
The purpose of this survey is to collect information on children with ADHD in
Jeddah and the kinds of games they play (if they do play at all).
If you do not have ADHD but know someone who does (ex a family member),
please answer the following questions on their behalf.
* Required
Have you or someone you know been diagnosed with ADHD? *
Yes
No
What is your/their gender? *
Female
Male
At what age were you/they diagnosed with ADHD?
*
How old are you/they currently? *
Younger than 4
4-6
7-9
10 - 12
13 - 15
16 - 18
18 +
What symptoms of ADHD do you/they have? *
Attention Deficiency
Hyperactivity
Impulsivness
Do you/they have difficulty concentrating in class? *
Yes
No
Do you/they take medication to help cope with your/their
ADHD? *
Yes
No
What other treatments are you/they currently being
administered for your/their ADHD? *
Psychotherapy (Visits to the psychiatrist)
Page 67 of 76
Behaviour Therapy
Self Help
None
Other:
Do you/they play video games? *
Yes
No
How many hours a week do you/they play video games? *
None
Less than an hour
1 - 2 Hours
3 - 4 Hours
5 - 6 Hours
7 - 8 Hours
8+ Hours
What kinds of video games do you/they play? *
Action (ex. Drake's Deception)
Adventure (ex. Myst)
Puzzle games (ex. Tetris, Soduko)
Platformer type (ex. Subway surfer)
First person shooters (ex Call of Duty)
Massively Multiplayer Online Role Playing Games
None
Other:
Which of the following features attracts you/them in a video
game? *
Bright colors
Fast gameplay
Background music
Background sound
Intuitive gameplay (no instructions - learn to play by trial)
Good graphics
Having a goal to work towards
Gaining rewards
The storyline
Nothing
Other:
Do you/they have difficulty reading the instructions in video
games? *
Yes
No
Page 68 of 76
Appendix B
using UnityEngine;
using System.Collections;
public class DeviceManager : MonoBehaviour
{
public static DeviceManager instance = null;
public float previousBeta;
public float beta;
public bool device;
void Awake ()
{
previousBeta = 0;
beta = 0;
if (instance == null)
{
instance = this;
} else if (instance != this)
Destroy (gameObject);
DontDestroyOnLoad (gameObject);//Prevents the object from being destroyed
}
}
using UnityEngine;
using System.Collections;
using UnityEngine.UI;
public class concentrationText : MonoBehaviour
{
Text concentration;
float beta;
// Use this for initialization
void Start ()
{
concentration = GetComponent <Text> ();
}
// Update is called once per frame
void Update ()
Page 69 of 76
{
beta = DeviceManager.instance.beta * 10; //Multilpy by ten to display a percentage value
concentration.text = Mathf.RoundToInt(beta) + "%"; //Rounds the beta off to an integer
}
}
using UnityEngine;
using System.Collections;
public class GameManager : MonoBehaviour {
public static GameManager instance = null;
private BoardManager boardScript;
public bool tileSelected;
public bool plantSelected;
private string plantType; //Keeps track of the pant selected
private int tileSelectedValue;//Keeps track of the value of the tile selected
private int[] numbersSelected; //Array of numbers selected
private int counter; //keeps track of the index of numbers selected
private int result; //Keeps track of the result of the numbers selected
public string vegtablePlanted;
public int bunniesSaved;
public int bunniesCrossedOver;
public bool notConnected;
public GameObject screenOverlay;
private int level = 1;
// Use this for initialization
void Start () {
}
void Awake()
{
numbersSelected = new int[] {0, 0, 0, 0};
counter = 0;
bunniesSaved = 0;
bunniesCrossedOver = 0;
tileSelected = false;
plantSelected = false;
vegtablePlanted = null;
//turnipPlanted = false;
result = 0;
//count = 0;
Page 70 of 76
//ensures there is only one instance of the object
if (instance == null) {
instance = this;
} else if (instance != this)
Destroy (gameObject);
//DontDestroyOnLoad (gameObject);//Prevents the object from being destroyed
if (DeviceManager.instance.device == false){
ShowNotConnectedScreen();
}
boardScript = GetComponent<BoardManager>();
InitGame();
}
//Getters and Setters!
public int[] getSelectedNumbers(){
return numbersSelected;
}
public void setSelectedNumbers(int[] array){
numbersSelected = array;
}
public int getCounter(){
return counter;
}
public void setCounter(int value){
counter = value;
}
public void addResult(int number){
result = result + number;
}
public void setResult(int number){
result = 0;
}
public int getResult(){
return result;
}
public string getPlantType(){
return plantType;
}
public void setPlantType(string type){
plantType = type;
}
public void setTileSelectedValue(int value){
tileSelectedValue = value;
Page 71 of 76
}
public int getTileSelectedValue(){
return tileSelectedValue;
}
public bool correct{
get{ return result == tileSelectedValue;}
}
void InitGame()
{
boardScript.SetupScene (level);
}
// Update is called once per frame
void Update () {
if(DeviceManager.instance.device == true)
{
HideNotConnectedScreen();
}
if (bunniesCrossedOver == 5) {
GameOver();
}
}
void GameOver(){
Application.LoadLevel ("gameOver");
}
void HideNotConnectedScreen(){
screenOverlay.SetActive (false);
notConnected = false;
}
void ShowNotConnectedScreen(){
screenOverlay.SetActive (true);
notConnected = true;
}
}
using UnityEngine;
using System.Collections;
public class Element : MonoBehaviour
Page 72 of 76
{
//Changes the sprite look of the tiles
public bool percentage;
public Sprite[] numberTextures;
public GameObject[] plants;
private string type;
public int value;
public bool carrotPlanted;
public bool turnipPlanted;
selectTile tile;
void Start () {
tile = GetComponent<selectTile> ();
percentage = Random.value <.35;
for (int i = 0; i<numberTextures.Length; i++)
{
if(percentage)
{
loadTexture(i);
}
else
loadTexture(Random.Range(0,i));
}
}
public void loadTexture(int counter){
GetComponent<SpriteRenderer> ().sprite = numberTextures [counter];
GetComponent<SpriteRenderer> ().color = new Color (1f, 1f, 1f, 1f);
type = numberTextures [counter].name;
setValue (type);
}
public void plantVegtable(int index){
GetComponent<SpriteRenderer> ().color = new Color (1f, 1f, 1f, 0f);
GameObject vegtale = Instantiate (plants [index], gameObject.transform.position, game
Object.transform.rotation) as GameObject;
vegtale.transform.SetParent (gameObject.transform);
}
public int getValue(){
return value;
}
Page 73 of 76
public void setCarrotPlanted (bool planted){
carrotPlanted = planted;
}
public void setTurnipPlanted(bool planted){
turnipPlanted = planted;
}
public void setValue(string type){
if (type == "fifteen")
value = 15;
else if (type == "fourteen")
value = 14;
else if (type == "thirteen")
value = 13;
else if (type == "tweleve")
value = 12;
else if (type == "eleven")
value = 11;
else if (type == "ten")
value = 10;
else if (type == "nine")
value = 9;
else if (type == "eight")
value = 8;
else if (type == "seven")
value = 7;
else if (type == "six")
value = 6;
else if (type == "five")
value = 5;
else if (type == "four")
value = 4;
else if (type == "three")
value = 3;
}
public void setCurrentSelected(bool selected)
{
tile.setCurrentSelected (selected);
}
void Update(){
if (GameManager.instance.vegtablePlanted == "carrot" && tile.getCurrentSelected()) {
plantVegtable (0);
tile.setCurrentSelected(false);
tile.setVegtablePlanted(true);
GameManager.instance.tileSelected = false;
GameManager.instance.vegtablePlanted = null;
Page 74 of 76
} else if (GameManager.instance.vegtablePlanted == "turnip" && tile.getCurrentSelecte
d()) {
plantVegtable(1);
tile.setCurrentSelected(false);
tile.setVegtablePlanted(true);
GameManager.instance.tileSelected = false;
GameManager.instance.vegtablePlanted = null;
}
else if (GameManager.instance.vegtablePlanted == "tomatoes" && tile.getCurrentSelect
ed()) {
plantVegtable(2);
tile.setCurrentSelected(false);
tile.setVegtablePlanted(true);
GameManager.instance.tileSelected = false;
GameManager.instance.vegtablePlanted = null;
}
else if (GameManager.instance.vegtablePlanted == "pumpkin" && tile.getCurrentSelect
ed()) {
plantVegtable(3);
tile.setCurrentSelected(false);
tile.setVegtablePlanted(true);
GameManager.instance.tileSelected = false;
GameManager.instance.vegtablePlanted = null;
}
if (tile.getVegtablePlanted () == false) {
GetComponent<SpriteRenderer> ().color = new Color (1f, 1f, 1f, 1f);
}
}
}
using UnityEngine;
using System.Collections;
public class selectTile : MonoBehaviour {
public bool currentSelected;
public bool vegtablePlanted;
Element element;
[SerializeField]
Sprite carrot;
[SerializeField]
Sprite turnip;
//plant = GameObject.FindGameObjectsWithTag("plant");
//private string tileSelectedName;
Page 75 of 76
// Use this for initialization
void Start () {
element = GetComponent<Element> () as Element;
currentSelected = false;
vegtablePlanted = false;
}
private void OnMouseDown()
{
if (GameManager.instance.tileSelected == false && currentSelected == false && vegtab
lePlanted == false) {
GameManager.instance.tileSelected = true;
currentSelected = true;
GameManager.instance.setTileSelectedValue(element.getValue());
//mouseOver = element.getSprite;
GetComponent<SpriteRenderer> ().color = new Color (1f, 1f, 1f, .5f);
}
else if(GameManager.instance.tileSelected == true&& currentSelected == true && vegta
blePlanted == false)
{
GameManager.instance.tileSelected = false;
currentSelected = false;
GameManager.instance.setTileSelectedValue(0);
GetComponent<SpriteRenderer>().color = new Color (1f, 1f, 1f, 1f);
}
//element.loadTexture (mouseOver);
}
public bool getCurrentSelected(){
return currentSelected;
}
public void setCurrentSelected(bool selected){
currentSelected = selected;
}
public bool getVegtablePlanted(){
return vegtablePlanted;
}
public void setVegtablePlanted(bool planted){
vegtablePlanted = planted;
}
// Update is called once per frame
void Update () {
Page 76 of 76
if (GameManager.instance.tileSelected == true && currentSelected == true) {
GetComponent<SpriteRenderer> ().color = new Color (1f, 1f, 1f, .5f);
} else if (GameManager.instance.tileSelected == false && currentSelected == false &&
vegtablePlanted == false) {
GetComponent<SpriteRenderer>().color = new Color (1f, 1f, 1f, 1f);
}
if (GameManager.instance.tileSelected == false) {
currentSelected = false;
}
}
}
using UnityEngine;
public class EnemyManager : MonoBehaviour
{
//public PlayerHealth playerHealth;
public GameObject enemy;
public float spawnTime = 15f;
public Transform[] spawnPoints;
void Start ()
{
InvokeRepeating ("Spawn", spawnTime, Random.Range (15, 20));
}
void Spawn ()
{
// if(playerHealth.currentHealth <= 0f)
// {
// return;
// }
if (GameManager.instance.notConnected == false) {
int spawnPointIndex = Random.Range (0, spawnPoints.Length);
Instantiate (enemy, spawnPoints [spawnPointIndex].position, spawnPoints [spawnPoi
ntIndex].rotation);
}
}
}