Latest 1.0.0
License MIT
Platforms ios 7.0, requires ARC

Build Status
twitter: @dylan36032

Goal-Based vector field path finding for iOS.

If you need to calculate the shortest path for many objects with the same target then this approach should be more efficient than traditional path finding algorithms. It creates a heatmap for the whole map, which takes time. But for each object it than only has to follow the heatmap values.



HeatMapPath is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "HeatMapPath"

If you’re not using CocoaPods you’ll find the source code files inside Pod/Classes.



Just create your own Tile class which implements the protocol DMTile.

Add the two synthesize:

@synthesize distance;
@synthesize position;

And add the method costFromSource:

- (int)costFromSource:(id<DMTile>)sourceTile {
    return 1;

Here you can return the cost for that tile. How you’ll do that is your choice. You get the source tile (the one that’s before it in the path) if your cost is different depending on the direction.


Initialize a DMHeatMap and keep it as member. Set the map property. The map property should be an array of arrays. The outer array is for each row. And each row is an NSArray with your tiles for that row. Hope this doesn’t sound too complicated.

Everytime your target changes you’ll have to set the target property and call the method generate.

For each object that needs a new path just call the method points:.



At the moment it doesn’t support diagonal moves, as for my use case this wasn’t needed. You can add this functionality quite easily. Just look at where neighbors are determined. Should be done at two places, once for the heatmap and once for the path finding.

Latest podspec

    "name": "HeatMapPath",
    "version": "1.0.0",
    "summary": "Goal-Based vector field path finding.",
    "homepage": "",
    "license": "MIT",
    "authors": {
        "Dylan Marriott": "[email protected]"
    "source": {
        "git": "",
        "tag": "1.0.0"
    "social_media_url": "",
    "screenshots": "",
    "platforms": {
        "ios": "7.0"
    "requires_arc": true,
    "source_files": "Pod/Classes",
    "resource_bundles": {
        "HeatMapPath": [

Pin It on Pinterest

Share This