{"id":1659,"date":"2011-08-31T00:50:00","date_gmt":"2011-08-30T23:50:00","guid":{"rendered":"http:\/\/t-machine.org\/?p=1659"},"modified":"2011-08-31T00:50:00","modified_gmt":"2011-08-30T23:50:00","slug":"ludumdare-21-escape-from-the-android-pit","status":"publish","type":"post","link":"http:\/\/new.t-machine.org\/index.php\/2011\/08\/31\/ludumdare-21-escape-from-the-android-pit\/","title":{"rendered":"LudumDare 21: Escape from the (Android) Pit"},"content":{"rendered":"<p>I couldn&#8217;t enter this <a href=\"http:\/\/ludumdare.com\/\">LudumDare<\/a> competition on a technicality, but here&#8217;s my entry which plays by the spirit of the rules. I took a total of 24 hours (out of 48), of which only 12 were actual design + development (see below).  Hopefully next time I&#8217;ll be able to do it properly, and actually compete. I&#8217;ve kept to every rule, except that I did my 48 hours time-shifted :) from everyone else (two successive Sundays, instead of a contiguous Saturday + Sunday).<\/p>\n<h3>Screenshot + Android APK<\/h3>\n<table border=\"0\">\n<tr>\n<td>\n<a href=\"https:\/\/t-machine.org\/wp-content\/uploads\/device-2011-08-31-003735.png\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/t-machine.org\/wp-content\/uploads\/device-2011-08-31-003735-180x300.png\" alt=\"\" title=\"device-2011-08-31-003735\" width=\"180\" height=\"300\" class=\"alignleft size-medium wp-image-1660\" srcset=\"https:\/\/t-machine.org\/wp-content\/uploads\/device-2011-08-31-003735-180x300.png 180w, https:\/\/t-machine.org\/wp-content\/uploads\/device-2011-08-31-003735-90x150.png 90w, https:\/\/t-machine.org\/wp-content\/uploads\/device-2011-08-31-003735.png 480w\" sizes=\"(max-width: 180px) 100vw, 180px\" \/><\/a>\n<\/td>\n<td>\nDownload link (APK &#8211; you need to know how to install APK&#8217;s manually (google it if you&#8217;re not sure, it only takes 5 seconds)):<\/p>\n<p><a href='https:\/\/t-machine.org\/wp-content\/uploads\/Escape-From-the-Pit.apk'>Escape From the Pit<\/a>\n<\/td>\n<\/tr>\n<\/table>\n<h3>Aims<\/h3>\n<ol>\n<li>Make a LudumDare entry as an Android application &#8211; none of this easy &#8220;make it in Flash&#8221; or &#8220;make it in java&#8221; stuff &#8211; let&#8217;s go for a full mobile game, designed, developed, and launched in exactly 2 days flat!\n<li>Use an Entity System (c.f. my long-running series of articles, and also the public Wiki I created), and show that ES&#8217;s facilitate you writing new games VERY VERY QUICKLY\n<li>Make a game that was mildly challenging and (almost) enjoyable\n<\/ol>\n<p>Failed to officially enter the competition, but otherwise succeeded&#8230;<\/p>\n<h3>Background<\/h3>\n<p>LudumDare challenges you to write an entire game in under 2 days (technically: 48 hours &#8211; it&#8217;s up to you how much of that you sleep). You can&#8217;t even design it in advance &#8211; there&#8217;s a theme that&#8217;s only decided shortly before the 48 hours starts.<\/p>\n<p>LudumDare was the weekend before last &#8211; but I had to work that weekend on urgent day-job stuff. Like: I had to work all day Saturday, and there was no way out of it. So I couldn&#8217;t do the same 48-hour stint as everyone else.<\/p>\n<p>Also, I know from previous experience that the &#8220;48 hours in one stretch&#8221; is very different from &#8211; say &#8211; &#8220;12 hours for 4 days&#8221;. When you do a 24 or 48 hour game, you tend to only manage a certain percent of &#8220;productive&#8221; hours. The challenge of designing + building something from scratch forces you to keep taking &#8220;time off&#8221; to go think about what do next.<\/p>\n<p>So, I kept a diary of hours worked, and hours taken &#8220;off&#8221; as well. I&#8217;m confident I&#8217;d have fitted all of this &#8211; development time AND down-time &#8211; into the 48 hours. But I had to spread it over 2 successive weekends :(.<\/p>\n<h4>Day 1<\/h4>\n<p>(3 hours) &#8211; install Eclipse and the Android plugin, and the Android SDK. Document what I&#8217;ve done (1 hour) and check I can re-do it at will. Google, please wise-up and fix your install process &#8211; it&#8217;s not changed in almost 2 years, and it SUCKS<\/p>\n<p>(1 hour) &#8211; install some extra Android OS versions, get the emulator working correctly, get projects imported, get everything in source-control, get empty app running on hardware device. Ready to start project!<\/p>\n<p>&#8212; NB: everything up to this line I should have done before the contest started. If I were the kind of person that had free time on weekdays. Which sadly I&#8217;m not &#8212;<\/p>\n<p>(1 hour) &#8211; getting Android base classes up and running. Takes a while: Android is insanely badly designed for the &#8220;Core application&#8221; part. Needs hundreds of lines of code to make a Hello World app that *actually* works as an app (Google&#8217;s code example that does it in 4 lines is fake: no real app could do that).<\/p>\n<p>(3 hours) &#8211; on the beach, not working<\/p>\n<p>(4 hours) &#8211; upgrading the open source Entity System Libraries on <a href=\"http:\/\/entitysystems.wikidot.com\">http:\/\/entitysystems.wikidot.com<\/a> to support a bunch of features I&#8217;ve been using for a while in my own projects. This required writing a lot of stuff from scratch (using my own old source as inspiration), and integrating some improvements from patches\/forks that other people had submitted.<\/p>\n<p>&#8212; NB: everything up to this line I could have done before the contest started. Interesting though that I thought this was going to be &#8220;about to start writing the actual game&#8221; and I&#8217;ve only finally got to the point where I can write my first line of game-code &#8212;<\/p>\n<h4>Day 2<\/h4>\n<p>(0.5 hours): trying to make textures in Photoshop. Photoshop really sucks. Half the online resources for making the kinds of textures I want require PSP&#8217;s unique filters\/effects &#8211; useless :(.<\/p>\n<p>(0.5 hours): get a single sprite to appear on screen. A couple of idiot errors in one of my libraries &#8211; plus Google&#8217;s Eclipse plugin being really really bad at understanding &#8220;the scroll bar&#8221; (bug in ADT: it implements the world&#8217;s only non-static scrollbar)<\/p>\n<p>(1 hour): random maze generation (using: <a href=\"http:\/\/en.wikipedia.org\/wiki\/Maze_generation_algorithm#Randomized_Prim.27s_algorithm\">http:\/\/en.wikipedia.org\/wiki\/Maze_generation_algorithm#Randomized_Prim.27s_algorithm<\/a> )  that makes nice mazes, printing out onto the screen, still with my default &#8220;starfield&#8221; background. Rotating the screen is causing the entire game-state to be regenerated &#8211; includkng the maze &#8211; which was an accident, but actually helped A LOT with testing the maze algorithm (just tilt to re-run the algorithm instantly)<\/p>\n<p>(0.5 hours): learn how to do Android input-handling correctly; en-route, discover I&#8217;m missing the SDK docs, and set about downloading + installing them &#8230; + updating my blog instructions on how to install Android to include &#8220;SDK docs&#8221; as a section.<\/p>\n<p>(2.5 hours): discovering MAJOR bugs in Google&#8217;s basic &#8220;touch handling&#8221; API for Android &#8211; including bugs on Google&#8217;s own website source code, and an API designer on crack who broke the core Java contract didn&#8217;t document it. Not Happy.<\/p>\n<h4>Day 3<\/h4>\n<p>(1 hour) &#8211; implementing a collision detection system that does proper swept-collisions, but works OK with the poor fine-grained control of touch input<\/p>\n<p>(1 hour) &#8211; added filters to collision detection so I could have background images that the player will NOT collide with<br \/>\n(previously was colliding with every on-screen rendered sprite). Also added a very simple lighting system where squares that the player has walked close to or upon gradually light up, showing how much has been explored<\/p>\n<p>(1 hour) &#8211; refined the user-controls so you can hold your finger still and character keeps moving in that direction. Added handling in collision-detection system to allow character to slide along walls and into side-passages without the player having to stop and be ultra-precise (pixel perfect!) in timing the change of direction.<\/p>\n<p>(0.5 hours) &#8211; added an exit, fixed bugs in the maze-generation (if started on a right or bottom edge, it crashed)<\/p>\n<p>(1 hour) &#8211; fix Android&#8217;s brain-dead handlig of Bitmaps, giving a big speed boost, and re-learning how to use DDBS memory-allocation-tracking. I&#8217;m now auto-caching each bitmap inside my Sprite object. Sigh. There&#8217;s no easy workaround: Google says &#8220;don&#8217;t use getter methods&#8221; but Google also says &#8220;don&#8217;t call our getDrawable method more than once&#8221;.<\/p>\n<p>(1 hour) &#8211; added ghosts, made them move around the map nicely, and collide with player was *automatic* on first compile (freebie from using an Entity System!). Also made arrows float nicely in same place on screen even while scrolling.<\/p>\n<p>(1 hour) merge code from laptop back to desktop. Finally add the &#8220;win&#8221; conditions that makes the app playable!<\/p>\n<h3>Source Code<\/h3>\n<p>To make this game, I improved the basic Java Entity System up on the ES Wiki, and added some usability improvements and features. I created a whole new page for it here:<\/p>\n<p><a href=\"http:\/\/entity-systems.wikidot.com\/rdbms-beta\">http:\/\/entity-systems.wikidot.com\/rdbms-beta<\/a><\/p>\n<p>NB: It&#8217;s called &#8220;Beta&#8221; simply meaning &#8220;second generation (beta == second letter of greek alphabet)&#8221;. Not because it&#8217;s a beta-quality release :).<\/p>\n<p>Source code to the game itself is also up on github right now &#8211; <a href=\"https:\/\/github.com\/adamgit\/Game--Escape-from-the-Pit\">https:\/\/github.com\/adamgit\/Game&#8211;Escape-from-the-Pit<\/a> &#8211; although that&#8217;s a closed repository at the moment. I want to double-check there&#8217;s nothing included that shouldn&#8217;t be before I set it to &#8220;public&#8221;.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I couldn&#8217;t enter this LudumDare competition on a technicality, but here&#8217;s my entry which plays by the spirit of the rules. I took a total of 24 hours (out of 48), of which only 12 were actual design + development (see below). Hopefully next time I&#8217;ll be able to do it properly, and actually compete. [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[63,13,60,9],"tags":[],"_links":{"self":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/1659"}],"collection":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/comments?post=1659"}],"version-history":[{"count":0,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/1659\/revisions"}],"wp:attachment":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/media?parent=1659"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/categories?post=1659"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/tags?post=1659"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}