mirror of
https://github.com/1dot13/source.git
synced 2026-09-16 14:47:17 +02:00
Added new option AI_PATH_TWEAKS which controls various experimental path tweaks for AI: avoid gas, deep water, light at night.
Added experimental path tweak: AI tanks prefer moving in straight directions to avoid sliding effect. Set default value for options AI_EXTRA_SUPPRESSION, AI_NEW_MORALE, AI_BETTER_COVER, AI_MOVEMENT_MODE to TRUE. git-svn-id: https://ja2svn.mooo.com/source/ja2/trunk/GameSource/ja2_v1.13/Build@8737 3b4a5df2-a311-0410-b5c6-a8a6f20db521
This commit is contained in:
+5
-4
@@ -2276,11 +2276,12 @@ void LoadGameExternalOptions()
|
|||||||
|
|
||||||
// sevenfm: tactical AI
|
// sevenfm: tactical AI
|
||||||
gGameExternalOptions.fAIYellowFlanking = iniReader.ReadBoolean("Tactical AI Settings", "AI_YELLOW_FLANKING", FALSE);
|
gGameExternalOptions.fAIYellowFlanking = iniReader.ReadBoolean("Tactical AI Settings", "AI_YELLOW_FLANKING", FALSE);
|
||||||
gGameExternalOptions.fAIExtraSuppression = iniReader.ReadBoolean("Tactical AI Settings", "AI_EXTRA_SUPPRESSION", FALSE);
|
gGameExternalOptions.fAIExtraSuppression = iniReader.ReadBoolean("Tactical AI Settings", "AI_EXTRA_SUPPRESSION", TRUE);
|
||||||
gGameExternalOptions.fAINewMorale = iniReader.ReadBoolean("Tactical AI Settings", "AI_NEW_MORALE", FALSE);
|
gGameExternalOptions.fAINewMorale = iniReader.ReadBoolean("Tactical AI Settings", "AI_NEW_MORALE", TRUE);
|
||||||
gGameExternalOptions.fAIBetterCover = iniReader.ReadBoolean("Tactical AI Settings", "AI_BETTER_COVER", FALSE);
|
gGameExternalOptions.fAIBetterCover = iniReader.ReadBoolean("Tactical AI Settings", "AI_BETTER_COVER", TRUE);
|
||||||
gGameExternalOptions.fAITacticalRetreat = iniReader.ReadBoolean("Tactical AI Settings", "AI_TACTICAL_RETREAT", FALSE);
|
gGameExternalOptions.fAITacticalRetreat = iniReader.ReadBoolean("Tactical AI Settings", "AI_TACTICAL_RETREAT", FALSE);
|
||||||
gGameExternalOptions.fAIMovementMode = iniReader.ReadBoolean("Tactical AI Settings", "AI_MOVEMENT_MODE", FALSE);
|
gGameExternalOptions.fAIMovementMode = iniReader.ReadBoolean("Tactical AI Settings", "AI_MOVEMENT_MODE", TRUE);
|
||||||
|
gGameExternalOptions.fAIPathTweaks = iniReader.ReadBoolean("Tactical AI Settings", "AI_PATH_TWEAKS", TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1543,6 +1543,7 @@ typedef struct
|
|||||||
BOOLEAN fAIBetterCover;
|
BOOLEAN fAIBetterCover;
|
||||||
BOOLEAN fAITacticalRetreat;
|
BOOLEAN fAITacticalRetreat;
|
||||||
BOOLEAN fAIMovementMode;
|
BOOLEAN fAIMovementMode;
|
||||||
|
BOOLEAN fAIPathTweaks;
|
||||||
|
|
||||||
} GAME_EXTERNAL_OPTIONS;
|
} GAME_EXTERNAL_OPTIONS;
|
||||||
|
|
||||||
|
|||||||
+11
-21
@@ -3832,18 +3832,25 @@ if(!GridNoOnVisibleWorldTile(iDestination))
|
|||||||
//nextCost = gubDiagCost[nextCost];
|
//nextCost = gubDiagCost[nextCost];
|
||||||
nextCost = nextCost * 14 / 10;
|
nextCost = nextCost * 14 / 10;
|
||||||
//nextCost++;
|
//nextCost++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( bLoopState == LOOPING_REVERSE)
|
if ( bLoopState == LOOPING_REVERSE)
|
||||||
{
|
{
|
||||||
// penalize moving backwards to encourage turning sooner
|
// penalize moving backwards to encourage turning sooner
|
||||||
nextCost += 50;
|
nextCost += 50;
|
||||||
|
}
|
||||||
|
|
||||||
|
// sevenfm: tanks prefer moving in straight directions to avoid sliding effect
|
||||||
|
if (gGameExternalOptions.fAIPathTweaks &&
|
||||||
|
TANK(s) &&
|
||||||
|
(iCnt & 1))
|
||||||
|
{
|
||||||
|
nextCost += 50;
|
||||||
}
|
}
|
||||||
|
|
||||||
newTotCost = curCost + nextCost;
|
|
||||||
|
|
||||||
// sevenfm: experimental path tweaks for AI
|
// sevenfm: experimental path tweaks for AI
|
||||||
if (s->bTeam != gbPlayerNum &&
|
if (gGameExternalOptions.fAIPathTweaks &&
|
||||||
|
s->bTeam != gbPlayerNum &&
|
||||||
!(s->flags.uiStatusFlags & SOLDIER_BOXER) &&
|
!(s->flags.uiStatusFlags & SOLDIER_BOXER) &&
|
||||||
!AreInMeanwhile() &&
|
!AreInMeanwhile() &&
|
||||||
IS_MERC_BODY_TYPE(s))
|
IS_MERC_BODY_TYPE(s))
|
||||||
@@ -3867,25 +3874,8 @@ if(!GridNoOnVisibleWorldTile(iDestination))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
// no diagonal bias - straightforward costing regardless of direction
|
|
||||||
newTotCost = curCost + nextCost;
|
newTotCost = curCost + nextCost;
|
||||||
|
|
||||||
|
|
||||||
// NOTE: ON JAN 6TH, 1995, IAN COMMENTED OUT THE DIAGONAL BIAS AND
|
|
||||||
// UNCOMMENTED THE "NO DIAGONAL BIAS"
|
|
||||||
//diagonal bias - this makes diagonal moves cost more
|
|
||||||
|
|
||||||
|
|
||||||
if (iCnt & 1)
|
|
||||||
// diagonal move costs 70 percent
|
|
||||||
//newTotCost += (nextCost/PATHFACTOR);
|
|
||||||
newTotCost += 1;
|
|
||||||
// newTotCost = curCost + ((prevCost+nextCost)*7)/10;
|
|
||||||
// else // non-diagonal costs only 50%
|
|
||||||
// newTotCost = curCost + (prevCost+nextCost)/2;
|
|
||||||
*/
|
|
||||||
|
|
||||||
// have we found a path to the current location that
|
// have we found a path to the current location that
|
||||||
// costs less than the best so far to the same location?
|
// costs less than the best so far to the same location?
|
||||||
if (trailCostUsed[newLoc] != gubGlobalPathCount || newTotCost < trailCost[newLoc])
|
if (trailCostUsed[newLoc] != gubGlobalPathCount || newTotCost < trailCost[newLoc])
|
||||||
|
|||||||
Reference in New Issue
Block a user