Dec 4, 2014

Stacky Project

Stacky is an interactive game I devised and developed for the final project of the 'Interactive Systems' class I did with professor Narcís Parés. This was done using the openFrameworks toolkit and the ofxKinectCommonBridge and ofxBox2D addons. The game's concept is actually pretty simple: You are a “stacker” that has to stack a pile of boxes in your hands, one pile on each hand. These boxes are falling from the top of the screen and the idea is to stack them and make the piles as higher as possible.

By moving your arms you control each pile, having to place the pile below the falling boxes in order to stack them. You better move your arms carefully to avoid dropping the boxes, as they follow the rules of physics. If the boxes are not well positioned in the center of balance, the boxes will fall and the game will finish after you loose all your lifes. As the piles gets higher the harder it is to keep them stable. 

Besides the boxes, there are also some black circles that makes the game even more difficult. If one of these circles touches a box from your piles you loose a life and they destabilize the pile.  When you have stacked an specified amount of boxes in each pile there are not more falling boxes and the game starts a counter where you have to keep all the boxes together without loosing all your lifes.


I use the Microsoft Kinect camera to track the movement of the upper part of the body and the user has to move his hands and arms to control the orientation and position of the two attached plates he has in both hands. These plates are placed in the palms of the user hands and these are the growing bases for each pile. 

Below you can see a recorded video of the game in use. Sorry that I had to record this in my smartphone because the framerate was not good enough when using screen recording softwares:



In the video the game is played in 'Easy Mode' and the amount of boxes that has to be piled before the countdown starts is set to three (to be more interesting this number should be around 20), meaning that we only have to pile three boxes in each plate to win the game.
The toughest part when programming this was to make the falling boxes stay together on top of the plates. This is because we assign the plate's position directly to the wrist joint position of the Kinect Skeleton and with the physical library that we use (Box2D), when you set the position of the physical bodies manually they do not to respond to the friction forces with the rest; making all the boxes slide over the plates. 


One of the solutions we tried to make the boxes stay together with the plate

We tried various approaches to solve this problem but we finally ended up moving the pile of boxes manually based on different factors: (1) the box is attached to the pile if its center falls within a distance range of the box below, (2) the boxes get disattached from the pile if we move the plate too fast.

All the source code of the game is here: https://github.com/fabiaserra/stacky

There are some details that had be polished but I didn't have the time to do:

  • Amount of boxes/black circles that fall in 'Easy Mode' vs 'Hard Mode'
  • Sound interactions:
  • Add sound when impact between black circles and plates
    • Add sound when impact between box and plate when some boxes are already attached in the plate
    • Multiple instances of the impact sound when contact between box and the boxes attached in the plate (it should play only once)
This is the description document we wrote before we had to develop the game: