{"id":119,"date":"2022-03-19T17:47:40","date_gmt":"2022-03-19T17:47:40","guid":{"rendered":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/?p=119"},"modified":"2022-03-19T17:49:12","modified_gmt":"2022-03-19T17:49:12","slug":"georges-status-report-for-3-19","status":"publish","type":"post","link":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/2022\/03\/19\/georges-status-report-for-3-19\/","title":{"rendered":"George&#8217;s Status Report for 3\/19"},"content":{"rendered":"<p>I&#8217;ve made lots of progress on this project since my previous update on 2\/26.<\/p>\n<p>Here&#8217;s a list of the major things I&#8217;ve added:<\/p>\n<ul>\n<li>Sound playback<\/li>\n<li>Font rendering<\/li>\n<li>More accurate calculation of score<\/li>\n<li>Reading beatmap data from JSON file<\/li>\n<li>Communication with drum peripheral<\/li>\n<\/ul>\n<p>To keep everything organized, I&#8217;ve separated most of these changes into different files. Some changed files include\u00a0<em>Sound.cpp,\u00a0<\/em><em>DrumPeripheral.cpp<\/em>, and\u00a0<em>Beatmap.cpp<\/em>. Here is a diagram that shows how the gameplay code is structured:<\/p>\n<p><img decoding=\"async\" loading=\"lazy\" class=\" wp-image-124 aligncenter\" src=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-content\/uploads\/sites\/179\/2022\/03\/George-Code-Diagram-193x300.png\" alt=\"\" width=\"701\" height=\"1090\" srcset=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-content\/uploads\/sites\/179\/2022\/03\/George-Code-Diagram-193x300.png 193w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-content\/uploads\/sites\/179\/2022\/03\/George-Code-Diagram-768x1194.png 768w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-content\/uploads\/sites\/179\/2022\/03\/George-Code-Diagram-659x1024.png 659w, http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-content\/uploads\/sites\/179\/2022\/03\/George-Code-Diagram.png 960w\" sizes=\"(max-width: 701px) 100vw, 701px\" \/><\/p>\n<p><em>Playing<\/em> sounds<\/p>\n<p>I used <em>PortAudio<\/em> for realtime audio playback, and I used a free library called <em>libaudiodecoder\u00a0<\/em>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&#8217;s sound device. This function is called the &#8220;stream callback&#8221; and it is run in a separate thread from the main gameplay code. See <a href=\"https:\/\/github.com\/gcwhitfield\/18-500-ECE-Design-Experience\/blob\/main\/src\/Sound.cpp\">Sound.cpp<\/a> for more details.<\/p>\n<p>&nbsp;<\/p>\n<p><em>Font rendering<\/em><\/p>\n<p>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\u00a0<a href=\"https:\/\/github.com\/gcwhitfield\/18-500-ECE-Design-Experience\/blob\/main\/src\/TextRenderer.cpp\">TextRenderer.cpp<\/a> and <a href=\"https:\/\/github.com\/gcwhitfield\/18-500-ECE-Design-Experience\/blob\/main\/src\/TextRenderProgram.cpp\">TextRenderProgram.cpp<\/a>.<\/p>\n<p>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&#8217;t spent enough time debugging this to know for sure. I&#8217;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.<\/p>\n<p>&nbsp;<\/p>\n<p><em>Communication with drum peripheral<\/em><\/p>\n<p>I found a simple library called &#8216;serialib&#8217; that does cross platform serial communication. It&#8217;s only 1 header file and 1 source file. The drums microcontroller and the player&#8217;s laptop are communicating using the RS-232 Communication Protocol. The drums microcontroller will send a 1-byte message to the player&#8217;s computer when one of the drums has a high output voltage. If no drums are being pressed, then no message is sent. See <a href=\"https:\/\/github.com\/gcwhitfield\/18-500-ECE-Design-Experience\/blob\/main\/src\/DrumPeripheral.hpp\">DrumPeripheral.hpp<\/a> for more implementation details.<\/p>\n<p>&nbsp;<\/p>\n<p>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.<\/p>\n<p><iframe loading=\"lazy\" width=\"525\" height=\"394\" src=\"https:\/\/www.youtube.com\/embed\/KzsQQ2KM3f8?feature=oembed\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\" allowfullscreen><\/iframe><\/p>\n<p>&nbsp;<\/p>\n<p><em>Next<\/em>\u00a0<em>steps<\/em><\/p>\n<p>Next week we expect to reach MVP.\u00a0 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:<\/p>\n<ol>\n<li>Figuring out how to run Python scripts from C++ so that the game can process song data at startup<\/li>\n<li>Verifying that the beatmap notes are synchronized to the music<\/li>\n<\/ol>\n<p>After this next week, the game should be in a playable state. I&#8217;m expecting that this will be the final week where I am working on\u00a0 building the game framework. After this week, I can work on adding features that make the game look and feel fun to experience.<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve made lots of progress on this project since my previous update on 2\/26. Here&#8217;s a list of the major things I&#8217;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&#8217;ve separated most of these changes into different files. &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/2022\/03\/19\/georges-status-report-for-3-19\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;George&#8217;s Status Report for 3\/19&#8221;<\/span><\/a><\/p>\n","protected":false},"author":526,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/posts\/119"}],"collection":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/users\/526"}],"replies":[{"embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/comments?post=119"}],"version-history":[{"count":4,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/posts\/119\/revisions"}],"predecessor-version":[{"id":128,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/posts\/119\/revisions\/128"}],"wp:attachment":[{"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/media?parent=119"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/categories?post=119"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/course.ece.cmu.edu\/~ece500\/projects\/s22-teama5\/wp-json\/wp\/v2\/tags?post=119"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}