Generating a grid graph for a programmatic 2d map

Hello,

I am currently looking to generate a graph for a runtime-generated and player-manipulatable tile map (not a Unity tilemap, its a custom data structure).

My game is 2d and my tiles are all uniform in shape, so I was thinking that I could create a gridGraph when I create the game, and when tiles are generated/modified to add them as a node and set if they are walkable or not based on type. Its worth noting that I do not use physics or colliders.

So I am wondering two things - one is does this sound like a feasible use of this A* project? And if so - how do I go about setting attributes on the grid graph within code such as 2d, turning off collisions, and the like? I see how to set the dimensions, but I may be overlooking sections of the docs outlining how to set these other attributes.

Thank you very much!

Hi

Sorry for the late reply.
Yes, this is feasible.

Here you can find information about how to create a graph during runtime: https://arongranberg.com/astar/docs/runtimegraphs.html
Here you can read about how to set the node data: https://arongranberg.com/astar/docs/graph-updates.php#scripting

If you use the beta version you could alternatively create a custom grid graph rule, which would make things like graph updates work out of the box: https://www.arongranberg.com/astar/documentation/dev_4_3_38_f6e479ec/gridruleswrite.html