HackNC is an annual hackathon event hosted by UNC Chapel Hill, and this year’s competition marks the first time I attended as a participant. I have been to Sitterson Hall before during last year’s ACM – ICPC (Association for Computing Machinery – International Collegiate Programming Contest) so it was nice coming back to something familiar!
In case I haven’t mentioned it before, I am currently a junior at Wake Forest University studying computer science. Chapel Hill and Duke have the biggest (and best I suppose) CS and EE departments around the area, so we often come here to attend events and meet new people.
The Oculus Rift, Myo, and Unity
For this competition, we decided to integrate the Oculus Rift reality headset with the Myo armband to create a third person shooter — all combined together in Unity. Due to the game’s main objective of destroying asteroids, we poetic minds decided to name our game Rifteroid. The game is 3D (obviously!) and has a 360 degree game environment. What this means is that while playing Rifteroid, users can look up, down, left, right, and even back to interact with the environment. Take this as an example: when looking up into the sky, users can expect to see a huge sun overshadowing their spacecraft, and when looking right, they can expect to see flying asteroids traveling in all directions.
This immersive 360 degree environment was actually made possible by integrating our existing gaming environment in Unity with a skybox to mimic the openness and emptiness of outer space. The skybox was created by integrating six highly-similar yet highly-integrable pictures of — yes, in the case of Rifteroid — outer space. The result from this was a flawless, borderless, and beautifully stunning 360 degree gaming environment.
As may have been deduced by the Rifteroid nickname, the game is an asteroid “shoot ’em up”. The Myo armband allows us to detect arm movements and hand gestures from the user, and thus we were able to program these recognizable gestures into specific functions. In our game, perhaps the most important function is the fire command. When the user creates a fist with his or her hand, the Myo senses the change in muscle movements and sends a signal via Bluetooth to our computer. Our Myo script detects the movement, and — as we programmed — tells Unity to fire lasers out of our spaceship.
Apart from acting just as a fire device, the Myo is also used to change the direction of the crosshair itself. Just like holding a real gun, when users move their arms, Myo will be able to detect the movements and correspondingly alter the direction of the crosshair on the virtual reality display.
To deal with the limited boundary of the skybox, we decided to make the position of the spaceship fixed. That is, the spaceship could look up, down, left, right, and even back, but could not — for example — move 50 units forward and 150 units right. Although it may sound bad, doing this actually doesn’t detract any of the positive user experiences from the game at all; in fact, it actually makes the game much more playable.
To achieve this, we created an imaginary stick and connected one end to the pivot, and the other to our spacecraft. We made the pivot stationary to the origin, and user movements of the Myo were limited in relation to that pivot. What this meant was that when users swings their arms, for example, to the left, the spacecraft will also move accordingly to the left but along the limited trajectory created by the pivot and the stick. Although this limited the maneuverability and movement of the spacecraft, it allowed us to easily prevent the spacecraft from moving outside the limited boundaries of our environment. A quick solution to a big problem.
After we were done with our environment, we decided to work on creating the gameplay itself. The idea was that as soon as the game starts, asteroids will start appearing in front of the spacecraft and the user will have to shoot them down. If they fail to do so, the spacecraft will explode and the game will be over. To avoid the scenario of random deaths due to asteroids spawning everywhere, we decided that the only place asteroids can spawn in is at the “front-side” of the environment. To make this possible, we created a huge plane that spanned 60 degrees from the center to each direction, and placed that in front of the starting position of the spacecraft. Asteroids can only spawn from any point inside that plane and travel towards the spacecraft (aka the origin point), although they may not always hit it.
Conclusion
Overall, I had a really fun time at HackNC 2014. I learned many things from this experience, and also made many new friends from other schools. Most importantly though, I learned that although each one of us may not be the brightest or smartest of our bunch, put together we are able to accomplish much more than what we can do just by ourselves. During the planning phase of our project, I was very certain that there was no way we could finish our project in time. I am sure many others felt the same way too. Little did we know that by cooperating with each other and carefully splitting and delegating our project into smaller parts, we were able to complete this big project and even have time in the end to fine-tune and polish up the rough spots. I am very glad that I attended HackNC this year, and will definitely be back next year with an even more ambitious project.