Scaling the Minecraft Game for studying Human Behavior

I’ve created a game in Minecraft for testing human exploration in indoor environments. It’s available for playing at . Please go ahead and give it a try if you have a minecraft account and want to play Minecraft for Science . Or if you’re the competitive sort, try to get on the leaderboard.


It’s been more than a year since my last post on how I created the game. Since then, I’ve got some very basic results from it with students in NTU playing. However, it was surprisingly hard to get people and I had to host it online to get enough data. It took a while to get funding approved and stuff but finally I’ve managed to host my experiment on Amazon. In this post, I’ll try to describe the things I had to do since my last post to get this to work.

What I’d already done:

A short version of what I explained in my last post: I’d created an adventure of sorts in Minecraft where players get spawned at one location, follow instructions to explore a three storey building and then complete a few tasks. On disconnecting from the server (manually), all the data of the actions of the player is written to a MySQL server. I analyse this data in the hope of finding a cure for cancer. And this is what I had to do for that:

Step 1 : Shutting down the server automatically

I can’t believe how long it took me to do this, but it ended up being quite simple with my modified statistician plugin simply sending a shutdown command to the server once the player completed the last task.

Step 2: Starting on request

Next, I used Python’s brilliant twisted framework to write a simple server program that would listen for connections and start a tekkit server when such a request was received. To test things out I created a simple client side script also that simply sent the username. The database would be queried for existing attempts and the unique id consisting of the username and attempt number was created to store it in the database.

TO start and stop the server I used this handy little script: .

Step 3: Hosting the server and scripts on AWS

Now that I had this simple set up working I got an amazon EC2 machine and a MySQL database and copied all my server files and scripts there. Instructions on how to do this are easily available on googling and quite straightforward to follow.

If anyone’s trying to copy a Tekkit server from a Windows to a linux machine, remember that you have to download the Tekkit server on the machine separately and just copy the world files (as opposed to trying to copy the whole folder there).

Step 4: Final Touches

Now that I had most of this working, I added a new page and with some simple python and javascript and a bit of effort in beautifying things, I was able to send requests to play from my website to the EC2 server and play.

I also made the server a white listed server with the white list being created on a person signing up. Finally, I put a time out on the server that would shut down the spawned tekkit server after an hour so that the experiment didn’t stop simply because someone started the server and didn’t play.

The end results of all this are there for all to see at .


Final Comments

I didn’t go to as much detail as I wanted simply because I don’t have the time to write in detail. I’ll try to share all the scripts and stuff I wrote on my GitHub page once I get time to clean it up a bit. In the mean time, if anyone’e curious to know more about any part of the process, do ask.

Also, if you play minecraft and have a minecraft account or know anyone who does, please go to and play minecraft for science 🙂

Each Tekkit server with all the plugins I have require about 3G of memory, so it’s expensive to get more than the one EC2 instance that I have now and making a proper queueing system that emails people when the server is available will take a lot of effort so as of now, only one player can play at a time and someone else who requests while the one player is playing will simply have to wait and check back later.

I’m working on a paper summarizing the results from my analysis. Shall share that also once I’m done with it.


Making a game to study how humans explore

 I made a first person exploration game in minecraft which I’m using to study how human beings gain and store spatial knowledge. This post outlines the processes involved in making and getting data for analysis from a minecraft server.

A little bit of background first: my PhD thesis is on modeling human behavior in simulations of crowds. More specifically it’s about modeling crowds that are evacuating buildings during fires, terrorist attacks or something similar. As a part of my thesis, I’ve been planning to develop a model of spatial knowledge and exploratory behavior of humans; this could be invaluable in structuring buildings in a way so that evacuation is quick, efficient and relatively painless. In order to get some data on how humans explore, we came up with the idea of making a game which could subsequently be analysed to determine something about human behavior (It’s not us who came up with the idea to use games to analyse stuff. There has been an interesting Ted talk on it). It’s been a really interesting process.

Making a game from scratch

I started off trying to make an actual game from scratch using the Unity Game Engine. Pretty soon, I realized that even though I could make a game of sorts in unity without much difficulty, I would be spending an inordinate amount of time designing the environment, the characters, the game play, etc. At the suggestion of my prof I decided to check Minecraft out as an alternative.

Resorting to Minecraft

For those who don’t know, in Minecraft, the player takes on an avatar that can destroy or create blocks, forming buildings, structures, artwork and even entire cities on multi-player servers or single player worlds across multiple game modes. It’s a simple and fun enough game. In the original version, in the day time you gather resources to make shelters and weapons and at night monsters come out to destroy you and you have to protect yourself. With the game having no specific goals and the player having the freedom to do a lot of things, despite the extremely simple graphics, it’s turned out to be insanely popular. Users range from gamers to hobbyists to teachers trying to teach computers and programming in an interesting way to kids.

Getting instructions to kick off

Getting instructions to kick off

Creating a world

Why did it make sense for me? Well, in minecraft, I could use the creative mode to get access to unlimited resources and make anything I wanted without having to bother with monsters. There were also some tools that made this part even easier. The worlds thus created could be exported and used any time. There were a lot of people who’d made some amazing stuff ranging from the Taj Mahal, to Hogwarts to scaled models of cities. Some of these amazing creations can be found at and the like. So now I could create an environment and modify it easily to structure my experiments as needed. After some research and testing I zeroed in on this amazing little palace.

I could edit it however I wanted and basically save a snapshot of the world I create by copying the “world” folder. At any point to start from that world, I could just replace the world folder in the currently running minecraft server instance and voila! I had a building/environment for my game. All I needed to do was make a game out of it.

Making a game in minecraft

The other great thing about Minecraft besides custom worlds are the mods.  Modifications of the Minecraft code, called mods, add a variety of gameplay changes, ranging from new blocks, new items, new mobs to entire arrays of mechanisms to craft. And there were hundreds, probably thousands of these online. There were also some particular flavors of minecraft like bukkit and tekkit that came preloaded with a lot of amazing mods. So I got tekkit and I had some pretty neat wireless transmitters and receivers and ready made NAND gates (You can create your own NANDgates in vanilla minecraft but this is incredibly hard and very messy). How would I use all these tools though? Again with inspiration from some podcasts and youtube videos and after discarding some ideas like making puzzle games and treasure hunts, I finally found the perfect idea for a game that would satisfy my research requirements and could be made by a beginner like me in minecraft without much difficulty. And I called it …. (drum-roll) ….

The Great Escape

Well, I do need to come up with a better name for it; but the basic idea was that a player would be made to explore the building doing some basic tasks. This would be the exploration phase. Following this, he would be given some tasks to do which would require him to use some of this knowledge he’s gained from his exploration. More specifically, the player had to find 11 prisons distributed around the palace and then fulfill a couple of tasks to escape. But how would I go about making this?

Prisons with glass windows and an iron door. Using the lever opens the door and sends a wireless signal.

Prisons with glass windows and an iron door. Using the lever opens the door and sends a wireless signal.

Making the prisons

Well, first, there was the relatively simple task of making the prisons. I manually made them using creative mode and some standard blocks, placed a villager avatar inside it and made an iron door with a lever next to it. In minecraft this meant that the iron door could only be opened with the lever. So after closing of certain parts of the huge palace and placing the prisons in such a way that finding them would require the player to explore at least 90% of the palace, I had to design the tasks to do after exploration. This was going to be much more difficult since I had to somehow hide these tasks and reveal them only when all the prisoners were freed.

Hidden tasks

This is where the NAND gates came in hand. Using a bunch of wireless transmitters connected to each lever I managed to create a simple circuit that would open secret walls only when all 11 prisons were opened or some tasks completed. My basic game was ready.

Making it a game

I had my environment and my game, there was still one big issue though: this was still minecraft. So the players could still go around destroy things I’d made and mess up the environment. This is when I turned to a different kind of mod: plugins. Minecraft is basically just java based and some people had been nice enough to create APIs of sorts and tutorials and stuff for it which could basically be used to modify the game to our liking. Plugins were basically java jar files that could would put on the server which modified the game in some way. With a bit of searching through the huge library of plugins and some help from some forums I found and modified some existing mods so that the players could now only interact with doors and levers.

Funky what simple logic gates can do... That's the logic of my game.

Funky what simple logic gates can do… That’s the logic of my game.

Now all I had to do was copy my world file and the mod that controlled the interacting permissions to my server and start it. I also installed a plugin that ensured that players who joined spawned at a particular location. After that if I joined the world I would start at the same location and be forced to play the game in the way it was meant to be played. But how would this help in my research?

Getting data

Here again, I found an existing plugin for a minecraft server called Statistician made by ChaseHQ. It’s a pretty neat tool that enables the minecraft server administrator to analyse statistics about what resources where gathered by each player and how much they ran. It wasn’t too hard to add a few lines of code to track the players locations at each time step as well.

Making it more interesting

Now that I had access to some code that could track the user, it wasn’t too hard for me to make the game a little more game-like with some interactive messages. I first made a timer that tracked how long the user had been playing and gave him/her a countdown of 45 minutes with a 1 minute time step.  I then changed this to include some preparation time for people who hadn’t played first person games before.

What was more interesting was adding some more custom events to the tracker. I added an event that would be triggered when a prison was opened, storing the lever ID (based on location) and the time it was opened in the database. This gave an idea of which prison and task was completed at what time. Now that I was tracking when prisons were opened I also gave warnings to players when they closed prison doors inadvertently, which was a common mistake that players made.

The actual setup

So basically, what I have is the game server running the world I created with all the prisoners, levers, prisons and stuff. A player could join the server and be spawned at the “starting location” for the game. Here he/she would follow instructions given from the server and complete the game. Once complete, he/she would quit the game. On the player disconnecting, all the data till the point of the last task being completed needed to be written into a database. After this I needed to restart the server with the same world in it’s pristine state again so that someone else could play. I made a script that could automate most of this. The player had to disconnect and the server had to be stopped manually. After this a script could be run that prompted for a name to store the latest data under. Once stored in the database, the world was copied into the server folder and the game restarted.

Pros and Cons of using Minecraft to do this experiment


  • Can relatively painlessly create new environments.
  • Could go on to study the effects of communication in escape by allowing more players to join the server and play at the same time. (I currently allow only one at a time for reasons I’ll discuss in a bit.)
  • The awesome mod community: There are countless existing mods and more importantly for me, it’s just simple java so I could add my own mods quite painlessly.
  • The game structure on the server is quite simple: easy to add mods and change worlds. And script the whole process.

Limitations :

Well, they’re mostly limitations of how I did it either due to lack of time/ interest or in some cases a lack of knowledge and not limitations of minecraft per se:

  • Only one person can play at a time. Unless I get more servers, any interactions made by one person to the world would be seen by others since they were playing in the same world.
  • I only had the school server to run on which is behind a corporate firewall and is thus quite slow to connect to remotely. So I had to be in the University network to play reasonably smoothly.
  • I still haven’t figured out a way to kill the server when a player disconnects and restart a new instance of the server with the pristine environment so that someone else can connect.

There are other limitations as well with regard to what conclusions can be drawn from a game reliably. But since I haven’t discussed the game or the structure of the experiment itself here. I don’t think it’s relevant to discuss this at this point.

There were certain minor issues I encountered along the way, not the least of which was making the game playable by people who had never played games before and for people who had difficulty understanding english properly. I still don’t have enough data, but some of the things do look interesting. Shall post about it later when I have something definitive.

A link to the modified plugin for anyone interested : github repo.