{"assets":[],"author_link":"author\/gre\/","author_name":"gre","cat":"LD #29","categories":["LD #29"],"comments":[],"epoch":1399295880,"event":"LD29","likes":5,"metadata":{"p_key":"81471","p_author":"gre","p_authorkey":"0","p_urlkey":"290588","p_title":"Postmortem of my Ant Sim Game","p_cat":"LD #29","p_event":"LD29","p_time":"1399295880","p_likes":"5","p_comments":"0","p_status":"WAYBACK","us_key":null,"us_name":null,"us_username":null,"event_start":"1398384000","event_key":"22","event_name":"LD29"},"source_url":"2014\/05\/05\/postmortem-of-my-ant-sim-game\/","text":"<h3><strong><span style=\"text-decoration: underline\"><a href=\"http:\/\/www.ludumdare.com\/compo\/ludum-dare-29\/?action=preview&amp;uid=18803\">\u201cAnthill\u201d<\/a><\/span> made in 48 hours by @greweb<\/strong><\/h3>\n<p><img alt=\"\" height=\"247\" src=\"http:\/\/greweb.me\/images\/2014\/05\/anthill.png\" style=\"font-weight: inherit;font-style: inherit\" width=\"419\"\/><\/p>\n<p><span style=\"color: #000000\">I enjoyed that time a lot. What changed from the previous Ludum Dare for me is that\u00a0<\/span><strong style=\"color: #000000\">I\u2019m now<\/strong><span style=\"color: #000000\">\u00a0\u2014and happy to be\u2014\u00a0<\/span><strong style=\"color: #000000\">a father<\/strong><span style=\"color: #000000\">, and I\u2019m enough trained to wake up at 3am so I could be there attending the beginning!<\/span><\/p>\n<p style=\"color: #000000\">I haven\u2019t played any Ant Simulation Game but I recently played a lot\u00a0<a href=\"http:\/\/www.shiningrocksoftware.com\/\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">\u201cBanished\u201d<\/a>, an awesome city-building strategy game, and I was inspired by the \u201cassign jobs to people\u201d gameplay of this game.<\/p>\n<ul style=\"color: #000000\">\n<li style=\"font-weight: inherit;font-style: inherit\"><strong style=\"font-style: inherit\"><a href=\"http:\/\/greweb.me\/ld29\/\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">Play the Game<\/a><\/strong><\/li>\n<li style=\"font-weight: inherit;font-style: inherit\"><a href=\"http:\/\/www.ludumdare.com\/compo\/ludum-dare-29\/?action=preview&amp;uid=18803\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">Ludum Dare entry<\/a><\/li>\n<li style=\"font-weight: inherit;font-style: inherit\"><a href=\"http:\/\/github.com\/gre\/ld29\/\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">Source code<\/a><\/li>\n<li style=\"font-weight: inherit;font-style: inherit\">(spoiler)\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=DBt-5Qmzu1k\">Video of Playing the Game<\/a><\/li>\n<\/ul>\n<p style=\"color: #000000\">Developing a complete game in 48 hours (including sleeping) is tough, especially that it is also about making the graphics and the music!<\/p>\n<p style=\"color: #000000\">The game resulting of these 2 days is more a\u00a0<strong style=\"font-style: inherit\">prototype<\/strong>\u00a0than a finished game: the simulation remains minimalist and fastly boring, the food is the only resource you have to care about.<\/p>\n<p style=\"color: #000000\">Here is a\u00a0<strong style=\"font-style: inherit\">300x accelerated screencast of the developement of \u201cAnthill\u201d<\/strong>:\u00a0<a href=\"https:\/\/www.youtube.com\/watch?v=VhH7of4gAHk\">https:\/\/www.youtube.com\/watch?v=VhH7of4gAHk<\/a><\/p>\n<h2 style=\"color: #a31818\"><a name=\"right\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\"><\/a>What went right<\/h2>\n<h3 style=\"color: #7318a3\">Music<\/h3>\n<p style=\"color: #000000\">Best achievement of my LD entry was \u2013to me\u2013\u00a0<strong style=\"font-style: inherit\">making the music<\/strong>.<\/p>\n<p style=\"color: #000000\"><img alt=\"\" class=\"thumbnail-left\" height=\"357\" src=\"http:\/\/greweb.me\/images\/2014\/05\/music_preset.jpg\" style=\"font-weight: inherit;font-style: inherit\" width=\"476\"\/><\/p>\n<p style=\"color: #000000\">I\u2019m not a musician, neither a pianist, but I played a lot with\u00a0<a href=\"http:\/\/greweb.me\/tags\/audio\/\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">Audio<\/a>\u00a0the past year and I\u2019ve managed to make a music for this game \u2014and had a lot of fun making it. I\u2019ve used my\u00a0<em style=\"font-weight: inherit\">Yamaha P105<\/em>\u00a0as a MIDI controller for making the game music and connecting it to\u00a0<a href=\"http:\/\/www.warmplace.ru\/soft\/sunvox\/\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">SunVox<\/a>, a modular tracker software.<\/p>\n<h4 style=\"color: #183fa3\">Play the music \u2013 feedback appreciated<\/h4>\n<p>\u00a0<\/p>\n<p style=\"text-align: center\"><strong><a href=\"https:\/\/soundcloud.com\/greweb\/sets\/ld29-1\">https:\/\/soundcloud.com\/greweb\/sets\/ld29-1<\/a><\/strong><\/p>\n<p>\u00a0<\/p>\n<p style=\"color: #000000\"><img alt=\"\" class=\"thumbnail-right\" height=\"391\" src=\"http:\/\/greweb.me\/images\/2014\/05\/playing_midi.png\" style=\"font-weight: inherit;font-style: inherit\" width=\"511\"\/><\/p>\n<p style=\"color: #000000\">Most of the notes you heard have been<strong style=\"font-style: inherit\">recorded live from my hand<\/strong>, and I was quite proud of that, because I\u2019m quite a noob on a piano. Doing that way, you keep some imperfection in the music (little delay on the notes, especially in the intro music) and I think that sometimes makes the music better.<\/p>\n<p style=\"color: #000000\">I\u2019ve talked a few times about SunVox, also\u00a0<a href=\"http:\/\/greweb.me\/2013\/07\/zound-live\/\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">I still want to make my own web version<\/a>\u00a0of a\u00a0<strong style=\"font-style: inherit\">modular audio tracker<\/strong>\u00a0that anyone (first myself!) could use and also could embed live in the game (and, for instance, having game variable impacting the audio experience).<\/p>\n<h3 style=\"color: #7318a3\">Graphics<\/h3>\n<p style=\"color: #000000\">Also, I\u2019m more a developer than a graphist so I would say this was a success^^<\/p>\n<h3 style=\"color: #7318a3\">Using a library<\/h3>\n<p style=\"color: #000000\">I\u2019ve entirely\u00a0<strong style=\"font-style: inherit\">focused on making my game<\/strong>\u00a0rather than making the technical stack. Usually, I tend to develop my own framework with the game. It is good to learn and discover some\u00a0<a href=\"http:\/\/greweb.me\/2014\/01\/promisify-your-games\/\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">cool ways of programming a game<\/a>\u00a0but this time I really wanted to get things done\u2026<\/p>\n<h3 style=\"color: #7318a3\">Phaser.io<\/h3>\n<p style=\"color: #000000\">\u2026so I\u2019ve used\u00a0<strong style=\"font-style: inherit\"><a href=\"http:\/\/www.phaser.io\/\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">Phaser<\/a><\/strong>\u00a0which is a trendy and awesome framework. It is also built on top of the<strong style=\"font-style: inherit\">Pixi.js<\/strong>\u00a0rendering library (I used in\u00a0<a href=\"http:\/\/www.ludumdare.com\/compo\/ludum-dare-27\/?action=preview&amp;uid=18803\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">LD27<\/a>) and\u00a0<strong style=\"font-style: inherit\">p2.js<\/strong>\u00a0physics engine, which are two brillant and performant JavaScript libraries.<\/p>\n<p style=\"color: #000000\">Hopefully I started my project with a \u201cPhaser template\u201d I bootstraped during the previous warmup weekend. I\u2019ve still lost some time playing with the Phaser API but I could have relied on Phaser features and performance so I think it worth it the second day.<\/p>\n<h3 style=\"color: #7318a3\">Google Hangout with Ludum Dare friends<\/h3>\n<p style=\"color: #000000\">I used Google Hangout during the whole Ludum Dare, as a way to put my webcam in the timelapse, but more importantly to have other Ludum Dare friends coming in it!<\/p>\n<p style=\"color: #000000\">This was a cool first experiment as an alternative to the \u201cstream my dev\u201d approach. It was quite fun and social to have\u00a0<a href=\"http:\/\/twitter.com\/mrspeaker\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">@mrspeaker<\/a>\u00a0showing me his crazy Metal Meter game advancement.<\/p>\n<p style=\"color: #000000\"><img alt=\"\" height=\"293\" src=\"http:\/\/greweb.me\/images\/2014\/05\/hangout.png\" style=\"font-weight: inherit;font-style: inherit\" width=\"510\"\/><\/p>\n<h2 style=\"color: #a31818\"><a name=\"wrong\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\"><\/a>What went wrong<\/h2>\n<h3 style=\"color: #7318a3\">Achievability<\/h3>\n<p style=\"color: #000000\"><strong style=\"font-style: inherit\">My\u00a0<a href=\"https:\/\/github.com\/gre\/ld29\/blob\/master\/TODO.md\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">initial plan<\/a>\u00a0was too ambitious.<\/strong>\u00a0It seems to always happen with me: I get the first day a lot of ideas and motivation, and I tend to underestimate the work to be done. Then at the end of the first day, I\u2019m frustrated to find out I won\u2019t have enough time to do all my plans. Indeed it is good to have a lot of ideas but, next Ludum Dare, I\u2019ll try to be sure to have achievable goals.<\/p>\n<blockquote style=\"font-style: italic;color: #000000\">\n<p style=\"font-weight: inherit;font-style: inherit\">Next time, let\u2019s\u00a0<strong style=\"font-style: inherit\">remove half the features<\/strong>\u00a0I establish!<\/p>\n<\/blockquote>\n<p style=\"color: #000000\">So, the second day morning, I\u2019ve been replanning from scratch and reprioritize my features to basically have something finished and working as a game. Because of this decision, the result you can see is a game, but far from the one I originally wanted.\u00a0<strong style=\"font-style: inherit\">This version is only about digging, collecting mushrooms and avoiding stravation<\/strong>.<\/p>\n<p style=\"color: #000000\">Also I originally scheduled to work that way\u00a0<strong style=\"font-style: inherit\">Day 1: developing-only, Day 2: music and graphics + new features<\/strong>. I\u2019m not sure this approach can really works, especially it doesn\u2019t scale, we better work by adding complete features one after the other. That theorically works, but it is however difficult to apply in practice with the stress of the Ludum Dare countdown!<\/p>\n<h3 style=\"color: #7318a3\">Path finding performance<\/h3>\n<p style=\"color: #000000\"><strong style=\"font-style: inherit\">Implementing my own path finding algorithm was fast but not optimal<\/strong>\u00a0at all because of performances! I recently released a bugfixed version which just use an existing\u00a0<a href=\"http:\/\/qiao.github.io\/PathFinding.js\/visual\/\" style=\"font-weight: inherit;font-style: inherit;color: #5588bb\">path finding library<\/a>\u00a0to fix my bad implementation and also to avoid an ant to request path finding each frame when looking for a task to be affected on.<\/p>\n<h3 style=\"color: #7318a3\">Finding the good simulation parameters<\/h3>\n<p style=\"color: #000000\">I underestimated a bit the amount of work needed to find the good parameters of the simulation. Those are very important to\u00a0<strong style=\"font-style: inherit\">make the game well-balanced<\/strong>\u00a0(e.g. not impossible but also not super-easy), I don\u2019t think I found the optimal parameter in the released version.<\/p>\n<p style=\"color: #000000\">I think I need two important things to make this parameter search easier:<\/p>\n<ul style=\"color: #000000\">\n<li style=\"font-weight: inherit;font-style: inherit\">a framework to maintain parameters presets and change them live.<\/li>\n<li style=\"font-weight: inherit;font-style: inherit\">make the simulation running at any speed to ease the development. (faster simulation)<\/li>\n<\/ul>\n<h3 style=\"color: #7318a3\">[bug] A task is not always completed by the closest ant<\/h3>\n<p style=\"color: #000000\">There is a inconvenient\u00a0<strong style=\"font-style: inherit\">proximity bug<\/strong>\u00a0in my game that you may have noticed: when a new job is created, it may happen that, even if a ant was here nearby, a very far ant is assigned to this job.<\/p>\n<p style=\"color: #000000\">I\u2019m using a\u00a0<code style=\"font-weight: inherit;font-style: inherit;color: #555555\">foreach ant in noJobAnts { findAntTask(ant,availableTasks) }<\/code>\u00a0loop. In this first approach, even if a ant will take the closest task in\u00a0<code style=\"font-weight: inherit;font-style: inherit;color: #555555\">findAntTask<\/code>, the first assigned ant will occupy the task even if a closer ant was after in the noJobAnts list.<\/p>\n<p style=\"color: #000000\">Another approach to solve this issue would be to do\u00a0<code style=\"font-weight: inherit;font-style: inherit;color: #555555\">foreach task in availableTasks { findTaskAnts(task,noJobAnts) }<\/code>. In this second approach, the\u00a0<code style=\"font-weight: inherit;font-style: inherit;color: #555555\">findTaskAnts<\/code>\u00a0should sort the noJobAnts list for the given task proximity.<\/p>\n<p style=\"color: #000000\">However it is not that trivial because tasks also have different priorities for a given ant, and\u00a0<code style=\"font-weight: inherit;font-style: inherit;color: #555555\">findAntTask<\/code>\u00a0solved that. In my original plan, there is some basic tasks like \u201cclean the dirt\u201d or \u201cclean the corpse\u201d which can be done by any ant. However, a specialized ant (let\u2019s say an Harvester) may have some more important tasks to be done first, so this is why we need this priority.<\/p>\n<p style=\"color: #000000\">In other word, fixing this bug is not trivial and I need to find the optimal loop for that!<\/p>\n<h2 style=\"color: #a31818\">To be continued\u2026<\/h2>\n<p style=\"color: #000000\">I really wish to continue this game because I enjoyed making it and I would enjoy playing the one I have in mind! Time will tell if I can accomplish that wish!<\/p>","time":"May 5th, 2014 1:18 pm","title":"Postmortem of my Ant Sim Game","title_was_empty":false}