I'm using the Floyd Table as the heuristic. I have also changed the cost function.
Code:
int gfunctionDamageDistCT(PATHNODE *p)
{
if (p == NULL)
return 65355;
if (!p->parent)
return 0;
int iThisIndex = p->iIndex;
int iCost = 0;
int iDangerIndex = (pBotExperienceData + iThisIndex * g_iNumWaypoints + iThisIndex)->iTeam1_danger_index;
if (iDangerIndex != -1)
iCost += (pBotExperienceData + iThisIndex * g_iNumWaypoints + iDangerIndex)->uTeam1Damage;
for (int i = 0; i < MAX_PATH_INDEX; i++)
{
int iNeighbour = paths[iThisIndex]->index[i];
if (iNeighbour != -1)
{
iDangerIndex = (pBotExperienceData + iNeighbour * g_iNumWaypoints + iNeighbour)->iTeam1_danger_index;
if (iDangerIndex != -1)
iCost += (pBotExperienceData + iNeighbour * g_iNumWaypoints + iDangerIndex)->uTeam1Damage;
}
}
iCost *= MAX_DAMAGE_VAL / (g_uMaxDamageCT + 1) / RANDOM_LONG(1, 8);
iCost += GetPathDistance(p->parent->iIndex, iThisIndex);
return iCost;
}
int hfunctionPathDist(PATHNODE *p)
{
if (p == NULL)
return 65355;
return GetPathDistance(p->iIndex, g_iSearchGoalIndex);
}
About the RealBot thing: I'm not using any flags to flag the bot. I just use CBaseBot::Instance() function (similar botman's UTIL_GetBotPointer() )
@Terran: Thanks for the fix ! I'll take a look at it...
Edit: cannot download your file Terran, just break up in half way
