Support Forum

About cost of moving between tiles

Hi
I am thinking about adding different costs of moving between tiles to a grid. Like in Civilization, only the direction that adjacent to a river has a greater cost. Although there is a Penalty variable in GridNode class, the neighbour costs seems belong to GridGraph.

My thought now is that:

  1. SetConnectionInternal(dir, false) to cut the neighbour
  2. AddConnection(node, cost) to set the connection and cost.
    (I will do this on both sides)
    In the doc of AddConnection it says “If the connection already exists, the cost will simply be updated and no extra connection added.” Does it mean I don’t need to call “SetConnectionInternal” first? Ot they are different types of connection?

The Seeker and Tag let different AI have different penalties. Is it possible to let them have different cost of moving between tiles?

Hi

Your thought is correct I think.

And yes, those are treated as different types of connections.

Unfortunately it is not possible at the moment to have different AIs have different traversal costs for edges. You can make them have different traversal costs for nodes (using e.g. tags or the ITraversalProvider interface) however.