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.
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 http://www.minecraftworldmap.com/ 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?
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.
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.
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?
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.
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.