For this week, my task was mainly to work on the game screens for Flex Dance, i.e. the screen that shows the arrows coming up. I built upon my mini project from week one since it’s mechanics are somewhat reminiscent of the game screen mechanics.
First, I changed the arrow spawning logic to have the sequence not be random anymore, but instead pre-set from a data structure (call it the “choreography” structure) that I could edit within the code. It’s essentially a list of python dictionaries, each dictionary with an “arrows” key that stores a list of arrows and “timestamp” key that indicates how long after the song begins playing the arrows from that list should spawn.
Once I checked that the above was working properly, I changed the code to have the choreography be read from a file instead of hard-coded. The file also contains the duration of each bar in the song so that the timestamps can be extracted as well. Lines that begin with a ‘#’ sign are considered comments in the file; they were implemented to improve readability and credit song creators.
Finally, it was time to add a song and see if I could synchronize the song properly with when the arrows were supposed to appear. This was the trickier bit and I’m not fully satisfied with it yet. In particular, since I’m testing with a royalty-free song from the internet, there aren’t music sheets available for it, so it’s harder for me to pin down the exact beats. For next week, I plan to test the synchronization part using some well-known public domain song like “happy birthday”, since I’m pretty sure I can find music sheets for that and not be sued if I add the music file to a public GitHub.
I also made some more quality of life changes, such as putting the game in full screen (though I’m also having some trouble here because of 4K monitors being weird to work with), changing the screen design to look more like Flex Dance, and adding a song icon to the screen. Throughout this week, I decided we will not have our song track files inside zipped folders, since we would need to extract the files temporarily to work with them. Also, the memory gain from compressing .mp3, .jpg, and .txt files is too small for our scope in order for the compression to be meaningful (it was a gain of about 60 kB per song).
The current version of the game screen can be found here: Flex Dance Game Screen Test. For next week, I plan to keep working on the game screen. I want to synchronize the music properly, add a pause button, adjust the proportions of the icons on the layout, and group most of my current functionalities inside a GameScreen class to make the final code tidier. One issue that came up this week was that I noticed we forgot to decide who is making the High Score screen, so Spandan and I will figure that out.