Online Behavioral Experiments Happening With nodeGame and Node.js


The goal of social science research is to discover fundamental features of human behavior. There are many different approaches to discover this, but one of the best approaches is through games. How do researches implement these types of games and what technologies are most appropriate to help them gather the research that they need to discover why humans behave like we do?

In advance of Node.js Interactive, to be held November 28 – December 2 in Austin, we talked with Stefano Balietti, postdoc at Northeastern Network Science Institute and fellow at Harvard Institute of Quantitative Social Science, about nodeGame, a framework in Node.js to create and manage real-time and discrete-time synchronous behavioral experiments. In this interview, he discusses why he chose Node.js for his game-based research, other research projects using Node.js, and what impact it could have on science in the future.

Stefano Balietti, postdoc at Northeastern Network Science Institute and fellow at Harvard Institute of Quantitative Social Science Can you give us a little background on how you came into working in social science and took an interest in scientific behavioral experiments?

Stefano Balietti: Well, this is a good question. I am not quite sure… Maybe my interest in behavioral experiments came out because I played too many video games as a kid, or because I believe that playing is the best way to learn. There is a famous quote — that we printed also in our Network Science lab t-shirts — that says, “Play is the highest form of research.”

I think it’s true.

Behavioral experiments are a wonderful way of inferring how people actually think and act accordingly. In other words, if you need to know what the real preferences and beliefs of a group of people are, most of the time the best way is not by asking them (because they might not actually know, or might be reluctant to say), but it is by putting them in a situation that replicates the problem at study.  

When we compare their behavior in an analogous situation, where only one situational variable (out of many) is changed, we can then determine the role of the variable, the causal mechanism, that the variable shapes in determining behavior. What is nodeGame? Why did you decide to use Node.js to help you with your research?

Stefano Balietti: nodeGame is a platform with an API for creating and running behavioral experiments in the browser, online or in a university lab. It uses Express.js as the HTTP server, and as a real-time transport mechanism for all game messages. It helps developers with automated requirements and waiting rooms; define the game sequence; handle players’ disconnections and reconnections; and more! If you want more details, check out this site.

I came from a background of PHP/MySQL applications and also did a couple of Drupal modules. However, when working with these technologies, I always needed better performance.

One day (a few years ago), I read an article in The Register talking about this new technology called Node.js. It emphasized that it was particularly good for dealing with many async requests.

I didn’t try Node.js straightway, but the article somehow got stuck in my mind. After a few months, in my research group we decided to run a new experiment about creativity and how competition affects it. The design we had in mind was more complex than traditional behavioral experiments in the social science, and would have been difficult to run with standard experimental software available that was available at the time.

I decided to implement it in Node.js. At the time, I had only a basic knowledge of JavaScript so that was quite a risky move. Eventually, it turned out to be a very good choice. Especially given that Node.js is fairly easy to learn when you know JavaScript and there were also so many software packages available, which made the first installation and setup of web server with websockets fairly easy. I was able to create a prototype in a relatively short time, run the experiment in the lab, create a follow up to run online, and finally the article was published in highly reputed scientific journal.

From there, I expanded the platform, made it more general, started writing documentation, wrote an interface to connect to Amazon Mechanical Turk, etc. Now we have nodeGame version 3.0, and other researchers have used it to their own studies as well. Do you see Node.js helping other people that are in behaviorial research?

Stefano Balietti: Node.js could really have an enormous impact with behavioral research. Mainly because funding in academia are generally much more limited than in industry, and given that Node.js is open source, this helps with the cost. Not to mention, it can achieve very high performance with relative low use of resources, if people know how to program it correctly. Why is Node.js a good platform to use in the world of science?

Stefano Balietti: Node.js is currently not yet used to its full potential in the world of science, in my opinion. Python at the moment has a larger user base, mainly due to the many scientific packages that are available out there for data-mining and machine-learning, but also for matrix calculus. Furthermore, in academia curricula, there are more Python courses than Node.js/JavaScript, so researchers (like myself) would have to learn a new language. This creates a small barrier.

However, Node.js is catching up as they are beginning to offer more scientific packages, and it has an edge on all web based application. Specially, when you need to create a virtual space where many individuals need to interact, like crowd-sourced research like prediction markets or Citizen Science platforms, which are both promising and trending right now. Node.js is very reliable and can scale pretty easily, with limited costs. I see a large potential of expansion here.

View the full schedule to learn more about this marquee event for Node.js developers, companies that rely on Node.js, and vendors. Or register now for Node.js Interactive.