# how to implement A Star path finding on 2D map with large tiles

The map tiles I have im my game are 64x64 pixels, and the characters are 16x16 pixels. I was reading about A Star path finding and I was wondering if I need my tiles closer to the size of my characters so that the movement given by the path finding seems more natural, or should I set up a different node map of where the characters can move, and use that in the A Star algorithm.

Or if you have a better solution let me know

Thanks!

EDIT: this is the Map class I am using

public class Map extends JComponent{
MapTile[][] map;
Random random;

public Map(char[][] mapKey){
map = createMap(mapKey);
}

public void update(){

}

@Override
public void paintComponent(Graphics g){
for(int i = 0; i < map.length; i++){
for(int j = 0; j < map[0].length; j++){
drawTile(g, map[i][j].getType(), i * 64, j * 64);
}
}
}

private MapTile[][] createMap(char[][] mapKey){
MapTile[][] temp = new MapTile[mapKey.length][mapKey[0].length];

for(int i = 0; i < mapKey.length; i++){
for(int j = 0; j < mapKey[i].length; j++){
temp[i][j] = new MapTile(mapKey[i][j]);
}
}
return temp;
}
}


really the only thing that the MapTiles hold at this point is a key to the Image they paint on the screen

• It depends very much on your movement style. If you have obstacles inside your tiles, you definitely need a finer graph so you can path around them. – Magus Feb 28 '14 at 16:51
• Could you share a map sample? I understand you don't want characters to move in rigid lines. This can be corrected without changing the tiles. – AturSams Feb 28 '14 at 16:52
• Technically since we don't know what your map looks like I could only suggest that you combine a Navigation mesh aka navmesh for high level path-finding and use flow field to find the path between two neighbouring nodes. Using a naive implementation of A* will not get satisfactory results. You could try to lower the resolution but I fear this may increase memory consumption and/or reduce performance. – AturSams Feb 28 '14 at 19:47