Submissions from 2015-03-10 to 2015-03-11 (2 total)

Today I did some AI planning and decided to postpone improving it until I have more spare time, which should be at latest in 2 or 3 weeks when a couple of the university courses are ending.

Today I also started working on Help view (no content there yet) and fixed another nasty bug. :)

If you would like to support Crystal Kingdom, please consider liking its facebook page and following it on twitter.
Yesterday's update can be found here.
In a case of any questions or suggestions, don't hesitate to contact me here or on twitter. ;)

Today I messed around with a heatmap algorithm. I wanted to create something that would let the computer discover the best way to get a lot of individual game objects as close to a certain point as possible. The trick was that I plan on having a lot of game objects and I didn't want to run a pathfinding algorithm for each one individually. So instead I pick the point that they should move towards and then rate every space on the board based on how close it is to the destination.

I was stupid though and set it up as a depth first search. Basically how the algorithm works is to start with a spot and then recursively call itself on each of the surrounding spots. I figured the quick and dirty method would just be a brute force approach with a depth first algorithm. I knew that I was going to lose some efficiency because I would be calculating values for spaces that would later be replaced with better moves, but I figured for a first pass I didn't care.

Well I should have. The algorithm found the values for all the spaces, but to calculate a board that is 40x40 took over a second and involved 1,600,000 calculations. Depth first is definitely not the way to go. I re-wrote it using a stack so I can control the order that the spots are calculated and now I'm down to under 8000 calculations for the 40x40 board and it completes an order of magnitude faster.

So my new algorithm runs 200 times faster because I was 200 time less stupid when coding it.

If you want to play around with the end result you can do so here: http://codingadventure.net/index.php/projects/heat...

Instructions on the page.