George’s Status Report for 3/19

I’ve made lots of progress on this project since my previous update on 2/26.

Here’s a list of the major things I’ve added:

  • Sound playback
  • Font rendering
  • More accurate calculation of score
  • Reading beatmap data from JSON file
  • Communication with drum peripheral

To keep everything organized, I’ve separated most of these changes into different files. Some changed files include Sound.cpp, DrumPeripheral.cpp, and Beatmap.cpp. Here is a diagram that shows how the gameplay code is structured:

Playing sounds

I used PortAudio for realtime audio playback, and I used a free library called libaudiodecoder that reads WAV and MP3 files. To play audio with PortAudio, we must write a special callback function that gets executed by PortAudio every time it needs more data to send send to the computer’s sound device. This function is called the “stream callback” and it is run in a separate thread from the main gameplay code. See Sound.cpp for more details.

 

Font rendering

If we were using a game engine, then this step would be trivial. However, because we are not using an engine, we need to write an interface for rendering fonts to an OpenGL window. Thankfully, I took Computer Game Programming last semester, and rendering fonts was one of our assignments, so I was already familiar with how to do this. I was able to re-use most of the code from that assignment when adding TextRenderer.cpp and TextRenderProgram.cpp.

One issue we currently have is that the fonts are not being shaped correctly. The positions of the letters look a little bit off. I think this is an issue with Harfbuzz, which is a library used for shaping text, but I haven’t spent enough time debugging this to know for sure. I’m going to put this issue aside for now, because it is not critical to the performance of our game, but after we reach MVP I would like to revisit it.

 

Communication with drum peripheral

I found a simple library called ‘serialib’ that does cross platform serial communication. It’s only 1 header file and 1 source file. The drums microcontroller and the player’s laptop are communicating using the RS-232 Communication Protocol. The drums microcontroller will send a 1-byte message to the player’s computer when one of the drums has a high output voltage. If no drums are being pressed, then no message is sent. See DrumPeripheral.hpp for more implementation details.

 

Here is a video of what the game currently looks like. In this example, the game plays a test audio file and a test beatmap. The beatmap notes are not synchronized to the music in this example.

 

Next steps

Next week we expect to reach MVP.  In our gantt chart, we have our MVP scheduled to be completed by Monday. I think that I will need a couple extra days to reach MVP because I got delayed due to the linking issues earlier in the semester, and the font + sound code took a little longer than expected. My main tasks for next week will be:

  1. Figuring out how to run Python scripts from C++ so that the game can process song data at startup
  2. Verifying that the beatmap notes are synchronized to the music

After this next week, the game should be in a playable state. I’m expecting that this will be the final week where I am working on  building the game framework. After this week, I can work on adding features that make the game look and feel fun to experience.

 

Leave a Reply

Your email address will not be published. Required fields are marked *