top of page

Rolling Rhapsody

Cover_Page0.2(1).png

Engine: Unity

Language: C#

Team Size: 4

Platform: Mobile, PC

Development Time: 1 month

Role: Programmer

Game Description:

A 3D physics-puzzle game where you tilt your mobile device to move a marble through an obstacle maze. The goal is to tilt the marble into the ending portal of each level!

While this game is intended for mobile devices, a windows build is available on itch.io

Coding Tasks:

For this game, we wanted to really make it feel like you were tilting the entire level with your phone to move the marble. However, this would be really hard to pull off by actually rotating the level, and you can create an easier and more convincing effect if you just create the illusion of rotating the level.

  • Created the marble movement system

  • Camera tilting with gyroscope input

  • Created gravity-shifting mechanic

The marble has a rigidbody component to handle physics, and a force is always being applied to the rigidbody based on the device's Gryoscope input. We are adding forces to the marble constantly based on the gyro input, and because of that, the code will move the marble based on gyroscope input. To make the world tilt with the marble movement, I also made it so the camera would tilt based on the gyro input. This, combined with the marble's rigidbody movement, creates the illusion of tilting the world with your mobile device!

Marble Movement

In this game, levels have the player tilting the marble up walls using ramps. Once you're on this ramp, and you try to go up the wall, the player's gravity will shift towards the wall so that you can move up the wall.

To achieve this effect, Unity's "Constant Force" component is used. This component lets you add a force that is constantly applied to the player in a direction which you can set. When you want normal gravity, which means you're on the starting floor, the constant force will not apply and the marble's rigidbody will just use normal gravity. When you go up a ramp and switch to a wall, we also add a constant force upward which is the same value as gravity so that you no longer move downwards, and we add the force of gravity towards whichever wall the player is trying to switch to.

Gravity-shifting

If the marble is to fall off the map, the player enters a death state, and the level restarts. If you make it to the portal, the player enters a victory state and you progress to the next level.

Death & Victory States

Death: Each level is inside of a big trigger collider box. If you fall off the level in any direction, you will exit this trigger. So, if the player ever exits the trigger, and the player hasn't won, we know they fell off the map and lost, so we know to change to the death state and restart the level.

Victory: Each level has an ending portal, which has a trigger collider around it. When the marble enters the trigger, we know they've won the level, so we change to the victory state.

Victory and death forces: When you complete a level, the camera stops in place, and looks at the marble as it flies into the sky. Same with the death state, except the camera will look at the marble as it falls away from whatever surface it was on. Accomplishing this was fairly trivial. If the player wins, we send a constant force upwards to the rigidbody on every physics update, and after a few seconds, the next level activates. Same idea for losing, but you don't need to apply extra force, as the ball is already falling.

There is a spike ball hazard in some levels, and if the player interacts with one, they will be thrown off the level.

Spike Ball Hazard

The spikeball's movement is handled by affecting the object's rotation with sin. The object has a pivot point that the sin rotation is applied to, and in return, it creates a swinging pendulum effect. We can change it's movement properties as well. By changing how sin is applied to the object, we can change the speed of the rotation, as well as the distance that it swings.

bottom of page