Process through Images
About the Game
Watch the Video
For my individual project I had look for an online brief, which would guide me through what type of project was needed. According to the brief I was suppose to create games for a purpose. Hence the user would play a game but there should be some learning outcome as well.
I decided to create a game that will teach or give people information about our solar system. I decided to create the game for Oculus Rift DK-2. Reasons for my choices were that I have always been interested in astronomy and visual effects that happen in documentaries and games. Therefore I decided to make a game about our solar system. I chose Oculus Rift because I got an oculus rift as a gift and I am also interested in virtual reality.
The game is called "Sky-Walk". What happens is that the user will be on earth as a starting point and he would fly into space to explore our solar system to gather information on planets and the sun. Each planet is a level so 8 planets gives us 8 levels and if you include the sun that gives us 9. As I was only required to create 1 level of the game, I decided to create it on the sun.
The game is simple. First the user selects a level/ a planet on about which he/she would like to know about (in this case the sun.) But first they will have to survive through meteors to get to the
sun, which takes care of the gaming bit, which is to aim and destroy meteors. The user will have to be careful because they will have a health bar as well so they can't let any asteroids hit them. After that a simulation of how the sun was born will be displayed and then few facts will be given about the sun. After that the user will have 5 multiple-choice questions to reflect on what they have learned. If the user manages to do this then a new level will be unlocked (in this case Mars.)
I wanted to give the game a futuristic look and feel. A close relevance to what I was trying to achieve would be Jarvis and Iron Man.
I researched and looked for futuristic interface designs so that the user will have few menus in the screen that would display their health, where they were, how much energy they have left and so on.
So I started to design my interface and just played around with it.
Changes in Design
Creating Terrain (Earth)
Creating Terrain (Mars)
I feel that development of this project really pushed my abilities and knowledge about the software and how ways in which I should work to develop a game in future.
The game is made in Unity Pro. The game relies heavily on a concept by Unity called "Raycasting". What it does is draws an infinity line from where you tell it to spawn. In my game it used to detect if something is in front of the player and then trigger an animation. For e.g. if you look at the Sun, Earth, Mars or any other object in the game, an animation will be triggered that will display information about the object. If your not looking at the object, no information will be displayed.
Raycasting is also being used to detect if there is a meteor in front of you and it shoots automatically. All you have to do is just look towards it.
After finishing a level, new level will be unlocked. So I had to edit my code later so that it would display different animation when it's unlocked than showing a lock.
I was trying to reduce the number of variables I have because before activating or deactivating any animation I have to define them as variables and having too many variables can be confusing. But then 1 day I was just playing around and I came up with the bottom I code. However I observed that this code only works if the game object is a prefab. There is nothing wrong with the code and doesn't give any errors. Another reason why it wouldn't have worked because my game is extremely buggy and sometimes my code is correct but it doesn't work so I have to find my way around which was defining a lot of variables but as I said not the best way but it works.
If you look at other screen shots of the game, in the top right corner there is system power. What it does is that it essentially counts down to show how much energy / power / battery you have. So I created a variable that essentially counts down from 2000 seconds (about 33 minutes.) When the timer reaches 0 the player will be sent home to charge up. But I have to display a percentage left and not the number of seconds left. So I created another variable and made a formula. The % displayed in the screen represents the bottom code.
A problem that occurs with Oculus rift while displaying text with script is that Oculus rift has 2 screens hence you would need 2 texts of the same thing. 1 for your left eye and 1 for your right eye. But script creates only 1 text. Hence I had to create 2 scripts. One for the left eye and another for right.
Now changing between scenes, I need to extract the data from the previous scene and transfer it to the next. Now extracting data can be a tricky hence I thought I would carry forward the player from 1 scene to another and not destroy it. Normally transferring between scenes would destroy the previous scene assets and take new ones in but in my case I take one forward and all other children of the object. I use "Don't Destroy on load" method to not destroy my player and transfer him to another scene.
So now I just have one camera / player in the entire game. That can create another problem if you comeback to the scene you started from.
What happens is that your first scene the game provides you a player / camera. Then you play the game and got to different scenes, which is fine but if you come back to the scene you started from, the game would crash.
This is because every time you go to the opening / first scene it will provide you with another player so you will have two players in a single scene, which crashes the game. It took me a while to realize this but when I did, I thought of creating a replica of the first scene but naming it differently and when the player returns home he would return to the new scene.
After the player selects a level (in the is case the sun) the player will have to destroy meteors. Now these meteors are being spawned randomly so there is no telling where the new meteor will arrive or be spawned. Unity has a method for calling random numbers, which can be used for multiple uses. The function is called random range. In my game it is used to spawn 3 meteors between a defined areas.
But the code will just spawn 3 meteors once. I want to call this function after every x amount of seconds. So I found another method that would call a function after every x amount of seconds and I have also added a delay so that it waits for 10 seconds before it starts calling the function every second or whatever you set it to. So in my game I am calling these function (3 meteors) every 3 seconds with a delay of 10 in the begining.
In the game to shoot down meteors, a raycast is being used to detect any meteors and as soon it picks up an asteroid it shoots automatically. I have very tiny cube right at the center of the target and what it does is it spawns a bullet.
After the meteor scene there will be an animation that will display how the sun was born it uses the particle system in unity to display that.
After that you will have multiple-choice questions for the user to reflect on what he has learned. It uses Raycasting as well to detect which answer your choosing.
What else could have been done?
As of now if the user has to select a level he has to press up arrow key. If I had more time I would add a feature similar to what Microsoft uses for Kinect. What it would do is if you are look at an object for a certain period of time it will select the level for you and the user will not have to press any key. This would have been applied to the multiple-choice questions where the user has to click up arrow key to select the answer.
Another thing I could have added was the Planetary Terrain system. When the user is going up in space the screen fades to black and when you fade back in you are in space. Planetary Terrain will let you view everything as you exit or enter any planet's atmosphere. It was a little costly and creating it from scratch would take weeks and I was short on time.