Tileshift – Using the A* algorithm as a fitness function.
Most genetic algorithms (GAs) require some kind of fitness function. Essentially the algorithms can be very simple. As input we have some initial state (in the case of Tileshift, a 2D tile map). Then, we have some mutation function which makes changes to the tile map. Each of these candidates is processed by a fitness function which in turn produces a single number that rates how good the candidate is. The candidate with the best rating is then used for the next iteration.
Tileshift uses the A* algorithm for path planning and the fitness function. Each candidate tilemap is ranked based on how it helps the player get to the end goal. By selecting a tile map that assist the user, eventually a path to the goal is formed. We hope to add additional challenges to the generation function along with keys, doors, monsters and movable blocks. These will enhance the gameplay and engage the user.
You can visualise part of the A* search by checking the visualise checkbox at the lower left side of the demo page. This shows the cost for the path search. The blue number is the best guess by the search algorithm, and ultimately represents the fitness of the current candidate. Red number means explored and green number means open. Candidates are evaluated as the user moves through the map (which you can’t see) and the best candidate is used to update the game state.







