# Dragon Race VR Development

We were tasked to make a VR application in a couple of days, using a game engine. I took this opportunity to research and try out several VR movement options.&#x20;

In the end, I ended up with a racing game where the player is riding a dragon and can control his movements using a rein (the small white object on top of the green dragon's head). The player races against a computer-controlled dragon and needs to follow a route of rings.

{% embed url="https://gyazo.com/4ad1fb58248611f8e2231223b80f3688" %}

I mainly focused on the programming and game design aspects of the game. Most of the assets I've found online.

## Programming&#x20;

### Movement

My main goal in this project was to make sure that the movement felt good for the player. I wanted to make moving around in a game space natural while being able to make a fun experience in less than a week. I solved this problem by deciding to ride some kind of creature. Being mounted on another creature is a way of movement that's thousands of years old, I felt like it was a good idea to try it out in VR.

My first attempt at moving the dragon was with four floating blocks in a pattern as a controller's movements buttons. This worked okay, however it was annoying that you needed to pick up and let go of those different blocks all the time. And I had the issue that the blocks sometimes became unreachable for the player.

![](https://708397551-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MjnIU3pkRtiaeZ6PEEt%2F-Mjnm32yQTRi1t47qw5s%2F-Mjnm_AaRx__pC5MqjTw%2Fblock%20movement.png?alt=media\&token=41bac589-d2e6-4381-ae99-da9614793363)

My second attempt also used those blocks, however this time the player wouldn't pick them up. They would simply move their hands in front of it. This was a step in a good direction, however the player's arm would get tired because the only way to stop rotating would be to keep your arm centered. There was also another issue that would cause the player's hands to flicker quite intensely when they were in front of one of the blocks. So I decided that I needed to rethink this idea as well.

My third and last attempt was quite successful. I decided to look at how animals were ridden in real life, and they were usually controlled with a rein. The rider would pull the rein in a certain direction and the animal would follow that. I implemented this in my game by making a rein object (the white oval above the dragon). The player could pick the rein up and move it in a direction and the dragon would follow. I chose to limit the directions that the dragon could rotate, to make it more realistic (animals don't 100% understand the orders given to them). So the player can move horizontal, vertical and diagonal, but none of the precise directions in between.

![](https://708397551-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjnIU3pkRtiaeZ6PEEt%2Fuploads%2Fk4RcvAyjdHu9CeG6S67u%2FDragon%20race%20start.gif?alt=media\&token=dc45859b-cb10-46aa-b186-f1ed389f3b2f)

### Enemy

One of the scripts that I've made lets the enemy dragon move and rotate towards the next ring on the course.

{% embed url="https://gyazo.com/08b8519629a41c0c232d5d1e066a408a" %}

I've also made a script that checks where the enemy dragon is compared to the player, the player will see this as a text that shows how many rings ahead/behind they are.

![](https://708397551-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MjnIU3pkRtiaeZ6PEEt%2F-MjnfGH3xaJPzTKLD7qG%2F-MjnhFHtn_lNk3_82OVU%2FRings%20ahead.png?alt=media\&token=8fbd7737-c59c-48e5-8e4c-ca5c5b2f77cf)

![](https://708397551-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MjnIU3pkRtiaeZ6PEEt%2Fuploads%2FFiJU6OSiRuZuDEK4xSxo%2FDragon%20race%20midrace.gif?alt=media\&token=5029a2f8-fc2c-4a26-9a02-f1301cc0519b)

## Other

Some smaller scripts that I've made do the following:

* Show the player the outcome of the race
* Track the collision with the rings
* Only start the game whenever the player is holding the rein and the countdown has reached 0
* Make sure that the player and enemy dragon only move while the race has begun and hasn't finished yet.
* etc.

## Environment

The terrain I used comes from an asset pack that I downloaded. I made the stone rings myself by using several small stone objects to form a circle. I applied fog to the scene to make the environment a bit more red/orange colored. The "skybox" is actually a big sphere with a custom shader on it.

## Helping

During my development of the game, it came to my attention that a lot of people were having trouble with getting their game to work properly or even Unity itself. So I've helped quite a few people during these past days and it's pretty cool to see how far they've come with their projects.

