2019-08-12 14:16:28 +03:00
|
|
|
//
|
2023-05-24 23:41:23 +03:00
|
|
|
// YaPB, based on PODBot by Markus Klinge ("CountFloyd").
|
|
|
|
|
// Copyright © YaPB Project Developers <yapb@jeefo.net>.
|
2019-08-12 14:16:28 +03:00
|
|
|
//
|
2020-11-03 08:57:12 +03:00
|
|
|
// SPDX-License-Identifier: MIT
|
2019-08-12 14:16:28 +03:00
|
|
|
//
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
// botname structure definition
|
|
|
|
|
struct BotName {
|
2024-11-13 17:52:19 +03:00
|
|
|
String name {};
|
2019-08-12 14:16:28 +03:00
|
|
|
int usedBy = -1;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
BotName () = default;
|
2023-03-13 15:39:15 +03:00
|
|
|
BotName (StringRef name, int usedBy) : name (name), usedBy (usedBy) {}
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// voice config structure definition
|
|
|
|
|
struct ChatterItem {
|
2024-11-13 17:52:19 +03:00
|
|
|
String name {};
|
|
|
|
|
float repeat {};
|
|
|
|
|
float duration {};
|
2019-08-12 14:16:28 +03:00
|
|
|
|
|
|
|
|
public:
|
2023-03-13 15:39:15 +03:00
|
|
|
ChatterItem (StringRef name, float repeat, float duration) : name (name), repeat (repeat), duration (duration) {}
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
// mostly config stuff, and some stuff dealing with menus
|
|
|
|
|
class BotConfig final : public Singleton <BotConfig> {
|
2020-06-12 18:52:38 +03:00
|
|
|
public:
|
|
|
|
|
struct DifficultyData {
|
|
|
|
|
float reaction[2] {};
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t headshotPct {};
|
|
|
|
|
int32_t seenThruPct {};
|
|
|
|
|
int32_t hearThruPct {};
|
2023-04-11 22:32:28 +03:00
|
|
|
int32_t maxRecoil {};
|
|
|
|
|
Vector aimError {};
|
2020-06-12 18:52:38 +03:00
|
|
|
};
|
|
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
private:
|
2023-04-02 12:17:12 +03:00
|
|
|
Array <StringArray> m_chat {};
|
|
|
|
|
Array <Array <ChatterItem>> m_chatter {};
|
2019-08-12 14:16:28 +03:00
|
|
|
|
2023-04-02 12:17:12 +03:00
|
|
|
Array <BotName> m_botNames {};
|
2023-05-12 20:00:06 +03:00
|
|
|
Array <ChatKeywords> m_replies {};
|
2023-04-02 12:17:12 +03:00
|
|
|
SmallArray <WeaponInfo> m_weapons {};
|
|
|
|
|
SmallArray <WeaponProp> m_weaponProps {};
|
2019-08-12 14:16:28 +03:00
|
|
|
|
2023-04-02 12:17:12 +03:00
|
|
|
StringArray m_logos {};
|
|
|
|
|
StringArray m_avatars {};
|
2019-08-12 14:16:28 +03:00
|
|
|
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
HashMap <uint32_t, String, Hash <int32_t>> m_language {};
|
|
|
|
|
HashMap <int32_t, DifficultyData> m_difficulty {};
|
2023-04-02 12:17:12 +03:00
|
|
|
HashMap <String, String> m_custom {};
|
2019-08-12 14:16:28 +03:00
|
|
|
|
2020-06-12 18:52:38 +03:00
|
|
|
// default tables for personality weapon preferences, overridden by weapon.cfg
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
SmallArray <int32_t> m_normalWeaponPrefs = { 0, 2, 1, 4, 5, 6, 3, 12, 10, 24, 25, 13, 11, 8, 7, 22, 23, 18, 21, 17, 19, 15, 17, 9, 14, 16 };
|
|
|
|
|
SmallArray <int32_t> m_rusherWeaponPrefs = { 0, 2, 1, 4, 5, 6, 3, 24, 19, 22, 23, 20, 21, 10, 12, 13, 7, 8, 11, 9, 18, 17, 19, 25, 15, 16 };
|
|
|
|
|
SmallArray <int32_t> m_carefulWeaponPrefs = { 0, 2, 1, 4, 25, 6, 3, 7, 8, 12, 10, 13, 11, 9, 24, 18, 14, 17, 16, 15, 19, 20, 21, 22, 23, 5 };
|
|
|
|
|
SmallArray <int32_t> m_botBuyEconomyTable = { 1900, 2100, 2100, 4000, 6000, 7000, 16000, 1200, 800, 1000, 3000 };
|
|
|
|
|
SmallArray <int32_t> m_grenadeBuyPrecent = { 95, 85, 60 };
|
2019-08-12 14:16:28 +03:00
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
BotConfig ();
|
|
|
|
|
~BotConfig () = default;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// load the configuration files
|
|
|
|
|
void loadConfigs ();
|
|
|
|
|
|
|
|
|
|
// loads main config file
|
2020-10-04 00:54:34 +03:00
|
|
|
void loadMainConfig (bool isFirstLoad = false);
|
2019-08-12 14:16:28 +03:00
|
|
|
|
|
|
|
|
// loads bot names
|
|
|
|
|
void loadNamesConfig ();
|
|
|
|
|
|
|
|
|
|
// loads weapons config
|
|
|
|
|
void loadWeaponsConfig ();
|
|
|
|
|
|
|
|
|
|
// loads chatter config
|
|
|
|
|
void loadChatterConfig ();
|
|
|
|
|
|
|
|
|
|
// loads chat config
|
|
|
|
|
void loadChatConfig ();
|
|
|
|
|
|
|
|
|
|
// loads language config
|
|
|
|
|
void loadLanguageConfig ();
|
|
|
|
|
|
|
|
|
|
// load bots logos config
|
|
|
|
|
void loadLogosConfig ();
|
|
|
|
|
|
|
|
|
|
// load bots avatars config
|
|
|
|
|
void loadAvatarsConfig ();
|
|
|
|
|
|
2020-06-12 18:52:38 +03:00
|
|
|
// load bots difficulty config
|
|
|
|
|
void loadDifficultyConfig ();
|
|
|
|
|
|
2020-06-15 11:28:42 +03:00
|
|
|
// loads bots map-specific config
|
|
|
|
|
void loadMapSpecificConfig ();
|
|
|
|
|
|
2020-12-15 15:28:58 +03:00
|
|
|
// loads custom config
|
|
|
|
|
void loadCustomConfig ();
|
|
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
// sets memfile to use engine functions
|
|
|
|
|
void setupMemoryFiles ();
|
|
|
|
|
|
|
|
|
|
// picks random bot name
|
|
|
|
|
BotName *pickBotName ();
|
|
|
|
|
|
|
|
|
|
// remove bot name from used list
|
|
|
|
|
void clearUsedName (Bot *bot);
|
|
|
|
|
|
2023-02-01 21:19:17 +03:00
|
|
|
// set the bot names as used
|
2023-03-13 15:39:15 +03:00
|
|
|
void setBotNameUsed (const int index, StringRef name);
|
2023-02-01 21:19:17 +03:00
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
// initialize weapon info
|
|
|
|
|
void initWeapons ();
|
|
|
|
|
|
|
|
|
|
// fix weapon prices (ie for elite)
|
|
|
|
|
void adjustWeaponPrices ();
|
|
|
|
|
|
2023-05-12 22:12:22 +03:00
|
|
|
// find weapon info by weapon id
|
2019-08-12 14:16:28 +03:00
|
|
|
WeaponInfo &findWeaponById (int id);
|
|
|
|
|
|
|
|
|
|
// translates bot message into needed language
|
2020-06-12 18:52:38 +03:00
|
|
|
const char *translate (StringRef input);
|
2019-08-12 14:16:28 +03:00
|
|
|
|
2020-12-15 15:28:58 +03:00
|
|
|
// display current custom values
|
|
|
|
|
void showCustomValues ();
|
|
|
|
|
|
2023-05-14 14:48:06 +03:00
|
|
|
// opens config helper
|
|
|
|
|
bool openConfig (StringRef fileName, StringRef errorIfNotExists, MemFile *outFile, bool languageDependant = false);
|
|
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
private:
|
2020-06-12 18:52:38 +03:00
|
|
|
bool isCommentLine (StringRef line) const {
|
|
|
|
|
if (line.empty ()) {
|
|
|
|
|
return true;
|
|
|
|
|
}
|
2020-06-21 14:59:33 +03:00
|
|
|
return line.substr (0, 1).findFirstOf ("#/;") != String::InvalidIndex;
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
2023-05-12 22:12:22 +03:00
|
|
|
// hash the language string, only the letters
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
uint32_t hashLangString (StringRef str);
|
2020-06-21 14:59:33 +03:00
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
public:
|
|
|
|
|
|
|
|
|
|
// checks whether chat banks contains messages
|
|
|
|
|
bool hasChatBank (int chatType) const {
|
|
|
|
|
return !m_chat[chatType].empty ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// checks whether chatter banks contains messages
|
|
|
|
|
bool hasChatterBank (int chatterType) const {
|
|
|
|
|
return !m_chatter[chatterType].empty ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// pick random phrase from chat bank
|
2020-06-12 18:52:38 +03:00
|
|
|
StringRef pickRandomFromChatBank (int chatType) {
|
2019-08-12 14:16:28 +03:00
|
|
|
return m_chat[chatType].random ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// pick random phrase from chatter bank
|
|
|
|
|
const ChatterItem &pickRandomFromChatterBank (int chatterType) {
|
|
|
|
|
return m_chatter[chatterType].random ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// gets chatter repeat-interval
|
|
|
|
|
float getChatterMessageRepeatInterval (int chatterType) const {
|
|
|
|
|
return m_chatter[chatterType][0].repeat;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get's the replies array
|
2023-05-12 20:00:06 +03:00
|
|
|
Array <ChatKeywords> &getReplies () {
|
2019-08-12 14:16:28 +03:00
|
|
|
return m_replies;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get's the weapon info data
|
|
|
|
|
SmallArray <WeaponInfo> &getWeapons () {
|
|
|
|
|
return m_weapons;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get's raw weapon info
|
|
|
|
|
WeaponInfo *getRawWeapons () {
|
|
|
|
|
return m_weapons.begin ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get's the weapons prop
|
2019-08-12 22:51:26 +03:00
|
|
|
WeaponProp &getWeaponProp (int id) {
|
2019-08-12 14:16:28 +03:00
|
|
|
return m_weaponProps[id];
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-13 02:21:15 +03:00
|
|
|
// get's weapons type by id
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t getWeaponType (int id) const {
|
2020-09-13 02:21:15 +03:00
|
|
|
for (const auto &weapon : m_weapons) {
|
|
|
|
|
if (weapon.id == id) {
|
|
|
|
|
return weapon.type;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return WeaponType::None;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
// get's weapon preferences for personality
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t *getWeaponPrefs (int personality) const {
|
2019-08-12 14:16:28 +03:00
|
|
|
switch (personality) {
|
|
|
|
|
case Personality::Normal:
|
|
|
|
|
default:
|
|
|
|
|
return m_normalWeaponPrefs.data ();
|
|
|
|
|
|
|
|
|
|
case Personality::Rusher:
|
|
|
|
|
return m_rusherWeaponPrefs.data ();
|
|
|
|
|
|
|
|
|
|
case Personality::Careful:
|
|
|
|
|
return m_carefulWeaponPrefs.data ();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-06-12 18:52:38 +03:00
|
|
|
// get's the difficulty level tweaks
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
DifficultyData *getDifficultyTweaks (int32_t level) {
|
2020-06-12 18:52:38 +03:00
|
|
|
if (level < Difficulty::Noob || level > Difficulty::Expert) {
|
|
|
|
|
return &m_difficulty[Difficulty::Expert];
|
|
|
|
|
}
|
|
|
|
|
return &m_difficulty[level];
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-12 14:16:28 +03:00
|
|
|
// get economics value
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t *getEconLimit () {
|
2019-08-12 14:16:28 +03:00
|
|
|
return m_botBuyEconomyTable.data ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get's grenade buy percents
|
|
|
|
|
bool chanceToBuyGrenade (int grenadeType) const {
|
|
|
|
|
return rg.chance (m_grenadeBuyPrecent[grenadeType]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get's random avatar for player (if any)
|
2020-06-12 18:52:38 +03:00
|
|
|
StringRef getRandomAvatar () const {
|
2019-08-12 14:16:28 +03:00
|
|
|
if (!m_avatars.empty ()) {
|
|
|
|
|
return m_avatars.random ();
|
|
|
|
|
}
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get's random logo index
|
aim: verify camp angles from nav data before using them
aim: tweaked a bit grenade handling, so bots should use them more
aim: reduce time between selecting grenade and throwing it away
aim: removed hacks in look angles code, due to removing yb_whoose_your_daddy cvar
aim: use direct enemy origin from visibility check, and not re-calculate it
aim: update enemy prediction, so it now depends on frame interval for a bot
aim: additional height offset are tweaked, and now used only for difficulty 4
nav: tweaked a bit player avoidance code, and it's not preventing bot from checking terrain
nav: do not check banned nodes, when bucket sizes re too low
nav: cover nodes are now selected depending on total bots on server
nav: let bot enter pause task after long jump
nav: extend velocity by a little for a jump, like it was in first versions of bot
nav: stuck checking is now taken in account lower minimal speed if bot is ducking
fix: navigation reachability timers, so bots will have correct current node index while camping
fix: bots are unable to finish pickup or destroy breakable task, if target is not reachable
fix: cover nodes are now calculated as they should
fix: manual calling bots add_[t/ct] now ignores yb_join_team cvar
bot: tweaked a little difficulty levels, so level 4 is now nightmare level, and 3 is very heard
bot: minor refactoring and moving functions to correct source file
bot: add yb_economics_disrespect_percent, so bots can ignore economics and buy more different guns
bot: add yb_check_darkness that allows to disable darkness checks for bot, thus disallowing usage of flashlight
bot: camp buttons are now lightly depends on bot health
chat: welcome chat message from bots is now sent during first freeze time period
crlib: switch over to stdint.h and remove crlib-own types
crlib: fixed alignment in sse code
2023-04-07 14:46:49 +03:00
|
|
|
int32_t getRandomLogoIndex () const {
|
|
|
|
|
return static_cast <int32_t> (m_logos.index (m_logos.random ()));
|
2019-08-12 14:16:28 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// get random name by index
|
2024-01-19 00:03:45 +03:00
|
|
|
StringRef getLogoName (int index) {
|
2019-08-12 14:16:28 +03:00
|
|
|
return m_logos[index];
|
|
|
|
|
}
|
2020-12-15 15:28:58 +03:00
|
|
|
|
|
|
|
|
// get custom value
|
|
|
|
|
StringRef fetchCustom (StringRef name) {
|
2023-04-15 04:10:09 +03:00
|
|
|
if (m_custom.exists (name)) {
|
2020-12-15 15:28:58 +03:00
|
|
|
return m_custom[name];
|
|
|
|
|
}
|
2024-01-19 00:03:45 +03:00
|
|
|
logger.error ("Trying to fetch unknown custom variable: %s", name);
|
2020-12-15 15:28:58 +03:00
|
|
|
|
|
|
|
|
return "";
|
|
|
|
|
}
|
|
|
|
|
|
2024-07-03 22:00:58 +03:00
|
|
|
// simple accessors to c4 model name
|
2020-12-15 15:28:58 +03:00
|
|
|
StringRef getBombModelName () {
|
|
|
|
|
return fetchCustom ("C4ModelName");
|
|
|
|
|
}
|
2019-08-12 14:16:28 +03:00
|
|
|
};
|
|
|
|
|
|
2022-04-26 21:57:36 +06:00
|
|
|
// expose global
|
2020-02-08 00:03:52 +03:00
|
|
|
CR_EXPOSE_GLOBAL_SINGLETON (BotConfig, conf);
|