2D Toolkit > Contract Work

[paid] Tilemap pathfinding

<< < (2/5) > >>

pythagoras123:
I am indeed and curious to see how you did it.
I have done some experiments too with simple A* but wasn't satisfied with the result. One of my main problem is that my tilemap is huge (930x326 tiles) with a tileset of 512 different tiles. I am trying to avoid generating colliders or prefabs for each and every tile.

dotty:
I ended up editing simple a* to run my own method a create an array of nodes. I essentially looped over ever tile, if it had a collider mark it as unwalkable, if it doesn't mark it walkable. I then pumped that array into simple a* and let it run it's own pathfinding. It worked well for me. I had a map about 100x100 tiles, each tile being 32px X 32px. I had about 50 pathfinders running without a hitch. This was on i7 retina macbook pro.

I'll send the code across later when I get home from work.

pythagoras123:
Thanks, that's very interesting ! I'm looking forward to see how you did that.

dotty:
Obviously import simple A *, then create a script called PathFinder2DTileMap.cs and add the code in the link below.

All you need to do is set Toolkit2DTileMap to a tk2dTileMap object and it should do the rest (if you click "Draw Map In Editor", you'll see the red areas that aren't walkable, and green which are).

You can then use simple A *'s Pathfinding functions. Be warned, this script was created for a 32x32 tile, and simply selects tiles if they have a collider or not, so you might need to tweek it a lil.

http://pastiebin.com/51d7253305569

pythagoras123:
Many thanks ! I'll try that as soon as i get back.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version