oTree

Testing oTree in devserver

In my oTree testing setup I embeded two handy AppleScripts

First, I created two applications to easily switch between 2K and 4K resolutions.

Once set to 4K (first script), I can run the "Test oTree" app (second script) and split the screen into four windows. Each window can represent a player or a group of players.

The result from the second app is shown in the following picture. Note that all sessions must have the same ID, and the delay must be set according to your laptop's speed. You can now hold cmd + click on the wide link to open as many tabs as you need in each window. In my case, I have sixteen participants divided into four groups and four treatments, and I can easily test a session with many players without losing too much control.

Dropout detection in oTree

In oTree you can play with timeouts to replace dropout players with bots, as suggested in the oTree documentation.

However, this works only when a player fails to submit the page. 

If your page is subject to a timeout already, and you want the timeout to be always triggered (e.g., in a two-minutes slider task), then you can use Java Script to detect the window closure of dropout participants. Here I propose a handy solution to do that.

You can put the following JavaScript into your html page using <script></script>. The script detects when a page is showing on the player's monitor or not.

If the participant closes their browser, the variable js_pagehide updates to true. Only when the player (or you) opens the page again, then the variable turns back to the false state.

You can now use live methods in your .py file to receive and send signals from clients to the server through the JS. If time runs out and a participant leaves, you can tick it as a dropout. That participant will be auto-advanced by the server, and you can substitute him or her with a bot that plays according to an existing empirical distribution of the same game or, if you already collected sufficient observations, according to the data you collected.