<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://www.bci2000.org/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lingling</id>
	<title>BCI2000 Wiki - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://www.bci2000.org/mediawiki/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Lingling"/>
	<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php/Special:Contributions/Lingling"/>
	<updated>2026-06-29T19:21:33Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.6</generator>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=12132</id>
		<title>Contributions:CommunicationTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=12132"/>
		<updated>2025-10-10T16:20:59Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* States */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
The hyperscanning task is a turn-based communication game between two clients. This game aims to guess what the subject is in Sender&#039;s computer without talking. For each trial, the two players will alternate between the roles of Sender and Receiver. The Sender will describe traits of the subject presented by adjusting the two axes(Noisy or silent/Big or small). Then, the Receiver will guess if the Sender is describing the animal or object. After the Receiver makes a guess, both players receive feedback on whether the Receiver makes the correct guess. This marks the end of a trial.&lt;br /&gt;
&lt;br /&gt;
The two clients exchange information through the hyperScanning backend, which uses a client-server model to share the states. Each client has a separate state machine. The server only forwards the information between two clients. Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class, which is the parent class of the application module. For more information, please refer to the hyperScanning framework wiki page: https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning.&lt;br /&gt;
&lt;br /&gt;
==Video Overview==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;youtube alignment=&amp;quot;center&amp;quot;&amp;gt;https://youtu.be/I1sSamSsTK4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=500px&amp;gt;&lt;br /&gt;
File:Hyperscanning pipe line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:Hyperscanning_1.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Anais Llorens (anaisllorens@hotmail.com) and  Athina Tzovara (athina.tzovara@unibe.ch) conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org), Max Marcus (bigmaxmarcus@gmail.com) and Sigurd Alnes (sigurd.alnes@unibe.ch) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
To run the server, you’ll need a Linux or macOS machine—Windows is not supported at this time. The steps below walk you through deploying the server on AWS.&amp;lt;br&amp;gt;&lt;br /&gt;
1. Prepare the AWS key.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In your terminal or shell, run&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; chmod 400 &amp;lt;key_path&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
to make the key file read-only for the owner.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Connect to the AWS server using SSH:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; ssh -i &amp;lt;key path&amp;gt; &amp;lt;user-name&amp;gt;@&amp;lt;ip-address&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Pull the code from GitHub.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/neurotechcenter/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Navigate to the server directory:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. To compile the project, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Launch the server by running:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application must be restarted after BCI2000 has been closed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:CommunicationTask batch.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====StimuliMatrix====&lt;br /&gt;
Shared parameter, matrix of stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImageReceiver and ImageSender(the path of images).&amp;lt;br&amp;gt;&lt;br /&gt;
2. Sender(the role of players),1 is the sender), 2 is the receiver.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Jitter(the duration to present the role).&amp;lt;br&amp;gt;&lt;br /&gt;
4. CorrectResponse(1: left, 2:right).&amp;lt;br&amp;gt;&lt;br /&gt;
5. Training(1: training, 0: main task).&amp;lt;br&amp;gt;&lt;br /&gt;
6. Category(1: object, 2: animal).&amp;lt;br&amp;gt;&lt;br /&gt;
7. Difficulty(1: easy, 2: moderate, 3: hard).&amp;lt;br&amp;gt;&lt;br /&gt;
8. Dimension1a and Dimension1b(bar#1 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
9. Dimension2a and Dimension2b(bar#2 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
10. Option1 and Option2(left option text and right option text).&lt;br /&gt;
&lt;br /&gt;
====BreakTrialSequece====&lt;br /&gt;
The sequence of break trials, a break will happen after the break trial.&lt;br /&gt;
&lt;br /&gt;
====FeedbackDuration====&lt;br /&gt;
Duration of feedback(ITI). Indicate the receiver to make a correct or incorrect guess.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server will generate the InitialTrialNumber and StimuliSequence, and save them into a parameter file named by IP addresses on the server. You don&#039;t need to worry about these two parameters. Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
====InitialTrialNumber====&lt;br /&gt;
The trial number to begin with. We provide the resume option, allowing clients to pause and resume the game from where they stop. After one of the clients quits the game, the server will discover it and save the current trial number and sequence. When the same clients(same IP address) reconnect the server again, the server will send the previous trial number to them. Otherwise, the InitialTrailNumber will be initialized by 0. Usually, you don&#039;t need to touch this parameter.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequence====&lt;br /&gt;
The sequence of stimuli(images). The server will generate a random stimuli sequence for every pair of clients (identified by the IP address).&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====PreTrialFlash====&lt;br /&gt;
Have the patch on the left bottom corner of the screen only flash before the trial starts:&amp;lt;br/&amp;gt;&lt;br /&gt;
- The square is white by default&amp;lt;br/&amp;gt;&lt;br /&gt;
- 500 ms before trial start, the square switches to black&amp;lt;br/&amp;gt;&lt;br /&gt;
- At trial start, the square switches back to white and stays white until next trial&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====StimuliWidth====&lt;br /&gt;
StimulusWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====InstructionWidth====&lt;br /&gt;
Instruction width in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====SliderWidth====&lt;br /&gt;
SliderWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====BarColor====&lt;br /&gt;
Color of the slider bar.&lt;br /&gt;
&lt;br /&gt;
====AxeActiveColor====&lt;br /&gt;
Color of active slider axe.&lt;br /&gt;
&lt;br /&gt;
====AxeInActiveColor====&lt;br /&gt;
Color of inactive slider axe.&lt;br /&gt;
&lt;br /&gt;
====DimensionFontColor====&lt;br /&gt;
Color of the text under the slider.&lt;br /&gt;
&lt;br /&gt;
====DimensionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====OptionFontActiveColor====&lt;br /&gt;
Color of the active options.&lt;br /&gt;
&lt;br /&gt;
====OptionFontInActiveColor====&lt;br /&gt;
Color of the inactive options.&lt;br /&gt;
&lt;br /&gt;
====OptionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====RoleFontColor====&lt;br /&gt;
Color of the role text.&lt;br /&gt;
&lt;br /&gt;
====RoleHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====FeedbackWidth====&lt;br /&gt;
Width of feedback in percent of screen width.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===TrialStart===&lt;br /&gt;
The onset time of the beginning of trial&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the 10 slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] indicates the client is waiting for the other client to push the button to start the game. ( We are waiting for another player; once she/he is ready, we&#039;re ready to go!)&amp;lt;br&amp;gt; &lt;br /&gt;
[2] When the role text is present on the screen.(Sender or Receiver).&amp;lt;br&amp;gt; &lt;br /&gt;
[3] When the sliders and stimulus are present on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Feedback: After the receiver locks the answer, it comes to phase [4], showing whether the answer is correct.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]Break: (Well done! Are you ready for the next block? \n\n Press SPACEBAR)&amp;lt;br&amp;gt; &lt;br /&gt;
[6]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===StimulusCode===&lt;br /&gt;
The stimulus ID&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The photodiode state. 1: flash, 0: no flash&lt;br /&gt;
&lt;br /&gt;
===SampleBlockCounter===&lt;br /&gt;
Count the block number in one phase&lt;br /&gt;
&lt;br /&gt;
===BarOneValue===&lt;br /&gt;
Value of slider#1. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarTwoValue===&lt;br /&gt;
Value of slider#2. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneActive, BarTwoActive===&lt;br /&gt;
0: slider is not selected.  1: slider is selected. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ResponseValue===&lt;br /&gt;
1: object.    2: animal. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===SenderLock, ReceiverLock===&lt;br /&gt;
0: client is moving the slider/making a guess. 1: client has locked the answer. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===isReadyStart0, isReadyStart1===&lt;br /&gt;
0: client isn&#039;t ready to start/resume/continue the game(not yet pushing the button).  1: client is ready to start/resume/continue the game(push the button). (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The hyperscanning application module is almost the same as a BCI2000 application module, except that the typical BCI2000 module is inherited from ApplicationBase, and the hyperscanning application module is inherited from HyperscanningApplicationBase. Basically, the HyperscanningApplicationBase class is the same as ApplicationBase class with adding the communication with the server. So instead of using  Publish, Preflight, Process, etc. We are using SharedPublish, SharedPreflight, SharedProcess, etc. These methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Communication_task_dualTask.h:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;ApplicationBase.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Slider.h&amp;quot;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;quot;TextStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Communication_task_dualTask : public HyperscanningApplicationBase&lt;br /&gt;
{&lt;br /&gt;
 public:&lt;br /&gt;
  Communication_task_dualTask();&lt;br /&gt;
  ~Communication_task_dualTask();&lt;br /&gt;
  void SharedPublish() override;&lt;br /&gt;
  void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
  void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
  void SharedAutoConfig( const SignalProperties&amp;amp; Input ) override;&lt;br /&gt;
  void SharedStartRun() override;&lt;br /&gt;
  void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
  void SharedStopRun() override;&lt;br /&gt;
  void SharedHalt() override;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
   //define your own private members here&lt;br /&gt;
   ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
&lt;br /&gt;
   //define your own private methods here&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Manipulate the shared state is the same as the BCI2000 state. &amp;quot;isReadyStart1&amp;quot; is a shared state.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   State(&amp;quot;isReadyStart1&amp;quot;) = 1; // assign 1 to &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get the value of the shared state &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   //Both of the two players are ready, move to the next phase&lt;br /&gt;
   if (State(&amp;quot;isReadyStart0&amp;quot;) &amp;amp;&amp;amp; State(&amp;quot;isReadyStart1&amp;quot;)) {&lt;br /&gt;
            m_instruction_container-&amp;gt;Conceal();&lt;br /&gt;
            m_role_txt-&amp;gt;Conceal();&lt;br /&gt;
            my_phase = role_text;&lt;br /&gt;
            m_block_in_phase = 0;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=12129</id>
		<title>Contributions:CommunicationTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=12129"/>
		<updated>2025-10-09T20:42:21Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Local Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
The hyperscanning task is a turn-based communication game between two clients. This game aims to guess what the subject is in Sender&#039;s computer without talking. For each trial, the two players will alternate between the roles of Sender and Receiver. The Sender will describe traits of the subject presented by adjusting the two axes(Noisy or silent/Big or small). Then, the Receiver will guess if the Sender is describing the animal or object. After the Receiver makes a guess, both players receive feedback on whether the Receiver makes the correct guess. This marks the end of a trial.&lt;br /&gt;
&lt;br /&gt;
The two clients exchange information through the hyperScanning backend, which uses a client-server model to share the states. Each client has a separate state machine. The server only forwards the information between two clients. Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class, which is the parent class of the application module. For more information, please refer to the hyperScanning framework wiki page: https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning.&lt;br /&gt;
&lt;br /&gt;
==Video Overview==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;youtube alignment=&amp;quot;center&amp;quot;&amp;gt;https://youtu.be/I1sSamSsTK4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=500px&amp;gt;&lt;br /&gt;
File:Hyperscanning pipe line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:Hyperscanning_1.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Anais Llorens (anaisllorens@hotmail.com) and  Athina Tzovara (athina.tzovara@unibe.ch) conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org), Max Marcus (bigmaxmarcus@gmail.com) and Sigurd Alnes (sigurd.alnes@unibe.ch) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
To run the server, you’ll need a Linux or macOS machine—Windows is not supported at this time. The steps below walk you through deploying the server on AWS.&amp;lt;br&amp;gt;&lt;br /&gt;
1. Prepare the AWS key.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In your terminal or shell, run&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; chmod 400 &amp;lt;key_path&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
to make the key file read-only for the owner.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Connect to the AWS server using SSH:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; ssh -i &amp;lt;key path&amp;gt; &amp;lt;user-name&amp;gt;@&amp;lt;ip-address&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Pull the code from GitHub.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/neurotechcenter/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Navigate to the server directory:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. To compile the project, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Launch the server by running:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application must be restarted after BCI2000 has been closed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:CommunicationTask batch.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====StimuliMatrix====&lt;br /&gt;
Shared parameter, matrix of stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImageReceiver and ImageSender(the path of images).&amp;lt;br&amp;gt;&lt;br /&gt;
2. Sender(the role of players),1 is the sender), 2 is the receiver.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Jitter(the duration to present the role).&amp;lt;br&amp;gt;&lt;br /&gt;
4. CorrectResponse(1: left, 2:right).&amp;lt;br&amp;gt;&lt;br /&gt;
5. Training(1: training, 0: main task).&amp;lt;br&amp;gt;&lt;br /&gt;
6. Category(1: object, 2: animal).&amp;lt;br&amp;gt;&lt;br /&gt;
7. Difficulty(1: easy, 2: moderate, 3: hard).&amp;lt;br&amp;gt;&lt;br /&gt;
8. Dimension1a and Dimension1b(bar#1 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
9. Dimension2a and Dimension2b(bar#2 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
10. Option1 and Option2(left option text and right option text).&lt;br /&gt;
&lt;br /&gt;
====BreakTrialSequece====&lt;br /&gt;
The sequence of break trials, a break will happen after the break trial.&lt;br /&gt;
&lt;br /&gt;
====FeedbackDuration====&lt;br /&gt;
Duration of feedback(ITI). Indicate the receiver to make a correct or incorrect guess.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server will generate the InitialTrialNumber and StimuliSequence, and save them into a parameter file named by IP addresses on the server. You don&#039;t need to worry about these two parameters. Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
====InitialTrialNumber====&lt;br /&gt;
The trial number to begin with. We provide the resume option, allowing clients to pause and resume the game from where they stop. After one of the clients quits the game, the server will discover it and save the current trial number and sequence. When the same clients(same IP address) reconnect the server again, the server will send the previous trial number to them. Otherwise, the InitialTrailNumber will be initialized by 0. Usually, you don&#039;t need to touch this parameter.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequence====&lt;br /&gt;
The sequence of stimuli(images). The server will generate a random stimuli sequence for every pair of clients (identified by the IP address).&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====PreTrialFlash====&lt;br /&gt;
Have the patch on the left bottom corner of the screen only flash before the trial starts:&amp;lt;br/&amp;gt;&lt;br /&gt;
- The square is white by default&amp;lt;br/&amp;gt;&lt;br /&gt;
- 500 ms before trial start, the square switches to black&amp;lt;br/&amp;gt;&lt;br /&gt;
- At trial start, the square switches back to white and stays white until next trial&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====StimuliWidth====&lt;br /&gt;
StimulusWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====InstructionWidth====&lt;br /&gt;
Instruction width in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====SliderWidth====&lt;br /&gt;
SliderWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====BarColor====&lt;br /&gt;
Color of the slider bar.&lt;br /&gt;
&lt;br /&gt;
====AxeActiveColor====&lt;br /&gt;
Color of active slider axe.&lt;br /&gt;
&lt;br /&gt;
====AxeInActiveColor====&lt;br /&gt;
Color of inactive slider axe.&lt;br /&gt;
&lt;br /&gt;
====DimensionFontColor====&lt;br /&gt;
Color of the text under the slider.&lt;br /&gt;
&lt;br /&gt;
====DimensionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====OptionFontActiveColor====&lt;br /&gt;
Color of the active options.&lt;br /&gt;
&lt;br /&gt;
====OptionFontInActiveColor====&lt;br /&gt;
Color of the inactive options.&lt;br /&gt;
&lt;br /&gt;
====OptionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====RoleFontColor====&lt;br /&gt;
Color of the role text.&lt;br /&gt;
&lt;br /&gt;
====RoleHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====FeedbackWidth====&lt;br /&gt;
Width of feedback in percent of screen width.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the 10 slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] indicates the client is waiting for the other client to push the button to start the game. ( We are waiting for another player; once she/he is ready, we&#039;re ready to go!)&amp;lt;br&amp;gt; &lt;br /&gt;
[2] When the role text is present on the screen.(Sender or Receiver).&amp;lt;br&amp;gt; &lt;br /&gt;
[3] When the sliders and stimulus are present on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Feedback: After the receiver locks the answer, it comes to phase [4], showing whether the answer is correct.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]Break: (Well done! Are you ready for the next block? \n\n Press SPACEBAR)&amp;lt;br&amp;gt; &lt;br /&gt;
[6]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===StimulusCode===&lt;br /&gt;
The stimulus ID&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The photodiode state. 1: flash, 0: no flash&lt;br /&gt;
&lt;br /&gt;
===SampleBlockCounter===&lt;br /&gt;
Count the block number in one phase&lt;br /&gt;
&lt;br /&gt;
===BarOneValue===&lt;br /&gt;
Value of slider#1. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarTwoValue===&lt;br /&gt;
Value of slider#2. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneActive, BarTwoActive===&lt;br /&gt;
0: slider is not selected.  1: slider is selected. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ResponseValue===&lt;br /&gt;
1: object.    2: animal. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===SenderLock, ReceiverLock===&lt;br /&gt;
0: client is moving the slider/making a guess. 1: client has locked the answer. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===isReadyStart0, isReadyStart1===&lt;br /&gt;
0: client isn&#039;t ready to start/resume/continue the game(not yet pushing the button).  1: client is ready to start/resume/continue the game(push the button). (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The hyperscanning application module is almost the same as a BCI2000 application module, except that the typical BCI2000 module is inherited from ApplicationBase, and the hyperscanning application module is inherited from HyperscanningApplicationBase. Basically, the HyperscanningApplicationBase class is the same as ApplicationBase class with adding the communication with the server. So instead of using  Publish, Preflight, Process, etc. We are using SharedPublish, SharedPreflight, SharedProcess, etc. These methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Communication_task_dualTask.h:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;ApplicationBase.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Slider.h&amp;quot;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;quot;TextStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Communication_task_dualTask : public HyperscanningApplicationBase&lt;br /&gt;
{&lt;br /&gt;
 public:&lt;br /&gt;
  Communication_task_dualTask();&lt;br /&gt;
  ~Communication_task_dualTask();&lt;br /&gt;
  void SharedPublish() override;&lt;br /&gt;
  void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
  void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
  void SharedAutoConfig( const SignalProperties&amp;amp; Input ) override;&lt;br /&gt;
  void SharedStartRun() override;&lt;br /&gt;
  void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
  void SharedStopRun() override;&lt;br /&gt;
  void SharedHalt() override;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
   //define your own private members here&lt;br /&gt;
   ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
&lt;br /&gt;
   //define your own private methods here&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Manipulate the shared state is the same as the BCI2000 state. &amp;quot;isReadyStart1&amp;quot; is a shared state.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   State(&amp;quot;isReadyStart1&amp;quot;) = 1; // assign 1 to &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get the value of the shared state &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   //Both of the two players are ready, move to the next phase&lt;br /&gt;
   if (State(&amp;quot;isReadyStart0&amp;quot;) &amp;amp;&amp;amp; State(&amp;quot;isReadyStart1&amp;quot;)) {&lt;br /&gt;
            m_instruction_container-&amp;gt;Conceal();&lt;br /&gt;
            m_role_txt-&amp;gt;Conceal();&lt;br /&gt;
            my_phase = role_text;&lt;br /&gt;
            m_block_in_phase = 0;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=BCI2000_Hyperscanning&amp;diff=12095</id>
		<title>BCI2000 Hyperscanning</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=BCI2000_Hyperscanning&amp;diff=12095"/>
		<updated>2025-09-15T16:46:49Z</updated>

		<summary type="html">&lt;p&gt;Lingling: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;BCI2000 Hyperscanning is a multiplayer simulation, a program that is synchronized over multiple computers, that supports the connection of two or more clients, the computers that are involved in the simulation. BCI2000 Hyperscanning also has subjects, which are the people that are using the client computers.&lt;br /&gt;
&lt;br /&gt;
In a multiplayer simulation, each client involved must know the current state of the game. This game state allows each client to determine the output that is shown to the user. In order for each client to display the same game to each user, each client must have the same game state. The game state is stored as a collection of state variables in a state machine.&lt;br /&gt;
A state machine is a set of variables, or states, that correspond with values. In essence, it is a simple database. The data in the database describes the state of the game (see figure \ref{fig:gamestate}).&lt;br /&gt;
&lt;br /&gt;
BCI2000 Hyperscanning has a master state machine that is stored on a centralized back-end server and one state machine for each client. Each client is connected to the back-end server through a TCP socket to ensure that each connection is maintained and everything that is sent is received. The clients output a stimulus to the user based on their state machines, and update their state machines based on user inputs. When one client updates its state machine, the server saves the game state in its master state machine and updates the other clients (see figure \ref{fig:gamestateupdate}).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:GameStateFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Game State.&#039;&#039;&#039; The game state shows synchrony between the master game state, which is stored on the server, and the client game states.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:GameStateUpdateFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Game State Updates.&#039;&#039;&#039; The game state updates (bottom) show a typical interaction that would result in a game state update to the master game state and the ensuing update to the other client(s). In this example, the user clicks, indicating they would like to place a marker in the tic-tac-toe game, and this triggers a local game state update. This local game state update is sent to the server. The server saves the update and synchronizes the remaining client(s). After the interaction has concluded, each client is synchronized.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:StateUpdatesFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Game State Update Scenarios.&#039;&#039;&#039; In scenario 1, the client updated its game state locally because of a user mouse press. This caused synchronization between it and the master game state to be lost. In this scenario, the client updates the master game state to match its game state. In scenario 2, a different client updated the master game state because of a user mouse press. This caused synchronization between the first client and the master game state to be lost. In this scenario, the server updates the first client to match its game state.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Server ==&lt;br /&gt;
The purpose of the server, or back-end, is to store, update, and distribute a master list of states. It synchronizes each of the client&#039;s state machines, so that each client displays the same game. &lt;br /&gt;
&lt;br /&gt;
At a given time, one of the clients may have a state variable set to a value that is different from the value that the server has that state set to. At this point there are two possibilities. If that state was changed based on user inputs, then the server will update its state machine to reflect that user input. Otherwise, if the client has an old value, one that has been changed by another client, then the server will update the client with the new value of the state, so that each client is synchronized (see figure \ref{fig:gamestateupdatescenarios}).&lt;br /&gt;
&lt;br /&gt;
In addition to synchronizing states between clients, the backend must also synchronize many initial parameters to ensure that the exact same experiment is being run for each subject, e.g. the order of stimulus images needs to be synchronized. To solve this, the server contains a BCI2000 parameter file that is sent to each client when it connects to the server. This also serves as a greeting message to ensure that the connection is functioning before the experiment begins.&lt;br /&gt;
&lt;br /&gt;
The server application can be run from any mac or linux computer, whether it is local to one of the clients or in the cloud, as long as it is configured to allow TCP traffic. It is a collection of c++ classes and methods that are implemented into an application file. This application file is then run on the server computer. The server is not an instance of BCI2000. Rather, it is a separate application that interacts with client instances of BCI2000. &lt;br /&gt;
&lt;br /&gt;
While the idea for this hyperscanning architecture propagated from one experimental design, we ensured that this technology was robust enough to be used reused for any experiment, even if it is radically different from our initial one. The core of the back-end is simple and abstracted. It is a state machine that can be updated from clients and will propagate those updates to other clients. This simplicity means that the central parts of the back-end will work for any experimental paradigm. The simplicity of the core also allows for a more specific framework to be built surrounding the core, should that be necessary for a specific application. &lt;br /&gt;
&lt;br /&gt;
For each paradigm, an application file is implemented on the server. This application file will always contain the basic backend framework, like connecting to clients and running the actual data exchange loop, but it can also contain more specific instructions. For example, if parameters need to be randomly generated and synchronized across clients the core design is flexible enough to allow that to be built. Parameters can be added to the previously mentioned parameter file through the application file to solve this particular example. If there is a paradigm requiring more complex changes to the standard backend, the core can also be broken down into its individual steps to allow that.  &lt;br /&gt;
&lt;br /&gt;
The backend runs in a continuous loop of data exchanges with the clients. This loop continues for as long as the experiment runs. The end to the session, and thus the loop, is singaled by one of the clients breaking its connection with the server. &lt;br /&gt;
&lt;br /&gt;
Even though a client disconnects, the experiment may not be concluded. There could have been a crash, internet issues, or the investigator may have wanted to pause the experiment, but the server cannot continue operating properly after a client has disconnected. To solve this issue, the application file can access the state machine after the loop has ended, and save any of the states that are necessary to redetermine the experimental state after a restart. These values can then be passed to BCI2000 as parameters when it is restarted. For example, the trial number can be saved and passed to BCI2000 as an initial trial number parameter (see figure \ref{fig:pause}).&lt;br /&gt;
&lt;br /&gt;
[[File:PauseFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Example paradigm with pause feature.&#039;&#039;&#039; This is a stimulus presentation paradigm, with a progression of faces being shown to the subject. During the first recording session, the subject gets through the first two trials before the session ends. The current trial number is saved to the server. During the next recording session, the server sends the current trial number, three, to the client; the client begins the session at trial number three and completes the paradigm.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Server Loop ===&lt;br /&gt;
The loop has three main steps (see figure \ref{fig:serverloop}). First, the server updates any states changed by the clients. Second, the server reconciles all of the updated states. Third, the server sends updated states back to the clients. &lt;br /&gt;
&lt;br /&gt;
[[File:ReconcilliationFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Progression of state updates over time.&#039;&#039;&#039; Each client sends state updates, indicated by black arrows, to the server-side-client state machines, indicated by pink arrows. The server side state machines send the state updates to the master state machine. These state updates include conflicting information; the master state machine saves the state update from client 1 and disregards the conflicting update from client 2. The server sends the changed states, indicated by triangular arrows and blue ovals, back to the server-side-client state machines. The server-side-client state machines send their changed states back to the clients.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Client Updates ====&lt;br /&gt;
&lt;br /&gt;
In this step, the server simply waits for at least one of the clients to send states that were changed locally. If a client has not sent any data, then the server will wait for 2ms before checking another client. The server saves the data sent by the client in a state machine that tracks the current values of the states on each client. These are the server-side-client state machines.&lt;br /&gt;
&lt;br /&gt;
==== Reconciliation ====&lt;br /&gt;
In this step, the server decides which states to save and prepares the updates to send to each client. After each client sends its updates, the server-side-client machines are different from the master state machine and from each other, but they are synchronized with their respective clients. The server has to synchronize all of these state machines by saving client changes to the master state machine and sending updates to the clients, but it is necessary to save only one version of each state and to send only updates with new information. If the server repeats state updates by sending the same update twice or by echoing a state change back to the client that sent it, that state will be changed at multiple times for that client, which can cause irregularities and bugs. %Tracker state machines, which track the changes when a state machine is updated, are used to ensure that only actual changes are sent to the clients. One tracker is used to determine all the changes to the master state machine from the client updates. These changes are then used to update the server-side-client state machines. The changes to the server-side-client state machines are only the updates from other clients that were saved as master states, so they are then used to update the actual client state machines.&lt;br /&gt;
&lt;br /&gt;
To solve this, each state must pass two tests to get sent to a client. First, it must have been saved to the master state machine. Second, it must have been sent by a different client. These tests are implemented using tracker state machines, which track the changes that occur when a state machine is updated. For the first test, the server updates the master state machine from the server-side-client state machines and tracks the changes. For the second test, the changes to the master state machine are used to update the server-side-client state machines, and the changes from this interaction are tracked. The changes to the server-side-client state machines pass both tests, because they were changed on the master state machine (they were saved to the master state machine) and one of the client state machines (they weren&#039;t sent by that client because, in that case, they would have already been updated). These changes can be sent to the clients.&lt;br /&gt;
&lt;br /&gt;
==== Update Clients ====&lt;br /&gt;
This final step is the opposite of the first step. The server sends the prepared states to the clients. After this step, the loop repeats, and the server waits for the client to send updates again. &lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
The purpose of the clients is to display the stimulus to the subject. Additionally, it is responsible for actually calculating the values of the game states. Each client is a separate instance of BCI2000, which are run on separate computers. They can be next to each other or hundreds of miles apart depending on the needs of the experiment.&lt;br /&gt;
&lt;br /&gt;
Once again, the structure is designed to be robust and reusable. To this end, the client exists in two pieces. The true frontend, which is responsible for calculating state values and outputting the stimulus, and the network logger, which is responsible for communication with the server. The true frontend is designed as a typical BCI2000 experiment, and thus will be different for every experiment. The network logger contains everything that will be the exact same for every BCI2000 Hyperscanning experiment. Thus, the network logger can be reused, while the true frontend is redesigned for every new experiment.&lt;br /&gt;
&lt;br /&gt;
The network logger is a part of the hyperscanning application base, which is a c++ class that a hyperscanning paradigm can be built upon. The hyperscanning application base will connect the network logger to the application module. &lt;br /&gt;
&lt;br /&gt;
BCI2000 has its own built in state machine. The network logger seamlessly updates a predefined set of these BCI2000 states based on server activity and the activity of other clients. It translates server data into BCI2000 states. The list of states that are updated by the network logger is defined in a BCI2000 parameter called shared states that contains both the names and the sizes of each of the states that the designer wants to be synchronized amongst the clients. To ensure that the states are sent rapidly, only the necessary states should be sent between clients, so they must be defined in this parameter. Other BCI2000 states will not be synchronized.&lt;br /&gt;
&lt;br /&gt;
=== Client Loops ===&lt;br /&gt;
Much like the server, the network logger loops, however, in order to conform with BCI2000 two distinct loops are utilized. One of them is synchronous with the rest of BCI2000. BCI2000 only allows its states to be changed during specific phases, so one of the loops must be synchronized with BCI2000. %The limitations of BCI2000 states require that state changes occur only during a specific time period, which necessitates synchronizing the loop with BCI2000. &lt;br /&gt;
While BCI2000 has a type of state that can be written to asynchronously, called an event, they are added to a queue and changed at a later time. This means the network logger cannot differentiate changes it made from changes the frontend made, so it doesn&#039;t know which changes to send to the server. The other loop is asynchronous, and makes use of multi-threading and parallel processing to increase the speed that data transfers can be made at, ensuring the greatest possible synchronicity between clients.&lt;br /&gt;
&lt;br /&gt;
Because these loops are both operating on the same data, i.e. the states that need to be changed, there is the risk of data corruption if both try to operate at the same time. The data is stored in mutexed buffers to ensure that does not happen. Mutexed buffers can only be written to or read by a single source at a time. If multiple sources try to access a mutexed buffer, one of them must wait for the other to finish its operation.&lt;br /&gt;
&lt;br /&gt;
Two buffers are shared between the two loops (see figure \ref{fig:clientloops}). One is a state machine that contains the name and value of each shared state, along with whether or not the state has a change from the server that hasn&#039;t been updated to the BCI2000 states, and the other is a message for the server that contains the states that have been updated by the frontend.&lt;br /&gt;
&lt;br /&gt;
[[File:clientloopsfigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Synchronous and asynchronous client loops and their data exchanges.&#039;&#039;&#039; The client updates a state, e.g. they indicate their move in tic-tac-toe with a mouse click, and the synchronous client loop adds that change to the message for the server. The asynchronous loop sends the message to the server. The asynchronous loop continues looping until it gets a response from the server. When it gets a response from the server, e.g. the other client&#039;s move, it adds it to the changed states buffer. The synchronous loop saves the changes in the changed states buffer to the BCI2000 state machine.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Synchronous Loop ====&lt;br /&gt;
&lt;br /&gt;
The synchronous loop first updates all of the BCI2000 states that have been changed by the server. %to the value sent by the server. &lt;br /&gt;
The loop then determines if any of the states in the mutexed state machine are different from their BCI2000 counterpart. Because all of the states that were different from BCI2000 because of a server update were just updated, all of the remaining discrepancies must be due to a client change. These are then recorded in the message for the server. &lt;br /&gt;
&lt;br /&gt;
It is very important for analyzing the experiment that the investigator knows when states were changed in relation to the recorded data. This could be complicated when states are being sent over the internet with delays and lag, but the network logger and BCI2000 radically simplify it. The important timestamp to record is when the state had an effect on the actual stimulus, because this is when it can have an effect on the subject. The timestamp of BCI2000 states is recorded whenever they are changed, and it is the BCI2000 states that have an effect on the stimulus. It is also BCI2000 that is providing the timestamps for the recorded data, therefore those timestamps will provide an accurate comparison between state changes and recorded data.&lt;br /&gt;
&lt;br /&gt;
==== Asynchronous Loop ====&lt;br /&gt;
&lt;br /&gt;
The asynchronous loop first sends the mutexed message to the server. If the message is empty, it doesn&#039;t send anything. This is the message that the server waits for in section 2.1.1. The loop then waits for a message from the server with the changes other clients have made. It waits 2ms for the server before moving on. This is the message the server sends in section 2.1.3. The loop then records these changes in the mutexed state machine and flags that they have a change from the server.&lt;br /&gt;
&lt;br /&gt;
=== Client Initialization ===&lt;br /&gt;
&lt;br /&gt;
The client initializes its connection with the server during the AutoConfig phase of BCI2000. This occurs after the Set Config button is pressed. The client first ensures that it hasn&#039;t already established a connection with the server, then it connects to the server. It uses user defined parameters to determine the IP address and port of the server application. The port of the server is defined by the designer in the server application file. The client then waits for the server to send an initial message that contains a client number and initial parameters. The client number is an id for the client to use to differentiate itself from other clients. For example, if each subject plays a different role in the paradigm, then the client number can be used to differentiate between roles. The parameters are then used to set BCI2000&#039;s parameters.&lt;br /&gt;
&lt;br /&gt;
== Example Paradigm Design ==&lt;br /&gt;
A BCI2000 Hyperscanning paradigm is designed very similarly to a typical BCI2000 paradigm with a couple key differences. First, states we want to be shared with other clients must be stated in the batch file, either under the optional parameter SharedStates (for states we want to be shared that BCI2000 Hyperscanning will define for us) or the optional parameter PreDefinedSharedStates (for states we want to be shared that we will define ourselves). Second, instead of the regular BCI2000 methods, i.e. Publish, Preflight, Process, etc., we use Hyperscanning Application Base methods, which are prefixed with Shared, i.e. SharedPublish, SharedPreflight, SharedProcess, etc.. The BCI2000 Hyperscanning methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
=== Turn Based Stimulus ===&lt;br /&gt;
&lt;br /&gt;
The well-known game Tic-Tac-Toe is an example of a turn based game. One player takes their turn, then the other player takes their turn. Each turn is taken after the previous one, with no overlap in timing. Here is our implementation of Tic-Tac-Toe to show how a turn based game works with BCI2000 hyperscanning:&lt;br /&gt;
&lt;br /&gt;
TicTacToe.cpp:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;TicTacToe.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;TextField.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;limits&amp;gt;&lt;br /&gt;
 #include &amp;quot;BCIEvent.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;string&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 //Shared States&lt;br /&gt;
 //grid, 32&lt;br /&gt;
 //turn, 8&lt;br /&gt;
 //x, 8&lt;br /&gt;
 //y, 8&lt;br /&gt;
 &lt;br /&gt;
 RegisterFilter( TicTacToe, 3 );&lt;br /&gt;
 &lt;br /&gt;
 TicTacToe::TicTacToe() : winText( NULL ), highlight( NULL ), tiles( NULL ), board( NULL ), mrDisplay( Window() ) {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::SharedPublish() {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const {&lt;br /&gt;
 	State( &amp;quot;grid&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;turn&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;ClientNumber&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;KeyDown&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;x&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;y&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 	Parameter( &amp;quot;SampleBlockSize&amp;quot; );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) {&lt;br /&gt;
 	ApplicationBase::Initialize( Input, Output );&lt;br /&gt;
 &lt;br /&gt;
 	board = new ImageStimulus( mrDisplay );&lt;br /&gt;
 	board-&amp;gt;SetObjectRect( { 0.f, 0.f, 1.f, 1.f } );&lt;br /&gt;
 	board-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustHeight );&lt;br /&gt;
 	board-&amp;gt;SetRenderingMode( GUI::RenderingMode::Transparent );&lt;br /&gt;
 	board-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/tictactoe.png&amp;quot; );&lt;br /&gt;
 	board-&amp;gt;SetZOrder( 12 );&lt;br /&gt;
 &lt;br /&gt;
 	winText = new TextField( mrDisplay );&lt;br /&gt;
 	winText-&amp;gt;SetVisible( true );&lt;br /&gt;
 	winText-&amp;gt;SetObjectRect( { 0.2f, 0.4f, 0.8f, 0.6f } );&lt;br /&gt;
 	board-&amp;gt;SetZOrder( 1 );&lt;br /&gt;
 &lt;br /&gt;
 	tiles = ( ImageStimulus** ) malloc( sizeof( ImageStimulus ) * 9 );&lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		tiles[ i ] = new ImageStimulus( mrDisplay );&lt;br /&gt;
 		int x = i % 3;&lt;br /&gt;
 		int y = i / 3;&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetObjectRect( { x / 3.f, y / 3.f, x / 3.f + 0.33f, y / 3.f + 0.33f } );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustBoth );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetRenderingMode( GUI::RenderingMode::Opaque );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetZOrder( i + 2 );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	highlight = new ImageStimulus( mrDisplay );&lt;br /&gt;
 	highlight-&amp;gt;SetObjectRect( { 0.f, 0.f, 0.33f, 0.33f } );&lt;br /&gt;
 	highlight-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustBoth );&lt;br /&gt;
 	highlight-&amp;gt;SetRenderingMode( GUI::RenderingMode::Transparent );&lt;br /&gt;
 	highlight-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/highlight.png&amp;quot; );&lt;br /&gt;
 	highlight-&amp;gt;SetZOrder( 11 );&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) {&lt;br /&gt;
 	board-&amp;gt;Present();&lt;br /&gt;
 	highlight-&amp;gt;Present();&lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		tiles[ i ]-&amp;gt;Present();&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	if ( State( &amp;quot;turn&amp;quot; ) == 3 ) {&lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 32 ) ) { //Space&lt;br /&gt;
 			Reset();&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	if ( State( &amp;quot;ClientNumber&amp;quot; ) == State( &amp;quot;turn&amp;quot; ) ) {&lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 38 ) &amp;amp;&amp;amp; State( &amp;quot;y&amp;quot; ) &amp;gt;= 1 ) { //Up&lt;br /&gt;
 			State( &amp;quot;y&amp;quot; ) = State( &amp;quot;y&amp;quot; ) - 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 40 ) &amp;amp;&amp;amp; State( &amp;quot;y&amp;quot; ) &amp;lt;= 1 ) { //Down&lt;br /&gt;
 			State( &amp;quot;y&amp;quot; ) = State( &amp;quot;y&amp;quot; ) + 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 37 ) &amp;amp;&amp;amp; State( &amp;quot;x&amp;quot; ) &amp;gt;= 1 ) { //Left&lt;br /&gt;
 			State( &amp;quot;x&amp;quot; ) = State( &amp;quot;x&amp;quot; ) - 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 39 ) &amp;amp;&amp;amp; State( &amp;quot;x&amp;quot; ) &amp;lt;= 1 ) { //Right&lt;br /&gt;
 			State( &amp;quot;x&amp;quot; ) = State( &amp;quot;x&amp;quot; ) + 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 32 ) ) { //Space&lt;br /&gt;
 			long xflag = 1UL &amp;lt;&amp;lt; ( 2 * ( State( &amp;quot;y&amp;quot; ) * 3 + State( &amp;quot;x&amp;quot; ) ) );&lt;br /&gt;
 			long oflag = 1UL &amp;lt;&amp;lt; ( 2 * ( State( &amp;quot;y&amp;quot; ) * 3 + State( &amp;quot;x&amp;quot; ) ) + 1 );&lt;br /&gt;
 &lt;br /&gt;
 			if ( !( State( &amp;quot;grid&amp;quot; ) &amp;amp; xflag ) &amp;amp;&amp;amp; !( State( &amp;quot;grid&amp;quot; ) &amp;amp; oflag ) ) {&lt;br /&gt;
 				if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 ) {&lt;br /&gt;
 					State( &amp;quot;grid&amp;quot; ) = State( &amp;quot;grid&amp;quot; ) | xflag;&lt;br /&gt;
 					State( &amp;quot;turn&amp;quot; ) = 1;&lt;br /&gt;
 				}&lt;br /&gt;
 &lt;br /&gt;
 				else {&lt;br /&gt;
 					State( &amp;quot;grid&amp;quot; ) = State( &amp;quot;grid&amp;quot; ) | oflag;&lt;br /&gt;
 					State( &amp;quot;turn&amp;quot; ) = 0;&lt;br /&gt;
 				}&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	long flag = 1UL;&lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		if ( State( &amp;quot;grid&amp;quot; ) &amp;amp; flag ) {&lt;br /&gt;
 			tiles[ i ]-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/x.png&amp;quot; );&lt;br /&gt;
 		}&lt;br /&gt;
 		flag &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 		if ( State( &amp;quot;grid&amp;quot; ) &amp;amp; flag ) {&lt;br /&gt;
 			tiles[ i ]-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/o.png&amp;quot; );&lt;br /&gt;
 		}&lt;br /&gt;
 		flag &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	long hwin = horizontal_win;&lt;br /&gt;
 	long vwin = vertical_win;&lt;br /&gt;
 	long dwin1 = diagonal_win_1;&lt;br /&gt;
 	long dwin2 = diagonal_win_2;&lt;br /&gt;
 &lt;br /&gt;
 	if ( ( State( &amp;quot;grid&amp;quot; ) &amp;amp; dwin1 ) == dwin1 || ( State( &amp;quot;grid&amp;quot; ) &amp;amp; dwin2 ) == dwin2 ) {&lt;br /&gt;
 		State( &amp;quot;turn&amp;quot; ) = 3;&lt;br /&gt;
 		winText-&amp;gt;SetText( &amp;quot;X Wins&amp;quot; );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	dwin1 &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 	dwin2 &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 &lt;br /&gt;
 	if ( ( State( &amp;quot;grid&amp;quot; ) &amp;amp; dwin1 ) == dwin1 || ( State( &amp;quot;grid&amp;quot; ) &amp;amp; dwin2 ) == dwin2 ) {&lt;br /&gt;
 		State( &amp;quot;turn&amp;quot; ) = 3;&lt;br /&gt;
 		winText-&amp;gt;SetText( &amp;quot;O Wins&amp;quot; );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 3; i++ ) {&lt;br /&gt;
 		if ( ( State( &amp;quot;grid&amp;quot; ) &amp;amp; hwin ) == hwin || ( State( &amp;quot;grid&amp;quot; ) &amp;amp; vwin ) == vwin ) {&lt;br /&gt;
 			State( &amp;quot;turn&amp;quot; ) = 3;&lt;br /&gt;
 			winText-&amp;gt;SetText( &amp;quot;X Wins&amp;quot; );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		hwin &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 		vwin &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 &lt;br /&gt;
 		if ( ( State( &amp;quot;grid&amp;quot; ) &amp;amp; hwin ) == hwin || ( State( &amp;quot;grid&amp;quot; ) &amp;amp; vwin ) == vwin ) {&lt;br /&gt;
 			State( &amp;quot;turn&amp;quot; ) = 3;&lt;br /&gt;
 			winText-&amp;gt;SetText( &amp;quot;O Wins&amp;quot; );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		hwin &amp;lt;&amp;lt;= 5;&lt;br /&gt;
 		vwin &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	highlight-&amp;gt;SetObjectRect( { State(&amp;quot;x&amp;quot;) / 3.f, State(&amp;quot;y&amp;quot;) / 3.f, (State(&amp;quot;x&amp;quot;) + 1) / 3.f, (State(&amp;quot;y&amp;quot;) + 1) / 3.f } );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 bool TicTacToe::CheckKeyPress( std::string event_name, int value ) {&lt;br /&gt;
 	for ( unsigned int i = 0; i &amp;lt; Parameter( &amp;quot;SampleBlockSize&amp;quot; ); i++ ) {&lt;br /&gt;
 		if ( State( event_name )( i ) == value ) {&lt;br /&gt;
 			return true;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 	return false;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::Reset() {&lt;br /&gt;
 	State( &amp;quot;turn&amp;quot; ) = 0;&lt;br /&gt;
 	State( &amp;quot;grid&amp;quot; ) = 0;&lt;br /&gt;
 &lt;br /&gt;
 	delete board;&lt;br /&gt;
 	board = new ImageStimulus( mrDisplay );&lt;br /&gt;
 	board-&amp;gt;SetObjectRect( { 0.f, 0.f, 1.f, 1.f } );&lt;br /&gt;
 	board-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustHeight );&lt;br /&gt;
 	board-&amp;gt;SetRenderingMode( GUI::RenderingMode::Transparent );&lt;br /&gt;
 	board-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/tictactoe.png&amp;quot; );&lt;br /&gt;
 	board-&amp;gt;SetZOrder( 12 );&lt;br /&gt;
 &lt;br /&gt;
 	delete winText;&lt;br /&gt;
 	winText = new TextField( mrDisplay );&lt;br /&gt;
 	winText-&amp;gt;SetVisible( true );&lt;br /&gt;
 	winText-&amp;gt;SetObjectRect( { 0.2f, 0.4f, 0.8f, 0.6f } );&lt;br /&gt;
 	board-&amp;gt;SetZOrder( 1 );&lt;br /&gt;
 &lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		delete tiles[ i ];&lt;br /&gt;
 	}&lt;br /&gt;
 	free( tiles );&lt;br /&gt;
 &lt;br /&gt;
 	tiles = ( ImageStimulus** ) malloc( sizeof( ImageStimulus ) * 9 );&lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		tiles[ i ] = new ImageStimulus( mrDisplay );&lt;br /&gt;
 		int x = i % 3;&lt;br /&gt;
 		int y = i / 3;&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetObjectRect( { x / 3.f, y / 3.f, x / 3.f + 0.33f, y / 3.f + 0.33f } );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustBoth );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetRenderingMode( GUI::RenderingMode::Opaque );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetZOrder( i + 2 );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	delete highlight;&lt;br /&gt;
 &lt;br /&gt;
 	highlight = new ImageStimulus( mrDisplay );&lt;br /&gt;
 	highlight-&amp;gt;SetObjectRect( { 0.f, 0.f, 0.33f, 0.33f } );&lt;br /&gt;
 	highlight-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustBoth );&lt;br /&gt;
 	highlight-&amp;gt;SetRenderingMode( GUI::RenderingMode::Transparent );&lt;br /&gt;
 	highlight-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/highlight.png&amp;quot; );&lt;br /&gt;
 	highlight-&amp;gt;SetZOrder( 11 );&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TicTacToe.h&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;TextField.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;ApplicationWindow.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class TicTacToe : public HyperscanningApplicationBase {&lt;br /&gt;
 	public:&lt;br /&gt;
 		TicTacToe();&lt;br /&gt;
 &lt;br /&gt;
 		void SharedPublish() override;&lt;br /&gt;
 &lt;br /&gt;
 		void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
 		void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
 		void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
 &lt;br /&gt;
 		bool CheckKeyPress( std::string, int );&lt;br /&gt;
 &lt;br /&gt;
 		void Reset();&lt;br /&gt;
 &lt;br /&gt;
 	private:&lt;br /&gt;
 		ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
 &lt;br /&gt;
 		ImageStimulus* board;&lt;br /&gt;
 		ImageStimulus** tiles;&lt;br /&gt;
 		ImageStimulus* highlight;&lt;br /&gt;
 &lt;br /&gt;
 		TextField* winText;&lt;br /&gt;
 &lt;br /&gt;
 		long horizontal_win = 21;&lt;br /&gt;
 		long vertical_win = 4161;&lt;br /&gt;
 		long diagonal_win_1 = 65793;&lt;br /&gt;
 		long diagonal_win_2 = 4368;&lt;br /&gt;
 };&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
and TicTacToe.bat&lt;br /&gt;
 Change directory $BCI2000LAUNCHDIR&lt;br /&gt;
 Show window; Set title ${Extract file base $0}&lt;br /&gt;
 Reset system&lt;br /&gt;
 Startup system localhost&lt;br /&gt;
 Start executable SignalGenerator --local --LogKeyboard=1&lt;br /&gt;
 Start executable DummySignalProcessing --local&lt;br /&gt;
 Start executable TicTacToe --local --Port=1234 --IPAddress=192.168.1.102 --SharedStates=grid,32&amp;amp;turn,8&amp;amp;x,8&amp;amp;y,8&lt;br /&gt;
 Wait for Connected&lt;br /&gt;
 Load parameterfile &amp;quot;../parms/CommunicationTask/Communication_task_dual.prm&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Important Notes ==&lt;br /&gt;
The most are important sections to draw your attention to are:&lt;br /&gt;
&lt;br /&gt;
 if ( State( &amp;quot;ClientNumber&amp;quot; ) == State( &amp;quot;turn&amp;quot; ) ) {&lt;br /&gt;
&lt;br /&gt;
ClientNumber is a state that is automatically sent by the server. It is an id, between 0 and N, where N is the number of clients connected, that can be used to differentiate between each client without having to run a separate application on each. &amp;quot;turn&amp;quot; is a shared state between the clients. Shared states are accessed in the exact same way that a normal BCI2000 state is accessed. This way we can use shared states and the client number to determine which client should be placing their mark. &lt;br /&gt;
&lt;br /&gt;
 State( &amp;quot;turn&amp;quot; ) = 1;&lt;br /&gt;
&lt;br /&gt;
Shared states are also written to the exact same way as normal BCI2000 shared states. They will be automatically updated for the other clients.&lt;br /&gt;
&lt;br /&gt;
  Start executable TicTacToe --local --Port=1234 --IPAddress=192.168.1.102 --SharedStates=grid,32&amp;amp;turn,8&amp;amp;x,8&amp;amp;y,8&lt;br /&gt;
&lt;br /&gt;
This is where we define the states that we want to share with &amp;quot;--SharedStates=&amp;quot;. The format is:&lt;br /&gt;
 --SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&lt;br /&gt;
We can also define predefined shared states here in a similar way, but without the size (because the size is already defined), using:&lt;br /&gt;
 --PreDefinedSharedStates=&amp;lt;state-1&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--Port and --IPAddress are additional parameters that tell the client where to find the server on the internet. All of these parameters can also be changed from the Config menu, and the client connects to the server after &amp;quot;Set Config&amp;quot; is pressed.&lt;br /&gt;
&lt;br /&gt;
=== Live Interaction Stimulus ===&lt;br /&gt;
&lt;br /&gt;
The classic video game pong is an example of live interaction. Both players can interact with the game simultaneously. There are no discrete turns. We implemented pong with BCI2000 hyperscanning to demonstrate a live interaction.&lt;br /&gt;
&lt;br /&gt;
pong.cpp&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;Pong.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;limits&amp;gt;&lt;br /&gt;
 #include &amp;quot;BCIEvent.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 //Shared States&lt;br /&gt;
 //BallX 32&lt;br /&gt;
 //BallY 32&lt;br /&gt;
 //BallVX 8&lt;br /&gt;
 //BallVY 8&lt;br /&gt;
 //Player1Y 32&lt;br /&gt;
 //Player2Y 32&lt;br /&gt;
 //Player1Ready 1&lt;br /&gt;
 //Player2Ready 1&lt;br /&gt;
 //GamePhase 8&lt;br /&gt;
 //&lt;br /&gt;
 //Game Phases&lt;br /&gt;
 //0 : Instruction&lt;br /&gt;
 //1 : Game&lt;br /&gt;
 //2 : Between Rounds&lt;br /&gt;
 &lt;br /&gt;
 RegisterFilter( Pong, 3 );&lt;br /&gt;
 &lt;br /&gt;
 Pong::Pong() : player1Paddle( NULL ), player2Paddle( NULL ), ball( NULL ), mrDisplay( Window() ) {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedPublish() {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const {&lt;br /&gt;
 	State( &amp;quot;BallX&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;BallY&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;BallVX&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;BallVY&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;Player1Y&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;Player2Y&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;Player1Ready&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;Player2Ready&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;GamePhase&amp;quot; );&lt;br /&gt;
 	State(&amp;quot;ClientNumber&amp;quot;);&lt;br /&gt;
 //	State( &amp;quot;KeyDown&amp;quot; );&lt;br /&gt;
 	Parameter( &amp;quot;SampleBlockSize&amp;quot; );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) {&lt;br /&gt;
 	player1Paddle = new RectangularShape( mrDisplay );&lt;br /&gt;
 	player1Paddle-&amp;gt;SetFillColor( RGBColor::Teal );&lt;br /&gt;
 	player1Paddle-&amp;gt;SetVisible( true );&lt;br /&gt;
 &lt;br /&gt;
 	player2Paddle = new RectangularShape( mrDisplay );&lt;br /&gt;
 	player2Paddle-&amp;gt;SetFillColor( RGBColor::Red );&lt;br /&gt;
 	player2Paddle-&amp;gt;SetVisible( true );&lt;br /&gt;
 &lt;br /&gt;
 	ball = new RectangularShape( mrDisplay );&lt;br /&gt;
 	ball-&amp;gt;SetFillColor( RGBColor::Black );&lt;br /&gt;
 	ball-&amp;gt;SetVisible( true );&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedStartRun() {&lt;br /&gt;
 	State( &amp;quot;BallX&amp;quot; ) = 500;&lt;br /&gt;
 	State( &amp;quot;BallY&amp;quot; ) = 500;&lt;br /&gt;
 	State( &amp;quot;Player1Y&amp;quot; ) = 200;&lt;br /&gt;
 	State( &amp;quot;Player2Y&amp;quot; ) = 800;&lt;br /&gt;
 	State( &amp;quot;BallVX&amp;quot; ) = 493;&lt;br /&gt;
 	State( &amp;quot;BallVY&amp;quot; ) = 497;&lt;br /&gt;
 	State( &amp;quot;GamePhase&amp;quot; ) = 2;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) {&lt;br /&gt;
 	if ( State( &amp;quot;GamePhase&amp;quot; ) == 1 ) {&lt;br /&gt;
 		if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 ) {&lt;br /&gt;
 			State( &amp;quot;BallX&amp;quot; ) = State( &amp;quot;BallX&amp;quot; ) + State( &amp;quot;BallVX&amp;quot; ) - 500;&lt;br /&gt;
 			State( &amp;quot;BallY&amp;quot; ) = State( &amp;quot;BallY&amp;quot; ) + State( &amp;quot;BallVY&amp;quot; ) - 500;&lt;br /&gt;
 &lt;br /&gt;
 			if ( State( &amp;quot;BallY&amp;quot; ) &amp;gt; 950 || State( &amp;quot;BallY&amp;quot; ) &amp;lt; 50 ) {&lt;br /&gt;
 				State( &amp;quot;BallVY&amp;quot; ) = 1000 - State( &amp;quot;BallVY&amp;quot; );&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			if ( State( &amp;quot;BallX&amp;quot; ) + 50 &amp;gt; 875 &amp;amp;&amp;amp; State( &amp;quot;BallX&amp;quot; ) - 50 &amp;lt; 925 &amp;amp;&amp;amp; State( &amp;quot;BallY&amp;quot; ) + 50 &amp;gt; State( &amp;quot;Player2Y&amp;quot; ) - 100 &amp;amp;&amp;amp; State( &amp;quot;BallY&amp;quot; ) - 50 &amp;lt; State( &amp;quot;Player2Y&amp;quot; ) + 100 ) {&lt;br /&gt;
 				State( &amp;quot;BallVX&amp;quot; ) = 1000 - State( &amp;quot;BallVX&amp;quot; );&lt;br /&gt;
 				State( &amp;quot;BallX&amp;quot; ) = 875 - 50;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			if ( State( &amp;quot;BallX&amp;quot; ) + 50 &amp;gt; 75  &amp;amp;&amp;amp; State( &amp;quot;BallX&amp;quot; ) - 50 &amp;lt; 125 &amp;amp;&amp;amp; State( &amp;quot;BallY&amp;quot; ) + 50 &amp;gt; State( &amp;quot;Player1Y&amp;quot; ) - 100 &amp;amp;&amp;amp; State( &amp;quot;BallY&amp;quot; ) - 50 &amp;lt; State( &amp;quot;Player1Y&amp;quot; ) + 100 ) {&lt;br /&gt;
 				State( &amp;quot;BallVX&amp;quot; ) = 1000 - State( &amp;quot;BallVX&amp;quot; );&lt;br /&gt;
 				State( &amp;quot;BallX&amp;quot; ) = 125 + 50;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			if ( State( &amp;quot;BallX&amp;quot; ) + 50 &amp;gt; 1000 || State( &amp;quot;BallX&amp;quot; ) - 50 &amp;lt; 0 ) {&lt;br /&gt;
 				State( &amp;quot;BallX&amp;quot; ) = 500;&lt;br /&gt;
 				State( &amp;quot;BallVY&amp;quot; ) = State( &amp;quot;BallVY&amp;quot; ) + 1;&lt;br /&gt;
 				State( &amp;quot;GamePhase&amp;quot; ) = 2;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 38 ) ) { //Up&lt;br /&gt;
 			if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 )&lt;br /&gt;
 				State( &amp;quot;Player1Y&amp;quot; ) = State( &amp;quot;Player1Y&amp;quot; ) - 30;&lt;br /&gt;
 			else &lt;br /&gt;
 				State( &amp;quot;Player2Y&amp;quot; ) = State( &amp;quot;Player2Y&amp;quot; ) - 30;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 40 ) ) { //Down&lt;br /&gt;
 			if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 )&lt;br /&gt;
 				State( &amp;quot;Player1Y&amp;quot; ) = State( &amp;quot;Player1Y&amp;quot; ) + 30;&lt;br /&gt;
 			else &lt;br /&gt;
 				State( &amp;quot;Player2Y&amp;quot; ) = State( &amp;quot;Player2Y&amp;quot; ) + 30;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	if ( State( &amp;quot;GamePhase&amp;quot; ) == 2 ) {&lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 32 ) == 0 ) { //Space&lt;br /&gt;
 			if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 )&lt;br /&gt;
 				State( &amp;quot;Player1Ready&amp;quot; ) = 1;&lt;br /&gt;
 			else&lt;br /&gt;
 				State( &amp;quot;Player2Ready&amp;quot; ) = 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( State( &amp;quot;Player1Ready&amp;quot; ) == 1 &amp;amp;&amp;amp; State( &amp;quot;Player2Ready&amp;quot; ) == 1 ) {&lt;br /&gt;
 			State( &amp;quot;GamePhase&amp;quot; ) = 1;&lt;br /&gt;
 			State( &amp;quot;Player1Ready&amp;quot; ) = 0;&lt;br /&gt;
 			State( &amp;quot;Player2Ready&amp;quot; ) = 0;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 	bciout &amp;lt;&amp;lt; &amp;quot;Ball: (&amp;quot; &amp;lt;&amp;lt; State(&amp;quot;BallX&amp;quot;) &amp;lt;&amp;lt; &amp;quot;, &amp;quot; &amp;lt;&amp;lt; State(&amp;quot;BallY&amp;quot;) &amp;lt;&amp;lt; &amp;quot;)&amp;quot;;&lt;br /&gt;
 	bciout &amp;lt;&amp;lt; &amp;quot;Player1: &amp;quot; &amp;lt;&amp;lt; State(&amp;quot;Player1Y&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	GUI::Rect rect = { ( State( &amp;quot;BallX&amp;quot; ) / 1000.f ) - 0.05, ( State( &amp;quot;BallY&amp;quot; ) / 1000.f ) - 0.05, ( State( &amp;quot;BallX&amp;quot; ) / 1000.f ) + 0.05, ( State( &amp;quot;BallY&amp;quot; ) / 1000.f ) + 0.05 };&lt;br /&gt;
 	ball-&amp;gt;SetObjectRect( rect );&lt;br /&gt;
 &lt;br /&gt;
 	rect = { 0.075f, ( State( &amp;quot;Player1Y&amp;quot; ) / 1000.f ) - 0.1f, 0.125f, ( State( &amp;quot;Player1Y&amp;quot; ) / 1000.f ) + 0.1f };&lt;br /&gt;
 	player1Paddle-&amp;gt;SetObjectRect( rect );&lt;br /&gt;
 &lt;br /&gt;
 	rect = { 0.875f, ( State( &amp;quot;Player2Y&amp;quot; ) / 1000.f ) - 0.1f, 0.925f, ( State( &amp;quot;Player2Y&amp;quot; ) / 1000.f ) + 0.1f };&lt;br /&gt;
 	player2Paddle-&amp;gt;SetObjectRect( rect );&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 bool Pong::CheckKeyPress( std::string event_name, int value ) {&lt;br /&gt;
 	for ( unsigned int i = 0; i &amp;lt; Parameter( &amp;quot;SampleBlockSize&amp;quot; ); i++ ) {&lt;br /&gt;
 		if ( State( event_name )( i ) == value ) {&lt;br /&gt;
 			return true;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 	return false;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
pong.h&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;ApplicationWindow.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class Pong : public HyperscanningApplicationBase {&lt;br /&gt;
 	public:&lt;br /&gt;
 		Pong();&lt;br /&gt;
 &lt;br /&gt;
 		void SharedPublish() override;&lt;br /&gt;
 &lt;br /&gt;
 		void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
 		void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
 		void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
 		void SharedStartRun() override;&lt;br /&gt;
 &lt;br /&gt;
 		bool CheckKeyPress( std::string event_name, int value );&lt;br /&gt;
 &lt;br /&gt;
 	private:&lt;br /&gt;
 		ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
 		RectangularShape* player1Paddle;&lt;br /&gt;
 		RectangularShape* player2Paddle;&lt;br /&gt;
 		RectangularShape* ball;&lt;br /&gt;
 };&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and pong.bat&lt;br /&gt;
 Change directory $BCI2000LAUNCHDIR&lt;br /&gt;
 Show window; Set title ${Extract file base $0}&lt;br /&gt;
 Reset system&lt;br /&gt;
 Startup system localhost&lt;br /&gt;
 Start executable SignalGenerator --local --LogKeyboard=1&lt;br /&gt;
 Start executable DummySignalProcessing --local&lt;br /&gt;
 Start executable Pong --local --Port=1234 --IPAddress=192.168.1.102 --SharedStates=BallX,32&amp;amp;BallY,32&amp;amp;Player1Y,32&amp;amp;Player2Y,32&amp;amp;BallVX,32&amp;amp;BallVY,32&amp;amp;Player1Ready,8&amp;amp;Player2Ready,8&amp;amp;GamePhase,8&amp;amp;Player1Score,8&amp;amp;Player2Score,8&lt;br /&gt;
 Wait for Connected&lt;br /&gt;
 Load parameterfile &amp;quot;../parms/CommunicationTask/Communication_task_dual.prm&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This behaves very similarly to the tic-tac-toe example, with the key difference being both clients can interact with states simultaneously, whereas in tic-tac-toe only one client was changing states at a time.&lt;br /&gt;
&lt;br /&gt;
Any processing of game states, for example changing the position of the ball in pong, can occur on either the clients or the server depending on the wants and needs of each implementation. If they are placed on the client side, only one of clients should be responsible for actually processing the data because otherwise there could be multiple versions of the same state that are equally correct, because they were each accurately calculated by a different client, so the server would have to choose one state to save to the master state machine and discard the other versions. This could lead to jumpiness when displaying the state or bugs. Because only one client is processing data, only that client will have a greater load than the others. If the overhead of the game is too significant, this could become problematic. If the processing is done on the server, there will not be an issue with one client running slower, but it will be more tedious to implement, because a custom installation will have to be designed instead of a premade backend application, and a more powerful server will be required.&lt;br /&gt;
&lt;br /&gt;
For turn based games, this is a non-issue because each client can process the game state for their own turn. It only becomes an issue when a game state needs to be calculated that isn&#039;t based on client inputs, once again like the movement of the ball in pong, as opposed to the movement of the paddles in pong.&lt;br /&gt;
&lt;br /&gt;
=== Example Server Application ===&lt;br /&gt;
application.cpp&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;statemachine.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;game.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;port.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;client.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;statemachine.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
 #include &amp;lt;thread&amp;gt;&lt;br /&gt;
 #include &amp;lt;chrono&amp;gt;&lt;br /&gt;
 #include &amp;lt;fstream&amp;gt;&lt;br /&gt;
 #include &amp;lt;algorithm&amp;gt;&lt;br /&gt;
 #include &amp;lt;random&amp;gt;&lt;br /&gt;
 #include &amp;quot;params.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Here we load a general parameter file to ensure that the experiment is the same on each client. We also load a parameter file for an existing game, so we can resume where we left off. We will write to the existing game file in the final section of the application file. If this is the first session, then we will randomly generate a stimuli sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 	// Load Parameter File&lt;br /&gt;
 	Params params = Params( &amp;quot;Parameters.prm&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 	// Load previous parameters&lt;br /&gt;
 	Params existing = Params( &amp;quot;ExistingGame.prm&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 	std::string stimuliSequence;&lt;br /&gt;
        &lt;br /&gt;
        // Check if saved parameters from previous game are populated&lt;br /&gt;
 	if ( existing.contents.size() &amp;gt; 0 ) {&lt;br /&gt;
 		params.contents += existing.contents;&lt;br /&gt;
 &lt;br /&gt;
 		stimuliSequence = existing.GetParam( &amp;quot;StimuliSequence&amp;quot; )-&amp;gt;line;&lt;br /&gt;
 	} // If they are not then generate them, and they will be saved when this game finishes&lt;br /&gt;
 	else {&lt;br /&gt;
 		// Generate Random Sequence&lt;br /&gt;
 &lt;br /&gt;
 		Param* stimmat = params.GetParam( &amp;quot;StimuliMatrix&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 		std::vector&amp;lt;int&amp;gt; order = std::vector&amp;lt;int&amp;gt;( stimmat-&amp;gt;width );&lt;br /&gt;
 		for ( int i = 0; i &amp;lt; stimmat-&amp;gt;width; i++ )&lt;br /&gt;
 			order[ i ] = i;&lt;br /&gt;
 &lt;br /&gt;
 		std::random_device rd;&lt;br /&gt;
 		auto rng = std::default_random_engine( rd() );&lt;br /&gt;
 		std::shuffle( std::begin( order ), std::end( order ), rng );&lt;br /&gt;
 &lt;br /&gt;
 		stimuliSequence = &amp;quot;\nApplication:Sequence intlist StimuliSequence= &amp;quot;;&lt;br /&gt;
 		stimuliSequence += std::to_string( stimmat-&amp;gt;width );&lt;br /&gt;
 		stimuliSequence += &amp;quot; &amp;quot;;&lt;br /&gt;
 		for ( int i = 0; i &amp;lt; stimmat-&amp;gt;width; i++ ) {&lt;br /&gt;
 			stimuliSequence += std::to_string( order[ i ] );&lt;br /&gt;
 			stimuliSequence += &amp;quot; &amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		stimuliSequence += &amp;quot;% % % //Random Stimuli Sequence&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 		params.AddParam( stimuliSequence );&lt;br /&gt;
 &lt;br /&gt;
 		params.AddParam( &amp;quot;Application int InitialTrialNumber= 0 % % % // trial number&amp;quot; );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	params.contents.push_back( 0 );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the only necessary part of the main function. Here we open the port for listening, connect to the clients, and start the loop. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
        //Open the port for listening&lt;br /&gt;
 	Port port( 1234, 100 );&lt;br /&gt;
 	if ( !port.open )&lt;br /&gt;
 		return 0;&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Connected to port &amp;quot; &amp;lt;&amp;lt; 1234 &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 &lt;br /&gt;
        // Initialize Game class&lt;br /&gt;
 	Game game = Game( port, params.contents );&lt;br /&gt;
 &lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Waiting for clients&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
        &lt;br /&gt;
        // Wait for a client to open a socket connection then connect them to the game&lt;br /&gt;
 	Client* client1 = port.WaitForClient();&lt;br /&gt;
 	game.Connect( client1 );&lt;br /&gt;
 &lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Connected to first client&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Waiting for second client&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 &lt;br /&gt;
        // Do the same for a second client&lt;br /&gt;
 	game.Connect( port.WaitForClient() );&lt;br /&gt;
 &lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Connected to second client&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
        &lt;br /&gt;
        // Run the server loop and save the final states&lt;br /&gt;
 	StateMachine out_states = game.Loop();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we take data from the master state machine and save it to the existing game parameter file, so we can use it when we restart the paradigm.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
        // Save the trial number from when the paradigm was ended&lt;br /&gt;
 	std::string InitialTrialNumber = out_states.GetState( &amp;quot;TrialNumber&amp;quot; );&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Trial Number: &amp;quot; &amp;lt;&amp;lt; InitialTrialNumber &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
        &lt;br /&gt;
        // Make sure that the trial number is populated and subtract one to repeat the unfinished trial&lt;br /&gt;
 	if ( InitialTrialNumber.size() == 0 ) InitialTrialNumber = &amp;quot;\1&amp;quot;;&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Saving Trial Number: &amp;quot; &amp;lt;&amp;lt; ( int ) *InitialTrialNumber.c_str() - 1 &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 &lt;br /&gt;
 	// Save Initial Trial Number and random stimuli sequence&lt;br /&gt;
 	std::ofstream egof( &amp;quot;ExistingGame.prm&amp;quot; );&lt;br /&gt;
 	egof &amp;lt;&amp;lt; &amp;quot;Application int InitialTrialNumber= &amp;quot; &amp;lt;&amp;lt; ( int )*InitialTrialNumber.c_str() - 1 &amp;lt;&amp;lt; &amp;quot; % % % // trial number&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 	egof &amp;lt;&amp;lt; stimuliSequence &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 &lt;br /&gt;
        // All Done!&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;All done!&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Important Notes ==&lt;br /&gt;
The server must be configured to allow inbound TCP traffic. Most only server services, like AWS or Azure, will allow you to do this easily. &lt;br /&gt;
&lt;br /&gt;
In AWS:&lt;br /&gt;
# Select an instance&lt;br /&gt;
# Go to the &amp;quot;Security&amp;quot; tab&lt;br /&gt;
# Select one of the security groups&lt;br /&gt;
# With one of the security groups selected, go to the &amp;quot;inbound rules&amp;quot; tab&lt;br /&gt;
# Press &amp;quot;edit inbound rules&amp;quot;&lt;br /&gt;
# Press &amp;quot;Add Rule&amp;quot;&lt;br /&gt;
# Set &amp;quot;Type&amp;quot; to &amp;quot;Any TCP&amp;quot;&lt;br /&gt;
# Set &amp;quot;Source&amp;quot; to the IP Addresses of each of your clients or to &amp;quot;Anywhere IPv4&amp;quot;&lt;br /&gt;
# Press &amp;quot;Save Rules&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To create an instance in AWS:&lt;br /&gt;
# Go to [aws.amazon.com/ec2|AWS] and create an account or log in&lt;br /&gt;
# Press &amp;quot;Launch Instance&amp;quot;&lt;br /&gt;
# Give your instance a name&lt;br /&gt;
# Select &amp;quot;Amazon Linux&amp;quot; or any other non-windows operating system of your choice&lt;br /&gt;
# Select the tier of server you would like. If you are doing the processing on the clients then the free-tier or cheapest option will suffice with no performance penalties. If you followed the example server application, then you are doing the processing on the clients. If you are doing processing on the server, then select whichever performance tier is necessary to run your application at an acceptable speed.&lt;br /&gt;
# Under Key Pair, press &amp;quot;Create New Key Pair&amp;quot;&lt;br /&gt;
# Name is whatever you would like&lt;br /&gt;
# Select RSA for key pair type&lt;br /&gt;
# Select .pem for private key file format&lt;br /&gt;
# Press create key pair and remember where you save it to. We will need to use this to connect to the server.&lt;br /&gt;
# Now press &amp;quot;Launch Instance&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To configure and run your aws instance (if it isn&#039;t an aws instance the same applies, except instead of &amp;quot;ec2-user&amp;quot; you will use the username for your server or if it is local ignore the ssh step):&lt;br /&gt;
Open a terminal or shell&lt;br /&gt;
Enter the command&lt;br /&gt;
 ssh -i &amp;lt;/path/key-pair-name.pem&amp;gt; ec2-user@&amp;lt;public-IPv4-address&amp;gt;&lt;br /&gt;
The public IPv4 address can be found by selecting the instance in the instance dashboard. If you do not see one, ensure that the instance is running.&lt;br /&gt;
If prompted with&lt;br /&gt;
 The authenticity of host &#039;ec2-198-51-100-1.compute-1.amazonaws.com (198-51-100-1)&#039; can&#039;t be established.&lt;br /&gt;
 ECDSA key fingerprint is l4UB/neBad9tvkgJf1QZWxheQmR59WgrgzEimCG6kZY.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)?&lt;br /&gt;
Type&lt;br /&gt;
 yes&lt;br /&gt;
Clone the github repository with&lt;br /&gt;
 git clone https://github.com/MaxwellMarcus/hyperscanning-backend&lt;br /&gt;
Go to the directory&lt;br /&gt;
 cd hyperscanning-backend&lt;br /&gt;
Edit or create an application in the file application.cpp, if you aren&#039;t using the default tutorial application file&lt;br /&gt;
Build the application with&lt;br /&gt;
 make&lt;br /&gt;
If you are working on remote servers over SSH. Please use the command &amp;quot;screen&amp;quot;, which keeps the server running even if you disconnect.&amp;lt;br /&amp;gt;&lt;br /&gt;
Creat a screen called dual&lt;br /&gt;
&amp;lt;syntaxhighlight&amp;gt;&lt;br /&gt;
screen -S dual&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Run the application with&lt;br /&gt;
 ./application&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=BCI2000_Hyperscanning&amp;diff=12094</id>
		<title>BCI2000 Hyperscanning</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=BCI2000_Hyperscanning&amp;diff=12094"/>
		<updated>2025-09-15T16:43:31Z</updated>

		<summary type="html">&lt;p&gt;Lingling: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;BCI2000 Hyperscanning is a multiplayer simulation, a program that is synchronized over multiple computers, that supports the connection of two or more clients, the computers that are involved in the simulation. BCI2000 Hyperscanning also has subjects, which are the people that are using the client computers.&lt;br /&gt;
&lt;br /&gt;
In a multiplayer simulation, each client involved must know the current state of the game. This game state allows each client to determine the output that is shown to the user. In order for each client to display the same game to each user, each client must have the same game state. The game state is stored as a collection of state variables in a state machine.&lt;br /&gt;
A state machine is a set of variables, or states, that correspond with values. In essence, it is a simple database. The data in the database describes the state of the game (see figure \ref{fig:gamestate}).&lt;br /&gt;
&lt;br /&gt;
BCI2000 Hyperscanning has a master state machine that is stored on a centralized back-end server and one state machine for each client. Each client is connected to the back-end server through a TCP socket to ensure that each connection is maintained and everything that is sent is received. The clients output a stimulus to the user based on their state machines, and update their state machines based on user inputs. When one client updates its state machine, the server saves the game state in its master state machine and updates the other clients (see figure \ref{fig:gamestateupdate}).&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:GameStateFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Game State.&#039;&#039;&#039; The game state shows synchrony between the master game state, which is stored on the server, and the client game states.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:GameStateUpdateFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Game State Updates.&#039;&#039;&#039; The game state updates (bottom) show a typical interaction that would result in a game state update to the master game state and the ensuing update to the other client(s). In this example, the user clicks, indicating they would like to place a marker in the tic-tac-toe game, and this triggers a local game state update. This local game state update is sent to the server. The server saves the update and synchronizes the remaining client(s). After the interaction has concluded, each client is synchronized.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
[[File:StateUpdatesFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Game State Update Scenarios.&#039;&#039;&#039; In scenario 1, the client updated its game state locally because of a user mouse press. This caused synchronization between it and the master game state to be lost. In this scenario, the client updates the master game state to match its game state. In scenario 2, a different client updated the master game state because of a user mouse press. This caused synchronization between the first client and the master game state to be lost. In this scenario, the server updates the first client to match its game state.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Server ==&lt;br /&gt;
The purpose of the server, or back-end, is to store, update, and distribute a master list of states. It synchronizes each of the client&#039;s state machines, so that each client displays the same game. &lt;br /&gt;
&lt;br /&gt;
At a given time, one of the clients may have a state variable set to a value that is different from the value that the server has that state set to. At this point there are two possibilities. If that state was changed based on user inputs, then the server will update its state machine to reflect that user input. Otherwise, if the client has an old value, one that has been changed by another client, then the server will update the client with the new value of the state, so that each client is synchronized (see figure \ref{fig:gamestateupdatescenarios}).&lt;br /&gt;
&lt;br /&gt;
In addition to synchronizing states between clients, the backend must also synchronize many initial parameters to ensure that the exact same experiment is being run for each subject, e.g. the order of stimulus images needs to be synchronized. To solve this, the server contains a BCI2000 parameter file that is sent to each client when it connects to the server. This also serves as a greeting message to ensure that the connection is functioning before the experiment begins.&lt;br /&gt;
&lt;br /&gt;
The server application can be run from any mac or linux computer, whether it is local to one of the clients or in the cloud, as long as it is configured to allow TCP traffic. It is a collection of c++ classes and methods that are implemented into an application file. This application file is then run on the server computer. The server is not an instance of BCI2000. Rather, it is a separate application that interacts with client instances of BCI2000. &lt;br /&gt;
&lt;br /&gt;
While the idea for this hyperscanning architecture propagated from one experimental design, we ensured that this technology was robust enough to be used reused for any experiment, even if it is radically different from our initial one. The core of the back-end is simple and abstracted. It is a state machine that can be updated from clients and will propagate those updates to other clients. This simplicity means that the central parts of the back-end will work for any experimental paradigm. The simplicity of the core also allows for a more specific framework to be built surrounding the core, should that be necessary for a specific application. &lt;br /&gt;
&lt;br /&gt;
For each paradigm, an application file is implemented on the server. This application file will always contain the basic backend framework, like connecting to clients and running the actual data exchange loop, but it can also contain more specific instructions. For example, if parameters need to be randomly generated and synchronized across clients the core design is flexible enough to allow that to be built. Parameters can be added to the previously mentioned parameter file through the application file to solve this particular example. If there is a paradigm requiring more complex changes to the standard backend, the core can also be broken down into its individual steps to allow that.  &lt;br /&gt;
&lt;br /&gt;
The backend runs in a continuous loop of data exchanges with the clients. This loop continues for as long as the experiment runs. The end to the session, and thus the loop, is singaled by one of the clients breaking its connection with the server. &lt;br /&gt;
&lt;br /&gt;
Even though a client disconnects, the experiment may not be concluded. There could have been a crash, internet issues, or the investigator may have wanted to pause the experiment, but the server cannot continue operating properly after a client has disconnected. To solve this issue, the application file can access the state machine after the loop has ended, and save any of the states that are necessary to redetermine the experimental state after a restart. These values can then be passed to BCI2000 as parameters when it is restarted. For example, the trial number can be saved and passed to BCI2000 as an initial trial number parameter (see figure \ref{fig:pause}).&lt;br /&gt;
&lt;br /&gt;
[[File:PauseFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Example paradigm with pause feature.&#039;&#039;&#039; This is a stimulus presentation paradigm, with a progression of faces being shown to the subject. During the first recording session, the subject gets through the first two trials before the session ends. The current trial number is saved to the server. During the next recording session, the server sends the current trial number, three, to the client; the client begins the session at trial number three and completes the paradigm.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
=== Server Loop ===&lt;br /&gt;
The loop has three main steps (see figure \ref{fig:serverloop}). First, the server updates any states changed by the clients. Second, the server reconciles all of the updated states. Third, the server sends updated states back to the clients. &lt;br /&gt;
&lt;br /&gt;
[[File:ReconcilliationFigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Progression of state updates over time.&#039;&#039;&#039; Each client sends state updates, indicated by black arrows, to the server-side-client state machines, indicated by pink arrows. The server side state machines send the state updates to the master state machine. These state updates include conflicting information; the master state machine saves the state update from client 1 and disregards the conflicting update from client 2. The server sends the changed states, indicated by triangular arrows and blue ovals, back to the server-side-client state machines. The server-side-client state machines send their changed states back to the clients.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Client Updates ====&lt;br /&gt;
&lt;br /&gt;
In this step, the server simply waits for at least one of the clients to send states that were changed locally. If a client has not sent any data, then the server will wait for 2ms before checking another client. The server saves the data sent by the client in a state machine that tracks the current values of the states on each client. These are the server-side-client state machines.&lt;br /&gt;
&lt;br /&gt;
==== Reconciliation ====&lt;br /&gt;
In this step, the server decides which states to save and prepares the updates to send to each client. After each client sends its updates, the server-side-client machines are different from the master state machine and from each other, but they are synchronized with their respective clients. The server has to synchronize all of these state machines by saving client changes to the master state machine and sending updates to the clients, but it is necessary to save only one version of each state and to send only updates with new information. If the server repeats state updates by sending the same update twice or by echoing a state change back to the client that sent it, that state will be changed at multiple times for that client, which can cause irregularities and bugs. %Tracker state machines, which track the changes when a state machine is updated, are used to ensure that only actual changes are sent to the clients. One tracker is used to determine all the changes to the master state machine from the client updates. These changes are then used to update the server-side-client state machines. The changes to the server-side-client state machines are only the updates from other clients that were saved as master states, so they are then used to update the actual client state machines.&lt;br /&gt;
&lt;br /&gt;
To solve this, each state must pass two tests to get sent to a client. First, it must have been saved to the master state machine. Second, it must have been sent by a different client. These tests are implemented using tracker state machines, which track the changes that occur when a state machine is updated. For the first test, the server updates the master state machine from the server-side-client state machines and tracks the changes. For the second test, the changes to the master state machine are used to update the server-side-client state machines, and the changes from this interaction are tracked. The changes to the server-side-client state machines pass both tests, because they were changed on the master state machine (they were saved to the master state machine) and one of the client state machines (they weren&#039;t sent by that client because, in that case, they would have already been updated). These changes can be sent to the clients.&lt;br /&gt;
&lt;br /&gt;
==== Update Clients ====&lt;br /&gt;
This final step is the opposite of the first step. The server sends the prepared states to the clients. After this step, the loop repeats, and the server waits for the client to send updates again. &lt;br /&gt;
&lt;br /&gt;
== Clients ==&lt;br /&gt;
The purpose of the clients is to display the stimulus to the subject. Additionally, it is responsible for actually calculating the values of the game states. Each client is a separate instance of BCI2000, which are run on separate computers. They can be next to each other or hundreds of miles apart depending on the needs of the experiment.&lt;br /&gt;
&lt;br /&gt;
Once again, the structure is designed to be robust and reusable. To this end, the client exists in two pieces. The true frontend, which is responsible for calculating state values and outputting the stimulus, and the network logger, which is responsible for communication with the server. The true frontend is designed as a typical BCI2000 experiment, and thus will be different for every experiment. The network logger contains everything that will be the exact same for every BCI2000 Hyperscanning experiment. Thus, the network logger can be reused, while the true frontend is redesigned for every new experiment.&lt;br /&gt;
&lt;br /&gt;
The network logger is a part of the hyperscanning application base, which is a c++ class that a hyperscanning paradigm can be built upon. The hyperscanning application base will connect the network logger to the application module. &lt;br /&gt;
&lt;br /&gt;
BCI2000 has its own built in state machine. The network logger seamlessly updates a predefined set of these BCI2000 states based on server activity and the activity of other clients. It translates server data into BCI2000 states. The list of states that are updated by the network logger is defined in a BCI2000 parameter called shared states that contains both the names and the sizes of each of the states that the designer wants to be synchronized amongst the clients. To ensure that the states are sent rapidly, only the necessary states should be sent between clients, so they must be defined in this parameter. Other BCI2000 states will not be synchronized.&lt;br /&gt;
&lt;br /&gt;
=== Client Loops ===&lt;br /&gt;
Much like the server, the network logger loops, however, in order to conform with BCI2000 two distinct loops are utilized. One of them is synchronous with the rest of BCI2000. BCI2000 only allows its states to be changed during specific phases, so one of the loops must be synchronized with BCI2000. %The limitations of BCI2000 states require that state changes occur only during a specific time period, which necessitates synchronizing the loop with BCI2000. &lt;br /&gt;
While BCI2000 has a type of state that can be written to asynchronously, called an event, they are added to a queue and changed at a later time. This means the network logger cannot differentiate changes it made from changes the frontend made, so it doesn&#039;t know which changes to send to the server. The other loop is asynchronous, and makes use of multi-threading and parallel processing to increase the speed that data transfers can be made at, ensuring the greatest possible synchronicity between clients.&lt;br /&gt;
&lt;br /&gt;
Because these loops are both operating on the same data, i.e. the states that need to be changed, there is the risk of data corruption if both try to operate at the same time. The data is stored in mutexed buffers to ensure that does not happen. Mutexed buffers can only be written to or read by a single source at a time. If multiple sources try to access a mutexed buffer, one of them must wait for the other to finish its operation.&lt;br /&gt;
&lt;br /&gt;
Two buffers are shared between the two loops (see figure \ref{fig:clientloops}). One is a state machine that contains the name and value of each shared state, along with whether or not the state has a change from the server that hasn&#039;t been updated to the BCI2000 states, and the other is a message for the server that contains the states that have been updated by the frontend.&lt;br /&gt;
&lt;br /&gt;
[[File:clientloopsfigure.png|center]]&lt;br /&gt;
&#039;&#039;&#039;&#039;&#039;Synchronous and asynchronous client loops and their data exchanges.&#039;&#039;&#039; The client updates a state, e.g. they indicate their move in tic-tac-toe with a mouse click, and the synchronous client loop adds that change to the message for the server. The asynchronous loop sends the message to the server. The asynchronous loop continues looping until it gets a response from the server. When it gets a response from the server, e.g. the other client&#039;s move, it adds it to the changed states buffer. The synchronous loop saves the changes in the changed states buffer to the BCI2000 state machine.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
==== Synchronous Loop ====&lt;br /&gt;
&lt;br /&gt;
The synchronous loop first updates all of the BCI2000 states that have been changed by the server. %to the value sent by the server. &lt;br /&gt;
The loop then determines if any of the states in the mutexed state machine are different from their BCI2000 counterpart. Because all of the states that were different from BCI2000 because of a server update were just updated, all of the remaining discrepancies must be due to a client change. These are then recorded in the message for the server. &lt;br /&gt;
&lt;br /&gt;
It is very important for analyzing the experiment that the investigator knows when states were changed in relation to the recorded data. This could be complicated when states are being sent over the internet with delays and lag, but the network logger and BCI2000 radically simplify it. The important timestamp to record is when the state had an effect on the actual stimulus, because this is when it can have an effect on the subject. The timestamp of BCI2000 states is recorded whenever they are changed, and it is the BCI2000 states that have an effect on the stimulus. It is also BCI2000 that is providing the timestamps for the recorded data, therefore those timestamps will provide an accurate comparison between state changes and recorded data.&lt;br /&gt;
&lt;br /&gt;
==== Asynchronous Loop ====&lt;br /&gt;
&lt;br /&gt;
The asynchronous loop first sends the mutexed message to the server. If the message is empty, it doesn&#039;t send anything. This is the message that the server waits for in section 2.1.1. The loop then waits for a message from the server with the changes other clients have made. It waits 2ms for the server before moving on. This is the message the server sends in section 2.1.3. The loop then records these changes in the mutexed state machine and flags that they have a change from the server.&lt;br /&gt;
&lt;br /&gt;
=== Client Initialization ===&lt;br /&gt;
&lt;br /&gt;
The client initializes its connection with the server during the AutoConfig phase of BCI2000. This occurs after the Set Config button is pressed. The client first ensures that it hasn&#039;t already established a connection with the server, then it connects to the server. It uses user defined parameters to determine the IP address and port of the server application. The port of the server is defined by the designer in the server application file. The client then waits for the server to send an initial message that contains a client number and initial parameters. The client number is an id for the client to use to differentiate itself from other clients. For example, if each subject plays a different role in the paradigm, then the client number can be used to differentiate between roles. The parameters are then used to set BCI2000&#039;s parameters.&lt;br /&gt;
&lt;br /&gt;
== Example Paradigm Design ==&lt;br /&gt;
A BCI2000 Hyperscanning paradigm is designed very similarly to a typical BCI2000 paradigm with a couple key differences. First, states we want to be shared with other clients must be stated in the batch file, either under the optional parameter SharedStates (for states we want to be shared that BCI2000 Hyperscanning will define for us) or the optional parameter PreDefinedSharedStates (for states we want to be shared that we will define ourselves). Second, instead of the regular BCI2000 methods, i.e. Publish, Preflight, Process, etc., we use Hyperscanning Application Base methods, which are prefixed with Shared, i.e. SharedPublish, SharedPreflight, SharedProcess, etc.. The BCI2000 Hyperscanning methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
=== Turn Based Stimulus ===&lt;br /&gt;
&lt;br /&gt;
The well-known game Tic-Tac-Toe is an example of a turn based game. One player takes their turn, then the other player takes their turn. Each turn is taken after the previous one, with no overlap in timing. Here is our implementation of Tic-Tac-Toe to show how a turn based game works with BCI2000 hyperscanning:&lt;br /&gt;
&lt;br /&gt;
TicTacToe.cpp:&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;TicTacToe.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;TextField.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;limits&amp;gt;&lt;br /&gt;
 #include &amp;quot;BCIEvent.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;string&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 //Shared States&lt;br /&gt;
 //grid, 32&lt;br /&gt;
 //turn, 8&lt;br /&gt;
 //x, 8&lt;br /&gt;
 //y, 8&lt;br /&gt;
 &lt;br /&gt;
 RegisterFilter( TicTacToe, 3 );&lt;br /&gt;
 &lt;br /&gt;
 TicTacToe::TicTacToe() : winText( NULL ), highlight( NULL ), tiles( NULL ), board( NULL ), mrDisplay( Window() ) {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::SharedPublish() {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const {&lt;br /&gt;
 	State( &amp;quot;grid&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;turn&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;ClientNumber&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;KeyDown&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;x&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;y&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 	Parameter( &amp;quot;SampleBlockSize&amp;quot; );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) {&lt;br /&gt;
 	ApplicationBase::Initialize( Input, Output );&lt;br /&gt;
 &lt;br /&gt;
 	board = new ImageStimulus( mrDisplay );&lt;br /&gt;
 	board-&amp;gt;SetObjectRect( { 0.f, 0.f, 1.f, 1.f } );&lt;br /&gt;
 	board-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustHeight );&lt;br /&gt;
 	board-&amp;gt;SetRenderingMode( GUI::RenderingMode::Transparent );&lt;br /&gt;
 	board-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/tictactoe.png&amp;quot; );&lt;br /&gt;
 	board-&amp;gt;SetZOrder( 12 );&lt;br /&gt;
 &lt;br /&gt;
 	winText = new TextField( mrDisplay );&lt;br /&gt;
 	winText-&amp;gt;SetVisible( true );&lt;br /&gt;
 	winText-&amp;gt;SetObjectRect( { 0.2f, 0.4f, 0.8f, 0.6f } );&lt;br /&gt;
 	board-&amp;gt;SetZOrder( 1 );&lt;br /&gt;
 &lt;br /&gt;
 	tiles = ( ImageStimulus** ) malloc( sizeof( ImageStimulus ) * 9 );&lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		tiles[ i ] = new ImageStimulus( mrDisplay );&lt;br /&gt;
 		int x = i % 3;&lt;br /&gt;
 		int y = i / 3;&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetObjectRect( { x / 3.f, y / 3.f, x / 3.f + 0.33f, y / 3.f + 0.33f } );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustBoth );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetRenderingMode( GUI::RenderingMode::Opaque );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetZOrder( i + 2 );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	highlight = new ImageStimulus( mrDisplay );&lt;br /&gt;
 	highlight-&amp;gt;SetObjectRect( { 0.f, 0.f, 0.33f, 0.33f } );&lt;br /&gt;
 	highlight-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustBoth );&lt;br /&gt;
 	highlight-&amp;gt;SetRenderingMode( GUI::RenderingMode::Transparent );&lt;br /&gt;
 	highlight-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/highlight.png&amp;quot; );&lt;br /&gt;
 	highlight-&amp;gt;SetZOrder( 11 );&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) {&lt;br /&gt;
 	board-&amp;gt;Present();&lt;br /&gt;
 	highlight-&amp;gt;Present();&lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		tiles[ i ]-&amp;gt;Present();&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	if ( State( &amp;quot;turn&amp;quot; ) == 3 ) {&lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 32 ) ) { //Space&lt;br /&gt;
 			Reset();&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	if ( State( &amp;quot;ClientNumber&amp;quot; ) == State( &amp;quot;turn&amp;quot; ) ) {&lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 38 ) &amp;amp;&amp;amp; State( &amp;quot;y&amp;quot; ) &amp;gt;= 1 ) { //Up&lt;br /&gt;
 			State( &amp;quot;y&amp;quot; ) = State( &amp;quot;y&amp;quot; ) - 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 40 ) &amp;amp;&amp;amp; State( &amp;quot;y&amp;quot; ) &amp;lt;= 1 ) { //Down&lt;br /&gt;
 			State( &amp;quot;y&amp;quot; ) = State( &amp;quot;y&amp;quot; ) + 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 37 ) &amp;amp;&amp;amp; State( &amp;quot;x&amp;quot; ) &amp;gt;= 1 ) { //Left&lt;br /&gt;
 			State( &amp;quot;x&amp;quot; ) = State( &amp;quot;x&amp;quot; ) - 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 39 ) &amp;amp;&amp;amp; State( &amp;quot;x&amp;quot; ) &amp;lt;= 1 ) { //Right&lt;br /&gt;
 			State( &amp;quot;x&amp;quot; ) = State( &amp;quot;x&amp;quot; ) + 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 32 ) ) { //Space&lt;br /&gt;
 			long xflag = 1UL &amp;lt;&amp;lt; ( 2 * ( State( &amp;quot;y&amp;quot; ) * 3 + State( &amp;quot;x&amp;quot; ) ) );&lt;br /&gt;
 			long oflag = 1UL &amp;lt;&amp;lt; ( 2 * ( State( &amp;quot;y&amp;quot; ) * 3 + State( &amp;quot;x&amp;quot; ) ) + 1 );&lt;br /&gt;
 &lt;br /&gt;
 			if ( !( State( &amp;quot;grid&amp;quot; ) &amp;amp; xflag ) &amp;amp;&amp;amp; !( State( &amp;quot;grid&amp;quot; ) &amp;amp; oflag ) ) {&lt;br /&gt;
 				if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 ) {&lt;br /&gt;
 					State( &amp;quot;grid&amp;quot; ) = State( &amp;quot;grid&amp;quot; ) | xflag;&lt;br /&gt;
 					State( &amp;quot;turn&amp;quot; ) = 1;&lt;br /&gt;
 				}&lt;br /&gt;
 &lt;br /&gt;
 				else {&lt;br /&gt;
 					State( &amp;quot;grid&amp;quot; ) = State( &amp;quot;grid&amp;quot; ) | oflag;&lt;br /&gt;
 					State( &amp;quot;turn&amp;quot; ) = 0;&lt;br /&gt;
 				}&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	long flag = 1UL;&lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		if ( State( &amp;quot;grid&amp;quot; ) &amp;amp; flag ) {&lt;br /&gt;
 			tiles[ i ]-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/x.png&amp;quot; );&lt;br /&gt;
 		}&lt;br /&gt;
 		flag &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 		if ( State( &amp;quot;grid&amp;quot; ) &amp;amp; flag ) {&lt;br /&gt;
 			tiles[ i ]-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/o.png&amp;quot; );&lt;br /&gt;
 		}&lt;br /&gt;
 		flag &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	long hwin = horizontal_win;&lt;br /&gt;
 	long vwin = vertical_win;&lt;br /&gt;
 	long dwin1 = diagonal_win_1;&lt;br /&gt;
 	long dwin2 = diagonal_win_2;&lt;br /&gt;
 &lt;br /&gt;
 	if ( ( State( &amp;quot;grid&amp;quot; ) &amp;amp; dwin1 ) == dwin1 || ( State( &amp;quot;grid&amp;quot; ) &amp;amp; dwin2 ) == dwin2 ) {&lt;br /&gt;
 		State( &amp;quot;turn&amp;quot; ) = 3;&lt;br /&gt;
 		winText-&amp;gt;SetText( &amp;quot;X Wins&amp;quot; );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	dwin1 &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 	dwin2 &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 &lt;br /&gt;
 	if ( ( State( &amp;quot;grid&amp;quot; ) &amp;amp; dwin1 ) == dwin1 || ( State( &amp;quot;grid&amp;quot; ) &amp;amp; dwin2 ) == dwin2 ) {&lt;br /&gt;
 		State( &amp;quot;turn&amp;quot; ) = 3;&lt;br /&gt;
 		winText-&amp;gt;SetText( &amp;quot;O Wins&amp;quot; );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 3; i++ ) {&lt;br /&gt;
 		if ( ( State( &amp;quot;grid&amp;quot; ) &amp;amp; hwin ) == hwin || ( State( &amp;quot;grid&amp;quot; ) &amp;amp; vwin ) == vwin ) {&lt;br /&gt;
 			State( &amp;quot;turn&amp;quot; ) = 3;&lt;br /&gt;
 			winText-&amp;gt;SetText( &amp;quot;X Wins&amp;quot; );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		hwin &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 		vwin &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 &lt;br /&gt;
 		if ( ( State( &amp;quot;grid&amp;quot; ) &amp;amp; hwin ) == hwin || ( State( &amp;quot;grid&amp;quot; ) &amp;amp; vwin ) == vwin ) {&lt;br /&gt;
 			State( &amp;quot;turn&amp;quot; ) = 3;&lt;br /&gt;
 			winText-&amp;gt;SetText( &amp;quot;O Wins&amp;quot; );&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		hwin &amp;lt;&amp;lt;= 5;&lt;br /&gt;
 		vwin &amp;lt;&amp;lt;= 1;&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	highlight-&amp;gt;SetObjectRect( { State(&amp;quot;x&amp;quot;) / 3.f, State(&amp;quot;y&amp;quot;) / 3.f, (State(&amp;quot;x&amp;quot;) + 1) / 3.f, (State(&amp;quot;y&amp;quot;) + 1) / 3.f } );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 bool TicTacToe::CheckKeyPress( std::string event_name, int value ) {&lt;br /&gt;
 	for ( unsigned int i = 0; i &amp;lt; Parameter( &amp;quot;SampleBlockSize&amp;quot; ); i++ ) {&lt;br /&gt;
 		if ( State( event_name )( i ) == value ) {&lt;br /&gt;
 			return true;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 	return false;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void TicTacToe::Reset() {&lt;br /&gt;
 	State( &amp;quot;turn&amp;quot; ) = 0;&lt;br /&gt;
 	State( &amp;quot;grid&amp;quot; ) = 0;&lt;br /&gt;
 &lt;br /&gt;
 	delete board;&lt;br /&gt;
 	board = new ImageStimulus( mrDisplay );&lt;br /&gt;
 	board-&amp;gt;SetObjectRect( { 0.f, 0.f, 1.f, 1.f } );&lt;br /&gt;
 	board-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustHeight );&lt;br /&gt;
 	board-&amp;gt;SetRenderingMode( GUI::RenderingMode::Transparent );&lt;br /&gt;
 	board-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/tictactoe.png&amp;quot; );&lt;br /&gt;
 	board-&amp;gt;SetZOrder( 12 );&lt;br /&gt;
 &lt;br /&gt;
 	delete winText;&lt;br /&gt;
 	winText = new TextField( mrDisplay );&lt;br /&gt;
 	winText-&amp;gt;SetVisible( true );&lt;br /&gt;
 	winText-&amp;gt;SetObjectRect( { 0.2f, 0.4f, 0.8f, 0.6f } );&lt;br /&gt;
 	board-&amp;gt;SetZOrder( 1 );&lt;br /&gt;
 &lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		delete tiles[ i ];&lt;br /&gt;
 	}&lt;br /&gt;
 	free( tiles );&lt;br /&gt;
 &lt;br /&gt;
 	tiles = ( ImageStimulus** ) malloc( sizeof( ImageStimulus ) * 9 );&lt;br /&gt;
 	for ( int i = 0; i &amp;lt; 9; i++ ) {&lt;br /&gt;
 		tiles[ i ] = new ImageStimulus( mrDisplay );&lt;br /&gt;
 		int x = i % 3;&lt;br /&gt;
 		int y = i / 3;&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetObjectRect( { x / 3.f, y / 3.f, x / 3.f + 0.33f, y / 3.f + 0.33f } );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustBoth );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetRenderingMode( GUI::RenderingMode::Opaque );&lt;br /&gt;
 		tiles[ i ]-&amp;gt;SetZOrder( i + 2 );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	delete highlight;&lt;br /&gt;
 &lt;br /&gt;
 	highlight = new ImageStimulus( mrDisplay );&lt;br /&gt;
 	highlight-&amp;gt;SetObjectRect( { 0.f, 0.f, 0.33f, 0.33f } );&lt;br /&gt;
 	highlight-&amp;gt;SetScalingMode( GUI::ScalingMode::AdjustBoth );&lt;br /&gt;
 	highlight-&amp;gt;SetRenderingMode( GUI::RenderingMode::Transparent );&lt;br /&gt;
 	highlight-&amp;gt;SetFile( &amp;quot;../tasks/hyperscanning_test/highlight.png&amp;quot; );&lt;br /&gt;
 	highlight-&amp;gt;SetZOrder( 11 );&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
TicTacToe.h&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;TextField.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;ApplicationWindow.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class TicTacToe : public HyperscanningApplicationBase {&lt;br /&gt;
 	public:&lt;br /&gt;
 		TicTacToe();&lt;br /&gt;
 &lt;br /&gt;
 		void SharedPublish() override;&lt;br /&gt;
 &lt;br /&gt;
 		void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
 		void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
 		void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
 &lt;br /&gt;
 		bool CheckKeyPress( std::string, int );&lt;br /&gt;
 &lt;br /&gt;
 		void Reset();&lt;br /&gt;
 &lt;br /&gt;
 	private:&lt;br /&gt;
 		ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
 &lt;br /&gt;
 		ImageStimulus* board;&lt;br /&gt;
 		ImageStimulus** tiles;&lt;br /&gt;
 		ImageStimulus* highlight;&lt;br /&gt;
 &lt;br /&gt;
 		TextField* winText;&lt;br /&gt;
 &lt;br /&gt;
 		long horizontal_win = 21;&lt;br /&gt;
 		long vertical_win = 4161;&lt;br /&gt;
 		long diagonal_win_1 = 65793;&lt;br /&gt;
 		long diagonal_win_2 = 4368;&lt;br /&gt;
 };&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
and TicTacToe.bat&lt;br /&gt;
 Change directory $BCI2000LAUNCHDIR&lt;br /&gt;
 Show window; Set title ${Extract file base $0}&lt;br /&gt;
 Reset system&lt;br /&gt;
 Startup system localhost&lt;br /&gt;
 Start executable SignalGenerator --local --LogKeyboard=1&lt;br /&gt;
 Start executable DummySignalProcessing --local&lt;br /&gt;
 Start executable TicTacToe --local --Port=1234 --IPAddress=192.168.1.102 --SharedStates=grid,32&amp;amp;turn,8&amp;amp;x,8&amp;amp;y,8&lt;br /&gt;
 Wait for Connected&lt;br /&gt;
 Load parameterfile &amp;quot;../parms/CommunicationTask/Communication_task_dual.prm&amp;quot;&lt;br /&gt;
&lt;br /&gt;
== Important Notes ==&lt;br /&gt;
The most are important sections to draw your attention to are:&lt;br /&gt;
&lt;br /&gt;
 if ( State( &amp;quot;ClientNumber&amp;quot; ) == State( &amp;quot;turn&amp;quot; ) ) {&lt;br /&gt;
&lt;br /&gt;
ClientNumber is a state that is automatically sent by the server. It is an id, between 0 and N, where N is the number of clients connected, that can be used to differentiate between each client without having to run a separate application on each. &amp;quot;turn&amp;quot; is a shared state between the clients. Shared states are accessed in the exact same way that a normal BCI2000 state is accessed. This way we can use shared states and the client number to determine which client should be placing their mark. &lt;br /&gt;
&lt;br /&gt;
 State( &amp;quot;turn&amp;quot; ) = 1;&lt;br /&gt;
&lt;br /&gt;
Shared states are also written to the exact same way as normal BCI2000 shared states. They will be automatically updated for the other clients.&lt;br /&gt;
&lt;br /&gt;
  Start executable TicTacToe --local --Port=1234 --IPAddress=192.168.1.102 --SharedStates=grid,32&amp;amp;turn,8&amp;amp;x,8&amp;amp;y,8&lt;br /&gt;
&lt;br /&gt;
This is where we define the states that we want to share with &amp;quot;--SharedStates=&amp;quot;. The format is:&lt;br /&gt;
 --SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&lt;br /&gt;
We can also define predefined shared states here in a similar way, but without the size (because the size is already defined), using:&lt;br /&gt;
 --PreDefinedSharedStates=&amp;lt;state-1&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;&lt;br /&gt;
&lt;br /&gt;
--Port and --IPAddress are additional parameters that tell the client where to find the server on the internet. All of these parameters can also be changed from the Config menu, and the client connects to the server after &amp;quot;Set Config&amp;quot; is pressed.&lt;br /&gt;
&lt;br /&gt;
=== Live Interaction Stimulus ===&lt;br /&gt;
&lt;br /&gt;
The classic video game pong is an example of live interaction. Both players can interact with the game simultaneously. There are no discrete turns. We implemented pong with BCI2000 hyperscanning to demonstrate a live interaction.&lt;br /&gt;
&lt;br /&gt;
pong.cpp&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;Pong.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;limits&amp;gt;&lt;br /&gt;
 #include &amp;quot;BCIEvent.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 //Shared States&lt;br /&gt;
 //BallX 32&lt;br /&gt;
 //BallY 32&lt;br /&gt;
 //BallVX 8&lt;br /&gt;
 //BallVY 8&lt;br /&gt;
 //Player1Y 32&lt;br /&gt;
 //Player2Y 32&lt;br /&gt;
 //Player1Ready 1&lt;br /&gt;
 //Player2Ready 1&lt;br /&gt;
 //GamePhase 8&lt;br /&gt;
 //&lt;br /&gt;
 //Game Phases&lt;br /&gt;
 //0 : Instruction&lt;br /&gt;
 //1 : Game&lt;br /&gt;
 //2 : Between Rounds&lt;br /&gt;
 &lt;br /&gt;
 RegisterFilter( Pong, 3 );&lt;br /&gt;
 &lt;br /&gt;
 Pong::Pong() : player1Paddle( NULL ), player2Paddle( NULL ), ball( NULL ), mrDisplay( Window() ) {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedPublish() {&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const {&lt;br /&gt;
 	State( &amp;quot;BallX&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;BallY&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;BallVX&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;BallVY&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;Player1Y&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;Player2Y&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;Player1Ready&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;Player2Ready&amp;quot; );&lt;br /&gt;
 	State( &amp;quot;GamePhase&amp;quot; );&lt;br /&gt;
 	State(&amp;quot;ClientNumber&amp;quot;);&lt;br /&gt;
 //	State( &amp;quot;KeyDown&amp;quot; );&lt;br /&gt;
 	Parameter( &amp;quot;SampleBlockSize&amp;quot; );&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) {&lt;br /&gt;
 	player1Paddle = new RectangularShape( mrDisplay );&lt;br /&gt;
 	player1Paddle-&amp;gt;SetFillColor( RGBColor::Teal );&lt;br /&gt;
 	player1Paddle-&amp;gt;SetVisible( true );&lt;br /&gt;
 &lt;br /&gt;
 	player2Paddle = new RectangularShape( mrDisplay );&lt;br /&gt;
 	player2Paddle-&amp;gt;SetFillColor( RGBColor::Red );&lt;br /&gt;
 	player2Paddle-&amp;gt;SetVisible( true );&lt;br /&gt;
 &lt;br /&gt;
 	ball = new RectangularShape( mrDisplay );&lt;br /&gt;
 	ball-&amp;gt;SetFillColor( RGBColor::Black );&lt;br /&gt;
 	ball-&amp;gt;SetVisible( true );&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedStartRun() {&lt;br /&gt;
 	State( &amp;quot;BallX&amp;quot; ) = 500;&lt;br /&gt;
 	State( &amp;quot;BallY&amp;quot; ) = 500;&lt;br /&gt;
 	State( &amp;quot;Player1Y&amp;quot; ) = 200;&lt;br /&gt;
 	State( &amp;quot;Player2Y&amp;quot; ) = 800;&lt;br /&gt;
 	State( &amp;quot;BallVX&amp;quot; ) = 493;&lt;br /&gt;
 	State( &amp;quot;BallVY&amp;quot; ) = 497;&lt;br /&gt;
 	State( &amp;quot;GamePhase&amp;quot; ) = 2;&lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 void Pong::SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) {&lt;br /&gt;
 	if ( State( &amp;quot;GamePhase&amp;quot; ) == 1 ) {&lt;br /&gt;
 		if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 ) {&lt;br /&gt;
 			State( &amp;quot;BallX&amp;quot; ) = State( &amp;quot;BallX&amp;quot; ) + State( &amp;quot;BallVX&amp;quot; ) - 500;&lt;br /&gt;
 			State( &amp;quot;BallY&amp;quot; ) = State( &amp;quot;BallY&amp;quot; ) + State( &amp;quot;BallVY&amp;quot; ) - 500;&lt;br /&gt;
 &lt;br /&gt;
 			if ( State( &amp;quot;BallY&amp;quot; ) &amp;gt; 950 || State( &amp;quot;BallY&amp;quot; ) &amp;lt; 50 ) {&lt;br /&gt;
 				State( &amp;quot;BallVY&amp;quot; ) = 1000 - State( &amp;quot;BallVY&amp;quot; );&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			if ( State( &amp;quot;BallX&amp;quot; ) + 50 &amp;gt; 875 &amp;amp;&amp;amp; State( &amp;quot;BallX&amp;quot; ) - 50 &amp;lt; 925 &amp;amp;&amp;amp; State( &amp;quot;BallY&amp;quot; ) + 50 &amp;gt; State( &amp;quot;Player2Y&amp;quot; ) - 100 &amp;amp;&amp;amp; State( &amp;quot;BallY&amp;quot; ) - 50 &amp;lt; State( &amp;quot;Player2Y&amp;quot; ) + 100 ) {&lt;br /&gt;
 				State( &amp;quot;BallVX&amp;quot; ) = 1000 - State( &amp;quot;BallVX&amp;quot; );&lt;br /&gt;
 				State( &amp;quot;BallX&amp;quot; ) = 875 - 50;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			if ( State( &amp;quot;BallX&amp;quot; ) + 50 &amp;gt; 75  &amp;amp;&amp;amp; State( &amp;quot;BallX&amp;quot; ) - 50 &amp;lt; 125 &amp;amp;&amp;amp; State( &amp;quot;BallY&amp;quot; ) + 50 &amp;gt; State( &amp;quot;Player1Y&amp;quot; ) - 100 &amp;amp;&amp;amp; State( &amp;quot;BallY&amp;quot; ) - 50 &amp;lt; State( &amp;quot;Player1Y&amp;quot; ) + 100 ) {&lt;br /&gt;
 				State( &amp;quot;BallVX&amp;quot; ) = 1000 - State( &amp;quot;BallVX&amp;quot; );&lt;br /&gt;
 				State( &amp;quot;BallX&amp;quot; ) = 125 + 50;&lt;br /&gt;
 			}&lt;br /&gt;
 &lt;br /&gt;
 			if ( State( &amp;quot;BallX&amp;quot; ) + 50 &amp;gt; 1000 || State( &amp;quot;BallX&amp;quot; ) - 50 &amp;lt; 0 ) {&lt;br /&gt;
 				State( &amp;quot;BallX&amp;quot; ) = 500;&lt;br /&gt;
 				State( &amp;quot;BallVY&amp;quot; ) = State( &amp;quot;BallVY&amp;quot; ) + 1;&lt;br /&gt;
 				State( &amp;quot;GamePhase&amp;quot; ) = 2;&lt;br /&gt;
 			}&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 38 ) ) { //Up&lt;br /&gt;
 			if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 )&lt;br /&gt;
 				State( &amp;quot;Player1Y&amp;quot; ) = State( &amp;quot;Player1Y&amp;quot; ) - 30;&lt;br /&gt;
 			else &lt;br /&gt;
 				State( &amp;quot;Player2Y&amp;quot; ) = State( &amp;quot;Player2Y&amp;quot; ) - 30;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 40 ) ) { //Down&lt;br /&gt;
 			if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 )&lt;br /&gt;
 				State( &amp;quot;Player1Y&amp;quot; ) = State( &amp;quot;Player1Y&amp;quot; ) + 30;&lt;br /&gt;
 			else &lt;br /&gt;
 				State( &amp;quot;Player2Y&amp;quot; ) = State( &amp;quot;Player2Y&amp;quot; ) + 30;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	if ( State( &amp;quot;GamePhase&amp;quot; ) == 2 ) {&lt;br /&gt;
 		if ( CheckKeyPress( &amp;quot;KeyDown&amp;quot;, 32 ) == 0 ) { //Space&lt;br /&gt;
 			if ( State( &amp;quot;ClientNumber&amp;quot; ) == 0 )&lt;br /&gt;
 				State( &amp;quot;Player1Ready&amp;quot; ) = 1;&lt;br /&gt;
 			else&lt;br /&gt;
 				State( &amp;quot;Player2Ready&amp;quot; ) = 1;&lt;br /&gt;
 		}&lt;br /&gt;
 &lt;br /&gt;
 		if ( State( &amp;quot;Player1Ready&amp;quot; ) == 1 &amp;amp;&amp;amp; State( &amp;quot;Player2Ready&amp;quot; ) == 1 ) {&lt;br /&gt;
 			State( &amp;quot;GamePhase&amp;quot; ) = 1;&lt;br /&gt;
 			State( &amp;quot;Player1Ready&amp;quot; ) = 0;&lt;br /&gt;
 			State( &amp;quot;Player2Ready&amp;quot; ) = 0;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 	bciout &amp;lt;&amp;lt; &amp;quot;Ball: (&amp;quot; &amp;lt;&amp;lt; State(&amp;quot;BallX&amp;quot;) &amp;lt;&amp;lt; &amp;quot;, &amp;quot; &amp;lt;&amp;lt; State(&amp;quot;BallY&amp;quot;) &amp;lt;&amp;lt; &amp;quot;)&amp;quot;;&lt;br /&gt;
 	bciout &amp;lt;&amp;lt; &amp;quot;Player1: &amp;quot; &amp;lt;&amp;lt; State(&amp;quot;Player1Y&amp;quot;);&lt;br /&gt;
 &lt;br /&gt;
 	GUI::Rect rect = { ( State( &amp;quot;BallX&amp;quot; ) / 1000.f ) - 0.05, ( State( &amp;quot;BallY&amp;quot; ) / 1000.f ) - 0.05, ( State( &amp;quot;BallX&amp;quot; ) / 1000.f ) + 0.05, ( State( &amp;quot;BallY&amp;quot; ) / 1000.f ) + 0.05 };&lt;br /&gt;
 	ball-&amp;gt;SetObjectRect( rect );&lt;br /&gt;
 &lt;br /&gt;
 	rect = { 0.075f, ( State( &amp;quot;Player1Y&amp;quot; ) / 1000.f ) - 0.1f, 0.125f, ( State( &amp;quot;Player1Y&amp;quot; ) / 1000.f ) + 0.1f };&lt;br /&gt;
 	player1Paddle-&amp;gt;SetObjectRect( rect );&lt;br /&gt;
 &lt;br /&gt;
 	rect = { 0.875f, ( State( &amp;quot;Player2Y&amp;quot; ) / 1000.f ) - 0.1f, 0.925f, ( State( &amp;quot;Player2Y&amp;quot; ) / 1000.f ) + 0.1f };&lt;br /&gt;
 	player2Paddle-&amp;gt;SetObjectRect( rect );&lt;br /&gt;
 &lt;br /&gt;
 }&lt;br /&gt;
 &lt;br /&gt;
 bool Pong::CheckKeyPress( std::string event_name, int value ) {&lt;br /&gt;
 	for ( unsigned int i = 0; i &amp;lt; Parameter( &amp;quot;SampleBlockSize&amp;quot; ); i++ ) {&lt;br /&gt;
 		if ( State( event_name )( i ) == value ) {&lt;br /&gt;
 			return true;&lt;br /&gt;
 		}&lt;br /&gt;
 	}&lt;br /&gt;
 	return false;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
pong.h&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;ApplicationWindow.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 class Pong : public HyperscanningApplicationBase {&lt;br /&gt;
 	public:&lt;br /&gt;
 		Pong();&lt;br /&gt;
 &lt;br /&gt;
 		void SharedPublish() override;&lt;br /&gt;
 &lt;br /&gt;
 		void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
 		void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
 		void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
 		void SharedStartRun() override;&lt;br /&gt;
 &lt;br /&gt;
 		bool CheckKeyPress( std::string event_name, int value );&lt;br /&gt;
 &lt;br /&gt;
 	private:&lt;br /&gt;
 		ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
 		RectangularShape* player1Paddle;&lt;br /&gt;
 		RectangularShape* player2Paddle;&lt;br /&gt;
 		RectangularShape* ball;&lt;br /&gt;
 };&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
and pong.bat&lt;br /&gt;
 Change directory $BCI2000LAUNCHDIR&lt;br /&gt;
 Show window; Set title ${Extract file base $0}&lt;br /&gt;
 Reset system&lt;br /&gt;
 Startup system localhost&lt;br /&gt;
 Start executable SignalGenerator --local --LogKeyboard=1&lt;br /&gt;
 Start executable DummySignalProcessing --local&lt;br /&gt;
 Start executable Pong --local --Port=1234 --IPAddress=192.168.1.102 --SharedStates=BallX,32&amp;amp;BallY,32&amp;amp;Player1Y,32&amp;amp;Player2Y,32&amp;amp;BallVX,32&amp;amp;BallVY,32&amp;amp;Player1Ready,8&amp;amp;Player2Ready,8&amp;amp;GamePhase,8&amp;amp;Player1Score,8&amp;amp;Player2Score,8&lt;br /&gt;
 Wait for Connected&lt;br /&gt;
 Load parameterfile &amp;quot;../parms/CommunicationTask/Communication_task_dual.prm&amp;quot;&lt;br /&gt;
&lt;br /&gt;
This behaves very similarly to the tic-tac-toe example, with the key difference being both clients can interact with states simultaneously, whereas in tic-tac-toe only one client was changing states at a time.&lt;br /&gt;
&lt;br /&gt;
Any processing of game states, for example changing the position of the ball in pong, can occur on either the clients or the server depending on the wants and needs of each implementation. If they are placed on the client side, only one of clients should be responsible for actually processing the data because otherwise there could be multiple versions of the same state that are equally correct, because they were each accurately calculated by a different client, so the server would have to choose one state to save to the master state machine and discard the other versions. This could lead to jumpiness when displaying the state or bugs. Because only one client is processing data, only that client will have a greater load than the others. If the overhead of the game is too significant, this could become problematic. If the processing is done on the server, there will not be an issue with one client running slower, but it will be more tedious to implement, because a custom installation will have to be designed instead of a premade backend application, and a more powerful server will be required.&lt;br /&gt;
&lt;br /&gt;
For turn based games, this is a non-issue because each client can process the game state for their own turn. It only becomes an issue when a game state needs to be calculated that isn&#039;t based on client inputs, once again like the movement of the ball in pong, as opposed to the movement of the paddles in pong.&lt;br /&gt;
&lt;br /&gt;
=== Example Server Application ===&lt;br /&gt;
application.cpp&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 #include &amp;quot;statemachine.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;game.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;port.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;client.h&amp;quot;&lt;br /&gt;
 #include &amp;quot;statemachine.h&amp;quot;&lt;br /&gt;
 #include &amp;lt;iostream&amp;gt;&lt;br /&gt;
 #include &amp;lt;thread&amp;gt;&lt;br /&gt;
 #include &amp;lt;chrono&amp;gt;&lt;br /&gt;
 #include &amp;lt;fstream&amp;gt;&lt;br /&gt;
 #include &amp;lt;algorithm&amp;gt;&lt;br /&gt;
 #include &amp;lt;random&amp;gt;&lt;br /&gt;
 #include &amp;quot;params.h&amp;quot;&lt;br /&gt;
 &lt;br /&gt;
 &lt;br /&gt;
 int main() {&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
Here we load a general parameter file to ensure that the experiment is the same on each client. We also load a parameter file for an existing game, so we can resume where we left off. We will write to the existing game file in the final section of the application file. If this is the first session, then we will randomly generate a stimuli sequence.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
 	// Load Parameter File&lt;br /&gt;
 	Params params = Params( &amp;quot;Parameters.prm&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 	// Load previous parameters&lt;br /&gt;
 	Params existing = Params( &amp;quot;ExistingGame.prm&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 	std::string stimuliSequence;&lt;br /&gt;
        &lt;br /&gt;
        // Check if saved parameters from previous game are populated&lt;br /&gt;
 	if ( existing.contents.size() &amp;gt; 0 ) {&lt;br /&gt;
 		params.contents += existing.contents;&lt;br /&gt;
 &lt;br /&gt;
 		stimuliSequence = existing.GetParam( &amp;quot;StimuliSequence&amp;quot; )-&amp;gt;line;&lt;br /&gt;
 	} // If they are not then generate them, and they will be saved when this game finishes&lt;br /&gt;
 	else {&lt;br /&gt;
 		// Generate Random Sequence&lt;br /&gt;
 &lt;br /&gt;
 		Param* stimmat = params.GetParam( &amp;quot;StimuliMatrix&amp;quot; );&lt;br /&gt;
 &lt;br /&gt;
 		std::vector&amp;lt;int&amp;gt; order = std::vector&amp;lt;int&amp;gt;( stimmat-&amp;gt;width );&lt;br /&gt;
 		for ( int i = 0; i &amp;lt; stimmat-&amp;gt;width; i++ )&lt;br /&gt;
 			order[ i ] = i;&lt;br /&gt;
 &lt;br /&gt;
 		std::random_device rd;&lt;br /&gt;
 		auto rng = std::default_random_engine( rd() );&lt;br /&gt;
 		std::shuffle( std::begin( order ), std::end( order ), rng );&lt;br /&gt;
 &lt;br /&gt;
 		stimuliSequence = &amp;quot;\nApplication:Sequence intlist StimuliSequence= &amp;quot;;&lt;br /&gt;
 		stimuliSequence += std::to_string( stimmat-&amp;gt;width );&lt;br /&gt;
 		stimuliSequence += &amp;quot; &amp;quot;;&lt;br /&gt;
 		for ( int i = 0; i &amp;lt; stimmat-&amp;gt;width; i++ ) {&lt;br /&gt;
 			stimuliSequence += std::to_string( order[ i ] );&lt;br /&gt;
 			stimuliSequence += &amp;quot; &amp;quot;;&lt;br /&gt;
 		}&lt;br /&gt;
 		stimuliSequence += &amp;quot;% % % //Random Stimuli Sequence&amp;quot;;&lt;br /&gt;
 &lt;br /&gt;
 		params.AddParam( stimuliSequence );&lt;br /&gt;
 &lt;br /&gt;
 		params.AddParam( &amp;quot;Application int InitialTrialNumber= 0 % % % // trial number&amp;quot; );&lt;br /&gt;
 	}&lt;br /&gt;
 &lt;br /&gt;
 	params.contents.push_back( 0 );&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This is the only necessary part of the main function. Here we open the port for listening, connect to the clients, and start the loop. &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
        //Open the port for listening&lt;br /&gt;
 	Port port( 1234, 100 );&lt;br /&gt;
 	if ( !port.open )&lt;br /&gt;
 		return 0;&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Connected to port &amp;quot; &amp;lt;&amp;lt; 1234 &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 &lt;br /&gt;
        // Initialize Game class&lt;br /&gt;
 	Game game = Game( port, params.contents );&lt;br /&gt;
 &lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Waiting for clients&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
        &lt;br /&gt;
        // Wait for a client to open a socket connection then connect them to the game&lt;br /&gt;
 	Client* client1 = port.WaitForClient();&lt;br /&gt;
 	game.Connect( client1 );&lt;br /&gt;
 &lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Connected to first client&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Waiting for second client&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 &lt;br /&gt;
        // Do the same for a second client&lt;br /&gt;
 	game.Connect( port.WaitForClient() );&lt;br /&gt;
 &lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Connected to second client&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
        &lt;br /&gt;
        // Run the server loop and save the final states&lt;br /&gt;
 	StateMachine out_states = game.Loop();&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Here we take data from the master state machine and save it to the existing game parameter file, so we can use it when we restart the paradigm.&lt;br /&gt;
 &lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
        // Save the trial number from when the paradigm was ended&lt;br /&gt;
 	std::string InitialTrialNumber = out_states.GetState( &amp;quot;TrialNumber&amp;quot; );&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Trial Number: &amp;quot; &amp;lt;&amp;lt; InitialTrialNumber &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
        &lt;br /&gt;
        // Make sure that the trial number is populated and subtract one to repeat the unfinished trial&lt;br /&gt;
 	if ( InitialTrialNumber.size() == 0 ) InitialTrialNumber = &amp;quot;\1&amp;quot;;&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;Saving Trial Number: &amp;quot; &amp;lt;&amp;lt; ( int ) *InitialTrialNumber.c_str() - 1 &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 &lt;br /&gt;
 	// Save Initial Trial Number and random stimuli sequence&lt;br /&gt;
 	std::ofstream egof( &amp;quot;ExistingGame.prm&amp;quot; );&lt;br /&gt;
 	egof &amp;lt;&amp;lt; &amp;quot;Application int InitialTrialNumber= &amp;quot; &amp;lt;&amp;lt; ( int )*InitialTrialNumber.c_str() - 1 &amp;lt;&amp;lt; &amp;quot; % % % // trial number&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 	egof &amp;lt;&amp;lt; stimuliSequence &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 &lt;br /&gt;
        // All Done!&lt;br /&gt;
 	std::cout &amp;lt;&amp;lt; &amp;quot;All done!&amp;quot; &amp;lt;&amp;lt; std::endl;&lt;br /&gt;
 }&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Important Notes ==&lt;br /&gt;
The server must be configured to allow inbound TCP traffic. Most only server services, like AWS or Azure, will allow you to do this easily. &lt;br /&gt;
&lt;br /&gt;
In AWS:&lt;br /&gt;
# Select an instance&lt;br /&gt;
# Go to the &amp;quot;Security&amp;quot; tab&lt;br /&gt;
# Select one of the security groups&lt;br /&gt;
# With one of the security groups selected, go to the &amp;quot;inbound rules&amp;quot; tab&lt;br /&gt;
# Press &amp;quot;edit inbound rules&amp;quot;&lt;br /&gt;
# Press &amp;quot;Add Rule&amp;quot;&lt;br /&gt;
# Set &amp;quot;Type&amp;quot; to &amp;quot;Any TCP&amp;quot;&lt;br /&gt;
# Set &amp;quot;Source&amp;quot; to the IP Addresses of each of your clients or to &amp;quot;Anywhere IPv4&amp;quot;&lt;br /&gt;
# Press &amp;quot;Save Rules&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To create an instance in AWS:&lt;br /&gt;
# Go to [aws.amazon.com/ec2|AWS] and create an account or log in&lt;br /&gt;
# Press &amp;quot;Launch Instance&amp;quot;&lt;br /&gt;
# Give your instance a name&lt;br /&gt;
# Select &amp;quot;Amazon Linux&amp;quot; or any other non-windows operating system of your choice&lt;br /&gt;
# Select the tier of server you would like. If you are doing the processing on the clients then the free-tier or cheapest option will suffice with no performance penalties. If you followed the example server application, then you are doing the processing on the clients. If you are doing processing on the server, then select whichever performance tier is necessary to run your application at an acceptable speed.&lt;br /&gt;
# Under Key Pair, press &amp;quot;Create New Key Pair&amp;quot;&lt;br /&gt;
# Name is whatever you would like&lt;br /&gt;
# Select RSA for key pair type&lt;br /&gt;
# Select .pem for private key file format&lt;br /&gt;
# Press create key pair and remember where you save it to. We will need to use this to connect to the server.&lt;br /&gt;
# Now press &amp;quot;Launch Instance&amp;quot;&lt;br /&gt;
&lt;br /&gt;
To configure and run your aws instance (if it isn&#039;t an aws instance the same applies, except instead of &amp;quot;ec2-user&amp;quot; you will use the username for your server or if it is local ignore the ssh step):&lt;br /&gt;
Open a terminal or shell&lt;br /&gt;
Enter the command&lt;br /&gt;
 ssh -i &amp;lt;/path/key-pair-name.pem&amp;gt; ec2-user@&amp;lt;public-IPv4-address&amp;gt;&lt;br /&gt;
The public IPv4 address can be found by selecting the instance in the instance dashboard. If you do not see one, ensure that the instance is running.&lt;br /&gt;
If prompted with&lt;br /&gt;
 The authenticity of host &#039;ec2-198-51-100-1.compute-1.amazonaws.com (198-51-100-1)&#039; can&#039;t be established.&lt;br /&gt;
 ECDSA key fingerprint is l4UB/neBad9tvkgJf1QZWxheQmR59WgrgzEimCG6kZY.&lt;br /&gt;
 Are you sure you want to continue connecting (yes/no)?&lt;br /&gt;
Type&lt;br /&gt;
 yes&lt;br /&gt;
Clone the github repository with&lt;br /&gt;
 git clone https://github.com/MaxwellMarcus/hyperscanning-backend&lt;br /&gt;
Go to the directory&lt;br /&gt;
 cd hyperscanning-backend&lt;br /&gt;
Edit or create an application in the file application.cpp, if you aren&#039;t using the default tutorial application file&lt;br /&gt;
Build the application with&lt;br /&gt;
 make&lt;br /&gt;
If you are working on remote servers over SSH. Please use the command &amp;quot;screen&amp;quot;, which keeps the server running even if you disconnect.&lt;br /&gt;
Creat a screen called dual&lt;br /&gt;
screen -S dual&lt;br /&gt;
&lt;br /&gt;
Run the application with&lt;br /&gt;
 ./application&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11849</id>
		<title>Contributions:CommunicationTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11849"/>
		<updated>2025-04-29T20:12:39Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Deploy the Server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
The hyperscanning task is a turn-based communication game between two clients. This game aims to guess what the subject is in Sender&#039;s computer without talking. For each trial, the two players will alternate between the roles of Sender and Receiver. The Sender will describe traits of the subject presented by adjusting the two axes(Noisy or silent/Big or small). Then, the Receiver will guess if the Sender is describing the animal or object. After the Receiver makes a guess, both players receive feedback on whether the Receiver makes the correct guess. This marks the end of a trial.&lt;br /&gt;
&lt;br /&gt;
The two clients exchange information through the hyperScanning backend, which uses a client-server model to share the states. Each client has a separate state machine. The server only forwards the information between two clients. Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class, which is the parent class of the application module. For more information, please refer to the hyperScanning framework wiki page: https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning.&lt;br /&gt;
&lt;br /&gt;
==Video Overview==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;youtube alignment=&amp;quot;center&amp;quot;&amp;gt;https://youtu.be/I1sSamSsTK4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=500px&amp;gt;&lt;br /&gt;
File:Hyperscanning pipe line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:Hyperscanning_1.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Anais Llorens (anaisllorens@hotmail.com) and  Athina Tzovara (athina.tzovara@unibe.ch) conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org), Max Marcus (bigmaxmarcus@gmail.com) and Sigurd Alnes (sigurd.alnes@unibe.ch) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
To run the server, you’ll need a Linux or macOS machine—Windows is not supported at this time. The steps below walk you through deploying the server on AWS.&amp;lt;br&amp;gt;&lt;br /&gt;
1. Prepare the AWS key.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In your terminal or shell, run&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; chmod 400 &amp;lt;key_path&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
to make the key file read-only for the owner.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Connect to the AWS server using SSH:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; ssh -i &amp;lt;key path&amp;gt; &amp;lt;user-name&amp;gt;@&amp;lt;ip-address&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Pull the code from GitHub.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/neurotechcenter/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Navigate to the server directory:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. To compile the project, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Launch the server by running:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application must be restarted after BCI2000 has been closed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:CommunicationTask batch.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====StimuliMatrix====&lt;br /&gt;
Shared parameter, matrix of stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImageReceiver and ImageSender(the path of images).&amp;lt;br&amp;gt;&lt;br /&gt;
2. Sender(the role of players),1 is the sender), 2 is the receiver.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Jitter(the duration to present the role).&amp;lt;br&amp;gt;&lt;br /&gt;
4. CorrectResponse(1: left, 2:right).&amp;lt;br&amp;gt;&lt;br /&gt;
5. Training(1: training, 0: main task).&amp;lt;br&amp;gt;&lt;br /&gt;
6. Category(1: object, 2: animal).&amp;lt;br&amp;gt;&lt;br /&gt;
7. Difficulty(1: easy, 2: moderate, 3: hard).&amp;lt;br&amp;gt;&lt;br /&gt;
8. Dimension1a and Dimension1b(bar#1 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
9. Dimension2a and Dimension2b(bar#2 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
10. Option1 and Option2(left option text and right option text).&lt;br /&gt;
&lt;br /&gt;
====BreakTrialSequece====&lt;br /&gt;
The sequence of break trials, a break will happen after the break trial.&lt;br /&gt;
&lt;br /&gt;
====FeedbackDuration====&lt;br /&gt;
Duration of feedback(ITI). Indicate the receiver to make a correct or incorrect guess.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server will generate the InitialTrialNumber and StimuliSequence, and save them into a parameter file named by IP addresses on the server. You don&#039;t need to worry about these two parameters. Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
====InitialTrialNumber====&lt;br /&gt;
The trial number to begin with. We provide the resume option, allowing clients to pause and resume the game from where they stop. After one of the clients quits the game, the server will discover it and save the current trial number and sequence. When the same clients(same IP address) reconnect the server again, the server will send the previous trial number to them. Otherwise, the InitialTrailNumber will be initialized by 0. Usually, you don&#039;t need to touch this parameter.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequence====&lt;br /&gt;
The sequence of stimuli(images). The server will generate a random stimuli sequence for every pair of clients (identified by the IP address).&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====StimuliWidth====&lt;br /&gt;
StimulusWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====InstructionWidth====&lt;br /&gt;
Instruction width in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====SliderWidth====&lt;br /&gt;
SliderWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====BarColor====&lt;br /&gt;
Color of the slider bar.&lt;br /&gt;
&lt;br /&gt;
====AxeActiveColor====&lt;br /&gt;
Color of active slider axe.&lt;br /&gt;
&lt;br /&gt;
====AxeInActiveColor====&lt;br /&gt;
Color of inactive slider axe.&lt;br /&gt;
&lt;br /&gt;
====DimensionFontColor====&lt;br /&gt;
Color of the text under the slider.&lt;br /&gt;
&lt;br /&gt;
====DimensionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====OptionFontActiveColor====&lt;br /&gt;
Color of the active options.&lt;br /&gt;
&lt;br /&gt;
====OptionFontInActiveColor====&lt;br /&gt;
Color of the inactive options.&lt;br /&gt;
&lt;br /&gt;
====OptionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====RoleFontColor====&lt;br /&gt;
Color of the role text.&lt;br /&gt;
&lt;br /&gt;
====RoleHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====FeedbackWidth====&lt;br /&gt;
Width of feedback in percent of screen width.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the 10 slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] indicates the client is waiting for the other client to push the button to start the game. ( We are waiting for another player; once she/he is ready, we&#039;re ready to go!)&amp;lt;br&amp;gt; &lt;br /&gt;
[2] When the role text is present on the screen.(Sender or Receiver).&amp;lt;br&amp;gt; &lt;br /&gt;
[3] When the sliders and stimulus are present on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Feedback: After the receiver locks the answer, it comes to phase [4], showing whether the answer is correct.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]Break: (Well done! Are you ready for the next block? \n\n Press SPACEBAR)&amp;lt;br&amp;gt; &lt;br /&gt;
[6]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===StimulusCode===&lt;br /&gt;
The stimulus ID&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The photodiode state. 1: flash, 0: no flash&lt;br /&gt;
&lt;br /&gt;
===SampleBlockCounter===&lt;br /&gt;
Count the block number in one phase&lt;br /&gt;
&lt;br /&gt;
===BarOneValue===&lt;br /&gt;
Value of slider#1. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarTwoValue===&lt;br /&gt;
Value of slider#2. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneActive, BarTwoActive===&lt;br /&gt;
0: slider is not selected.  1: slider is selected. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ResponseValue===&lt;br /&gt;
1: object.    2: animal. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===SenderLock, ReceiverLock===&lt;br /&gt;
0: client is moving the slider/making a guess. 1: client has locked the answer. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===isReadyStart0, isReadyStart1===&lt;br /&gt;
0: client isn&#039;t ready to start/resume/continue the game(not yet pushing the button).  1: client is ready to start/resume/continue the game(push the button). (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The hyperscanning application module is almost the same as a BCI2000 application module, except that the typical BCI2000 module is inherited from ApplicationBase, and the hyperscanning application module is inherited from HyperscanningApplicationBase. Basically, the HyperscanningApplicationBase class is the same as ApplicationBase class with adding the communication with the server. So instead of using  Publish, Preflight, Process, etc. We are using SharedPublish, SharedPreflight, SharedProcess, etc. These methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Communication_task_dualTask.h:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;ApplicationBase.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Slider.h&amp;quot;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;quot;TextStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Communication_task_dualTask : public HyperscanningApplicationBase&lt;br /&gt;
{&lt;br /&gt;
 public:&lt;br /&gt;
  Communication_task_dualTask();&lt;br /&gt;
  ~Communication_task_dualTask();&lt;br /&gt;
  void SharedPublish() override;&lt;br /&gt;
  void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
  void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
  void SharedAutoConfig( const SignalProperties&amp;amp; Input ) override;&lt;br /&gt;
  void SharedStartRun() override;&lt;br /&gt;
  void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
  void SharedStopRun() override;&lt;br /&gt;
  void SharedHalt() override;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
   //define your own private members here&lt;br /&gt;
   ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
&lt;br /&gt;
   //define your own private methods here&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Manipulate the shared state is the same as the BCI2000 state. &amp;quot;isReadyStart1&amp;quot; is a shared state.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   State(&amp;quot;isReadyStart1&amp;quot;) = 1; // assign 1 to &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get the value of the shared state &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   //Both of the two players are ready, move to the next phase&lt;br /&gt;
   if (State(&amp;quot;isReadyStart0&amp;quot;) &amp;amp;&amp;amp; State(&amp;quot;isReadyStart1&amp;quot;)) {&lt;br /&gt;
            m_instruction_container-&amp;gt;Conceal();&lt;br /&gt;
            m_role_txt-&amp;gt;Conceal();&lt;br /&gt;
            my_phase = role_text;&lt;br /&gt;
            m_block_in_phase = 0;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11829</id>
		<title>Contributions:CommunicationTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11829"/>
		<updated>2025-04-24T16:26:20Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* TrialNumber */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
The hyperscanning task is a turn-based communication game between two clients. This game aims to guess what the subject is in Sender&#039;s computer without talking. For each trial, the two players will alternate between the roles of Sender and Receiver. The Sender will describe traits of the subject presented by adjusting the two axes(Noisy or silent/Big or small). Then, the Receiver will guess if the Sender is describing the animal or object. After the Receiver makes a guess, both players receive feedback on whether the Receiver makes the correct guess. This marks the end of a trial.&lt;br /&gt;
&lt;br /&gt;
The two clients exchange information through the hyperScanning backend, which uses a client-server model to share the states. Each client has a separate state machine. The server only forwards the information between two clients. Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class, which is the parent class of the application module. For more information, please refer to the hyperScanning framework wiki page: https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning.&lt;br /&gt;
&lt;br /&gt;
==Video Overview==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;youtube alignment=&amp;quot;center&amp;quot;&amp;gt;https://youtu.be/I1sSamSsTK4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=500px&amp;gt;&lt;br /&gt;
File:Hyperscanning pipe line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:Hyperscanning_1.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Anais Llorens (anaisllorens@hotmail.com) and  Athina Tzovara (athina.tzovara@unibe.ch) conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org), Max Marcus (bigmaxmarcus@gmail.com) and Sigurd Alnes (sigurd.alnes@unibe.ch) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
To run the server, you’ll need a Linux or macOS machine—Windows is not supported at this time. The steps below walk you through deploying the server on AWS.&amp;lt;br&amp;gt;&lt;br /&gt;
1. Prepare the AWS key.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In your terminal or shell, run&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; chmod 400 &amp;lt;key_path&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
to make the key file read-only for the owner.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Connect to the AWS server using SSH:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; ssh -i &amp;lt;key path&amp;gt; &amp;lt;user-name&amp;gt;@&amp;lt;ip-address&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Pull the code from GitHub.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Navigate to the server directory:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. To compile the project, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Launch the server by running:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application must be restarted after BCI2000 has been closed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:CommunicationTask batch.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====StimuliMatrix====&lt;br /&gt;
Shared parameter, matrix of stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImageReceiver and ImageSender(the path of images).&amp;lt;br&amp;gt;&lt;br /&gt;
2. Sender(the role of players),1 is the sender), 2 is the receiver.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Jitter(the duration to present the role).&amp;lt;br&amp;gt;&lt;br /&gt;
4. CorrectResponse(1: left, 2:right).&amp;lt;br&amp;gt;&lt;br /&gt;
5. Training(1: training, 0: main task).&amp;lt;br&amp;gt;&lt;br /&gt;
6. Category(1: object, 2: animal).&amp;lt;br&amp;gt;&lt;br /&gt;
7. Difficulty(1: easy, 2: moderate, 3: hard).&amp;lt;br&amp;gt;&lt;br /&gt;
8. Dimension1a and Dimension1b(bar#1 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
9. Dimension2a and Dimension2b(bar#2 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
10. Option1 and Option2(left option text and right option text).&lt;br /&gt;
&lt;br /&gt;
====BreakTrialSequece====&lt;br /&gt;
The sequence of break trials, a break will happen after the break trial.&lt;br /&gt;
&lt;br /&gt;
====FeedbackDuration====&lt;br /&gt;
Duration of feedback(ITI). Indicate the receiver to make a correct or incorrect guess.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server will generate the InitialTrialNumber and StimuliSequence, and save them into a parameter file named by IP addresses on the server. You don&#039;t need to worry about these two parameters. Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
====InitialTrialNumber====&lt;br /&gt;
The trial number to begin with. We provide the resume option, allowing clients to pause and resume the game from where they stop. After one of the clients quits the game, the server will discover it and save the current trial number and sequence. When the same clients(same IP address) reconnect the server again, the server will send the previous trial number to them. Otherwise, the InitialTrailNumber will be initialized by 0. Usually, you don&#039;t need to touch this parameter.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequence====&lt;br /&gt;
The sequence of stimuli(images). The server will generate a random stimuli sequence for every pair of clients (identified by the IP address).&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====StimuliWidth====&lt;br /&gt;
StimulusWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====InstructionWidth====&lt;br /&gt;
Instruction width in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====SliderWidth====&lt;br /&gt;
SliderWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====BarColor====&lt;br /&gt;
Color of the slider bar.&lt;br /&gt;
&lt;br /&gt;
====AxeActiveColor====&lt;br /&gt;
Color of active slider axe.&lt;br /&gt;
&lt;br /&gt;
====AxeInActiveColor====&lt;br /&gt;
Color of inactive slider axe.&lt;br /&gt;
&lt;br /&gt;
====DimensionFontColor====&lt;br /&gt;
Color of the text under the slider.&lt;br /&gt;
&lt;br /&gt;
====DimensionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====OptionFontActiveColor====&lt;br /&gt;
Color of the active options.&lt;br /&gt;
&lt;br /&gt;
====OptionFontInActiveColor====&lt;br /&gt;
Color of the inactive options.&lt;br /&gt;
&lt;br /&gt;
====OptionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====RoleFontColor====&lt;br /&gt;
Color of the role text.&lt;br /&gt;
&lt;br /&gt;
====RoleHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====FeedbackWidth====&lt;br /&gt;
Width of feedback in percent of screen width.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the 10 slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] indicates the client is waiting for the other client to push the button to start the game. ( We are waiting for another player; once she/he is ready, we&#039;re ready to go!)&amp;lt;br&amp;gt; &lt;br /&gt;
[2] When the role text is present on the screen.(Sender or Receiver).&amp;lt;br&amp;gt; &lt;br /&gt;
[3] When the sliders and stimulus are present on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Feedback: After the receiver locks the answer, it comes to phase [4], showing whether the answer is correct.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]Break: (Well done! Are you ready for the next block? \n\n Press SPACEBAR)&amp;lt;br&amp;gt; &lt;br /&gt;
[6]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===StimulusCode===&lt;br /&gt;
The stimulus ID&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The photodiode state. 1: flash, 0: no flash&lt;br /&gt;
&lt;br /&gt;
===SampleBlockCounter===&lt;br /&gt;
Count the block number in one phase&lt;br /&gt;
&lt;br /&gt;
===BarOneValue===&lt;br /&gt;
Value of slider#1. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarTwoValue===&lt;br /&gt;
Value of slider#2. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneActive, BarTwoActive===&lt;br /&gt;
0: slider is not selected.  1: slider is selected. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ResponseValue===&lt;br /&gt;
1: object.    2: animal. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===SenderLock, ReceiverLock===&lt;br /&gt;
0: client is moving the slider/making a guess. 1: client has locked the answer. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===isReadyStart0, isReadyStart1===&lt;br /&gt;
0: client isn&#039;t ready to start/resume/continue the game(not yet pushing the button).  1: client is ready to start/resume/continue the game(push the button). (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The hyperscanning application module is almost the same as a BCI2000 application module, except that the typical BCI2000 module is inherited from ApplicationBase, and the hyperscanning application module is inherited from HyperscanningApplicationBase. Basically, the HyperscanningApplicationBase class is the same as ApplicationBase class with adding the communication with the server. So instead of using  Publish, Preflight, Process, etc. We are using SharedPublish, SharedPreflight, SharedProcess, etc. These methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Communication_task_dualTask.h:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;ApplicationBase.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Slider.h&amp;quot;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;quot;TextStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Communication_task_dualTask : public HyperscanningApplicationBase&lt;br /&gt;
{&lt;br /&gt;
 public:&lt;br /&gt;
  Communication_task_dualTask();&lt;br /&gt;
  ~Communication_task_dualTask();&lt;br /&gt;
  void SharedPublish() override;&lt;br /&gt;
  void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
  void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
  void SharedAutoConfig( const SignalProperties&amp;amp; Input ) override;&lt;br /&gt;
  void SharedStartRun() override;&lt;br /&gt;
  void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
  void SharedStopRun() override;&lt;br /&gt;
  void SharedHalt() override;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
   //define your own private members here&lt;br /&gt;
   ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
&lt;br /&gt;
   //define your own private methods here&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Manipulate the shared state is the same as the BCI2000 state. &amp;quot;isReadyStart1&amp;quot; is a shared state.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   State(&amp;quot;isReadyStart1&amp;quot;) = 1; // assign 1 to &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get the value of the shared state &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   //Both of the two players are ready, move to the next phase&lt;br /&gt;
   if (State(&amp;quot;isReadyStart0&amp;quot;) &amp;amp;&amp;amp; State(&amp;quot;isReadyStart1&amp;quot;)) {&lt;br /&gt;
            m_instruction_container-&amp;gt;Conceal();&lt;br /&gt;
            m_role_txt-&amp;gt;Conceal();&lt;br /&gt;
            my_phase = role_text;&lt;br /&gt;
            m_block_in_phase = 0;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11826</id>
		<title>Contributions:CommunicationTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11826"/>
		<updated>2025-04-23T16:39:06Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Deploy the Server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
The hyperscanning task is a turn-based communication game between two clients. This game aims to guess what the subject is in Sender&#039;s computer without talking. For each trial, the two players will alternate between the roles of Sender and Receiver. The Sender will describe traits of the subject presented by adjusting the two axes(Noisy or silent/Big or small). Then, the Receiver will guess if the Sender is describing the animal or object. After the Receiver makes a guess, both players receive feedback on whether the Receiver makes the correct guess. This marks the end of a trial.&lt;br /&gt;
&lt;br /&gt;
The two clients exchange information through the hyperScanning backend, which uses a client-server model to share the states. Each client has a separate state machine. The server only forwards the information between two clients. Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class, which is the parent class of the application module. For more information, please refer to the hyperScanning framework wiki page: https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning.&lt;br /&gt;
&lt;br /&gt;
==Video Overview==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;youtube alignment=&amp;quot;center&amp;quot;&amp;gt;https://youtu.be/I1sSamSsTK4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=500px&amp;gt;&lt;br /&gt;
File:Hyperscanning pipe line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:Hyperscanning_1.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Anais Llorens (anaisllorens@hotmail.com) and  Athina Tzovara (athina.tzovara@unibe.ch) conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org), Max Marcus (bigmaxmarcus@gmail.com) and Sigurd Alnes (sigurd.alnes@unibe.ch) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
To run the server, you’ll need a Linux or macOS machine—Windows is not supported at this time. The steps below walk you through deploying the server on AWS.&amp;lt;br&amp;gt;&lt;br /&gt;
1. Prepare the AWS key.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In your terminal or shell, run&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; chmod 400 &amp;lt;key_path&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
to make the key file read-only for the owner.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Connect to the AWS server using SSH:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; ssh -i &amp;lt;key path&amp;gt; &amp;lt;user-name&amp;gt;@&amp;lt;ip-address&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Pull the code from GitHub.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Navigate to the server directory:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. To compile the project, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Launch the server by running:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application must be restarted after BCI2000 has been closed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:CommunicationTask batch.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====StimuliMatrix====&lt;br /&gt;
Shared parameter, matrix of stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImageReceiver and ImageSender(the path of images).&amp;lt;br&amp;gt;&lt;br /&gt;
2. Sender(the role of players),1 is the sender), 2 is the receiver.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Jitter(the duration to present the role).&amp;lt;br&amp;gt;&lt;br /&gt;
4. CorrectResponse(1: left, 2:right).&amp;lt;br&amp;gt;&lt;br /&gt;
5. Training(1: training, 0: main task).&amp;lt;br&amp;gt;&lt;br /&gt;
6. Category(1: object, 2: animal).&amp;lt;br&amp;gt;&lt;br /&gt;
7. Difficulty(1: easy, 2: moderate, 3: hard).&amp;lt;br&amp;gt;&lt;br /&gt;
8. Dimension1a and Dimension1b(bar#1 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
9. Dimension2a and Dimension2b(bar#2 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
10. Option1 and Option2(left option text and right option text).&lt;br /&gt;
&lt;br /&gt;
====BreakTrialSequece====&lt;br /&gt;
The sequence of break trials, a break will happen after the break trial.&lt;br /&gt;
&lt;br /&gt;
====FeedbackDuration====&lt;br /&gt;
Duration of feedback(ITI). Indicate the receiver to make a correct or incorrect guess.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server will generate the InitialTrialNumber and StimuliSequence, and save them into a parameter file named by IP addresses on the server. You don&#039;t need to worry about these two parameters. Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
====InitialTrialNumber====&lt;br /&gt;
The trial number to begin with. We provide the resume option, allowing clients to pause and resume the game from where they stop. After one of the clients quits the game, the server will discover it and save the current trial number and sequence. When the same clients(same IP address) reconnect the server again, the server will send the previous trial number to them. Otherwise, the InitialTrailNumber will be initialized by 0. Usually, you don&#039;t need to touch this parameter.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequence====&lt;br /&gt;
The sequence of stimuli(images). The server will generate a random stimuli sequence for every pair of clients (identified by the IP address).&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====StimuliWidth====&lt;br /&gt;
StimulusWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====InstructionWidth====&lt;br /&gt;
Instruction width in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====SliderWidth====&lt;br /&gt;
SliderWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====BarColor====&lt;br /&gt;
Color of the slider bar.&lt;br /&gt;
&lt;br /&gt;
====AxeActiveColor====&lt;br /&gt;
Color of active slider axe.&lt;br /&gt;
&lt;br /&gt;
====AxeInActiveColor====&lt;br /&gt;
Color of inactive slider axe.&lt;br /&gt;
&lt;br /&gt;
====DimensionFontColor====&lt;br /&gt;
Color of the text under the slider.&lt;br /&gt;
&lt;br /&gt;
====DimensionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====OptionFontActiveColor====&lt;br /&gt;
Color of the active options.&lt;br /&gt;
&lt;br /&gt;
====OptionFontInActiveColor====&lt;br /&gt;
Color of the inactive options.&lt;br /&gt;
&lt;br /&gt;
====OptionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====RoleFontColor====&lt;br /&gt;
Color of the role text.&lt;br /&gt;
&lt;br /&gt;
====RoleHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====FeedbackWidth====&lt;br /&gt;
Width of feedback in percent of screen width.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the 10 slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] indicates the client is waiting for the other client to push the button to start the game. ( We are waiting for another player; once she/he is ready, we&#039;re ready to go!)&amp;lt;br&amp;gt; &lt;br /&gt;
[2] When the role text is present on the screen.(Sender or Receiver).&amp;lt;br&amp;gt; &lt;br /&gt;
[3] When the sliders and stimulus are present on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Feedback: After the receiver locks the answer, it comes to phase [4], showing whether the answer is correct.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]Break: (Well done! Are you ready for the next block? \n\n Press SPACEBAR)&amp;lt;br&amp;gt; &lt;br /&gt;
[6]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneValue===&lt;br /&gt;
Value of slider#1. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarTwoValue===&lt;br /&gt;
Value of slider#2. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneActive, BarTwoActive===&lt;br /&gt;
0: slider is not selected.  1: slider is selected. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ResponseValue===&lt;br /&gt;
1: object.    2: animal. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===SenderLock, ReceiverLock===&lt;br /&gt;
0: client is moving the slider/making a guess. 1: client has locked the answer. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===isReadyStart0, isReadyStart1===&lt;br /&gt;
0: client isn&#039;t ready to start/resume/continue the game(not yet pushing the button).  1: client is ready to start/resume/continue the game(push the button). (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The hyperscanning application module is almost the same as a BCI2000 application module, except that the typical BCI2000 module is inherited from ApplicationBase, and the hyperscanning application module is inherited from HyperscanningApplicationBase. Basically, the HyperscanningApplicationBase class is the same as ApplicationBase class with adding the communication with the server. So instead of using  Publish, Preflight, Process, etc. We are using SharedPublish, SharedPreflight, SharedProcess, etc. These methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Communication_task_dualTask.h:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;ApplicationBase.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Slider.h&amp;quot;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;quot;TextStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Communication_task_dualTask : public HyperscanningApplicationBase&lt;br /&gt;
{&lt;br /&gt;
 public:&lt;br /&gt;
  Communication_task_dualTask();&lt;br /&gt;
  ~Communication_task_dualTask();&lt;br /&gt;
  void SharedPublish() override;&lt;br /&gt;
  void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
  void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
  void SharedAutoConfig( const SignalProperties&amp;amp; Input ) override;&lt;br /&gt;
  void SharedStartRun() override;&lt;br /&gt;
  void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
  void SharedStopRun() override;&lt;br /&gt;
  void SharedHalt() override;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
   //define your own private members here&lt;br /&gt;
   ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
&lt;br /&gt;
   //define your own private methods here&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Manipulate the shared state is the same as the BCI2000 state. &amp;quot;isReadyStart1&amp;quot; is a shared state.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   State(&amp;quot;isReadyStart1&amp;quot;) = 1; // assign 1 to &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get the value of the shared state &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   //Both of the two players are ready, move to the next phase&lt;br /&gt;
   if (State(&amp;quot;isReadyStart0&amp;quot;) &amp;amp;&amp;amp; State(&amp;quot;isReadyStart1&amp;quot;)) {&lt;br /&gt;
            m_instruction_container-&amp;gt;Conceal();&lt;br /&gt;
            m_role_txt-&amp;gt;Conceal();&lt;br /&gt;
            my_phase = role_text;&lt;br /&gt;
            m_block_in_phase = 0;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11825</id>
		<title>Contributions:CommunicationTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11825"/>
		<updated>2025-04-23T15:16:16Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Deploy the Server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
The hyperscanning task is a turn-based communication game between two clients. This game aims to guess what the subject is in Sender&#039;s computer without talking. For each trial, the two players will alternate between the roles of Sender and Receiver. The Sender will describe traits of the subject presented by adjusting the two axes(Noisy or silent/Big or small). Then, the Receiver will guess if the Sender is describing the animal or object. After the Receiver makes a guess, both players receive feedback on whether the Receiver makes the correct guess. This marks the end of a trial.&lt;br /&gt;
&lt;br /&gt;
The two clients exchange information through the hyperScanning backend, which uses a client-server model to share the states. Each client has a separate state machine. The server only forwards the information between two clients. Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class, which is the parent class of the application module. For more information, please refer to the hyperScanning framework wiki page: https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning.&lt;br /&gt;
&lt;br /&gt;
==Video Overview==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;youtube alignment=&amp;quot;center&amp;quot;&amp;gt;https://youtu.be/I1sSamSsTK4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=500px&amp;gt;&lt;br /&gt;
File:Hyperscanning pipe line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:Hyperscanning_1.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Anais Llorens (anaisllorens@hotmail.com) and  Athina Tzovara (athina.tzovara@unibe.ch) conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org), Max Marcus (bigmaxmarcus@gmail.com) and Sigurd Alnes (sigurd.alnes@unibe.ch) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
To run the server, you’ll need a Linux or macOS machine—Windows is not supported at this time. The steps below walk you through deploying the server on AWS.&amp;lt;br&amp;gt;&lt;br /&gt;
1. Prepare the SSH key.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In your terminal or shell, run&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; chmod 400 &amp;lt;key_path&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
to make the key file read-only for the owner.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Connect to the AWS server using SSH:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; ssh -i &amp;lt;key path&amp;gt; &amp;lt;user-name&amp;gt;@&amp;lt;ip-address&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Pull the code from GitHub.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Navigate to the server directory:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. To compile the project, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Launch the server by running:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application must be restarted after BCI2000 has been closed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:CommunicationTask batch.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====StimuliMatrix====&lt;br /&gt;
Shared parameter, matrix of stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImageReceiver and ImageSender(the path of images).&amp;lt;br&amp;gt;&lt;br /&gt;
2. Sender(the role of players),1 is the sender), 2 is the receiver.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Jitter(the duration to present the role).&amp;lt;br&amp;gt;&lt;br /&gt;
4. CorrectResponse(1: left, 2:right).&amp;lt;br&amp;gt;&lt;br /&gt;
5. Training(1: training, 0: main task).&amp;lt;br&amp;gt;&lt;br /&gt;
6. Category(1: object, 2: animal).&amp;lt;br&amp;gt;&lt;br /&gt;
7. Difficulty(1: easy, 2: moderate, 3: hard).&amp;lt;br&amp;gt;&lt;br /&gt;
8. Dimension1a and Dimension1b(bar#1 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
9. Dimension2a and Dimension2b(bar#2 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
10. Option1 and Option2(left option text and right option text).&lt;br /&gt;
&lt;br /&gt;
====BreakTrialSequece====&lt;br /&gt;
The sequence of break trials, a break will happen after the break trial.&lt;br /&gt;
&lt;br /&gt;
====FeedbackDuration====&lt;br /&gt;
Duration of feedback(ITI). Indicate the receiver to make a correct or incorrect guess.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server will generate the InitialTrialNumber and StimuliSequence, and save them into a parameter file named by IP addresses on the server. You don&#039;t need to worry about these two parameters. Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
====InitialTrialNumber====&lt;br /&gt;
The trial number to begin with. We provide the resume option, allowing clients to pause and resume the game from where they stop. After one of the clients quits the game, the server will discover it and save the current trial number and sequence. When the same clients(same IP address) reconnect the server again, the server will send the previous trial number to them. Otherwise, the InitialTrailNumber will be initialized by 0. Usually, you don&#039;t need to touch this parameter.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequence====&lt;br /&gt;
The sequence of stimuli(images). The server will generate a random stimuli sequence for every pair of clients (identified by the IP address).&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====StimuliWidth====&lt;br /&gt;
StimulusWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====InstructionWidth====&lt;br /&gt;
Instruction width in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====SliderWidth====&lt;br /&gt;
SliderWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====BarColor====&lt;br /&gt;
Color of the slider bar.&lt;br /&gt;
&lt;br /&gt;
====AxeActiveColor====&lt;br /&gt;
Color of active slider axe.&lt;br /&gt;
&lt;br /&gt;
====AxeInActiveColor====&lt;br /&gt;
Color of inactive slider axe.&lt;br /&gt;
&lt;br /&gt;
====DimensionFontColor====&lt;br /&gt;
Color of the text under the slider.&lt;br /&gt;
&lt;br /&gt;
====DimensionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====OptionFontActiveColor====&lt;br /&gt;
Color of the active options.&lt;br /&gt;
&lt;br /&gt;
====OptionFontInActiveColor====&lt;br /&gt;
Color of the inactive options.&lt;br /&gt;
&lt;br /&gt;
====OptionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====RoleFontColor====&lt;br /&gt;
Color of the role text.&lt;br /&gt;
&lt;br /&gt;
====RoleHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====FeedbackWidth====&lt;br /&gt;
Width of feedback in percent of screen width.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the 10 slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] indicates the client is waiting for the other client to push the button to start the game. ( We are waiting for another player; once she/he is ready, we&#039;re ready to go!)&amp;lt;br&amp;gt; &lt;br /&gt;
[2] When the role text is present on the screen.(Sender or Receiver).&amp;lt;br&amp;gt; &lt;br /&gt;
[3] When the sliders and stimulus are present on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Feedback: After the receiver locks the answer, it comes to phase [4], showing whether the answer is correct.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]Break: (Well done! Are you ready for the next block? \n\n Press SPACEBAR)&amp;lt;br&amp;gt; &lt;br /&gt;
[6]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneValue===&lt;br /&gt;
Value of slider#1. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarTwoValue===&lt;br /&gt;
Value of slider#2. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneActive, BarTwoActive===&lt;br /&gt;
0: slider is not selected.  1: slider is selected. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ResponseValue===&lt;br /&gt;
1: object.    2: animal. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===SenderLock, ReceiverLock===&lt;br /&gt;
0: client is moving the slider/making a guess. 1: client has locked the answer. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===isReadyStart0, isReadyStart1===&lt;br /&gt;
0: client isn&#039;t ready to start/resume/continue the game(not yet pushing the button).  1: client is ready to start/resume/continue the game(push the button). (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The hyperscanning application module is almost the same as a BCI2000 application module, except that the typical BCI2000 module is inherited from ApplicationBase, and the hyperscanning application module is inherited from HyperscanningApplicationBase. Basically, the HyperscanningApplicationBase class is the same as ApplicationBase class with adding the communication with the server. So instead of using  Publish, Preflight, Process, etc. We are using SharedPublish, SharedPreflight, SharedProcess, etc. These methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Communication_task_dualTask.h:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;ApplicationBase.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Slider.h&amp;quot;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;quot;TextStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Communication_task_dualTask : public HyperscanningApplicationBase&lt;br /&gt;
{&lt;br /&gt;
 public:&lt;br /&gt;
  Communication_task_dualTask();&lt;br /&gt;
  ~Communication_task_dualTask();&lt;br /&gt;
  void SharedPublish() override;&lt;br /&gt;
  void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
  void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
  void SharedAutoConfig( const SignalProperties&amp;amp; Input ) override;&lt;br /&gt;
  void SharedStartRun() override;&lt;br /&gt;
  void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
  void SharedStopRun() override;&lt;br /&gt;
  void SharedHalt() override;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
   //define your own private members here&lt;br /&gt;
   ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
&lt;br /&gt;
   //define your own private methods here&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Manipulate the shared state is the same as the BCI2000 state. &amp;quot;isReadyStart1&amp;quot; is a shared state.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   State(&amp;quot;isReadyStart1&amp;quot;) = 1; // assign 1 to &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get the value of the shared state &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   //Both of the two players are ready, move to the next phase&lt;br /&gt;
   if (State(&amp;quot;isReadyStart0&amp;quot;) &amp;amp;&amp;amp; State(&amp;quot;isReadyStart1&amp;quot;)) {&lt;br /&gt;
            m_instruction_container-&amp;gt;Conceal();&lt;br /&gt;
            m_role_txt-&amp;gt;Conceal();&lt;br /&gt;
            my_phase = role_text;&lt;br /&gt;
            m_block_in_phase = 0;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11824</id>
		<title>Contributions:CommunicationTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11824"/>
		<updated>2025-04-23T15:11:57Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Versioning */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
The hyperscanning task is a turn-based communication game between two clients. This game aims to guess what the subject is in Sender&#039;s computer without talking. For each trial, the two players will alternate between the roles of Sender and Receiver. The Sender will describe traits of the subject presented by adjusting the two axes(Noisy or silent/Big or small). Then, the Receiver will guess if the Sender is describing the animal or object. After the Receiver makes a guess, both players receive feedback on whether the Receiver makes the correct guess. This marks the end of a trial.&lt;br /&gt;
&lt;br /&gt;
The two clients exchange information through the hyperScanning backend, which uses a client-server model to share the states. Each client has a separate state machine. The server only forwards the information between two clients. Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class, which is the parent class of the application module. For more information, please refer to the hyperScanning framework wiki page: https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning.&lt;br /&gt;
&lt;br /&gt;
==Video Overview==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;youtube alignment=&amp;quot;center&amp;quot;&amp;gt;https://youtu.be/I1sSamSsTK4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=500px&amp;gt;&lt;br /&gt;
File:Hyperscanning pipe line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:Hyperscanning_1.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Anais Llorens (anaisllorens@hotmail.com) and  Athina Tzovara (athina.tzovara@unibe.ch) conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org), Max Marcus (bigmaxmarcus@gmail.com) and Sigurd Alnes (sigurd.alnes@unibe.ch) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps outline the process for deploying the server on AWS.&amp;lt;br&amp;gt;&lt;br /&gt;
1. Prepare the SSH key.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In your terminal or shell, run&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; chmod 400 &amp;lt;key_path&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
to make the key file read-only for the owner.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Connect to the AWS server using SSH:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; ssh -i &amp;lt;key path&amp;gt; &amp;lt;user-name&amp;gt;@&amp;lt;ip-address&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Pull the code from GitHub.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Navigate to the server directory:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. To compile the project, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Launch the server by running:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application must be restarted after BCI2000 has been closed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:CommunicationTask batch.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====StimuliMatrix====&lt;br /&gt;
Shared parameter, matrix of stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImageReceiver and ImageSender(the path of images).&amp;lt;br&amp;gt;&lt;br /&gt;
2. Sender(the role of players),1 is the sender), 2 is the receiver.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Jitter(the duration to present the role).&amp;lt;br&amp;gt;&lt;br /&gt;
4. CorrectResponse(1: left, 2:right).&amp;lt;br&amp;gt;&lt;br /&gt;
5. Training(1: training, 0: main task).&amp;lt;br&amp;gt;&lt;br /&gt;
6. Category(1: object, 2: animal).&amp;lt;br&amp;gt;&lt;br /&gt;
7. Difficulty(1: easy, 2: moderate, 3: hard).&amp;lt;br&amp;gt;&lt;br /&gt;
8. Dimension1a and Dimension1b(bar#1 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
9. Dimension2a and Dimension2b(bar#2 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
10. Option1 and Option2(left option text and right option text).&lt;br /&gt;
&lt;br /&gt;
====BreakTrialSequece====&lt;br /&gt;
The sequence of break trials, a break will happen after the break trial.&lt;br /&gt;
&lt;br /&gt;
====FeedbackDuration====&lt;br /&gt;
Duration of feedback(ITI). Indicate the receiver to make a correct or incorrect guess.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server will generate the InitialTrialNumber and StimuliSequence, and save them into a parameter file named by IP addresses on the server. You don&#039;t need to worry about these two parameters. Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
====InitialTrialNumber====&lt;br /&gt;
The trial number to begin with. We provide the resume option, allowing clients to pause and resume the game from where they stop. After one of the clients quits the game, the server will discover it and save the current trial number and sequence. When the same clients(same IP address) reconnect the server again, the server will send the previous trial number to them. Otherwise, the InitialTrailNumber will be initialized by 0. Usually, you don&#039;t need to touch this parameter.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequence====&lt;br /&gt;
The sequence of stimuli(images). The server will generate a random stimuli sequence for every pair of clients (identified by the IP address).&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====StimuliWidth====&lt;br /&gt;
StimulusWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====InstructionWidth====&lt;br /&gt;
Instruction width in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====SliderWidth====&lt;br /&gt;
SliderWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====BarColor====&lt;br /&gt;
Color of the slider bar.&lt;br /&gt;
&lt;br /&gt;
====AxeActiveColor====&lt;br /&gt;
Color of active slider axe.&lt;br /&gt;
&lt;br /&gt;
====AxeInActiveColor====&lt;br /&gt;
Color of inactive slider axe.&lt;br /&gt;
&lt;br /&gt;
====DimensionFontColor====&lt;br /&gt;
Color of the text under the slider.&lt;br /&gt;
&lt;br /&gt;
====DimensionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====OptionFontActiveColor====&lt;br /&gt;
Color of the active options.&lt;br /&gt;
&lt;br /&gt;
====OptionFontInActiveColor====&lt;br /&gt;
Color of the inactive options.&lt;br /&gt;
&lt;br /&gt;
====OptionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====RoleFontColor====&lt;br /&gt;
Color of the role text.&lt;br /&gt;
&lt;br /&gt;
====RoleHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====FeedbackWidth====&lt;br /&gt;
Width of feedback in percent of screen width.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the 10 slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] indicates the client is waiting for the other client to push the button to start the game. ( We are waiting for another player; once she/he is ready, we&#039;re ready to go!)&amp;lt;br&amp;gt; &lt;br /&gt;
[2] When the role text is present on the screen.(Sender or Receiver).&amp;lt;br&amp;gt; &lt;br /&gt;
[3] When the sliders and stimulus are present on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Feedback: After the receiver locks the answer, it comes to phase [4], showing whether the answer is correct.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]Break: (Well done! Are you ready for the next block? \n\n Press SPACEBAR)&amp;lt;br&amp;gt; &lt;br /&gt;
[6]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneValue===&lt;br /&gt;
Value of slider#1. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarTwoValue===&lt;br /&gt;
Value of slider#2. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneActive, BarTwoActive===&lt;br /&gt;
0: slider is not selected.  1: slider is selected. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ResponseValue===&lt;br /&gt;
1: object.    2: animal. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===SenderLock, ReceiverLock===&lt;br /&gt;
0: client is moving the slider/making a guess. 1: client has locked the answer. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===isReadyStart0, isReadyStart1===&lt;br /&gt;
0: client isn&#039;t ready to start/resume/continue the game(not yet pushing the button).  1: client is ready to start/resume/continue the game(push the button). (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The hyperscanning application module is almost the same as a BCI2000 application module, except that the typical BCI2000 module is inherited from ApplicationBase, and the hyperscanning application module is inherited from HyperscanningApplicationBase. Basically, the HyperscanningApplicationBase class is the same as ApplicationBase class with adding the communication with the server. So instead of using  Publish, Preflight, Process, etc. We are using SharedPublish, SharedPreflight, SharedProcess, etc. These methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Communication_task_dualTask.h:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;ApplicationBase.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Slider.h&amp;quot;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;quot;TextStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Communication_task_dualTask : public HyperscanningApplicationBase&lt;br /&gt;
{&lt;br /&gt;
 public:&lt;br /&gt;
  Communication_task_dualTask();&lt;br /&gt;
  ~Communication_task_dualTask();&lt;br /&gt;
  void SharedPublish() override;&lt;br /&gt;
  void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
  void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
  void SharedAutoConfig( const SignalProperties&amp;amp; Input ) override;&lt;br /&gt;
  void SharedStartRun() override;&lt;br /&gt;
  void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
  void SharedStopRun() override;&lt;br /&gt;
  void SharedHalt() override;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
   //define your own private members here&lt;br /&gt;
   ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
&lt;br /&gt;
   //define your own private methods here&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Manipulate the shared state is the same as the BCI2000 state. &amp;quot;isReadyStart1&amp;quot; is a shared state.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   State(&amp;quot;isReadyStart1&amp;quot;) = 1; // assign 1 to &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get the value of the shared state &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   //Both of the two players are ready, move to the next phase&lt;br /&gt;
   if (State(&amp;quot;isReadyStart0&amp;quot;) &amp;amp;&amp;amp; State(&amp;quot;isReadyStart1&amp;quot;)) {&lt;br /&gt;
            m_instruction_container-&amp;gt;Conceal();&lt;br /&gt;
            m_role_txt-&amp;gt;Conceal();&lt;br /&gt;
            my_phase = role_text;&lt;br /&gt;
            m_block_in_phase = 0;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11823</id>
		<title>Contributions:CommunicationTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11823"/>
		<updated>2025-04-23T15:11:15Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Deploy the Server */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
The hyperscanning task is a turn-based communication game between two clients. This game aims to guess what the subject is in Sender&#039;s computer without talking. For each trial, the two players will alternate between the roles of Sender and Receiver. The Sender will describe traits of the subject presented by adjusting the two axes(Noisy or silent/Big or small). Then, the Receiver will guess if the Sender is describing the animal or object. After the Receiver makes a guess, both players receive feedback on whether the Receiver makes the correct guess. This marks the end of a trial.&lt;br /&gt;
&lt;br /&gt;
The two clients exchange information through the hyperScanning backend, which uses a client-server model to share the states. Each client has a separate state machine. The server only forwards the information between two clients. Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class, which is the parent class of the application module. For more information, please refer to the hyperScanning framework wiki page: https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning.&lt;br /&gt;
&lt;br /&gt;
==Video Overview==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;youtube alignment=&amp;quot;center&amp;quot;&amp;gt;https://youtu.be/I1sSamSsTK4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=500px&amp;gt;&lt;br /&gt;
File:Hyperscanning pipe line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:Hyperscanning_1.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Anais Llorens (anaisllorens@hotmail.com) and  Athina Tzovara (athina.tzovara@unibe.ch) conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Max Marcus (bigmaxmarcus@gmail.com), Huiling Huang (huiling@neurotechcenter.org), and Sigurd Alnes (sigurd.alnes@unibe.ch) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps outline the process for deploying the server on AWS.&amp;lt;br&amp;gt;&lt;br /&gt;
1. Prepare the SSH key.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
2. In your terminal or shell, run&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; chmod 400 &amp;lt;key_path&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
to make the key file read-only for the owner.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
3. Connect to the AWS server using SSH:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt; ssh -i &amp;lt;key path&amp;gt; &amp;lt;user-name&amp;gt;@&amp;lt;ip-address&amp;gt; &amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
4. Pull the code from GitHub.&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Navigate to the server directory:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
6. To compile the project, run:&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
5. Launch the server by running:&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application must be restarted after BCI2000 has been closed.&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:CommunicationTask batch.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====StimuliMatrix====&lt;br /&gt;
Shared parameter, matrix of stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImageReceiver and ImageSender(the path of images).&amp;lt;br&amp;gt;&lt;br /&gt;
2. Sender(the role of players),1 is the sender), 2 is the receiver.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Jitter(the duration to present the role).&amp;lt;br&amp;gt;&lt;br /&gt;
4. CorrectResponse(1: left, 2:right).&amp;lt;br&amp;gt;&lt;br /&gt;
5. Training(1: training, 0: main task).&amp;lt;br&amp;gt;&lt;br /&gt;
6. Category(1: object, 2: animal).&amp;lt;br&amp;gt;&lt;br /&gt;
7. Difficulty(1: easy, 2: moderate, 3: hard).&amp;lt;br&amp;gt;&lt;br /&gt;
8. Dimension1a and Dimension1b(bar#1 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
9. Dimension2a and Dimension2b(bar#2 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
10. Option1 and Option2(left option text and right option text).&lt;br /&gt;
&lt;br /&gt;
====BreakTrialSequece====&lt;br /&gt;
The sequence of break trials, a break will happen after the break trial.&lt;br /&gt;
&lt;br /&gt;
====FeedbackDuration====&lt;br /&gt;
Duration of feedback(ITI). Indicate the receiver to make a correct or incorrect guess.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server will generate the InitialTrialNumber and StimuliSequence, and save them into a parameter file named by IP addresses on the server. You don&#039;t need to worry about these two parameters. Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
====InitialTrialNumber====&lt;br /&gt;
The trial number to begin with. We provide the resume option, allowing clients to pause and resume the game from where they stop. After one of the clients quits the game, the server will discover it and save the current trial number and sequence. When the same clients(same IP address) reconnect the server again, the server will send the previous trial number to them. Otherwise, the InitialTrailNumber will be initialized by 0. Usually, you don&#039;t need to touch this parameter.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequence====&lt;br /&gt;
The sequence of stimuli(images). The server will generate a random stimuli sequence for every pair of clients (identified by the IP address).&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====StimuliWidth====&lt;br /&gt;
StimulusWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====InstructionWidth====&lt;br /&gt;
Instruction width in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====SliderWidth====&lt;br /&gt;
SliderWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====BarColor====&lt;br /&gt;
Color of the slider bar.&lt;br /&gt;
&lt;br /&gt;
====AxeActiveColor====&lt;br /&gt;
Color of active slider axe.&lt;br /&gt;
&lt;br /&gt;
====AxeInActiveColor====&lt;br /&gt;
Color of inactive slider axe.&lt;br /&gt;
&lt;br /&gt;
====DimensionFontColor====&lt;br /&gt;
Color of the text under the slider.&lt;br /&gt;
&lt;br /&gt;
====DimensionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====OptionFontActiveColor====&lt;br /&gt;
Color of the active options.&lt;br /&gt;
&lt;br /&gt;
====OptionFontInActiveColor====&lt;br /&gt;
Color of the inactive options.&lt;br /&gt;
&lt;br /&gt;
====OptionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====RoleFontColor====&lt;br /&gt;
Color of the role text.&lt;br /&gt;
&lt;br /&gt;
====RoleHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====FeedbackWidth====&lt;br /&gt;
Width of feedback in percent of screen width.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the 10 slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] indicates the client is waiting for the other client to push the button to start the game. ( We are waiting for another player; once she/he is ready, we&#039;re ready to go!)&amp;lt;br&amp;gt; &lt;br /&gt;
[2] When the role text is present on the screen.(Sender or Receiver).&amp;lt;br&amp;gt; &lt;br /&gt;
[3] When the sliders and stimulus are present on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Feedback: After the receiver locks the answer, it comes to phase [4], showing whether the answer is correct.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]Break: (Well done! Are you ready for the next block? \n\n Press SPACEBAR)&amp;lt;br&amp;gt; &lt;br /&gt;
[6]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneValue===&lt;br /&gt;
Value of slider#1. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarTwoValue===&lt;br /&gt;
Value of slider#2. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneActive, BarTwoActive===&lt;br /&gt;
0: slider is not selected.  1: slider is selected. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ResponseValue===&lt;br /&gt;
1: object.    2: animal. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===SenderLock, ReceiverLock===&lt;br /&gt;
0: client is moving the slider/making a guess. 1: client has locked the answer. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===isReadyStart0, isReadyStart1===&lt;br /&gt;
0: client isn&#039;t ready to start/resume/continue the game(not yet pushing the button).  1: client is ready to start/resume/continue the game(push the button). (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The hyperscanning application module is almost the same as a BCI2000 application module, except that the typical BCI2000 module is inherited from ApplicationBase, and the hyperscanning application module is inherited from HyperscanningApplicationBase. Basically, the HyperscanningApplicationBase class is the same as ApplicationBase class with adding the communication with the server. So instead of using  Publish, Preflight, Process, etc. We are using SharedPublish, SharedPreflight, SharedProcess, etc. These methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Communication_task_dualTask.h:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;ApplicationBase.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Slider.h&amp;quot;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;quot;TextStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Communication_task_dualTask : public HyperscanningApplicationBase&lt;br /&gt;
{&lt;br /&gt;
 public:&lt;br /&gt;
  Communication_task_dualTask();&lt;br /&gt;
  ~Communication_task_dualTask();&lt;br /&gt;
  void SharedPublish() override;&lt;br /&gt;
  void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
  void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
  void SharedAutoConfig( const SignalProperties&amp;amp; Input ) override;&lt;br /&gt;
  void SharedStartRun() override;&lt;br /&gt;
  void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
  void SharedStopRun() override;&lt;br /&gt;
  void SharedHalt() override;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
   //define your own private members here&lt;br /&gt;
   ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
&lt;br /&gt;
   //define your own private methods here&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Manipulate the shared state is the same as the BCI2000 state. &amp;quot;isReadyStart1&amp;quot; is a shared state.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   State(&amp;quot;isReadyStart1&amp;quot;) = 1; // assign 1 to &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get the value of the shared state &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   //Both of the two players are ready, move to the next phase&lt;br /&gt;
   if (State(&amp;quot;isReadyStart0&amp;quot;) &amp;amp;&amp;amp; State(&amp;quot;isReadyStart1&amp;quot;)) {&lt;br /&gt;
            m_instruction_container-&amp;gt;Conceal();&lt;br /&gt;
            m_role_txt-&amp;gt;Conceal();&lt;br /&gt;
            my_phase = role_text;&lt;br /&gt;
            m_block_in_phase = 0;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11780</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11780"/>
		<updated>2025-03-18T17:30:08Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000.&lt;br /&gt;
&lt;br /&gt;
==titration rule==&lt;br /&gt;
In titration task, we use 3-down-1-up to adjust the contrast: decrease the contrast by one degree if 3 consecutive correct responses happens. Increase the contrast by one degree if 1 incorrect response happens.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the main task:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Start with the first 15 trials:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Record accuracy for the initial 15 match trials.&amp;lt;br/&amp;gt;&lt;br /&gt;
Calculate the average accuracy of these trials.&amp;lt;br/&amp;gt;&lt;br /&gt;
Adjust the contrast based on the computed average.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Ongoing updates with a sliding window:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After every set of 5 new trials:&amp;lt;br/&amp;gt;&lt;br /&gt;
Incorporate these 5 new trials into the dataset.&amp;lt;br/&amp;gt;&lt;br /&gt;
Remove the oldest 5 trials from the sequence.&amp;lt;br/&amp;gt;&lt;br /&gt;
Recalculate the average accuracy of the updated 15-trial window.&amp;lt;br/&amp;gt;&lt;br /&gt;
Adjust the contrast accordingly.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
This process continues for every subsequent batch of 5 trials.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar. range [0,1]&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross. range [0,1]&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue. range [0,1]&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target. range [0,1]&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%). range [0,100]&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%). range [0,100]&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%). range [0,100]&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task. range [0,100]&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle. range [0,360]&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastUpdateTrialNum===&lt;br /&gt;
The number of update trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy. range [0,1]&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy. range [0,1]&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version. range [0,1]&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br/&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11777</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11777"/>
		<updated>2025-03-17T22:00:59Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* titration rule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000.&lt;br /&gt;
&lt;br /&gt;
==titration rule==&lt;br /&gt;
In titration task, we use 3-down-1-up to adjust the contrast: decrease the contrast by one degree if 3 consecutive correct responses happens. Increase the contrast by one degree if 1 incorrect response happens.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the main task:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Start with the first 15 trials:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Record accuracy for the initial 15 match trials.&amp;lt;br/&amp;gt;&lt;br /&gt;
Calculate the average accuracy of these trials.&amp;lt;br/&amp;gt;&lt;br /&gt;
Adjust the contrast based on the computed average.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Ongoing updates with a sliding window:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After every set of 5 new trials:&amp;lt;br/&amp;gt;&lt;br /&gt;
Incorporate these 5 new trials into the dataset.&amp;lt;br/&amp;gt;&lt;br /&gt;
Remove the oldest 5 trials from the sequence.&amp;lt;br/&amp;gt;&lt;br /&gt;
Recalculate the average accuracy of the updated 15-trial window.&amp;lt;br/&amp;gt;&lt;br /&gt;
Adjust the contrast accordingly.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
This process continues for every subsequent batch of 5 trials.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastUpdateTrialNum===&lt;br /&gt;
The number of update trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br/&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11776</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11776"/>
		<updated>2025-03-17T22:00:31Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* titration rule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000.&lt;br /&gt;
&lt;br /&gt;
==titration rule==&lt;br /&gt;
In titration task, we use 3-down-1-up to adjust the contrast: decrease the contrast by one degree if 3 consecutive correct responses happens. Increase the contrast by one degree if 1 incorrect response happens.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the main task:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Start with the first 15 trials:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Record accuracy for the initial 15 match trials.&amp;lt;br/&amp;gt;&lt;br /&gt;
Calculate the average accuracy of these trials.&amp;lt;br/&amp;gt;&lt;br /&gt;
Adjust the contrast based on the computed average.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Ongoing updates with a sliding window:&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After every set of 5 new trials:&amp;lt;br/&amp;gt;&lt;br /&gt;
Incorporate these 5 new trials into the dataset.&amp;lt;br/&amp;gt;&lt;br /&gt;
Remove the oldest 5 trials from the sequence.&amp;lt;br/&amp;gt;&lt;br /&gt;
Recalculate the average accuracy of the updated 15-trial window.&amp;lt;br/&amp;gt;&lt;br /&gt;
Adjust the contrast accordingly.&amp;lt;br/&amp;gt;&lt;br /&gt;
This process continues for every subsequent batch of 5 trials.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastUpdateTrialNum===&lt;br /&gt;
The number of update trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br/&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11775</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11775"/>
		<updated>2025-03-17T22:00:14Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* titration rule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000.&lt;br /&gt;
&lt;br /&gt;
==titration rule==&lt;br /&gt;
In titration task, we use 3-down-1-up to adjust the contrast: decrease the contrast by one degree if 3 consecutive correct responses happens. Increase the contrast by one degree if 1 incorrect response happens.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the main task:&amp;lt;br/&amp;gt;&lt;br /&gt;
1. Start with the first 15 trials:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Record accuracy for the initial 15 match trials.&amp;lt;br/&amp;gt;&lt;br /&gt;
Calculate the average accuracy of these trials.&amp;lt;br/&amp;gt;&lt;br /&gt;
Adjust the contrast based on the computed average.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
2. Ongoing updates with a sliding window:&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
&lt;br /&gt;
After every set of 5 new trials:&amp;lt;br/&amp;gt;&lt;br /&gt;
Incorporate these 5 new trials into the dataset.&amp;lt;br/&amp;gt;&lt;br /&gt;
Remove the oldest 5 trials from the sequence.&amp;lt;br/&amp;gt;&lt;br /&gt;
Recalculate the average accuracy of the updated 15-trial window.&amp;lt;br/&amp;gt;&lt;br /&gt;
Adjust the contrast accordingly.&amp;lt;br/&amp;gt;&lt;br /&gt;
This process continues for every subsequent batch of 5 trials.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastUpdateTrialNum===&lt;br /&gt;
The number of update trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br/&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11774</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11774"/>
		<updated>2025-03-17T21:54:10Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000.&lt;br /&gt;
&lt;br /&gt;
==titration rule==&lt;br /&gt;
In titration task, we use 3-down-1-up to adjust the contrast: decrease the contrast by one degree if 3 consecutive correct responses happens. Increase the contrast by one degree if 1 incorrect response happens.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the main task, we choose the slide window size as 15 trials and calculate the accuracy for the most recent 15 trials. If accuracy &amp;gt; 80%, decrease the contrast by one degree; otherwise, increase by one degree until the color is the same as the bar color.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastUpdateTrialNum===&lt;br /&gt;
The number of update trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br/&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11771</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11771"/>
		<updated>2025-03-13T15:37:01Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Authors */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000.&lt;br /&gt;
&lt;br /&gt;
==titration rule==&lt;br /&gt;
In titration task, we use 3-down-1-up to adjust the contrast: decrease the contrast by one degree if 3 consecutive correct responses happens. Increase the contrast by one degree if 1 incorrect response happens.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the main task, we choose the slide window size as 15 trials and calculate the accuracy for the most recent 15 trials. If accuracy &amp;gt; 80%, decrease the contrast by one degree; otherwise, increase by one degree until the color is the same as the bar color.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br/&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11770</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11770"/>
		<updated>2025-03-13T15:28:16Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* titration rule */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==titration rule==&lt;br /&gt;
In titration task, we use 3-down-1-up to adjust the contrast: decrease the contrast by one degree if 3 consecutive correct responses happens. Increase the contrast by one degree if 1 incorrect response happens.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the main task, we choose the slide window size as 15 trials and calculate the accuracy for the most recent 15 trials. If accuracy &amp;gt; 80%, decrease the contrast by one degree; otherwise, increase by one degree until the color is the same as the bar color.&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br/&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11769</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11769"/>
		<updated>2025-03-13T15:27:58Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==titration rule==&lt;br /&gt;
In titration task:  we use 3-down-1-up to adjust the contrast, decrease the contrast by one degree if 3 consecutive correct responses happens. Increase the contrast by one degree if 1 incorrect response happens.&amp;lt;br/&amp;gt;&lt;br /&gt;
In the main task, we choose the slide window size as 15 trials and calculate the accuracy for the most recent 15 trials. If accuracy &amp;gt; 80%, decrease the contrast by one degree; otherwise, increase by one degree until the color is the same as the bar color.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br/&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=File:GuiltTaskVideo.gif&amp;diff=11749</id>
		<title>File:GuiltTaskVideo.gif</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=File:GuiltTaskVideo.gif&amp;diff=11749"/>
		<updated>2025-03-03T20:52:32Z</updated>

		<summary type="html">&lt;p&gt;Lingling: Lingling uploaded a new version of File:GuiltTaskVideo.gif&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11748</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11748"/>
		<updated>2025-03-03T20:38:17Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Timeline */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1500px heights=1200px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the instruction showing the end of the practice trial&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[5] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[6] reset the states and GUI&amp;lt;br&amp;gt; &lt;br /&gt;
[7] Choose the compensation/forgiveness level.&amp;lt;br&amp;gt; &lt;br /&gt;
[8] display the compensation/forgiveness that another player selects&amp;lt;br&amp;gt;&lt;br /&gt;
[9] The end of the game, shows the total score, compensation and average forgiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
[10] End: (Well done! You have finished all the trials.)&amp;lt;br&amp;gt; &lt;br /&gt;
[11] none, the initial value of the state.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=File:Guilty_task_time_line.png&amp;diff=11747</id>
		<title>File:Guilty task time line.png</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=File:Guilty_task_time_line.png&amp;diff=11747"/>
		<updated>2025-03-03T20:36:12Z</updated>

		<summary type="html">&lt;p&gt;Lingling: Lingling uploaded a new version of File:Guilty task time line.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11746</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11746"/>
		<updated>2025-03-03T17:15:17Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* PhaseNumber */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the instruction showing the end of the practice trial&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[5] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[6] reset the states and GUI&amp;lt;br&amp;gt; &lt;br /&gt;
[7] Choose the compensation/forgiveness level.&amp;lt;br&amp;gt; &lt;br /&gt;
[8] display the compensation/forgiveness that another player selects&amp;lt;br&amp;gt;&lt;br /&gt;
[9] The end of the game, shows the total score, compensation and average forgiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
[10] End: (Well done! You have finished all the trials.)&amp;lt;br&amp;gt; &lt;br /&gt;
[11] none, the initial value of the state.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11745</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11745"/>
		<updated>2025-03-03T17:09:12Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* PhaseNumber */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the instruction showing the end of the practice trial&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[5] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[6] reset the states and GUI&amp;lt;br&amp;gt; &lt;br /&gt;
[7] Choose the compensation/forgiveness level.&amp;lt;br&amp;gt; &lt;br /&gt;
[8] display the compensation/forgiveness that another player selects&lt;br /&gt;
[9] The end of the game, shows the total score, compensation and average forgiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
[10] End: (Well done! You have finished all the trials.)&amp;lt;br&amp;gt; &lt;br /&gt;
[11] none, the initial value of the state.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11744</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11744"/>
		<updated>2025-02-26T17:36:57Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* PhaseNumber */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the instruction showing the end of the practice trial&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[5] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[6] reset the states and GUI&lt;br /&gt;
[7] Choose the compensation/forgiveness level.&amp;lt;br&amp;gt; &lt;br /&gt;
[8] display the compensation/forgiveness that another player selects&lt;br /&gt;
[9] The end of the game, shows the total score, compensation and average forgiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
[10] End: (Well done! You have finished all the trials.)&amp;lt;br&amp;gt; &lt;br /&gt;
[11] none, the initial value of the state.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11724</id>
		<title>Contributions:CommunicationTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:CommunicationTask&amp;diff=11724"/>
		<updated>2025-01-28T22:12:31Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Timeline */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
The hyperscanning task is a turn-based communication game between two clients. This game aims to guess what the subject is in Sender&#039;s computer without talking. For each trial, the two players will alternate between the roles of Sender and Receiver. The Sender will describe traits of the subject presented by adjusting the two axes(Noisy or silent/Big or small). Then, the Receiver will guess if the Sender is describing the animal or object. After the Receiver makes a guess, both players receive feedback on whether the Receiver makes the correct guess. This marks the end of a trial.&lt;br /&gt;
&lt;br /&gt;
The two clients exchange information through the hyperScanning backend, which uses a client-server model to share the states. Each client has a separate state machine. The server only forwards the information between two clients. Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class, which is the parent class of the application module. For more information, please refer to the hyperScanning framework wiki page: https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning.&lt;br /&gt;
&lt;br /&gt;
==Video Overview==&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&amp;lt;youtube alignment=&amp;quot;center&amp;quot;&amp;gt;https://youtu.be/I1sSamSsTK4&amp;lt;/youtube&amp;gt;&lt;br /&gt;
&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=500px&amp;gt;&lt;br /&gt;
File:Hyperscanning pipe line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:Hyperscanning_1.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Anais Llorens (anaisllorens@hotmail.com) and  Athina Tzovara (athina.tzovara@unibe.ch) conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Max Marcus (bigmaxmarcus@gmail.com), Huiling Huang (huiling@neurotechcenter.org), and Sigurd Alnes (sigurd.alnes@unibe.ch) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:CommunicationTask batch.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====StimuliMatrix====&lt;br /&gt;
Shared parameter, matrix of stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImageReceiver and ImageSender(the path of images).&amp;lt;br&amp;gt;&lt;br /&gt;
2. Sender(the role of players),1 is the sender), 2 is the receiver.&amp;lt;br&amp;gt;&lt;br /&gt;
3. Jitter(the duration to present the role).&amp;lt;br&amp;gt;&lt;br /&gt;
4. CorrectResponse(1: left, 2:right).&amp;lt;br&amp;gt;&lt;br /&gt;
5. Training(1: training, 0: main task).&amp;lt;br&amp;gt;&lt;br /&gt;
6. Category(1: object, 2: animal).&amp;lt;br&amp;gt;&lt;br /&gt;
7. Difficulty(1: easy, 2: moderate, 3: hard).&amp;lt;br&amp;gt;&lt;br /&gt;
8. Dimension1a and Dimension1b(bar#1 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
9. Dimension2a and Dimension2b(bar#2 left text and right text).&amp;lt;br&amp;gt;&lt;br /&gt;
10. Option1 and Option2(left option text and right option text).&lt;br /&gt;
&lt;br /&gt;
====BreakTrialSequece====&lt;br /&gt;
The sequence of break trials, a break will happen after the break trial.&lt;br /&gt;
&lt;br /&gt;
====FeedbackDuration====&lt;br /&gt;
Duration of feedback(ITI). Indicate the receiver to make a correct or incorrect guess.&amp;lt;br&amp;gt;&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The server will generate the InitialTrialNumber and StimuliSequence, and save them into a parameter file named by IP addresses on the server. You don&#039;t need to worry about these two parameters. Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
====InitialTrialNumber====&lt;br /&gt;
The trial number to begin with. We provide the resume option, allowing clients to pause and resume the game from where they stop. After one of the clients quits the game, the server will discover it and save the current trial number and sequence. When the same clients(same IP address) reconnect the server again, the server will send the previous trial number to them. Otherwise, the InitialTrailNumber will be initialized by 0. Usually, you don&#039;t need to touch this parameter.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequence====&lt;br /&gt;
The sequence of stimuli(images). The server will generate a random stimuli sequence for every pair of clients (identified by the IP address).&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====StimuliWidth====&lt;br /&gt;
StimulusWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====InstructionWidth====&lt;br /&gt;
Instruction width in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====SliderWidth====&lt;br /&gt;
SliderWidth in percent of screen width (zero for original pixel size).&lt;br /&gt;
&lt;br /&gt;
====BarColor====&lt;br /&gt;
Color of the slider bar.&lt;br /&gt;
&lt;br /&gt;
====AxeActiveColor====&lt;br /&gt;
Color of active slider axe.&lt;br /&gt;
&lt;br /&gt;
====AxeInActiveColor====&lt;br /&gt;
Color of inactive slider axe.&lt;br /&gt;
&lt;br /&gt;
====DimensionFontColor====&lt;br /&gt;
Color of the text under the slider.&lt;br /&gt;
&lt;br /&gt;
====DimensionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====OptionFontActiveColor====&lt;br /&gt;
Color of the active options.&lt;br /&gt;
&lt;br /&gt;
====OptionFontInActiveColor====&lt;br /&gt;
Color of the inactive options.&lt;br /&gt;
&lt;br /&gt;
====OptionHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====RoleFontColor====&lt;br /&gt;
Color of the role text.&lt;br /&gt;
&lt;br /&gt;
====RoleHeight====&lt;br /&gt;
Height of text in percent of the screen height.&lt;br /&gt;
&lt;br /&gt;
====FeedbackWidth====&lt;br /&gt;
Width of feedback in percent of screen width.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the 10 slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] indicates the client is waiting for the other client to push the button to start the game. ( We are waiting for another player; once she/he is ready, we&#039;re ready to go!)&amp;lt;br&amp;gt; &lt;br /&gt;
[2] When the role text is present on the screen.(Sender or Receiver).&amp;lt;br&amp;gt; &lt;br /&gt;
[3] When the sliders and stimulus are present on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Feedback: After the receiver locks the answer, it comes to phase [4], showing whether the answer is correct.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]Break: (Well done! Are you ready for the next block? \n\n Press SPACEBAR)&amp;lt;br&amp;gt; &lt;br /&gt;
[6]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneValue===&lt;br /&gt;
Value of slider#1. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarTwoValue===&lt;br /&gt;
Value of slider#2. (32 bits)&lt;br /&gt;
&lt;br /&gt;
===BarOneActive, BarTwoActive===&lt;br /&gt;
0: slider is not selected.  1: slider is selected. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ResponseValue===&lt;br /&gt;
1: object.    2: animal. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===SenderLock, ReceiverLock===&lt;br /&gt;
0: client is moving the slider/making a guess. 1: client has locked the answer. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===isReadyStart0, isReadyStart1===&lt;br /&gt;
0: client isn&#039;t ready to start/resume/continue the game(not yet pushing the button).  1: client is ready to start/resume/continue the game(push the button). (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&lt;br /&gt;
&lt;br /&gt;
==Example==&lt;br /&gt;
The hyperscanning application module is almost the same as a BCI2000 application module, except that the typical BCI2000 module is inherited from ApplicationBase, and the hyperscanning application module is inherited from HyperscanningApplicationBase. Basically, the HyperscanningApplicationBase class is the same as ApplicationBase class with adding the communication with the server. So instead of using  Publish, Preflight, Process, etc. We are using SharedPublish, SharedPreflight, SharedProcess, etc. These methods behave in the exact same way, except they also call the client loops which interact with the server.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Communication_task_dualTask.h:&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
#include &amp;quot;ApplicationBase.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Slider.h&amp;quot;&lt;br /&gt;
#include &amp;lt;map&amp;gt;&lt;br /&gt;
#include &amp;lt;vector&amp;gt;&lt;br /&gt;
#include &amp;lt;string&amp;gt;&lt;br /&gt;
#include &amp;quot;TextStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;ImageStimulus.h&amp;quot;&lt;br /&gt;
#include &amp;quot;Shapes.h&amp;quot;&lt;br /&gt;
#include &amp;quot;HyperscanningApplicationBase.h&amp;quot;&lt;br /&gt;
&lt;br /&gt;
class Communication_task_dualTask : public HyperscanningApplicationBase&lt;br /&gt;
{&lt;br /&gt;
 public:&lt;br /&gt;
  Communication_task_dualTask();&lt;br /&gt;
  ~Communication_task_dualTask();&lt;br /&gt;
  void SharedPublish() override;&lt;br /&gt;
  void SharedPreflight( const SignalProperties&amp;amp; Input, SignalProperties&amp;amp; Output ) const override;&lt;br /&gt;
  void SharedInitialize( const SignalProperties&amp;amp; Input, const SignalProperties&amp;amp; Output ) override;&lt;br /&gt;
  void SharedAutoConfig( const SignalProperties&amp;amp; Input ) override;&lt;br /&gt;
  void SharedStartRun() override;&lt;br /&gt;
  void SharedProcess( const GenericSignal&amp;amp; Input, GenericSignal&amp;amp; Output ) override;&lt;br /&gt;
  void SharedStopRun() override;&lt;br /&gt;
  void SharedHalt() override;&lt;br /&gt;
&lt;br /&gt;
 private:&lt;br /&gt;
   //define your own private members here&lt;br /&gt;
   ApplicationWindow&amp;amp; mrDisplay;&lt;br /&gt;
&lt;br /&gt;
   //define your own private methods here&lt;br /&gt;
&lt;br /&gt;
};&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Manipulate the shared state is the same as the BCI2000 state. &amp;quot;isReadyStart1&amp;quot; is a shared state.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   State(&amp;quot;isReadyStart1&amp;quot;) = 1; // assign 1 to &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Get the value of the shared state &amp;quot;isReadyStart1&amp;quot;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
   //Both of the two players are ready, move to the next phase&lt;br /&gt;
   if (State(&amp;quot;isReadyStart0&amp;quot;) &amp;amp;&amp;amp; State(&amp;quot;isReadyStart1&amp;quot;)) {&lt;br /&gt;
            m_instruction_container-&amp;gt;Conceal();&lt;br /&gt;
            m_role_txt-&amp;gt;Conceal();&lt;br /&gt;
            my_phase = role_text;&lt;br /&gt;
            m_block_in_phase = 0;&lt;br /&gt;
   }&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11621</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11621"/>
		<updated>2024-10-02T18:40:57Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Response */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br/&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11620</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11620"/>
		<updated>2024-10-02T18:40:49Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* States */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: correct. &amp;lt;br\&amp;gt;&lt;br /&gt;
2: incorrect&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11618</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11618"/>
		<updated>2024-09-17T20:10:19Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* KeyDown, KeyUp, DCXX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX, PushButton===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11617</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11617"/>
		<updated>2024-09-17T20:08:59Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* KeyDown, KeyUp, DCXX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11616</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11616"/>
		<updated>2024-09-17T20:08:43Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* KeyDown, KeyUp, DCXX */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11615</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11615"/>
		<updated>2024-09-17T20:08:18Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* States */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;PushButton.&amp;quot; It registers when the software detects the keyboard or button push or release. There is a delay after the software detects the response, so the backup &amp;quot;PushButton&amp;quot; happens later than the actual keyboard or button response. You only need the backup &amp;quot;PushButton&amp;quot; when the &amp;quot;DCXX&amp;quot; or &amp;quot;KeyDown&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;. It registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup &amp;quot;Photodiode&amp;quot; happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11614</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11614"/>
		<updated>2024-09-16T21:06:42Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* PushButtonType */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier; the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;, it registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup Photodiode happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11613</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11613"/>
		<updated>2024-09-16T21:05:40Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* States */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier, the delay is minor, and can be ignored. Please confirm with the experimenter the variable name where the PushButtom is stored. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===KeyDown, KeyUp, DCXX===&lt;br /&gt;
Recording when the subject is pushing or releasing the button.&amp;lt;br/&amp;gt;&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&lt;br /&gt;
DC and analog: The push button is directly connected to the amplifier, so the delay is minor and can be ignored. Please confirm the variable name where the PushButtom is stored with the experimenter. The variable name varies with the channel the push button connects to through the amplifier. Usually, the variable name begins with &amp;quot;DC&amp;quot;; for example, &amp;quot;DC02&amp;quot;, the number &amp;quot;02&amp;quot; is the channel ID.&amp;lt;br/&amp;gt;&lt;br /&gt;
Keyboard: This usually has a tens of millisecond delay. When a key is pressed, &amp;quot;KeyDown&amp;quot; will be set to the key&#039;s [http://msdn.microsoft.com/en-us/library/ms927178.aspx &#039;&#039;virtual key code&#039;&#039;] at the corresponding sample position. When a key is released, the key code will be written into the &amp;quot;KeyUp&amp;quot; state variable.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;, it registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup Photodiode happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11612</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11612"/>
		<updated>2024-09-16T21:01:33Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===PushButtonType===&lt;br /&gt;
We provide 3 sources of pushbuttons: DC, analog, and keyboard.&amp;lt;br/&amp;gt;&lt;br /&gt;
DC and analog: the push button is directly connected to the amplifier, the delay is minor, and can be ignored. Please confirm with the experimenter the variable name where the PushButtom is stored. The variable name varies with the channel that the push button connects to through the amplifier.&amp;lt;br/&amp;gt;&lt;br /&gt;
keyboard: usually has tens of milliseconds delay.&lt;br /&gt;
&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;, it registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup Photodiode happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11611</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11611"/>
		<updated>2024-09-16T17:38:22Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Photodiode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &amp;lt;br/&amp;gt;&lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;, it registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup Photodiode happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11610</id>
		<title>Contributions:EglyDriverTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=Contributions:EglyDriverTask&amp;diff=11610"/>
		<updated>2024-09-16T17:37:57Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Photodiode */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=450px&amp;gt;&lt;br /&gt;
File:Egly_driver_Timeline.jpg|Figure 1: Single trial timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=600px&amp;gt;&lt;br /&gt;
File:Egly_driver_trial_types.jpg|Figure 2: Trial types&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1920px heights=1080px&amp;gt;&lt;br /&gt;
File:Egly driver visualize.gif&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
===FixationColor, BarColor, CueColor, TargetColor===&lt;br /&gt;
The color of the fixation, bar, cue, target.&lt;br /&gt;
&lt;br /&gt;
===BarThick===&lt;br /&gt;
The thickness of the bar.&lt;br /&gt;
&lt;br /&gt;
===FixationWidth===&lt;br /&gt;
The width of the fixation cross.&lt;br /&gt;
&lt;br /&gt;
===CueThick===&lt;br /&gt;
The thickness of the cue.&lt;br /&gt;
&lt;br /&gt;
===TargetWidth===&lt;br /&gt;
The width of the target.&lt;br /&gt;
&lt;br /&gt;
===FixationDurationMin, FixationDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the fixation phase.&lt;br /&gt;
&lt;br /&gt;
===BarDurationMin, BarDurationMax===&lt;br /&gt;
Minimum/Maximum duration of the bar phase.&lt;br /&gt;
&lt;br /&gt;
===CueDuration===&lt;br /&gt;
Duration of cue.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDurationMin, CueToTargetDurationMax===&lt;br /&gt;
Minimum/Maximum interval time between cue and target.&lt;br /&gt;
&lt;br /&gt;
===TargetDuration===&lt;br /&gt;
Duration of target.&lt;br /&gt;
&lt;br /&gt;
===PostTargetResponseTime===&lt;br /&gt;
The maximum time allows the subject to respond after the target disappears.&lt;br /&gt;
&lt;br /&gt;
===FeedbackDuration===&lt;br /&gt;
Duration of the feedback&lt;br /&gt;
&lt;br /&gt;
===TotalTrial===&lt;br /&gt;
Number of the total trials.&lt;br /&gt;
&lt;br /&gt;
===CatchTrialPerctg===&lt;br /&gt;
The percentage of the catch trial(no target)(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtMatchPerctg===&lt;br /&gt;
The percentage of the cue matches the target trial(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtSmObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the same object(%).&lt;br /&gt;
&lt;br /&gt;
===CueTgtDifObjctPerctg===&lt;br /&gt;
The percentage of the target mismatches the cue, on the different objects(%). Set as 0 when it is a simplified task.&lt;br /&gt;
&lt;br /&gt;
===ScreenWidth, ScreenHeight===&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
===EyeToSreenDistance===&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
===VisualAngle===&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastBy===&lt;br /&gt;
Adjust the contrast of the target color by: 0 overall accuracy, 1 match accuracy, 2 non-match accuracy.&lt;br /&gt;
&lt;br /&gt;
===AdjustContrastTrialNum===&lt;br /&gt;
The number of trials needed to calculate the accuracy for adjusting the contrast.&lt;br /&gt;
&lt;br /&gt;
===AccuracyUp===&lt;br /&gt;
The up boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===AccuracyLow===&lt;br /&gt;
The low boundary of the accuracy.&lt;br /&gt;
&lt;br /&gt;
===Simplified===&lt;br /&gt;
Enable the simplified version, only has two squares rather than two bars.&lt;br /&gt;
&lt;br /&gt;
===SquareLength===&lt;br /&gt;
The lenght of square in simplified version.&lt;br /&gt;
&lt;br /&gt;
===IsStairCase===&lt;br /&gt;
Enable the Staircase.&lt;br /&gt;
&lt;br /&gt;
===DownCounts===&lt;br /&gt;
Contrast decreases one step following the number of consecutive correct trials.&lt;br /&gt;
&lt;br /&gt;
===UpCounts===&lt;br /&gt;
Contrast increases one step following the number of consecutive incorrect trials.&lt;br /&gt;
&lt;br /&gt;
===ProgressBar===&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarHeight, ProgressBarWidth===&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
===ProgressBarBackgroundColor, ProgressBarForegroundColor===&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatch===&lt;br /&gt;
Display a photo diode patch on the stimulus window. Recording from a photo diode located on that patch will allow triggering on actual stimulus delivery (see User_Reference:P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
=== PhotoDiodePatchHeight, PhotoDiodePatchWidth===&lt;br /&gt;
Photo diode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchLeft, PhotoDiodePatchTop ===&lt;br /&gt;
Photo diode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchShape===&lt;br /&gt;
Photo diode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchActiveColor===&lt;br /&gt;
Photo diode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
===PhotoDiodePatchInactiveColor===&lt;br /&gt;
Photo diode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits)&lt;br /&gt;
0: none; 1: Beginning of the trial; 2: Fixation; 3: Bar; 4: Cue; 5: Cue to target; 6: Target; 7: Post target response; 8: Feedback.&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (16 bits)&lt;br /&gt;
&lt;br /&gt;
===BarDirection===&lt;br /&gt;
Main task: 1: Vertical; 2: Horizontal. &amp;lt;br/&amp;gt;&lt;br /&gt;
Simplified task: 1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===CuePosition, TargetPosition===&lt;br /&gt;
1: LeftTop; 2: RightTop; 3: RightBottom; 4: LeftBottom.&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: no target, catch trial;&amp;lt;br/&amp;gt; 2: cue target match; &amp;lt;br/&amp;gt;3:cue target don&#039;t match, on the same object;&amp;lt;br/&amp;gt;&lt;br /&gt;
4: cue target don&#039;t match,  on the different object;&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
Duration of the phase Fixation by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===BarDuration===&lt;br /&gt;
Duration of the phase Bar by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===CueToTargetDuration===&lt;br /&gt;
Duration of the phase CueToTargetDuration by the number of blocks.&lt;br /&gt;
&lt;br /&gt;
===TargetColor===&lt;br /&gt;
The color of the target. Represent in decimal numbers.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
The Photodiode is stored in the .bat file, and the name begins with &amp;quot;DC&amp;quot;. For example, &amp;quot;DC03&amp;quot;, the number after &amp;quot;DC&amp;quot; represents the channel number, because the photodiode is directly connected to the amplifier, the name depends on the hardware connection. Please confirm the name of the Photodiode with the experimenter before starting the analysis. &lt;br /&gt;
We also have a backup State called &amp;quot;Photodiode&amp;quot;, it registers when the software sends the command to hardware to present the stimulus or whenever we need to flash the photodiode. Between the software sending the command to the hardware actual response, there are roughly about 20 ms delays. So the backup Photodiode happens earlier than the actual photodiode flashes. You only need the backup Phtodiode when the &amp;quot;DCXX&amp;quot; is not available for some reason.&lt;br /&gt;
&lt;br /&gt;
1: active; &amp;lt;br/&amp;gt;&lt;br /&gt;
2: non-active&lt;br /&gt;
&lt;br /&gt;
==See also==&lt;br /&gt;
[[Contributions:Applications]]&lt;br /&gt;
[[Category:Contributions]][[Category:User Application]]&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11518</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11518"/>
		<updated>2024-08-14T16:53:53Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* InstructionPathVicT= */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the instruction showing the end of the practice trial&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[5] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[6] Choose the compensation/forgiveness level.&amp;lt;br&amp;gt; &lt;br /&gt;
[7] The end of the game, shows the total score, compensation and average forgiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
[8] End: (Well done! You have finished all the trials.)&amp;lt;br&amp;gt; &lt;br /&gt;
[9] none, the initial value of the state.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11517</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11517"/>
		<updated>2024-08-14T16:53:47Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* InstructionPathTrans= */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT=====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the instruction showing the end of the practice trial&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[5] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[6] Choose the compensation/forgiveness level.&amp;lt;br&amp;gt; &lt;br /&gt;
[7] The end of the game, shows the total score, compensation and average forgiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
[8] End: (Well done! You have finished all the trials.)&amp;lt;br&amp;gt; &lt;br /&gt;
[9] none, the initial value of the state.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11516</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11516"/>
		<updated>2024-08-14T16:53:11Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans=====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT=====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the instruction showing the end of the practice trial&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[5] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[6] Choose the compensation/forgiveness level.&amp;lt;br&amp;gt; &lt;br /&gt;
[7] The end of the game, shows the total score, compensation and average forgiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
[8] End: (Well done! You have finished all the trials.)&amp;lt;br&amp;gt; &lt;br /&gt;
[9] none, the initial value of the state.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11504</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11504"/>
		<updated>2024-08-09T16:22:43Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* PhaseNumber */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans=====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT=====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the instruction showing the end of the practice trial&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[5] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[6] Choose the compensation/forgiveness level.&amp;lt;br&amp;gt; &lt;br /&gt;
[7] The end of the game, shows the total score, compensation and average forgiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
[8] End: (Well done! You have finished all the trials.)&amp;lt;br&amp;gt; &lt;br /&gt;
[9] none, the initial value of the state.&amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11503</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11503"/>
		<updated>2024-08-09T16:22:13Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* States */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans=====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT=====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;be&amp;gt; &lt;br /&gt;
[1] present the instruction showing the end of the practice trial&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[5] Display the outcome.&amp;lt;be&amp;gt; &lt;br /&gt;
[6] Choose the compensation/forgiveness level.&amp;lt;be&amp;gt; &lt;br /&gt;
[7] The end of the game, shows the total score, compensation and average forgiveness.&amp;lt;br&amp;gt; &lt;br /&gt;
[8] End: (Well done! You have finished all the trials.)&lt;br /&gt;
[9] none, the initial value of the state.&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11502</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11502"/>
		<updated>2024-08-09T16:16:45Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* States */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans=====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT=====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===Shared State===&lt;br /&gt;
&lt;br /&gt;
====isReadyStart0, isReadyStart1====&lt;br /&gt;
Check if client0/client1 is ready to move to the next phase or trial.&lt;br /&gt;
&lt;br /&gt;
====ClientNumber====&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
====Compensation====&lt;br /&gt;
The compensation that the transgressor gives in each trial&lt;br /&gt;
&lt;br /&gt;
====Forgiveness====&lt;br /&gt;
The forgiveness that the victim gives in each trial&lt;br /&gt;
&lt;br /&gt;
===Local State===&lt;br /&gt;
====PhaseNumber====&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
====TrialNumber====&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====TrialType====&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====StimulusCode====&lt;br /&gt;
The id of the stimulus in each trial&lt;br /&gt;
&lt;br /&gt;
====ResponseValue====&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
====FixationDuration====&lt;br /&gt;
The duration of the fixation phase in each trial.&lt;br /&gt;
&lt;br /&gt;
====Photodiode====&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11501</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11501"/>
		<updated>2024-08-09T16:09:53Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Parameters */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====MyStimuliSequence====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====StimuliSequencePractice====&lt;br /&gt;
Practice trial stimuli sequence&lt;br /&gt;
&lt;br /&gt;
====InstructionPathTrans=====&lt;br /&gt;
Transgressor instruction image path&lt;br /&gt;
&lt;br /&gt;
====InstructionPathVicT=====&lt;br /&gt;
Victim instruction image path&lt;br /&gt;
&lt;br /&gt;
====FeedbackPathList====&lt;br /&gt;
Feedback icon path list&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
====TrialSequece1, TrialSequece2====&lt;br /&gt;
There are two sequences of trial types, for each experiment, we can run them alternatively, we can specify the sequence through the Parameter &amp;quot;TrialTypeSequenceID&amp;quot;.&amp;lt;br&amp;gt;&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationList====&lt;br /&gt;
Duration of Fixation(ITI) list.&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
====CompensationDuration====&lt;br /&gt;
The duration to display the compensation.&lt;br /&gt;
&lt;br /&gt;
====EnablePractice====&lt;br /&gt;
Enable the practice trial or not&lt;br /&gt;
&lt;br /&gt;
====StartPoints====&lt;br /&gt;
The initial total points of the game&lt;br /&gt;
&lt;br /&gt;
====GuessDots====&lt;br /&gt;
INstruction of the guessing the number of the dots&lt;br /&gt;
&lt;br /&gt;
====DotsNumber====&lt;br /&gt;
Guess the number of dots is greater or less than the &amp;quot;DotsNumber&amp;quot;, &amp;quot;DotsNumber&amp;quot; is the number to be compared with.&lt;br /&gt;
&lt;br /&gt;
====optionOne, optionTwo====&lt;br /&gt;
guess option one/two, for example &amp;quot;Greater&amp;quot; and &amp;quot;Less&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====CompensationQuestion====&lt;br /&gt;
Instruction of compensation phase&lt;br /&gt;
&lt;br /&gt;
====CompensationOne, CompensationTwo, CompensationThree, CompensationFour====&lt;br /&gt;
Compensation options&lt;br /&gt;
&lt;br /&gt;
====ForgivenessQuestion====&lt;br /&gt;
Instruction of forgiveness phase&lt;br /&gt;
&lt;br /&gt;
====ForgivenessOne, ForgivenessTwo, ForgivenessThree, ForgivenessFour====&lt;br /&gt;
Forgiveness options&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====FontActiveColor====&lt;br /&gt;
Color of the active font(be selected)&lt;br /&gt;
&lt;br /&gt;
====GUIScale====&lt;br /&gt;
Scale the GUI, 1 is maximum, 0 is minimium&lt;br /&gt;
&lt;br /&gt;
====TrialTypeSequenceID====&lt;br /&gt;
Specify the trial type sequence, see Parameter &amp;quot;TrialSequece1 and TrialSequece2&amp;quot;&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
The duration of fixation.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=File:GuiltTaskVideo.gif&amp;diff=11500</id>
		<title>File:GuiltTaskVideo.gif</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=File:GuiltTaskVideo.gif&amp;diff=11500"/>
		<updated>2024-08-09T15:27:06Z</updated>

		<summary type="html">&lt;p&gt;Lingling: Lingling uploaded a new version of File:GuiltTaskVideo.gif&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11499</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11499"/>
		<updated>2024-08-09T15:22:35Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Visual Representation */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=800px heights=450px&amp;gt;&lt;br /&gt;
File:GuiltTaskVideo.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====StimuliSequece====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====TrialSequece====&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationMax, FixationDurationMin====&lt;br /&gt;
Maximum and minimum Duration of Fixation(ITI).&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====ScreenWidth, ScreenHeight====&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
====EyeToSreenDistance====&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
====VisualAngle====&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
The duration of fixation.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=File:GuiltTaskVideo.gif&amp;diff=11498</id>
		<title>File:GuiltTaskVideo.gif</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=File:GuiltTaskVideo.gif&amp;diff=11498"/>
		<updated>2024-08-09T15:20:54Z</updated>

		<summary type="html">&lt;p&gt;Lingling: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11497</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11497"/>
		<updated>2024-08-09T14:02:06Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* Timeline */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1200px heights=700px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:xx.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====StimuliSequece====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====TrialSequece====&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationMax, FixationDurationMin====&lt;br /&gt;
Maximum and minimum Duration of Fixation(ITI).&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====ScreenWidth, ScreenHeight====&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
====EyeToSreenDistance====&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
====VisualAngle====&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
The duration of fixation.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=File:Guilty_task_time_line.png&amp;diff=11496</id>
		<title>File:Guilty task time line.png</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=File:Guilty_task_time_line.png&amp;diff=11496"/>
		<updated>2024-08-09T14:00:41Z</updated>

		<summary type="html">&lt;p&gt;Lingling: Lingling uploaded a new version of File:Guilty task time line.png&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11398</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11398"/>
		<updated>2024-06-18T19:58:28Z</updated>

		<summary type="html">&lt;p&gt;Lingling: /* InstructionImagesSeque */&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1000px heights=500px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:xx.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====StimuliSequece====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====TrialSequece====&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSequence====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationMax, FixationDurationMin====&lt;br /&gt;
Maximum and minimum Duration of Fixation(ITI).&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====ScreenWidth, ScreenHeight====&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
====EyeToSreenDistance====&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
====VisualAngle====&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
The duration of fixation.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
	<entry>
		<id>https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11397</id>
		<title>GuiltTask</title>
		<link rel="alternate" type="text/html" href="https://www.bci2000.org/mediawiki/index.php?title=GuiltTask&amp;diff=11397"/>
		<updated>2024-06-13T16:41:27Z</updated>

		<summary type="html">&lt;p&gt;Lingling: &lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;==Synopsis==&lt;br /&gt;
In the interpersonal task, you will team up with another participant in a different room (referred to as “partner”). You do not know each other before, and you will not see each other after the task. &lt;br /&gt;
During this task, the two of you will complete multiple rounds of “dot-estimation” together. Specifically, both you and the partner will see an array of white dots scattered on the screen. Your task is to estimate the total number of these dots. &lt;br /&gt;
After the dots disappear, you will see a number on the screen. Now you need to guess whether the number of dots you just saw is greater or smaller than the number on the screen. If you think the number of dots is smaller than the number on the screen, then press the left arrow button to select “Smaller”; if you think the number of dots is larger than the number on the screen, then press the right arrow button to select “Greater”. You will need to make the choice within 3 seconds, otherwise your responses will be recorded as “incomplete” will be reminded to respond faster next round.&lt;br /&gt;
&lt;br /&gt;
==Timeline==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=1000px heights=500px&amp;gt;&lt;br /&gt;
File:Guilty_task_time_line.png|Figure 1: Single Trial Timeline.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Visual Representation ==&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=750px heights=421px&amp;gt;&lt;br /&gt;
File:xx.gif|Figure 2: Visual Representation&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Versioning==&lt;br /&gt;
===Authors===&lt;br /&gt;
Hongbo Yu &amp;lt;hongbo.yu@psych.ucsb.edu&amp;gt; and Shuo Wang &amp;lt;wangshuo45@gmail.com&amp;gt; conceived this paradigm. &amp;lt;br&amp;gt;&lt;br /&gt;
Huiling Huang (huiling@neurotechcenter.org) implemented the paradigm into BCI2000. &amp;lt;br&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Set up==&lt;br /&gt;
===Deploy the Server===&lt;br /&gt;
You will need a Linux or macOS computer to run the server. Currently, the Windows OS is not supported. The following steps are for deploying the server on the local network. If you want to deploy the server on AWS, please refer to https://www.bci2000.org/mediawiki/index.php/BCI2000_Hyperscanning#Important_Notes_2.&amp;lt;br&amp;gt;&lt;br /&gt;
First, please ensure all the computers are connected to the same local network. Then open the terminal(Mac OS or Linux) and run the command below to clone the server code from GitHub.&lt;br /&gt;
&amp;lt;pre&amp;gt;git clone https://github.com/MaxwellMarcus/hyperscanning-backend&amp;lt;/pre&amp;gt;&lt;br /&gt;
Go the hyperscanning directory&lt;br /&gt;
&amp;lt;pre&amp;gt;cd hyperscanning&amp;lt;/pre&amp;gt;&lt;br /&gt;
Compile the project by&lt;br /&gt;
&amp;lt;pre&amp;gt;make -B&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot;  widths=600px heights=350px&amp;gt;&lt;br /&gt;
File:CommunicationTask server set up.png|Figure 3: Download and Compile the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
Run the server with&lt;br /&gt;
&amp;lt;pre&amp;gt;./application&amp;lt;/pre&amp;gt;&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=100px&amp;gt;&lt;br /&gt;
File:CommunicationTask_server_launched.png|Figure 4: Launch the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
The application will only run as long as the experiment and will have to be restarted.&lt;br /&gt;
&lt;br /&gt;
===Batch File===&lt;br /&gt;
The batch file is located in ./batch/CommunicationTask.bat. &lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=200px&amp;gt;&lt;br /&gt;
File:xxx.png|Figure 5: Batch File.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Unlike the normal bci2000 task, we define the shared states in the batch file(line 35) by beginning with&amp;quot;--SharedStates=&amp;quot;. The form is:&lt;br /&gt;
&amp;lt;pre&amp;gt;--SharedStates=&amp;lt;state-1&amp;gt;,&amp;lt;state-1-size&amp;gt;&amp;amp;&amp;lt;state-2&amp;gt;,&amp;lt;state-2-size&amp;gt;&amp;amp;&amp;lt;state-3&amp;gt;,&amp;lt;state-3-size&amp;gt;...&amp;lt;/pre&amp;gt;&lt;br /&gt;
IPAddress and Port indicate the server computer.&lt;br /&gt;
&lt;br /&gt;
===Run the experiment on the client computer===&lt;br /&gt;
Go to the./batch, find the &amp;quot;CommunicationTask.bat&amp;quot;, and double click it. After pushing &amp;quot;Set Config,&amp;quot; the BCI2000 will try to connect the server. If it successfully connects to the server, the System Log will print &amp;quot;Connected to server.&amp;quot; If only one client connects to the server, the &amp;quot;Start&amp;quot; button in the operator will turn gray until another client connects.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=600px heights=400px&amp;gt;&lt;br /&gt;
File:Launch_the_experiment.gif|Figure 6: Launch the BCI2000.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Troubleshooting==&lt;br /&gt;
After you quit the server from the terminal and restart it again, you might see this error message. That means the server is still running. You need to kill the &amp;quot;application&amp;quot; process.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;gallery mode=&amp;quot;packed&amp;quot; widths=400px heights=300px&amp;gt;&lt;br /&gt;
File:Kill server.png|Figure 7: Kill the Server.&lt;br /&gt;
&amp;lt;/gallery&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==Parameters==&lt;br /&gt;
There are two kinds of parameters: shared and local. The shared parameter is the one you want to synchronize between two clients, like the stimulus sequence, the sequence of break trials you wish to take a break after this trial, etc. It should be saved on the server as a parameter file and passed to the clients through messages as a parameter. The local parameter is that you want to customize the parameter locally, like GUI. The local parameter is the regular BCI2000 parameter file saved under the local BCI2000 project folder.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Shared Parameters===&lt;br /&gt;
You must upload the parameters below to the server as a parameter file. When the client connects to the server, it will automatically download the parameter file from the server and save it locally. You can indicate the download path in the Application tab, ParamterPath. Please do not modify the parameter file. Otherwise, the synchronization between two clients can&#039;t be guaranteed.&lt;br /&gt;
&lt;br /&gt;
====Stimuli====&lt;br /&gt;
Shared parameter, stimulus information, including:&amp;lt;br&amp;gt;&lt;br /&gt;
1. ImagePath(the path of dots images).&lt;br /&gt;
&lt;br /&gt;
====StimuliSequece====&lt;br /&gt;
The sequence of dots images.&lt;br /&gt;
&lt;br /&gt;
====TrialSequece====&lt;br /&gt;
Sequence of trial type.&amp;lt;br&amp;gt;&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
====InstructionImagesSeque====&lt;br /&gt;
The sequence of instruction images path.&lt;br /&gt;
&lt;br /&gt;
====FixationDurationMax, FixationDurationMin====&lt;br /&gt;
Maximum and minimum Duration of Fixation(ITI).&lt;br /&gt;
&lt;br /&gt;
====DotsDuration====&lt;br /&gt;
Duration of displaying the dots&lt;br /&gt;
&lt;br /&gt;
====ResponseDuration====&lt;br /&gt;
The maximum time allows the subject to make a response.&lt;br /&gt;
&lt;br /&gt;
====OutcomeDuration====&lt;br /&gt;
The duration to display the outcome.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Unlike the parameters described above, they are saved on the server rather than on local computers.&lt;br /&gt;
&lt;br /&gt;
===Local Parameters===&lt;br /&gt;
&lt;br /&gt;
====FontSize, FixationSize====&lt;br /&gt;
Font/Fixation size.&lt;br /&gt;
&lt;br /&gt;
====FontColor, FixationColor====&lt;br /&gt;
Color of the font/fixation.&lt;br /&gt;
&lt;br /&gt;
====ScreenWidth, ScreenHeight====&lt;br /&gt;
Width/height of the monitor screen in cm.&lt;br /&gt;
&lt;br /&gt;
====EyeToSreenDistance====&lt;br /&gt;
Distance from the subject&#039;s eyes to the screen in cm.&lt;br /&gt;
&lt;br /&gt;
====VisualAngle====&lt;br /&gt;
The degrees of visual angle.&lt;br /&gt;
&lt;br /&gt;
====ProgressBar====&lt;br /&gt;
Display progress bar.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarHeight, ProgressBarWidth====&lt;br /&gt;
Progress bar height/width in pixels.&lt;br /&gt;
&lt;br /&gt;
====ProgressBarBackgroundColor, ProgressBarForegroundColor====&lt;br /&gt;
Color of progress bar background/foreground.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatch====&lt;br /&gt;
Display a photodiode patch on the stimulus window. Recording from a photodiode located on that patch will allow triggering on actual stimulus delivery (see User_Reference: P3TemporalFilter#OnsetExpression).&lt;br /&gt;
&lt;br /&gt;
==== PhotoDiodePatchHeight, PhotoDiodePatchWidth====&lt;br /&gt;
Photodiode patch height/width in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchLeft, PhotoDiodePatchTop ====&lt;br /&gt;
Photodiode patch left/top position in relative coordinates (between 0 and 1).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchShape====&lt;br /&gt;
Photodiode patch shape: 0 rectangle, 1 ellipse.&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchActiveColor====&lt;br /&gt;
Photodiode patch color when active (RGB color in format 0xrrggbb).&lt;br /&gt;
&lt;br /&gt;
====PhotoDiodePatchInactiveColor====&lt;br /&gt;
Photodiode patch color when inactive, (RGB color in format 0xrrggbb, use 0xff000000 for transparent).&lt;br /&gt;
&lt;br /&gt;
==States==&lt;br /&gt;
Shared states are converted to BCI2000 states asynchronously through events using the HyperscanningApplicationBase class. We declared shared states in the batch file as &amp;quot;--SharedStates=state1_name,state1_size&amp;amp;state2_name,state2_size&amp;amp;...&amp;quot;, which is appended to the end of the application module.&lt;br /&gt;
&lt;br /&gt;
===PhaseNumber===&lt;br /&gt;
The index of phase in each trial. (8 bits) &amp;lt;br&amp;gt;  &lt;br /&gt;
[0] indicates the instruction at the beginning of the experiment. (When the slides instruction images are present on the screen)&amp;lt;br&amp;gt; &lt;br /&gt;
[1] present the fixation on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[2] present the dots on the screen.&amp;lt;br&amp;gt; &lt;br /&gt;
[3] The subject estimates the number of dots.&amp;lt;br&amp;gt; &lt;br /&gt;
[4] Display the outcome.&amp;lt;br&amp;gt; &lt;br /&gt;
[5]End: (Well done! You have finished all the trials.)&lt;br /&gt;
&lt;br /&gt;
===TrialNumber===&lt;br /&gt;
Index of trials. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===TrialType===&lt;br /&gt;
1: both correct&amp;lt;br&amp;gt;&lt;br /&gt;
2: victim incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
3: transgressor incorrect&amp;lt;br&amp;gt;&lt;br /&gt;
4: both incorrect&lt;br /&gt;
&lt;br /&gt;
===Response===&lt;br /&gt;
1: greater.    2: smaller. (8 bits)&lt;br /&gt;
&lt;br /&gt;
===ClientNumber===&lt;br /&gt;
The client’s ID, is assigned by the server. Either 0 or 1. (8 bits)&amp;lt;br&amp;gt;&lt;br /&gt;
0: Transgressor.    1: Victim&lt;br /&gt;
&lt;br /&gt;
===FixationDuration===&lt;br /&gt;
The duration of fixation.&lt;br /&gt;
&lt;br /&gt;
===Photodiode===&lt;br /&gt;
1: active;&lt;br /&gt;
2: non-active&lt;/div&gt;</summary>
		<author><name>Lingling</name></author>
	</entry>
</feed>