{"author_name":"ZXeno","cat":"LD #31","comments":[],"epoch":1418152500,"likes":2,"metadata":{"p_key":"22296","p_author":"ZXeno","p_authorkey":"28862","p_urlkey":"57663","p_title":"Ludum Traders","p_cat":"LD #31","p_event":"LD31","p_time":"1418152500","p_likes":"2","p_comments":"1","p_status":"UPD5","us_key":"28862","us_name":"ZXeno","us_username":"\/author\/zxeno\/","event_start":"1417737600","event_key":"26","event_name":"LD31"},"text":"<p>Happy Tuesday (or Wednesday, depending on where you are) everyone! So I decided to do a quick rundown of my game and do some shameless self-plugging, and throw out the offer to sit down and play your games! So firstly, plug: http:\/\/ludumdare.com\/compo\/ludum-dare-31\/?action=preview&amp;uid=28862<\/p>\n <p>Secondly, post a comment on this post with a link to your game, and I&#8217;ll give it a play\/comment as soon as I have time. I hope to see some good ones!<\/p>\n <p>So&#8230; muh game!<\/p>\n <p>Star Traders. I had been sick all week leading up to Ludum Dare. I had gotten in no practice, aside from some horrifying attempt at procedurally generating 2D tile terrain while doped-out on cold meds. It wasn&#8217;t pretty. And I was (and still am) a little sick during the entirety of the jam. My friend, Artuir, offered to do music and was kind of excited about the idea. He&#8217;d done music for game jams before, but for reasons unbeknownst to me, was excited for this one. So I said, &#8220;Sure! Why not?&#8221; And now, Ludum Traders has some really good music! But, back to the breakdown&#8230;<\/p>\n <p>I was brainstorming after the theme release. I knew it would be tile-based, but I really had no idea what. I went back and forth between a few ideas, but finally stuck on the idea of a trade tycoon or construction tycoon type of game. After boiling it down for about 3 hours, I decided on a trade game, and had no idea what setting to put it in. So, I picked space because&#8230; spaaaaaaaaace!<\/p>\n <p>I got started on map and entity and tickrate and graphics and whatnot, Artuir got started on music and had something excellent by mid-day Saturday. Once he had put the music out, it was time to work on pathfinding for the trade ships. I knew I&#8217;d be using A*, but knew more about Dijkstra&#8217;s and had actually implemented it before. I wrote up Dijkstras for first implementation and kept going. But once I started getting to where it was time to actually get ships to have path queues&#8230; there was a problem&#8230; Dijkstra&#8217;s greedy slowness was causing about a 25ms pause every time a ship calculated its path. No good. So, I started down a path of rewriting the pathfinding for A*&#8230; which turned into 9 hours of having no idea why it wasn&#8217;t working. After those 9 hours, I said &#8220;fuck this, now I&#8217;m behind&#8230;&#8221; and reverted back to my Dijkstra&#8217;s implementation, and continued working on the game with the pauses. Once I got the most basic parts of the game done, and with about 6 hours left on the 48 hour clock (I was trying to follow it, despite planning to submit for the jam), I decided it was time to revisit pathfinding again. I started at about 1300hrs at rewriting for A*. This was the result after the first hour:<\/p>\n <p><a href=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2014\/12\/B4SyBHICUAAaeQg.png\"><img class=\"aligncenter wp-image-423970 size-medium\" src=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2014\/12\/B4SyBHICUAAaeQg-300x290.png\" alt=\"B4SyBHICUAAaeQg\" width=\"300\" height=\"290\" \/><\/a><\/p>\n <p>I was quite confused, and very, very frustrated. I rewrote it and optimized it and changed from floats to ints and from ints to decimals and doubles&#8230; I couldn&#8217;t figure out where my math was wrong. Then, in one last highly frustrated and desperate moment, I converted the ENTIRE algorithm to doubles and found my mistake&#8230; a cast from double to int in my heuristics function I didn&#8217;t even realize I&#8217;d made. Fixing that gave me working, fast, accurate pathfinding. I had completed something I had never done before! I implemented A* pathfinding in a game that wasn&#8217;t built from a tutorial! I was so ecstatic I hopped up with my arms in the air, ran downstairs and hugged my kid and kissed my wife before coming back upstairs to finish. Looking at the total time I spent on pathfinding&#8230; It came out to about 15 hours.\u00a0 Absolutely too much time on one thing for a speed-based competition, but now I know it, and I&#8217;ll never have that particular problem again.<\/p>\n <p>However, having spent that much time on it, meant that I had to shave needed features to get it in on-time. Random events (like pirates destroying your ships), another pass on getting the goods pricing algorithm right, the ability to buy out the stars and own them as a possible winning condition&#8230; things that would have made the game challenging and fun, ultimately got cut to finish on-time. With work looming the next day, I didn&#8217;t have much time between bedtime Sunday and submission time Monday to work on it. I polished up what I had, tested it as best I could, had Artuir test it as much as he could, and fixed the bugs we found, before submitting about an hour before the jam deadline. So there were a lot of lessons learned, and quite a few personal achievements earned, but it came at a bit of a cost.<\/p>\n <p><span style=\"text-decoration: underline\">What went right<\/span>:<\/p>\n <ul>\n <li>Stuck to a to-do list and accomplished all but two things on it before the deadline!<\/li>\n <li>Implemented working pathfinding for the first time<\/li>\n <li>Didn&#8217;t wait until the last hour to think about sound and music<\/li>\n <li>Didn&#8217;t over-scope in terms of feature count for once<\/li>\n <li>Had time to bug-crush (a little) before the deadline<\/li>\n <\/ul>\n <p><span style=\"text-decoration: underline\">What went wrong<\/span>:<\/p>\n <ul>\n <li>Spent entirely too much time on one thing, to the detriment of the game<\/li>\n <li>Didn&#8217;t have an outlined plan for implementing certain features<\/li>\n <li>Started programming while sick<\/li>\n <li>Did not get enough practice in<\/li>\n <li>Did not finish all features due to a bad decision<\/li>\n <\/ul>\n <p><span style=\"text-decoration: underline\">What I learned<\/span>:<\/p>\n <ul>\n <li>Don&#8217;t take on new, poorly-understood tasks during a timed competition<\/li>\n <li>Stick to slightly simpler, less complex ideas if they need complex implementaiton<\/li>\n <li>If you have a working algorithm but it&#8217;s slow, work around it rather that write something that takes too long but is fast<\/li>\n <li>Have your workspace ready 24 hours in advance, rather than start preparing it 1 hour in advance<\/li>\n <li>Consider the resolution requirements during design, and operate around it accordingly<\/li>\n <\/ul>\n <p>I had an absolute blast. I&#8217;m hoping I&#8217;m not busy during the next one, as I really want to start participating more often.<\/p>\n <p>I hope everyone had a great time, and good luck during the voting round!<\/p>","time":"December 9th, 2014 2:15 pm","title":"Ludum Traders"}