Skip to content

omar92/RhythmAttack-VR

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

479 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

RhythmAttack-VR

ITI T38 GD/GA Graduation Project โ€” A Virtual Reality music rhythm game where you slash and shoot enemies in sync with MIDI music.

๐ŸŽฎ Unity Connect Project Page


Table of Contents


About the Game

RhythmAttack-VR is a VR rhythm combat game built with Unity. Notes are spawned in sync with MIDI music tracks โ€” slash them with your sword, dodge the ones you can't cut, and blast the boss with your gun. The game uses a ScriptableObject-based architecture for flexible, data-driven level and gameplay configuration.


Features

  • ๐ŸŽต MIDI-synced gameplay โ€” notes are generated from real MIDI files in real time
  • โš”๏ธ Dual combat modes โ€” Melee (sword) and Ranged (gun) phases
  • ๐Ÿ›ก๏ธ Defense & Attack โ€” dodge incoming notes and counter-attack the boss
  • ๐Ÿ† Scoring & Leaderboards โ€” points awarded for accurate hits; leaderboard tracking
  • ๐ŸŽš๏ธ Multiple difficulty levels โ€” swap MIDI tracks for different challenge levels
  • ๐Ÿ”Œ Multi-platform VR โ€” supports SteamVR, Oculus, Windows Mixed Reality, and more via VRTK
  • ๐Ÿงฑ ScriptableObject architecture โ€” fully data-driven; designers can tweak balance without code changes

Prerequisites

Requirement Version / Details
Unity 2018.1.5f1 (exact version required)
VR Headset HTC Vive, Oculus Rift, Windows Mixed Reality, or any VRTK-compatible headset
SteamVR Required for PC VR playback
Operating System Windows 10 (64-bit recommended)

โš ๏ธ The project was built and tested with Unity 2018.1.5f1. Opening it in a different Unity version may cause compatibility issues with VRTK, SteamVR, and MidiPlayerTK plugins.


Getting Started

1. Clone the Repository

git clone https://github.com/omar92/RhythmAttack-VR.git

2. Install Unity 2018.1.5f1

Download and install Unity 2018.1.5f1 using Unity Hub or the standalone installer.

3. Open the Project

  1. Open Unity Hub.
  2. Click Add and navigate to the cloned RhythmAttack-VR folder.
  3. Select Unity 2018.1.5f1 as the editor version.
  4. Click Open โ€” Unity will import all assets on the first launch (this may take a few minutes).

4. Open the Main Scene

Navigate to:

Assets/0_ProjectFiles/Scenes/GamePlayScene.unity

Double-click GamePlayScene.unity to open it.

5. Connect Your VR Headset (Optional)

  • Launch SteamVR before pressing Play if you want to play in VR.
  • The game also supports keyboard input for testing without a headset.

6. Press Play

Click the โ–ถ Play button in the Unity Editor toolbar to start the game.


How to Play

Controls

Action VR Controller Keyboard (Testing)
Slash notes Swing the right controller (sword) โ€”
Shoot enemy Pull right trigger (gun) Space
Dodge notes Move your head/body Arrow keys
Grip weapon Hold grip button โ€”

Gameplay Loop

  1. Music starts โ€” the MIDI track begins playing.
  2. Notes spawn โ€” coloured notes fly toward you in sync with the beat.
  3. Slash or dodge โ€” cut attack notes with your sword; dodge evade notes.
  4. Attack the Boss โ€” when the boss is exposed, switch to the gun and fire.
  5. Survive โ€” your health decreases when you miss notes; regeneration kicks in between phases.
  6. Score โ€” combo multipliers reward consistent, accurate hits.
  7. Win โ€” deplete the boss's health to finish the level.

Scoring Tips

  • Hit notes exactly on the beat for maximum points.
  • Chain consecutive hits to build your combo multiplier.
  • Avoid taking damage to preserve your combo.

Configuration

All game parameters are stored as ScriptableObject assets located in:

Assets/0_ProjectFiles/ScriptableObjects/GameData/
Asset What it Controls
LevelSettings.asset Player/boss health, note speed, damage values, healing rates
LevelSounds.asset MIDI track paths for each difficulty level
GeneralGameSounds.asset Sound effects (sword swing, gunshot, pain, boss dialogue)
GameLevel.asset Currently active difficulty level

Adding a Custom MIDI Track

  1. Place your .mid file in Assets/0_ProjectFiles/Resources/Tracks/.
  2. Open LevelSounds.asset in the Inspector.
  3. Assign the new track to the desired difficulty slot.

Adjusting Game Balance

Open LevelSettings.asset and adjust values such as:

  • playerMaxHealth / bossMaxHealth
  • noteMoveSpeed
  • hitDamage / missDamage
  • healthRegenRate

Project Structure

RhythmAttack-VR/
โ”œโ”€โ”€ Assets/
โ”‚   โ”œโ”€โ”€ 0_ProjectFiles/             # All custom game content
โ”‚   โ”‚   โ”œโ”€โ”€ Audios/                 # Sound effects (MP3)
โ”‚   โ”‚   โ”œโ”€โ”€ Effects/                # Visual & audio effects
โ”‚   โ”‚   โ”œโ”€โ”€ Materials/              # Game materials
โ”‚   โ”‚   โ”œโ”€โ”€ Prefabs/                # Reusable game objects
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ GamePLayElements/   # VR Player, Boss, health bars
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Engine/             # Scene manager prefabs
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Characters/         # Character models
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ UI/                 # UI prefabs
โ”‚   โ”‚   โ”œโ”€โ”€ Resources/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Models/             # 3D models (Boss, Minions)
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Tracks/             # MIDI track files
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ UI/                 # UI resources
โ”‚   โ”‚   โ”œโ”€โ”€ Scenes/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ GamePlayScene.unity # Main gameplay scene
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ TestScene.unity     # Development / testing scene
โ”‚   โ”‚   โ”œโ”€โ”€ Scripts/
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ MonoScripts/        # Runtime gameplay logic
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Midi/           # MIDI parsing & playback
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Emitter/        # Note spawning system
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Engine/         # Game state & managers
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ VR/             # VR controller input
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ MeleeWeapon/    # Sword mechanics
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ RangedWeapon/   # Gun mechanics
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Player/         # Player health & states
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Boss/           # Boss behaviour
โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ ScriptableObjectsScripts/
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ DataTypes/      # FloatVariable, BoolVariable, etc.
โ”‚   โ”‚   โ”‚   โ”‚   โ”œโ”€โ”€ Engine/         # StateMachine, GameState
โ”‚   โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Events/         # GameEvent system
โ”‚   โ”‚   โ”‚   โ””โ”€โ”€ Editor/             # Custom Unity Editor tools
โ”‚   โ”‚   โ””โ”€โ”€ ScriptableObjects/      # Runtime data assets
โ”‚   โ”œโ”€โ”€ VRTK/                       # VR Toolkit SDK
โ”‚   โ”œโ”€โ”€ SteamVR/                    # SteamVR plugin
โ”‚   โ”œโ”€โ”€ Oculus/                     # Oculus SDK
โ”‚   โ””โ”€โ”€ MidiPlayer/                 # MidiPlayerTK plugin
โ”œโ”€โ”€ Packages/                       # Unity Package Manager manifests
โ”œโ”€โ”€ ProjectSettings/                # Unity project settings
โ””โ”€โ”€ README.md

Architecture Overview

The project follows a ScriptableObject-driven, event-based architecture:

State Machine

  • StateMachine.cs โ€” ScriptableObject state machine supporting smooth and forced transitions.
  • GameState.cs โ€” Base class for all game states (OnEnter, OnExit, OnPause, OnUnPause).
  • GameStateHandler.cs โ€” MonoBehaviour that drives state transitions at runtime.

Event System

  • GameEvent.cs โ€” ScriptableObject events for loose coupling between systems.
  • GameEventListener.cs โ€” MonoBehaviour that subscribes to a GameEvent and invokes a UnityEvent response.

MIDI & Rhythm Pipeline

  1. MidiHandler.cs loads the MIDI file and maps notes to lanes.
  2. BroadcastMidiWave.cs broadcasts note events on each beat.
  3. Emitter.cs spawns note prefabs at the correct time and position.
  4. NoteScript.cs handles the note's movement and collision with the player's weapon.

ScriptableObject Data Containers

  • FloatVariable, BoolVariable, StringVariable, IntVariable โ€” runtime data shared across components without direct references.

VR Platform Support

VRTK abstracts input across all major PC VR platforms:

Platform SDK
HTC Vive SteamVR
Oculus Rift / Rift S Oculus SDK
Windows Mixed Reality SteamVR / WMR
Daydream Google VR
Ximmerse Ximmerse SDK
HyperealVR HyperealVR SDK

Credits

About

ITI T38 GD/GA Graduation Project

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors