This game is developed as a class Assignment for the Computer Graphics Course. Hoopers is a game which birthed from the idea of combining a shooting game with a fast paced score-crunching gameplay.
You can build the game for any Android Device(device should be support AR), by installing the Unity 2021 LTS Version and building it for AR.
Since the game is based on AR, you would have be greeted by numerous floating hoops in your screen, along with a small aiming ball at the centre. Simply rotate your phone to aim the hoop and press the "Throw" button to shoot the basketball.
Note The Hoops may not always spawn at the screen, try pointing the phone at different angles to see the hoops.
This is description of all the game mechanics used in the game and how they are implemented.
-
Initilization and Destruction
The ball is spawned just below the camera, whenever the player presses the "Throw" button and is destroyed after 5 seconds of being thrown.
-
Projectile Motion
The basketball is not shot but is thrown, this should be reflected by the projectile motion of the ball.
This was implemented by calculating by :-
- the distance between the hoop and the ball
- then, the velocity needed to launch the ball to the distance at a certain angle
We decided on the angle 65 to be made default in the game because otherwise the projectile wouldn't be properly reflected in the gameplay and going any further would mean the ball would take longer to reach the ground.
-
Projectile to different Heights
The hoops would in the game would spawn at diffferent places and at different height. For this reason, traditional projectile equations for 2d plane won't work to make things easy we rotate the ball in such a manner that the local axis of the ball aligns with the hoop, this solves the projectile in 3d plane and also at different height.
The hoops contain two parts, a wooden board and a net in the bottom.
-
Distance from Hoops
The distance of the hoops should always remain a constant no matter the movement or the height. To acheive this we made an empty object at the centre(camera position) in reference to which the Hoops would be always at a certain distance. This mechanic was introduced after the it was observed that it was difficult to pinpoint the distance of the hoop from the camera.
-
Types of Hoops
There are three types of hoops present in the game :-
- Static Hoops
- Horizontal Motion Hoops
- Vertical Motion Hoops
-
Position of Hoops
The initial position of the hoops are generated randomly in which we take account of the height and width of the space in which the hoops should spawn. The three types of hoops have different probability of spawning and are all random.
-
Probability
The probability of spawning a certain type of hoop be it static or motion is calculated by a probability function which takes the game score as its argument. The result of this is that initially after score = 5, there is a 10 % chance that the next hoop will be that of a vertical motion one, 30 % chance of a horizontal motion and 60 % chance of a static hoop. And as the score increases, the probability for motion hoops increases making the game difficult.
-
-
Motion of Hoops
The motion of the hoops is not achieved by applying velocity to it but rather rotating the hoops around the center(camera position). This is less performance intensive but also in this manner the hoops always face the camera.
-
Speed
The speed of the hoops is simply the speed at which they are rotated, this speed is calculated through a speed function which takes score as its argument and thus increases with score.
-
The score is increased whenever the ball passes through the hoop collider placed at the center.
There is a single life given to the player at the start of the game
-
Increase of Lives
The lives increase if you manage to score 3 consequtive hoops without missing.
-
Decrease of Lives
The lives decrease if you miss 3 consequtive shots.
-
GameOver
The GameOver happens when your lives become 0.
-
Main Menu
The Main Menu consists of a background and three options:-
- Play
- Options
- Exit
-
Options
At the start the options UI has only a volume slider but later in the middle of the game this also has "Return to Main Menu" and "Exit" options.
-
Game Over
The Game Over UI appears when the player loses and it has a exit option.
-
Gameplay Layout
The gameplay layout consists of a single "Throw" button at the bottom, a score text at corner right, a lives UI at corner left.
-
Background Sounds
There are three different background sounds suited for 3 different scenes i.e Menu, Gameplay and GameOver.
-
Effects Sound
Effects sounds are placed for scoring, throwing the ball, Decreasing of Lives and Menu selection.
There is a confetti animation in which rectangles shapes of different colors explode from a hoop when a hoop is scored.