Game Development Community

Grid Weight

by Shakey · in Torque Game Builder · 11/25/2009 (11:31 am) · 1 replies

Hi I have a couple of questions Reading over the aStar Pathfinding documentation, I have come across a term. What is a grid weight.

Also in reading the documentation you select the starting location and the ending location(destination). When the enemy objects spawns, I really don't want it to take the shortest route to the destination. I have a maze that I want the enemy to follow, built with a tilemap, so it it a predetermined path the enemy should take. would this still work.

I will probably have to set up collision on the tilemap so the enemy would not go through the grid right. My enemy would be following along a straight path and frequently make 90 degrees turns.

#1
11/25/2009 (11:51 am)
Your questions are tied together actually. The grid weight is used in the evaluation of adjacent tiles where the A* algorithm is trying to find the best path. A higher weight means that the actor considers the cell more expensive to traverse, so a lower weight will be a more ideal path.

So, you don't need collision, but rather weight the areas that you don't want to actor to travel on and the A* alogorithm will have them tend towards that path.

For instance, high grass may have a slightly higher weight than a road, while mountains may have a very large weight compared to a road.

Patrick