How to change calculating method of connection cost on grid graphs?

As far as I know, connection cost of grid graphs can’t be changed. However, I would like to dynamically change the cost and calculating method of it. In other words,

  1. Connection cost between two nodes should be changeable in real time.
  2. There are some NPCs, and each of them should evaluate the cost differently. For example, some NPCs may select the flat way, others may select the fastest way.

Any idea to do that?

Thanks.

Costs on grid graphs are not saved on a node - node basis. They are only saved as “cost to walk in this direction” (doing otherwise would use quite a lot of memory).
However by overriding the GridNode’s implementation (which is not that hard at all actually) almost anything is possible. So if you can give me some more specifics in what you want to implement I could help you.

My game is cube-based 3D world. It will be similar to this image:
http://cubementd.com/wp-content/uploads/2012/03/MAS_Screenshot_01.png

I think non-layered grid graphs would be fit for my game because path finding isn’t needed while characters are climbing walls.

What I want is:

  1. If a character stands a ladder to a wall in real time, the path on the ladder should get higher priority than normal paths on other walls.
  2. Thin characters should use path on ladders more than fat characters do.

Thanks.

I have contact with the maker of CubeMen (the image you showed). He actually uses a point graphs for everything since that means he can add custom connections everywhere he wants (e.g ladders) with the correct costs.

  1. I’m not exactly sure how this looks in game. But if I understand you correctly, a character places a ladder against a wall to climb up. In that case, I think you should handle placing a ladder and climbing up as a single action so that a unit will always climb up if it places a ladder.

  2. That could be handled, slightly tricky though, using either making ladders like bottom node - connection - node - connection - top node. Instead of bottom node - connection - top node. I.e you place a node in the middle of the ladder. That node could then have a tag applied and fat units could get a really high penalty for traversing that tag.
    The other way would be to override the implementation for point graph nodes and create a specific higher cost if the unit is a fat unit and is trying to traverse a connection which goes up quite a lot (and would therefore probably be a ladder connection).

I’ve got good ideas from you. Thank you so much.