I am implementing some like:cgf-ai.com/docs/straatman_remco_killzone_ai.pdffor my AI. I have a couple of questions:
- Grabbing all grid-graph nodes/waypoints. Is there a way to this. I know I can Get the nearest node in a position.
- Storing information on the nodes (to implement the tactical ai bit, i would store a weight generated by running functions that determine the best position for an AI to be at).
I found a function to get nodes in bounding box/area.
What about storing information on a node?
Sorry for being a bit late.
Storing information on a node is most easily done by creating a custom node class and modifying the graph generator to use that node class instead of its default.
using Pathfinding; public class MyNode : GridNode { public float myfield; }
`
//In GridGenerator.cs
public override Node[] CreateNodes (int number) {
MyNode[] tmp = new MyNode[number];
for (int i=0;i<number;i++) {
tmp[i] = new MyNode ();
tmp[i].penalty = initialPenalty;
}
nodes = tmp;
return tmp as Node[];
}`
Or similar for other graph types.
Then you can simply cast every Node object you get to your custom node class and use whatever fields you add to it.