Rise limit of waypoints to 3072. Need compatability testing.

This change invalidates all 'learned' bot data, such as visibility, pathmatrices and experiences, so file versions of them are bumped.

Tweaked yb_quota_mode.
Allowed low-skill bots to throw grenades.
This commit is contained in:
jeefo 2019-05-05 01:01:12 +03:00
commit 8456bb57cb
7 changed files with 24 additions and 33 deletions

1
.gitignore vendored
View file

@ -68,3 +68,4 @@ Icon
*.html *.html
*.settings *.settings
*.sarif *.sarif
*.txt

View file

@ -481,9 +481,9 @@ const char FH_VISTABLE[] = "PODVIS!";
const char FH_MATRIX[] = "PODMAT!"; const char FH_MATRIX[] = "PODMAT!";
constexpr int FV_WAYPOINT = 7; constexpr int FV_WAYPOINT = 7;
constexpr int FV_EXPERIENCE = 3; constexpr int FV_EXPERIENCE = 4;
constexpr int FV_VISTABLE = 2; constexpr int FV_VISTABLE = 3;
constexpr int FV_MATRIX = 2; constexpr int FV_MATRIX = 3;
// some hardcoded desire defines used to override calculated ones // some hardcoded desire defines used to override calculated ones
constexpr float TASKPRI_NORMAL = 35.0f; constexpr float TASKPRI_NORMAL = 35.0f;
@ -512,7 +512,7 @@ constexpr int MAX_PATH_INDEX = 8;
constexpr int MAX_DAMAGE_VALUE = 2040; constexpr int MAX_DAMAGE_VALUE = 2040;
constexpr int MAX_GOAL_VALUE = 2040; constexpr int MAX_GOAL_VALUE = 2040;
constexpr int MAX_KILL_HISTORY = 16; constexpr int MAX_KILL_HISTORY = 16;
constexpr int MAX_WAYPOINTS = 1024; constexpr int MAX_WAYPOINTS = 3072;
constexpr int MAX_ROUTE_LENGTH = MAX_WAYPOINTS / 2; constexpr int MAX_ROUTE_LENGTH = MAX_WAYPOINTS / 2;
constexpr int MAX_WEAPONS = 32; constexpr int MAX_WEAPONS = 32;
constexpr int NUM_WEAPONS = 26; constexpr int NUM_WEAPONS = 26;

View file

@ -47,19 +47,19 @@
<ProjectGuid>{C232645A-3B99-48F4-A1F3-F20CF0A9568B}</ProjectGuid> <ProjectGuid>{C232645A-3B99-48F4-A1F3-F20CF0A9568B}</ProjectGuid>
<RootNamespace>yapb</RootNamespace> <RootNamespace>yapb</RootNamespace>
<TargetPlatformVersion>8.1</TargetPlatformVersion> <TargetPlatformVersion>8.1</TargetPlatformVersion>
<WindowsTargetPlatformVersion>8.1</WindowsTargetPlatformVersion> <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
<UseOfMfc>false</UseOfMfc> <UseOfMfc>false</UseOfMfc>
<WholeProgramOptimization>true</WholeProgramOptimization> <WholeProgramOptimization>true</WholeProgramOptimization>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>DynamicLibrary</ConfigurationType> <ConfigurationType>DynamicLibrary</ConfigurationType>
<UseOfMfc>false</UseOfMfc> <UseOfMfc>false</UseOfMfc>
<PlatformToolset>v141</PlatformToolset> <PlatformToolset>v142</PlatformToolset>
</PropertyGroup> </PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings"> <ImportGroup Label="ExtensionSettings">

View file

@ -1925,7 +1925,7 @@ void Bot::setConditions (void) {
} }
// check for grenades depending on difficulty // check for grenades depending on difficulty
if (rng.getInt (0, 100) < m_difficulty * 25) { if (rng.getInt (0, 100) < cr::max (25, m_difficulty * 25)) {
checkGrenadesThrow (); checkGrenadesThrow ();
} }
@ -5633,7 +5633,7 @@ void Bot::checkBurstMode (float distance) {
} }
void Bot::checkSilencer (void) { void Bot::checkSilencer (void) {
if (((m_currentWeapon == WEAPON_USP && m_difficulty < 2) || m_currentWeapon == WEAPON_M4A1) && !hasShield ()) { if ((m_currentWeapon == WEAPON_USP || m_currentWeapon == WEAPON_M4A1) && !hasShield ()) {
int prob = (m_personality == PERSONALITY_RUSHER ? 35 : 65); int prob = (m_personality == PERSONALITY_RUSHER ? 35 : 65);
// aggressive bots don't like the silencer // aggressive bots don't like the silencer

View file

@ -884,7 +884,7 @@ void execBotConfigs (bool onlyMain) {
} }
enum Lang { LANG_ORIGINAL, LANG_TRANSLATED, LANG_UNDEFINED } langState = static_cast <Lang> (LANG_UNDEFINED); enum Lang { LANG_ORIGINAL, LANG_TRANSLATED, LANG_UNDEFINED } langState = static_cast <Lang> (LANG_UNDEFINED);
char buffer[1024] = { 0, }; char buffer[MAX_PRINT_BUFFER] = { 0, };
Pair<String, String> lang; Pair<String, String> lang;
while (fp.gets (lineBuffer, 255)) { while (fp.gets (lineBuffer, 255)) {
@ -917,11 +917,11 @@ void execBotConfigs (bool onlyMain) {
else { else {
switch (langState) { switch (langState) {
case LANG_ORIGINAL: case LANG_ORIGINAL:
strncat (buffer, lineBuffer, 1024 - 1 - strlen (buffer)); strncat (buffer, lineBuffer, MAX_PRINT_BUFFER - 1 - strlen (buffer));
break; break;
case LANG_TRANSLATED: case LANG_TRANSLATED:
strncat (buffer, lineBuffer, 1024 - 1 - strlen (buffer)); strncat (buffer, lineBuffer, MAX_PRINT_BUFFER - 1 - strlen (buffer));
break; break;
case LANG_UNDEFINED: case LANG_UNDEFINED:
@ -2723,7 +2723,7 @@ int pfnRegUserMsg (const char *name, int size) {
void pfnAlertMessage (ALERT_TYPE alertType, char *format, ...) { void pfnAlertMessage (ALERT_TYPE alertType, char *format, ...) {
va_list ap; va_list ap;
char buffer[1024]; char buffer[MAX_PRINT_BUFFER];
va_start (ap, format); va_start (ap, format);
vsnprintf (buffer, cr::bufsize (buffer), format, ap); vsnprintf (buffer, cr::bufsize (buffer), format, ap);

View file

@ -393,27 +393,17 @@ void BotManager::maintainQuota (void) {
if (!engine.isDedicated () && !totalHumansInGame) { if (!engine.isDedicated () && !totalHumansInGame) {
return; return;
} }
int desiredBotCount = yb_quota.integer (); int desiredBotCount = yb_quota.integer ();
int botsInGame = getBotCount (); int botsInGame = getBotCount ();
bool halfRoundPassed = g_gameWelcomeSent && g_timeRoundMid > engine.timebase ();
if (stricmp (yb_quota_mode.str (), "fill") == 0) { if (stricmp (yb_quota_mode.str (), "fill") == 0) {
if (halfRoundPassed) { botsInGame += humanPlayersInGame;
desiredBotCount = botsInGame;
}
else {
desiredBotCount = cr::max <int> (0, desiredBotCount - humanPlayersInGame);
}
} }
else if (stricmp (yb_quota_mode.str (), "match") == 0) { else if (stricmp (yb_quota_mode.str (), "match") == 0) {
if (halfRoundPassed) { int detectQuotaMatch = yb_quota_match.integer () == 0 ? yb_quota.integer () : yb_quota_match.integer ();
desiredBotCount = botsInGame;
} desiredBotCount = cr::max <int> (0, detectQuotaMatch * humanPlayersInGame);
else {
int quotaMatch = yb_quota_match.integer () == 0 ? yb_quota.integer () : yb_quota_match.integer ();
desiredBotCount = cr::max <int> (0, quotaMatch * humanPlayersInGame);
}
} }
if (yb_join_after_player.boolean () && humanPlayersInGame == 0) { if (yb_join_after_player.boolean () && humanPlayersInGame == 0) {

View file

@ -1211,11 +1211,11 @@ void Bot::searchShortestPath (int srcIndex, int destIndex) {
// this function finds the shortest path from source index to destination index // this function finds the shortest path from source index to destination index
if (!waypoints.exists (srcIndex)){ if (!waypoints.exists (srcIndex)){
logEntry (true, LL_ERROR, "Pathfinder source path index not valid (%d)", srcIndex); logEntry (false, LL_ERROR, "Pathfinder source path index not valid (%d)", srcIndex);
return; return;
} }
else if (!waypoints.exists (destIndex)) { else if (!waypoints.exists (destIndex)) {
logEntry (true, LL_ERROR, "Pathfinder destination path index not valid (%d)", destIndex); logEntry (false, LL_ERROR, "Pathfinder destination path index not valid (%d)", destIndex);
return; return;
} }
clearSearchNodes (); clearSearchNodes ();
@ -1444,11 +1444,11 @@ void Bot::searchPath (int srcIndex, int destIndex, SearchPathType pathType /*= S
// this function finds a path from srcIndex to destIndex // this function finds a path from srcIndex to destIndex
if (!waypoints.exists (srcIndex)) { if (!waypoints.exists (srcIndex)) {
logEntry (true, LL_ERROR, "Pathfinder source path index not valid (%d)", srcIndex); logEntry (false, LL_ERROR, "Pathfinder source path index not valid (%d)", srcIndex);
return; return;
} }
else if (!waypoints.exists (destIndex)) { else if (!waypoints.exists (destIndex)) {
logEntry (true, LL_ERROR, "Pathfinder destination path index not valid (%d)", destIndex); logEntry (false, LL_ERROR, "Pathfinder destination path index not valid (%d)", destIndex);
return; return;
} }
clearSearchNodes (); clearSearchNodes ();
@ -3040,7 +3040,7 @@ void Bot::processLookAngles (void) {
float stiffness = 200.0f; float stiffness = 200.0f;
float damping = 25.0f; float damping = 25.0f;
if ((m_aimFlags & (AIM_ENEMY | AIM_ENTITY | AIM_GRENADE)) && m_difficulty > 2) { if ((m_aimFlags & (AIM_ENEMY | AIM_ENTITY | AIM_GRENADE)) && m_difficulty > 3) {
accelerate += 800.0f; accelerate += 800.0f;
stiffness += 320.0f; stiffness += 320.0f;
damping -= 8.0f; damping -= 8.0f;