Hello Guest

Author Topic: [paid] Tilemap pathfinding  (Read 26816 times)

semiessessi

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: [paid] Tilemap pathfinding
« Reply #15 on: January 03, 2014, 12:23:53 pm »
is this doing some kind of graph traversal at run-time?

do you have any dynamics that aren't just switching the collision on and off on a tile? you could cache everything offline as some kind of 'potential reachability set' data and partition the world up so that tiny little numbers like 4k x 4k are no longer scary but trivial to handle quickly... dealing with this kind of data efficiently can be slightly painful if you have a very large grid, but the combination of hierarchy and clever use of memory can help there - although given how much Unity consumes when it does nothing its probably not worth bothering with that until you confirm that you really have a memory problem first. :)

has this been adequately solved yet? i'm kind of curious just out of interest rather than any desire to make this for money - this is pretty standard games/AI programmer stuff so in theory it should be easy to solve with help from the internet - in practice I know that a lot of this stuff is pretty poorly documented in terms of practical implementation details.

(I'd do it, but I have a full-time job and I'm very expensive - I'd feel rude just to ask for even 10% of my usual rate from an indy).

hektac

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: [paid] Tilemap pathfinding
« Reply #16 on: February 27, 2014, 11:20:21 pm »
It doesn't seem to be 100% accurate.  Walkable nodes will still connect to non-walkable nodes like this (the gray walls have colliders on them):



I'm trying to figure out why but has anyone else encountered this problem?

I have run into this problem as well, did you ever find a resolution for this?

dotty

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 65
    • View Profile
Re: [paid] Tilemap pathfinding
« Reply #17 on: March 13, 2014, 03:36:42 pm »
Just a follow up to this. I spent a lot of money on different a* solutions, and the best, by far, was http://arongranberg.com/astar/ .

There's a free version, but I opted for the pro versions ($100) as I'll be able to apply it to more situations (both 3d, and 2d).

The latest version of A* works with BoxCollider2D which is perfect! However, there's 1 downfall. When you create a tilemap with TK2D it create it's colliders using EdgeCollider2D. It uses EdgeCollider2D as it reduces the amount of PolygonCollider/BoxColliders needed. So basically you need to manually draw all the BoxCollider2D's for each 'solid' tile, then get the A* to generate a grid.

If your tilemaps have a consistent tilesize (32x32 64x64, etc) and each tile is either collidable, or not, then you can use my super handy UnityEditor plugin to automatically loop through your tilemap and place a BoxCollider2D in it's place.

https://github.com/kevdotbadger/BoxColliderGenerator


zeteginara

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 38
    • View Profile
Re: [paid] Tilemap pathfinding
« Reply #19 on: June 20, 2014, 03:57:07 am »


I'm also having this problem when attempting to follow Dotty's script.  Can anyone think of a solution to this?  Or another pathfinding solution that will easily work with a 2dtoolkit tilemap?

rakkarage

  • Newbie
  • *
  • Posts: 12
    • View Profile
Re: [paid] Tilemap pathfinding
« Reply #20 on: June 20, 2014, 04:30:52 am »
check out that code & pics i just posted... a simple astar that works with 2dtoolkit
it will need to be reworked a bit for individual games i guess but