{"id":207,"date":"2014-04-19T21:23:46","date_gmt":"2014-04-19T21:23:46","guid":{"rendered":"http:\/\/mjdarby.net\/blog\/?p=207"},"modified":"2014-04-19T21:23:46","modified_gmt":"2014-04-19T21:23:46","slug":"rogue-detective-part-1-a-defective-rogue","status":"publish","type":"post","link":"http:\/\/mjdarby.net\/blog\/2014\/04\/19\/rogue-detective-part-1-a-defective-rogue\/","title":{"rendered":"Rogue Detective Part 1 &#8211; A Defective Rogue"},"content":{"rendered":"<p>Rogue Detective started off as an attempt at the annual <a title=\"7DRL Challenge\" href=\"http:\/\/www.roguebasin.com\/index.php?title=Seven_Day_Roguelike_Challenge\">7 Day Roguelike<\/a> competition, wherein one aspires to create a full roguelike in a mere seven days. Entrants are allowed to use previous work, provided the final game is a new roguelike unto itself.<\/p>\n<p>This year, the competition fell in one of the two weeks of my holiday from work. Being one of the many proud staycationers so prevalent in England, this meant I would have the full week to develop a game! I heard about the competition one day in advance of its start, which gave me a little bit of time to start mulling over a few ideas I had.<\/p>\n<p>At the same time, I started considering at my options regarding development. I already knew what my editor would be: Emacs, of course! I figured if I was going to pull this off in a reasonable time frame, I&#8217;d need to use a language I was comfortable developing in. That meant a choice between C(++) and Python. Given how I&#8217;d recently\u00a0worked on a Python game, the language was still fresh in my mind. Indeed, for speedy development I am in general more comfortable in Python.<\/p>\n<p>Editor sorted, language sorted.. Now I needed to consider what libraries might exist out there to help me. I vaguely remembered NetHack using the curses library for terminal stuff, so the first thing I did was check for Python bindings. Sure enough, a Python library for curses existed. At this point, I hadn&#8217;t even considered a graphical roguelike. I knew I had no chance to produce something pretty, so I would stick to ascii. I started work on getting an @ symbol wandering the void. This is not the most thorough approach to library selection, but yeah! Limited time means limited research.<\/p>\n<p>I hadn&#8217;t quite realised what I was undertaking: A complete roguelike from scratch, save for terminal character manipulation. Given only a week, surely the typical entrant would have to take the whole time to finish something even remotely playable, eschewing work and a social life?<\/p>\n<p>Meanwhile, my friend <a title=\"Aivalar\" href=\"http:\/\/aivalar.com\/blog\/\">Ariff<\/a> was considering entering the same competition. The first thing he did was check for the already existing roguelike libraries that could help. Of course! Why wouldn&#8217;t something so obviously useful exist?<\/p>\n<p>For Python, there already exists the <a title=\"libtcod\" href=\"doryen.eptalys.net\/libtcod\">libtcod library<\/a>. Rather than build everything from scratch, libtcod provides users with useful functionality such as built-in dungeon generation, pathfinding, line of sight algorithms.. And to top it off, the whole thing is portable: Rather than build off a terminal-based library, it uses the <a title=\"LibSDL\" href=\"http:\/\/www.libsdl.org\/\">SDL library<\/a>. So while programs now have to run in a non-terminal, there&#8217;s very little messing about with getting games working on multiple platforms AND with full colour!<\/p>\n<p>So it&#8217;s a no-brainer, right? Using this library, I&#8217;d be able to get to work on the meat of my game idea immediately! Maybe this wouldn&#8217;t be such an impossible task after all.<\/p>\n<p>Of course, I&#8217;d already gotten an @ symbol walking around.. And it would be a shame to waste &#8216;all that work&#8217;.. Long story short, I made the questionable decision to continue with my own &#8216;from scratch&#8217; engine. This was probably due to a mix of hubris and ignorance. Sufficed to say, I didn&#8217;t finish in seven days. It turns out that unless you&#8217;ve implemented things like path-finding and field of view before, they can be more than a little time consuming!<\/p>\n<p>So the dream of a roguelike in seven days was dead on arrival. But this wouldn&#8217;t kill the dream of a roguelike in totality. Over the past month I&#8217;ve continued to work on my little game, and over the next few posts I&#8217;d like to go through some of the basics of roguelike development using my repository&#8217;s history to guide us. It will definitely not be a guide on the proper usage of source control (one branch for life!), but I think maybe it&#8217;ll be useful for me to solidify the process and maybe useful for people reading if they want some insights on how a newbie might write a roguelike.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Rogue Detective started off as an attempt at the annual 7 Day Roguelike competition, wherein one aspires to create a full roguelike in a mere seven days. Entrants are allowed to use previous work, provided the final game is a new roguelike unto itself. This year, the competition fell in one of the two weeks <a class=\"read-more\" href=\"http:\/\/mjdarby.net\/blog\/2014\/04\/19\/rogue-detective-part-1-a-defective-rogue\/\">[&hellip;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7,15],"tags":[],"class_list":["post-207","post","type-post","status-publish","format-standard","hentry","category-programming","category-rogue-detective"],"_links":{"self":[{"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/posts\/207","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/comments?post=207"}],"version-history":[{"count":2,"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/posts\/207\/revisions"}],"predecessor-version":[{"id":209,"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/posts\/207\/revisions\/209"}],"wp:attachment":[{"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/media?parent=207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/categories?post=207"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/mjdarby.net\/blog\/wp-json\/wp\/v2\/tags?post=207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}