Question: This version of Beat Saber - inspired game introduces synchronizing beats with music through file reading, transitioning from a random beat generator to a rhythm
This version of Beat Saberinspired game introduces
synchronizing beats with music through file reading, transitioning from a random beat generator to a
rhythmfueled experience with the rhythm of your chosen song. While retaining the simplicity that
allows gameplay on any computer using a keyboard.
Song and Difficulty Selection You now have the power to select both the song and its difficulty level
before the game starts.
DualHand Coordination The beats will now flow in two streams: the left stream controlled by the
WASD keys and the right stream managed by the arrow keys
Reading Beats from a File Instead of the previous assignment's random beat generation, you'll now
read beat information from a file. This information includes the frame count at which the beat should
appear, the direction it should point, and whether it should be in the left or right stream.
Simplified Beat Dynamics Beats will not rotate after they are
created and they will fall at a constant pixels per second. This value is defined in the starter code as
SPEED and should not be changed.
Scoring and Gameplay Mechanics The game introduces a 'hit window, a critical period during which
each beat must be struck to score points. The hit window is a rectangle that stretches all the way across
the game window, between y and y The provided background images have lines showing
the boundaries of the hit window. Successful hits within the designated hit window now reward points,
while misses subtract a point. A beat is considered within the hit window only if it is inside the window.
The goal remains to achieve the highest score possible.
Game Conclusion The game is no longer based on a timer. Instead, it should end when the music track
finishes playing, or if the users score drops below zero.
Game Structure
Before the Game
Before launching the game, players are required to enter three critical pieces of information as
commandline arguments: their name, the chosen song, and the selected difficulty level. If the player
does not enter the correct number of command line arguments, enters a song for which there is no
music file, or a difficulty level other than Easy, Normal, Hard, or Expert ignore case then display a
helpful error message and exit the program. The wording of the error message and any exit error code
you use are up to you. If valid command line arguments are provided, the game is launched, and a
starting screen guides the player to start the game with a simple action, such as pressing the space bar.
At this point, the game loads the beat map for the songdifficulty chosen from a file along with the top
high scores stored in a separate file and awaits the player to start the game.
During the Game
With the game underway and the chosen track playing, beats descend in sync with the rhythm from
predetermined sides of the screen based on the information gathered from the file. Players use both
hands to navigate the musical challengeWASD keys for the left hand and arrow keys for the right to
match the falling beats. Key presses other than WASD or arrow keys are ignored once the game begins.
Each hand can only influence the beats on its side. While the entirety of a beat is in the hit window
the key press will be compared against its direction and if it is hit correctly, the player gets rewarded two
points. If the player doesnt press the correct WASD or arrow key for the lowest beat on the relevant side
of the window, or the beat reaches the bottom of the game window, the beat turns red and one point is
deducted from the players score. So when scoring, the only score changes are now or
The game continues until the music track ends. However, if at any point the players score falls into the
negatives, the game end.
Once the game ends, the top high scores are displayed. If the player's score is high enough to enter
this elite leaderboard, their name and score are added to the list. Should the
players score not rank among the top ten, the players score is still shown, but it is not added to the top
File Manipulation
Understanding the organization and use of both beat map files and the topcsv file is essential for
developing the rhythm game. The music files for the game are still stored in the music
folder, but now each music track included in the game corresponds to a separate folder named after the
track, containing beat map files for various difficulty levels: Easy, Medium, Hard, and Expert. These beat
map files dictate when beats should be generated to synchronize with the music. As one example, there is now a file called believer under music, and a
separate folder, also called believer, containing Easy.beat, Normal.beat, Hard.beat, and Expert.beat files
to generate beats in time with the rhythm of that song. a topcsv file, located in the same directory as the
starter file, records the highest scores achieved by players,
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
