I've been thinking up a real-time strategy game that plays on a platformer type of map. The collidable portion of these maps will be made up of square tiles. I've done A* pathfinding in top down tile based games before, but I'm unsure how to lay out my tile map in such a way that allows for easy pathfinding. I've thought up some examples, but I'm not sure if it's the right way to go about it, so I thought I'd throw it out here and see if someone who knows what they're doing can give me some tips.
The first solution I thought of was to use a 2D array storing all of the tiles and empty space, similar to what I would most definitely do in a top down tile based strategy game. The 2D grid would be invisible in the background but really store whether each grid section is empty, or has a tile on it. like this:
In this example I'm unsure as to how I would pathfind up hills, or in that specific example, determine that a wall is too high to cross. Lets say that dude can jump over 1 tile high blocks, but 2 tiles is too much. How would I effectively determine that through a pathfinding algorithm?
The other example I was thinking of was to place pathfinding nodes on top of traversible terrain, like this:
Each node might be able to give directions or commands on how to get to the next (Like the need to jump to cross a gap, or it's faster to go under rather than over, etc). Now I would want to do this logically through code, and not manually place them at design time.
This might be a better solution, but something I'm thinking of in this game is to have destructable terrain. Say an explosion happens and leaves a big hole like this:
Suddenly those nodes I placed earlier won't work. I'd need to remake them on the fly. In this case the 2D grid sounds like the better option since I can just flip the value of that tile from full to empty.
So hopefully those 2 examples made sense, and I'd like some opinions on which might be the best option, or even if there's some other solution I didn't think about I would be glad to hear it! I'm using Unity if that helps.
I just want to get this design choice out of the way early, as it would be a pain to have to tear it apart later.