Menu

Project page

BubbleVR, Virtual Reality

About

BubbleVR, Virtual Reality

This is the third project for the CS491 Virtual and Augmented Reality class at UIC. The game is inspired by a series of 2D flash games that I used to play with my best friend years ago: Bubble Struggle. You can easily play it by going to: Bubble Struggle 2.

Download entire project

Game specifications

Goal

This is a first person game, the player is in a virtual 10x10 meters arena and the goal is to shoot at incoming balls and try to avoid being hit by them.

Arena and balls

The arena is a 10x10 meters platform with solid walls, the player is confined to be in the 3x3 meters area at the center of the arena, that is also visually shown with a different design in the game. There are 4 cannons, one per each corner of the arena, they spit random balls at random times between a predefined and dynamic range based on the level or the elapsed time in the game. The balls bounce in the arena preserving their mechanical energy, there is no friction, and the balls do not collide with each other and can only bounce if they hit a wall, in this way their movement is predictable by the player. Each ball is extracted randomly from the set of 3 balls: green, red, blue. The green ball is the biggest, it measures 2 meters in diameter and has the highest amount of potential energy at the creation, thus, it will be the one which reaches the highest height. The blue one is the smallest one, 0.5 meters in diameter and with least amount of energy, and the red one is in the middle.

The walls, floor and textures are taken from the VRTK example scenes and modified only in shapes and can be found at the repository /thestonefox/VRTK

Screen

Balls split

The player can shoot at the balls or dodge them, beware that dodging too much instead of shooting leads to many more balls in the game and increases the difficulty. When the bullet hits a green ball, it pops and it divides into 2 red balls, when a red ball is hit, instead, 2 blue balls will be created by its popping. When a blue ball is hit, it just pops without creating any other ball. The newly created balls, will have an initial xz component velocity which is perpendicular to the bullet xz component velocity, this allows the user to not having to be careful of those new balls, at least for some seconds. They will also have an initial y velocity (upward) which will be computed in order to make the ball align with the maximum height as of the balls of the same color.

Cannons and balls emission

When a cannon spits a ball its color changes to the color of the emitted ball and its xz direction varies in a range (-15,15) degrees (customizable), and a sound is emitted, so that the user becomes aware that an incoming ball could arrive. However, the initial direction of the cannons is such that no ball emitted from them can reach the user before hitting any other wall. In this way, the player has some slack and is not required to look at where the ball is falling right away, if for instance is in a dangerous situation.

MODELS

This simple cannon model was created by me using Blender, click on the image to access to the model. The balls are just standard 3D balls created in unity, a download link is not provided for them.

Guns

At first I wanted to try and make a type of gun similar to the one of the original game. Unfortunately, since this game is in 3D, it wasn't really working, it was very difficult to hit the balls because of the difficult prediction of the ball trajectory. So I decided to transform that gun in a laser gun that shoots laser rays that gets longer over time so that it's more likely to hit a ball. The other type of gun is a simple gun that shoots fast bullets. I think it is easier to hit balls with fast bullets and this is why I decided to introduce a normal gun that by default is on the left hand. The right hand, instead, has the laser gun by default, but the controllers can be switched without any type of problem and your favorite gun can be in your best hand.

The bullet and the laser ray make a sound effect when emitted and when hitting a ball or a wall. They also disappear on a collision event.

MODELS

These are the models I used for the gun, bullets and particle system that is quickly played when a bullet or laser ray hits a wall. There is also the unity package I used to create 3D texts in the game.

Walls text

There are some useful dynamic texts on the walls of the arena: a digital timer that starts when the game starts, the score of the current game, the selected game mode.

Special items

During the game, depending on the game mode, there will be some special items spawned in the 3x3 meters area at the center where the player should be, these items can be grabbed by the user and used whenever he wants.

Winning or losing

When the user is hit by a ball he loses. The goal is just to survive in staying alive mode and get the maximum score or reach the highest level or the highest score in classical mode.

How to start playing

Whenever you start the game, you will find yourself on a platform, if you reach for the center, the main platform will disappear and a smaller centered one will remain, allowing you to choose a game mode by jumping on the corresponding mode text. This is done so that a single person can start the game without having to be in the center of the calibrated HTC Vive area.

Big main platform:
Screen

Restart or change game mode at runtime

To restart the game while you're playing you just need to shoot at the big white ball that appears above you a few seconds after the game has started.

Soft restart button:
Screen


Sounds

Ambient sound

N'to - Trauma (Worakls Remix)

Sound effects

Gunshot
Ball Spawning
Freeze
Bomb Explosion
Using shield
Game Over voice
Bullet Ricochet

Game modes

The player starts in an elevated platform with respect to the arena platform. The user has to jump choosing the game mode he wants out of the 4 game modes present that are rotating around the small elevated platform. With this leap of faith, the player jumps into the arena and starts playing with the chosen game mode.

Screen

Classical

The classical mode consists in going through levels, each with increasing difficulty, in which the frequency of the emitted balls increases. Each level lasts for 60 seconds, the player will have to try to stay alive either by dodging balls or popping them or both. At the end of each level a special item is spawned and every ball in the arena is popped (the arena is cleared)

Screen

Staying Alive

This mode's goal is to just stay alive. There is no end to this, just try to be in the game as long as you can or improve your maximum score. A random type of ball is emitted by a random cannon every random number of seconds in a range that decreases with time. Every 30 seconds a special item appears to help the player.

Screen

God Mode

Gode Mode is a much more difficult and fast type of game but it has the same concept as staying alive. The player cannot in this game mode and the balls bounces on the player like they do on a wall.

Screen

Training

The training mode has the goal of practicing your aim in shooting balls. There are 3 pyramids of balls, hundreds of balls in total, which are frozen. When a ball is popped, however, if the ball was green or red, the new balls will have the normal physics. The player cannot die in this game mode.

Screen


Special items

During the game, depending on the game mode, there will be some special items spawned in a random location confined in the 3x3 meters area at the center where the player should be, these items can be grabbed by the user (use the grip button on the HTC Vive controller) and used (by pressing the trackpad button on the HTC Vive controller) whenever he wants. When an item is used it disappears from the player's hands. In no other way the item can disappear.

MODELS

I took this objects from the Unity asset store and 3Dwarehouse, click on the link to access the source web page.
The 3 special items are:

Freeze

The freeze special item is in the form of a snowflake object. When used every ball present in the arena is frozen forever and does not move, the user can leave them there or shoot at them. However, when he shoots at a frozen ball, it divides into balls which are not frozen.

Bomb

The bomb special item is in the form of a bomb object. When used, every ball present in the arena is popped and the spawned balls are popped again and so on until they disappear and the arena is empty.

Shield

The shield special item is in the form of a green shield. When used, a medium size shield appears in the right hand of the player who can still shoot with that hand though. The shield can be used to protect yourself from balls and it has a limited time of 30 seconds whose count is displayed in a small digital screen visible by the user.

Technical details

How to build and start the application

I last saved the project with Unity version 2018.2.15.f1, in order to be sure everything works fine, it's better to open the project with this version of Unity. To build the project and run it the only necessary steps are to download the project from the provided link above, open the project with Unity and run it. The game is already downloaded in the classroom PC.

Development

The game was developed in C# trying to follow an object-oriented programming fashion. It should not be hard to extend it by adding new features and in particular new game modes.

Every game mode extends the BallSpawner Monobehavior, which is a script that handles the random ball spawning in cannons and the ranom rotation of the cannons. They also implement the IGameMode interface whose concrete implementation's instance is passed to the GameManager. A basic class diagram is provided below.

Screen

Development challenges

The main struggles that I had while implementing the game were a few. When I started, I discovered that I could not rely of Unity to create physics materials for the ball in such a way that they would bounce without losing or gaining energy and thus height or speed. This is probably because they computations on the GPU of floating point numbers is not exact, and after a few bounces I noticed that the balls were reaching different heights. I solved this by explicitly resetting the velocity of every ball when it collides with a wall or ceiling, in such a way as to reproduce a perfectly elastic collision. Another problem is that balls sometimes were "stuck" to bounce on a plane parallel to a side wall, making it very easy for the user to even not consider those balls, I also had to fix this problem by changing the velocity in those situations.

Another challenge was to create the different type of gun as it was in the original game. At the end I managed to create something similar but since having a ray in 3D to hit balls is completely different and much more difficult than having it in 2D, I decided to change it in a more easy and practical laser gun.

I got a few other problems that I did not notice while using the simulator when I tested the game on the actual HTC Vive in class but I managed to solve them.

Video

Video presentation

Contact Us

Reach out for a new project or just say hello

Send Me A Message

Sending...
Something went wrong. Please try again.
Your message was sent, thank you!

Contact Info

Where I live

Bussero, MI
20060 Italy

Email Me At

mrk23 at hotmail dot it

Call Me At

Mobile: