Gridgraph connection blocking

Hello,

first of all, thanks for a great product!

Now to my question. I am creating an isometric, tile-based, turn-based tactics game akin to Jagged Alliance 2. So far I managed to get what I want by using a Pointgraph, but because it uses game objects for each node it becomes too slow for a pointgraph of anything bigger than 40x40 nodes. So now I have started looking into using gridgraphs which seem to be much faster and could be made into a much bigger playing field, but I have one problem. I have a building with thin walls between nodes that should block movement, but the gridgraph (with one node per tile) doesn’t register the walls between nodes, only if the walls are actually on a node (which would look unrealistic).

Is there any way to have the gridgraph search for connections like the pointgraph does via raycast, so obstacles between nodes register?

On a side note, when using a pointgraph, the GraphUpdateScene object doesn’t work (doesn’t change walkability etc. of pointgraph nodes in the polygon), but the same GUO works with a gridgraph. Any ideas?

Thanks,

Robert

Hi

There is no built in such way. Often I recommend people to increase the grid graph resolution, that often works very well. If you really want to use raycasting you can modify the GridGenerator.cs -> IsValidConnection method to do some raycasting as well (I think that method exists in the current version anyway).

PS: If you are using isometric, check out the Grid Graph Settings -> Aspect Ratio. It is often useful for isometric games.

I finally overcame my fear of the (to me) rather complex pathfinding code and tried to apply your suggestion. It was pretty easy and it now workd flawlessly. I just copied the raycasting section from the pointgraph script and pasted it into the GridGenerator.cs -> IsValidConnection method, along with the corresponding variables. Then I had to change some of the return values from true to false and vice versa (can’t remember which ones) but in the end it worked :slight_smile: Thanks!