{"author_name":"ippa","cat":"LD #21","comments":[],"epoch":1314128820,"likes":0,"metadata":{"p_key":"63671","p_author":"ippa","p_authorkey":"1087","p_urlkey":"99456","p_title":"HTML5 \/ Javascript gamedev postmortem","p_cat":"LD #21","p_event":"LD21","p_time":"1314128820","p_likes":"0","p_comments":"0","p_status":"UPD5","us_key":"1087","us_name":"ippa","us_username":"ippa","event_start":"1313712000","event_key":"7","event_name":"LD21"},"text":"<p>So I chose to make a game with HTML5 \/ Javascript using the <a href=\"http:\/\/jawsjs.com\/\">JawsJS html5 gamelib<\/a>.<\/p>\n <p>I used the &lt;canvas&gt;-tag since I wanted to make a freeform level with pixelperfect collisions, basically I made the whole thing in graphics gale, could as well have done it in paintbrush.<\/p>\n <p>The new HTML5 &lt;canvas&gt; tag makes it easy to get the data in raw format, basically an array with RGBA values. From there on it&#8217;s to check collisions.. 1 pixel at the feet is a decent start.<\/p>\n <p>The most annoying thing is probably the audio-formats that&#8217;s supported for the new &lt;audio&gt;-tag.<\/p>\n <p>Safari doesn&#8217;t play OGGs for some lame reason, and Firefox doesn&#8217;t do MP3s. So all audio has to be provided in 2 formats.. also you wan&#8217;t detection at asset-loading time etc. I could have lived without that cruft.<\/p>\n <p>Otherwise Javascript has become amazingly fast, I think V8 is faster then ruby and python. All browsers come with good debugging possibilites.<\/p>\n <p>Javascript doesn&#8217;t have the traditional classes and inheritence, but rather prototypical inheritence.. which can be confusing at first.<\/p>\n <p>What I love is the dynamic nature of objects in Javascript.. basically all objects are big key-value storages (hashes).<\/p>\n <p>So you can whenever you want just set a new flag\/property on whatever object.<\/p>\n <p>\/* Player.dead has never been defined or used at this point *\/<\/p>\n <p>if(player.dead) { &#8230; do sometting &#8230;} \/\/ won&#8217;t throw any error.. played.dead will just return undefined<\/p>\n <p>player.dead = true<\/p>\n <p>if(player.dead) { &#8230; do something .. } \/\/ played.dead is now true and code will be executed<\/p>\n <p>The biggest upside with javascript is ofcourse ppl not having to download anything. No virus-scan etc etc. Just instant gaming. And the big players are making the javascript engines faster on a daily basis.<\/p>\n <p>Play my Javascript game here:<\/p>\n <p><a href=\"http:\/\/www.ludumdare.com\/compo\/ludum-dare-21\/?action=preview&amp;uid=1087\">http:\/\/www.ludumdare.com\/compo\/ludum-dare-21\/?action=preview&amp;uid=108<\/a><\/p>\n <p>Here&#8217;s a teaser-shot from the game, you start in the &#8220;west prison<a href=\"http:\/\/www.ludumdare.com\/compo\/2011\/08\/23\/html5-javascript-gamedev-postmortem-is-it-ready-for-the-big-leagues\/level1_cut\/\" rel=\"attachment wp-att-70821\"><img class=\"alignleft size-full wp-image-70821\" src=\"http:\/\/www.ludumdare.com\/compo\/wp-content\/uploads\/2011\/08\/level1_cut.png\" alt=\"\" width=\"780\" height=\"1254\" srcset=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2011\/08\/level1_cut-550x884.png 550w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2011\/08\/level1_cut.png 780w\" sizes=\"(max-width: 780px) 100vw, 780px\" \/><\/a>&#8221; and have to find your way out of a huge castle.<\/p>\n <p>&nbsp;<\/p>\n \n <p>Tags: <a href=\"http:\/\/ludumdare.com\/compo\/tag\/canvas\/\" rel=\"tag\">canvas<\/a>, <a href=\"http:\/\/ludumdare.com\/compo\/tag\/html5\/\" rel=\"tag\">html5<\/a>, <a href=\"http:\/\/ludumdare.com\/compo\/tag\/javascript\/\" rel=\"tag\">javascript<\/a>, <a href=\"http:\/\/ludumdare.com\/compo\/tag\/postmortem\/\" rel=\"tag\">postmortem<\/a><\/p>","time":"August 23rd, 2011 2:47 pm","title":"HTML5 \/ Javascript gamedev postmortem"}