Creating Virtual Reality game with HTC Vive and Unity Engine

  • Scope:
  • Web Development

Ever dreamed to work in game dev?

If you are here, you probably did – and so have some of Tooploox employees once. Tooploox does not deal with games on a daily basis, Hackathon proved to be a perfect occasion to try it. And since our basement in Wrocław’s Headquarters is already equipped with three headsets for Virtual Reality – HTC Vive, Oculus Rift and Playstation VR – our team decided to use one of them.

We went for HTC Vive and ordered 3 additional trackers in order to create game with full body tracking. As Unity Engine introduced tools for developing on VR, we decided to use it.

Brainstorming game idea

The pivot idea for the game presented during pitching was of course far different from the one we went for.

At first, the game was inspired by Despicable Me 2 scene where Gru has to dance on colored floor panels to open the gate and the indie game Crypt of the Necrodancer. Vision of dancing around on colored platforms seemed really cool and we easily gathered a 5-member party. The squad that answered the call included: two Swifting iOS developers, a C++ Engineer working on Computer Vision, one of our Co-founders and a Culture and People Specialist (yup, that’s me) – all with vast gaming experience.

This is when we named the project “DaneVR” (aka YourLastDance).

But this idea, as cool as it is, actually makes the full body tracking unnecessary. In all dancing-related game mechanics we took under consideration, the only important body parts to track were feet. Additionally, jumping around from one virtual panel to another could be dangerous for the users. Finally, limiting the movements to small space (3×3 or something) would be no different from a dance pad. That is why we searched for inspiration elsewhere.

Remember Tetris? Ever seen Hole in the Wall?

We decided to combine that and challenge the players to fit in holes in virtual walls approaching them. The HTC Vive equipment, comprising of headset, controllers and three trackers (one on each foot and one on the waist), tracks the player’s body placement. If the player fits the hole, he or she scores. If not, sorry, YOU DIED and your soul is taken. The holes are shaped like tetris blocks for those who enjoy retro vibes. At the very end of the first day we agreed that retro/arcade/synthwave style is the one to go. We added some music and shaders to make the game roll even more. We renamed the project to HumanTetris VR, but the old name sticked to it and now both are in usage.

See what we’ve learned before venturing forth

12 am, day 1 – lesson 1 – Setup the gear earlier. HTC Vive set and trackers setup took us nearly two hours when the coding began. We went through user manuals, updated software of all 3 trackers, the headset, 2 base stations and 2 controllers. Then struggled with charging the gear and worried about the number of USB hubs. And also Unity installation, though user-friendly, takes time that could have been saved for coding. Be smarter. Do it earlier.

1:30 pm, day 1 – lesson 2 – Trackers work fine with velcro. They stick to the sneakers really well if you buy a long piece and wrap it around the shoe. Consider it if you want to track feet. Check out our terrific engineering skills.

1 pm, day 1 – lesson 3 – So… who knows C#? One of the crew member last used C# 18 months ago. Others probably remembered something from the university. Be sure to refresh the memory few days before the hackathon next time. (We just discovered you can also use JavaScript or Go – that we also do not use on a daily basis…)

2 pm, day 1 – lesson 4 – Hey, does Unity run on Mac? Yes, it does, but unfortunately does not go well with VR, and that’s an issue if you want to test something. Be sure that you have a powerful PC with Windows to code. Otherwise, if you have only one like we did, you will do a pair-programming session with 4 people (is it quartet-programming then?).

8 pm, day 1 – lesson 6 – Colliders in Unity are a real pain. Or maybe we struggled with detecting collision of the wall and the model because we had only 2 team members who had tried to use Unity before (and one who bought the course on Udemy, and that probably counts as 0.25 member who knows something about Unity). It’s also worth mentioning that all the VR gear – tracker and controller blocks, and also base stations – are a colliding object by default. It took us a while to notice it.

9 pm, day 1 – lesson 7 – “Coding” with mouse is tiring. We were surprised how much you rely on mouse while creating games in Unity. As diehard keyboard fans, guys struggled a lot while creating the game. Not until the colliders I’ve mentioned before were set in Unity did our developers realise that, in fact, using brains and scripts instead of mouse actually works better.

12 pm, day 1 – lesson 8 – Unity free assets are a bomb! We managed to create the whole retro-arcade-wave-vibe using just free assets that are shared by Unity – the shader, the sky and music.

12 am, day 2 – lesson 9 – Merging hell. No one could have predicted that merging will take us 2 hours and we will finish 5 minutes after the time for presentation. Luckily, our colleagues forgave us the delay. We’ve already moved the project to Unity Cloud Build and hope to avoid this struggle in the future by using this tool.

2 pm, day 2 – lesson 10 – Humans have a limited capability to fit the holes. Logical, yet still a surprising finding. We were sure that we kept that in mind while designing the walls, but it turns out that in order to make the gameplay better we need to redesign the maps. For now, the maps are almost impossible to complete (or literally impossible in one case).

Take a crack at game dev just for fun

All the hardship I’ve mentioned actually made the hackathon even better. It was very fulfilling to see the game’s creation process – from scratch to the working demo – and to be a part of this process!

After the presentations, we encouraged other participants to try our TetrisVR out as watching the game shown on-screen was not even close to the feeling you got while being inside our retro-arcade space. Those who decided to take up the challenge and suit up with the whole equipment had a lot of fun – and we felt really good watching them.

It was probably the fact that VR doesn’t look so impressive while watching somebody else playing that made us lose the Hackathon. Still, our team, proud laureates of the second place, will continue the adventure with VR to make the final result even better.

Similar Posts

See all posts