Dragon Song Bloggpost #1
|
The project I am now working on is a rhythm game that is called Dragon Song. Dragon song is a space shooter game and you play as the dragon Riff, this dragon is not like the other dragons. Instead of breathing fire Riff uses his song to defeat the enemies in the game. The main feature of the game is to keep to the beat of the level. I have the role of lead code, and I have been working on what we call a beat meter. The beat meter is keeping track on what beat the song is right now. This means that we will be able to look at all time how close the player is to keeping to the beat of the song. When the beat meter is called in the code the player will get score depending on how well the player is keeping to the beat. If the player is keeping the beat good the beat meter will turn on a layer of music and the player will be awarded with extra score. When the player is not keeping the beat the music will fade away and if the player can’t find the beat again the player will lose the level. We are also working on an enemy spawning system this is also connected to the beat meter because the enemies will spawn on a certain beats. We will read when the enemies will spawn from a txt file. The way I created the beat meter is that I created the beat meter is built by a first a timer and integer that is called SongBPS which is how many beats the song does per second. The music in the game have 128BPM (beats per minute) so the SongBPS = SongBPM / 60. To calculate the beats we have the Beats = timer * SongBPS. The timer will always increase this way the current beat is also always changing. The Accuracy is calculated by the absolute value of of Closestbeat and the Currentbeat. Closestbeat is the closest integer to Currentbeat. We did choose to create the beat meter this way because it was the most accurate of the three prototypes we had from the first two weeks of the project. It is also very simple to change if we would like to have a level with different BPM. Because the beat meter is built like it is we will be able to add a score system and an enemy spawning system by looking at the beat Accuracy and the Currentbeat. sf::Clock m_StartClock; sf::Time m_StartTime; int m_SongBPM; float m_SongBPS; float m_NumberOfTheBeats; int m_ClosestBeat; float m_Accuracy; m_SongBPM = 128; m_SongBPS = m_SongBPM / 60.0f; m_StartTime = m_StartClock.getElapsedTime(); m_NumberOfTheBeats = m_StartTime.asSeconds() * m_SongBPS; m_ClosestBeat = round(m_NumberOfTheBeats); m_Accuracy = abs((m_ClosestBeat - m_NumberOfTheBeats)*2.0f); |
