{"id":20921,"date":"2013-09-04T07:47:21","date_gmt":"2013-09-04T12:47:21","guid":{"rendered":"http:\/\/www.shamusyoung.com\/twentysidedtale\/?p=20921"},"modified":"2015-07-01T04:50:29","modified_gmt":"2015-07-01T09:50:29","slug":"project-good-robot-part-9-under-the-hood","status":"publish","type":"post","link":"https:\/\/www.shamusyoung.com\/twentysidedtale\/?p=20921","title":{"rendered":"Project Good Robot Part 9: Under The Hood"},"content":{"rendered":"<p>My project depends on a number of external libraries. It wouldn&#8217;t be possible to get this much done without offloading some of the drudgery to a few low-level packages written by others. I can make windows without getting married to Microsoft, render polygons without worrying myself with the arcane details of the driver layer, and make sound effects while knowing not a blessed thing about audio hardware.<\/p>\n<p>The downside of not writing your code yourself is that you&#8217;re dependent on other teams, who might not be all that dependable. A few people have asked what libraries I&#8217;m using. So here it is:<\/p>\n<p><table width='600'  cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/gr9_screen3.jpg' class='insetimage' width='600' alt='Image unrelated. Addendum: pew pew pew!' title='Image unrelated. Addendum: pew pew pew!'\/><\/td><\/tr><\/table><\/p>\n<p><!--more--><\/p>\n<h3>OpenGL<\/h3>\n<p>Good old Open Graphics Library. While the OpenGL <em>shader language<\/em> continues to be a mysterious heap of <a href=\"?p=15956\">poorly-documented features, hidden keywords, and devious traps for the uninitiated<\/a>, OpenGL itself is as rock-solid as ever. There are multiple versions of the documentation, there are <a href=\"http:\/\/nehe.gamedev.net\/tutorial\/lessons_01__05\/22004\/\">incredible tutorials<\/a>, and there&#8217;s even a <a href=\"http:\/\/www.glprogramming.com\/red\/\">comprehensive book<\/a> you can read for free. If you&#8217;re looking for technical documentation online, this is about as good as it gets. <\/p>\n<p>I&#8217;m not sure if I want to fool around with shaders at this point. I&#8217;m just not seeing the need. Sure, there are a lot of cool tricks you CAN do with shaders (I wouldn&#8217;t mind a quick-and-easy blur on the background layers in my game) but right now it&#8217;s just not worth the hassle. I could blow an afternoon fishing around search engines and wading through the tedious jackasses that sometimes answer your technical questions after they&#8217;re done insulting you, but that&#8217;s a low-productivity \/ high frustration road and I&#8217;m in no hurry to go down it.<\/p>\n<p>Someday GLSL docs will be as thorough and ubiquitous as the OpenGL docs.  But that day is not soon.<\/p>\n<p><table width='600'  cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/gr9_screen1.jpg' class='insetimage' width='600' alt='Question: How many robots I can spawn before the game slows down? Answer: About that many.' title='Question: How many robots I can spawn before the game slows down? Answer: About that many.'\/><\/td><\/tr><\/table><\/p>\n<h3>SDL<\/h3>\n<p><strong>S<\/strong>imple <strong>D<\/strong>irectMedia <strong>L<\/strong>ayer is another standby in my projects. Sadly, now is a bad time to be using SDL. The documentation seems to be in some sort of upheaval. As of this writing the documentation is focused on the new 2.0 version, and I don&#8217;t want to mess around with the new version. The old one does what I need, the new one might have bugs, and migration is time consuming. <\/p>\n<p>On the other hand, <a href=\"http:\/\/sdl.beuc.net\/sdl.wiki\/SDL_Init\">the old docs<\/a> are kind of sketchy and in shambles.  I can&#8217;t tell what happened and I&#8217;m not going to go crawling around in the wayback machine to figure out where the docs are supposed to be and who moved them. All I know was that for a few weeks Google couldn&#8217;t find a dang thing.  I&#8217;d enter <code>SDL_Init<\/code> into Google and I&#8217;d end up on a six-year-old forum where someone was asking a question and happened to have SDL_Init () in the text of their question. If you&#8217;re not a programmer: Imagine you want to know the meaning and spelling of a word, so you search for the definition. But the only result you get is where someone used the word in a sentence. And they did so in the process of asking why the sentence is incorrect. You have no way of knowing the definition and you can&#8217;t even tell if they spelled it right. <\/p>\n<p>It&#8217;s a little better now. I have a pretty good chance of typing an SDL function into a search engine and ending up at a page that actually documents the thing, but if I want to do something and I don&#8217;t know what the function is called I&#8217;m basically screwed. I&#8217;ll either end up in the 2.0 docs, at a broken link in the old docs, or in a forum somewhere. <\/p>\n<p><table width='600'  cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/gr9_screen2.jpg' class='insetimage' width='600' alt='WHY SO MENY BOOLITS?!?' title='WHY SO MENY BOOLITS?!?'\/><\/td><\/tr><\/table><\/p>\n<h3>DevIL<\/h3>\n<p>The Developer&#8217;s Image Library. I began using this <a href=\"?p=12293\">way back in Project Frontier<\/a>. I don&#8217;t need docs because the library is already doing everything I need it to do and I never have to touch my image-loading code.  <\/p>\n<h3>OpenAL<\/h3>\n<p>I really thought that OpenAL was going to do for audio what OpenGL did for graphics. But no. The official page is <a href=\"http:\/\/openal.org\/\">GONE<\/a>. Most of the docs out there are just little code snippets with links to that now-dead page. <\/p>\n<p>I wouldn&#8217;t mind, but some clever monkey left me this present:<\/p>\n<pre lang=\"c\">\r\n1>  audio.cpp\r\n1>e:\\source\\goodrobot\\goodrobot\\audio.cpp(189): warning C4996: 'alutLoadWAVFile': was declared deprecated\r\n1>          e:\\sdk\\openal\\include\\alut.h(113) : see declaration of 'alutLoadWAVFile'\r\n1>e:\\source\\goodrobot\\goodrobot\\audio.cpp(199): warning C4996: 'alutUnloadWAV': was declared deprecated\r\n1>          e:\\sdk\\openal\\include\\alut.h(116) : see declaration of 'alutUnloadWAV'\r\n1>e:\\source\\goodrobot\\goodrobot\\audio.cpp(226): warning C4996: 'alutLoadWAVFile': was declared deprecated\r\n1>          e:\\sdk\\openal\\include\\alut.h(113) : see declaration of 'alutLoadWAVFile'\r\n1>e:\\source\\goodrobot\\goodrobot\\audio.cpp(237): warning C4996: 'alutUnloadWAV': was declared deprecated\r\n1>          e:\\sdk\\openal\\include\\alut.h(116) : see declaration of 'alutUnloadWAV'\r\n1>e:\\source\\goodrobot\\goodrobot\\audio.cpp(355): warning C4996: 'alutLoadWAVFile': was declared deprecated\r\n1>          e:\\sdk\\openal\\include\\alut.h(113) : see declaration of 'alutLoadWAVFile'\r\n1>e:\\source\\goodrobot\\goodrobot\\audio.cpp(365): warning C4996: 'alutUnloadWAV': was declared deprecated\r\n1>          e:\\sdk\\openal\\include\\alut.h(116) : see declaration of 'alutUnloadWAV'\r\n1>  Generating Code...\r\n1>  GoodRobot.vcxproj -> E:\\Source\\GoodRobot\\Debug\\GoodRobot.exe\r\n========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========\r\n<\/pre>\n<p>That&#8217;s what I see every single time I do something that causes my audio system to recompile. The important phrase is this:<\/p>\n<p><code>'alutLoadWAVFile': was declared deprecated<\/code><\/p>\n<p><table width='600'  cellpadding='0' cellspacing='0' border='0' align='center'><tr><td><img src='https:\/\/www.shamusyoung.com\/twentysidedtale\/images\/gr9_screen5.jpg' class='insetimage' width='600' alt='Maybe if I ignore them they&#8217;ll just go away.' title='Maybe if I ignore them they&#8217;ll just go away.'\/><\/td><\/tr><\/table><\/p>\n<p>alutLoadWAVFile is a function you use to load a wave file so you can use it in your program. That message is an OpenAL developer frantically waving a red flag saying, &#8220;Hey! You shouldn&#8217;t be using alutLoadWAVFile! That&#8217;s the old way of doing things and we don&#8217;t support it! You should re-write your code to use the new system, which I will not hint at or explain.&#8221;<\/p>\n<p>After much searching I discover that <code>alutCreateBufferFromFile ()<\/code> is the new hotness. I also discover that the new hotness way of doing things is busted, and the old way works just fine. And I can&#8217;t sort it out because all the documentation vanished with the website. So the developer of OpenAL metaphorically sabotaged the old version, destroyed the documentation, and killed himself. <\/p>\n<p>What makes this even more fun are all the forum posts where someone asks a reasonable question and some smart-ass replies with: &#8220;Why don&#8217;t you just <a href=\"http:\/\/dead-link.com\">use this<\/a>?&#8221; With a link to the now-missing docs. So the death of OpenAL.org has also killed off a good percent of your fallback documentation.<\/p>\n<p>In any case, I get a page of errors in my face whenever I do anything. It still works, but it will be hard if I need to change anything about how the audio system operates. And of course the error messages are annoying, like having a fire alarm go off every time you do something mundane. <\/p>\n<p>A small ray of hope is that the new SDL was supposed to support audio.  So if I do ever make the leap to SDL 2.0, it might let me drop OpenAL.  That would be one less library to worry about. I don&#8217;t know if SDL 2.0 is ready for that yet and I&#8217;m in no hurry to mess with it now, but it&#8217;s probably going to be good news for developers when it happens.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>My project depends on a number of external libraries. It wouldn&#8217;t be possible to get this much done without offloading some of the drudgery to a few low-level packages written by others. I can make windows without getting married to Microsoft, render polygons without worrying myself with the arcane details of the driver layer, and [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[498],"tags":[],"class_list":["post-20921","post","type-post","status-publish","format-standard","hentry","category-good-robot"],"_links":{"self":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/20921","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=20921"}],"version-history":[{"count":0,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=\/wp\/v2\/posts\/20921\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=20921"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=20921"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shamusyoung.com\/twentysidedtale\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=20921"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}