A* Pathfinding, Calculating G cost
<p>I'm having some difficulty understanding how to consistently calculate a correct G cost for the implementation of A* Pathfinding. As I understand it, it's the cost of moving from the starting node to the current node, but what I don't fully understand is how to find the value that is used to increment the G cost. I've seen examples that use numbers like 10 and 14, but are these arbitrary and does it depend upon the implementation? </p>

<p>When I was developing a 2D game, it seemed like I almost had to find a "sweet spot" for the G cost (which I should note seemed to be close to the width of the floor tiles that were being used as nodes) before I was consistently finding the shortest paths.</p>

<p>Any clarification on the matter would be great.</p>