{"author_name":"shcromlet","cat":"LD #33","comments":[],"epoch":1440385980,"likes":7,"metadata":{"p_key":"14032","p_author":"shcromlet","p_authorkey":"44368","p_urlkey":"49293","p_title":"Functional Programming is Different: A Postmortem","p_cat":"LD #33","p_event":"LD33","p_time":"1440385980","p_likes":"7","p_comments":"0","p_status":"UPD5","us_key":"44368","us_name":"shcromlet","us_username":"shcromlet","event_start":"1440115200","event_key":"29","event_name":"LD33"},"text":"<p>So I&#8217;d say I&#8217;m a post-newbie stage functional programmer. \u00a0I tend to program in Haskell no matter what language I&#8217;m using, as they say. \u00a0I go for purity even when it hurts.<\/p>\n <p>But I&#8217;ve actually never made a complex game with a functional language. \u00a0 It turns out there&#8217;s some tricky bits, and I ended up wasting an enormous amount of time on them. \u00a0I&#8217;m not sure I even learned anything. \u00a0Maybe I learned: 1) You can fudge random numbers with sufficiently weird multiplication, 2) Functional programming does not ensure non-crufty code. \u00a0This was some of the ugliest code I&#8217;ve ever written.<\/p>\n <p><span id=\"more-489770\"><\/span><\/p>\n <p>Last week I made<a href=\"https:\/\/koeida.github.io\/space.html\" target=\"_blank\"> an asteroids clone <\/a>in Elm that ended up being more fun than my compo game. But maybe that&#8217;s because asteroids is just fun.<\/p>\n <p>Things I like about Elm:<\/p>\n <ol>\n <li>It has a really useful time-traveling debugger. \u00a0You should check it out.<\/li>\n <li>It never froze. \u00a0If it compiles, it&#8217;s solid. \u00a0Pretty much. \u00a0But I&#8217;m used to that with other functional languages.<\/li>\n <\/ol>\n <p>Things I didn&#8217;t like:<\/p>\n <ol>\n <li>I&#8217;m actually a little puzzled about the benefits of functional reactive programming for game programming. \u00a0The structure of the code ended up not looking much different than my naive non-FRP games in functional languages. \u00a0The whole signal-processing part of it is really only a few lines. \u00a0Maybe I&#8217;m missing something.<\/li>\n <li>Random numbers. lol. I&#8217;m just totally unaccustomed to the functional way of dealing with this. Using random numbers anywhere pollutes everything. Every function that touches a random number has to pass a seed around. Blech.<\/li>\n <li>Elm is supposed to have human-readable error messages. \u00a0But they were actually atrocious. \u00a0I assume this is a work-in-progress, but I really, really missed GHC&#8217;s unfriendly messages this weekend.<\/li>\n <li>I like using little sprites. \u00a0Like, 16&#215;16 or 32&#215;32. \u00a0But I can&#8217;t make a low-res game with elm. \u00a0I can only make a very small canvas. \u00a0So I ended up with just tiny little sprites <img src=\"http:\/\/ludumdare.com\/compo\/wp-includes\/images\/smilies\/frownie.png\" alt=\":-(\" class=\"wp-smiley\" style=\"height: 1em; max-height: 1em;\" \/><\/li>\n <\/ol>","time":"August 23rd, 2015 10:13 pm","title":"Functional Programming is Different: A Postmortem"}