{"author_name":"ioquatix","cat":"LD #24","comments":[],"epoch":1345985520,"likes":5,"metadata":{"p_key":"52595","p_author":"ioquatix","p_authorkey":"14234","p_urlkey":"88297","p_title":"Tileshift \u2013 Updated A* implementation and query size.","p_cat":"LD #24","p_event":"LD24","p_time":"1345985520","p_likes":"5","p_comments":"0","p_status":"UPD5","us_key":"14234","us_name":"ioquatix","us_username":"ioquatix","event_start":"1345766400","event_key":"12","event_name":"LD24"},"text":"<p>So, I&#8217;ve been working on A* heuristics.<\/p>\n <p>It is interesting so I wrote a visualisation tool for looking at the costs and paths.<\/p>\n <p>This is a relatively large number of iterations using Manhattan Distance. The large search space is quite costly since we use the search algorithm as a fitness function to the genetic selection algorithm:<\/p>\n <p><a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/08\/26\/tileshift-updated-a-implementation-and-query-size\/searchlarge\/\" rel=\"attachment wp-att-170556\"><img class=\"aligncenter size-full wp-image-170556\" src=\"http:\/\/www.ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/SearchLarge.png\" alt=\"\" width=\"465\" height=\"497\" \/><\/a><\/p>\n <p>To improve the efficiency of the GA, I reduced the size of the search, and we get a similar short term prediction which is good enough:<\/p>\n <p><a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/08\/26\/tileshift-updated-a-implementation-and-query-size\/searchsmall\/\" rel=\"attachment wp-att-170566\"><img class=\"aligncenter size-full wp-image-170566\" src=\"http:\/\/www.ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/SearchSmall.png\" alt=\"\" width=\"263\" height=\"336\" \/><\/a><\/p>\n <p>In particular, the shorter search allows for the users location to have more of an effect on the genetic algorithm since the best possible destination will be more local.<\/p>\n <p>Finally, I was interested to compare the results with Euclidean distance. We see a larger diagonal component (which is to be expected) heading towards the goal (in this case towards the lower right).<\/p>\n <p><a href=\"http:\/\/www.ludumdare.com\/compo\/2012\/08\/26\/tileshift-updated-a-implementation-and-query-size\/searcheuclidean\/\" rel=\"attachment wp-att-170574\"><img class=\"aligncenter size-full wp-image-170574\" src=\"http:\/\/www.ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/SearchEuclidean.png\" alt=\"\" width=\"669\" height=\"378\" srcset=\"http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/SearchEuclidean-300x169.png 300w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/SearchEuclidean-550x310.png 550w, http:\/\/ludumdare.com\/compo\/wp-content\/uploads\/2012\/08\/SearchEuclidean.png 669w\" sizes=\"(max-width: 669px) 100vw, 669px\" \/><\/a><\/p>\n <p>I actually found that the directionality of this cost function didn&#8217;t give as good results as the Manhattan distance allows the user to try out both horizontal and vertical paths which effectively have the same cost, where-as the Euclidian cost tends to build paths directly towards the goal diagonally.<\/p>\n <p>It has been interesting to play with the parameters of the A* algorithm and visualise the results, and generally it has been very helpful. You can try out some of the visualisations in the <a href=\"http:\/\/www.codeotaku.com\/game-mechanics-society\/games\/tileshift\/index.html\">first level here<\/a>.<\/p>","time":"August 26th, 2012 7:52 am","title":"Tileshift \u2013 Updated A* implementation and query size."}