with human participants.
1.1 Related Works
PsychoPy (Peirce, 2007; Peirce, 2009) is a Python
based open source software tool to build experiments
with frame accurate timing for psychophysics type ex-
periments. PsychoPy is cross platform and runs on
Windows, Mac OS and Linux. It uses OpenGL for
fast 2D graphics, supports multiple monitors, moni-
tor calibration and includes many standard visual and
auditory stimuli. PsychoPy also supports many exter-
nal devices such as response boxes, parallel and serial
ports, eye trackers, and more.
PsychoJS is a recent initiative to bring PsychoPy
functionality to the web browser using JavaScript and
pixi.js and WebGL for high-performance 2D rendering
in the browser.
One of the most used tools for this type of exper-
iments has been the Z
¨
urich Toolkit for Readymade
Economic Experiments: z-Tree (Fischbacher, 2007).
z-Tree runs on Windows computers and employs a
client-server architecture, with a client application
called z-Leaf and a server application called z-Tree.
The programming model of z-Tree is somewhat id-
iosyncratic, using a spreadsheet like construct called
tables which holds most variables and where scoping
rules and the scoping operator controls referencing
variables from other tables.
A recent alternative is oTree (Chen et al., 2016)
which is an open source Python based solution, which
like z-Tree is a client-server architecture, that uses a
web browser as the client through Django. This has the
advantage that experiments can run on most platforms
in the lab, online and in the field.
Experimental Tribe, or XTribe (Caminiti et al.,
2013) is a web platform for programming and advertis-
ing so-called games with a purpose or citizen science
games, through the Xtribe web site. Xtribe function-
ality is similar to oTree, but is tied to the Xtribe plat-
form, which also serves to recruit participants. Game
backends (called game managers) in Xtribe can be
programmed in PHP, JavaScript (node.js), Python or
JSP.
The most recent addition to the family of
browser-based multi-participant experiment platforms
is nodeGame (Balietti, 2016), which uses JavaScript
for both client and server. nodeGame has many of
the same features as oTree and XTribe and is built on
node.js.
A system for real-time multiplayer experiments on
the web including a physics engine (Hawkins, 2015)
has also been developed. The system, called MWERT,
is also based on node.js, and uses the HTML 5 can-
vas to display client-side graphics. It also includes a
physics engine, so that players position in a virtual
world can be used in experiments.
The solution described in the present paper gives
researchers a way to develop real-time multi partici-
pant experiments using a widely used programming
language (Python) in a flexible manner. In this regard
it is similar to oTree, nodeGame, Xtribe and MWERT,
although unlike these solutions it is not web based.
This is a deliberate design, although when develop-
ment of the present solution was started the author had
no knowledge of these other solutions, most of which
have only recently been published. It seems that most
of these related works were developed in parallel with
little or no knowledge of the other solutions.
2 SOLUTION
This paper describes a solution that was needed for
several novel experiment designs at Cognition and Be-
havior Lab at Aarhus University in late 2014. At the
time, no existing solution was found to satisfy all the
requirements needed for these designs, which included
the ability to embed players in different (social) net-
work topologies, real-time interaction between players,
interactive graphics and use of audio, use of server-side
calculations, and the ability to mix human participants
and software agents.
Since multiple projects had similar requirements,
and in the interest of being able re-use the solution for
future projects, a general solution was sought. Cog-
nition and Behavior Lab is an interdisciplinary lab
used by researchers from several disciplines at Aarhus
University, including, but not limited to psychology,
economics, cognitive science, marketing, political sci-
ence, neuroscience, and linguistics. As a consequence
many different platforms for developing behavioral
experiments are used, but open source platforms have
become increasingly popular – chiefly among these is
PsychoPy (Peirce, 2007). Part of the infrastructure at
Cognition and Behavior Lab is the Computer-based
Interaction Lab, with 33 computers. These computers
have PsychoPy installed, and many of the researchers
using the lab and programming their own experiments
are well versed in Python. A wide variety of experi-
ments have used PsychoPy
1
in a range of different dis-
ciplines. For this reason it was decided to implement
the initial solution in Python. With a local user-base
of lab researchers and research assistants who could
1
At the time of writing the two main PsychoPy pub-
lications (Peirce, 2007; Peirce, 2009) had 1130 citations,
according to Google Scholar.
Studying Complex Interactions in Real Time: an XMPP-based Framework for Behavioral Experiments
131