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
This commit is contained in:
jeefo 2023-04-07 14:46:49 +03:00
commit 29c00565dc
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
31 changed files with 1395 additions and 1305 deletions

View file

@ -32,9 +32,9 @@ class BotConfig final : public Singleton <BotConfig> {
public:
struct DifficultyData {
float reaction[2] {};
int32 headshotPct {};
int32 seenThruPct {};
int32 hearThruPct {};
int32_t headshotPct {};
int32_t seenThruPct {};
int32_t hearThruPct {};
};
private:
@ -49,16 +49,16 @@ private:
StringArray m_logos {};
StringArray m_avatars {};
HashMap <uint32, String, Hash <int32>> m_language {};
HashMap <int32, DifficultyData> m_difficulty {};
HashMap <uint32_t, String, Hash <int32_t>> m_language {};
HashMap <int32_t, DifficultyData> m_difficulty {};
HashMap <String, String> m_custom {};
// default tables for personality weapon preferences, overridden by weapon.cfg
SmallArray <int32> 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> 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> 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> m_botBuyEconomyTable = { 1900, 2100, 2100, 4000, 6000, 7000, 16000, 1200, 800, 1000, 3000 };
SmallArray <int32> m_grenadeBuyPrecent = { 95, 85, 60 };
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 };
public:
BotConfig ();
@ -138,7 +138,7 @@ private:
};
// hash the lang string, only the letters
uint32 hashLangString (StringRef str);
uint32_t hashLangString (StringRef str);
public:
@ -188,7 +188,7 @@ public:
}
// get's weapons type by id
int32 getWeaponType (int id) const {
int32_t getWeaponType (int id) const {
for (const auto &weapon : m_weapons) {
if (weapon.id == id) {
return weapon.type;
@ -198,7 +198,7 @@ public:
}
// get's weapon preferences for personality
int32 *getWeaponPrefs (int personality) const {
int32_t *getWeaponPrefs (int personality) const {
switch (personality) {
case Personality::Normal:
default:
@ -213,7 +213,7 @@ public:
}
// get's the difficulty level tweaks
DifficultyData *getDifficultyTweaks (int32 level) {
DifficultyData *getDifficultyTweaks (int32_t level) {
if (level < Difficulty::Noob || level > Difficulty::Expert) {
return &m_difficulty[Difficulty::Expert];
}
@ -221,7 +221,7 @@ public:
}
// get economics value
int32 *getEconLimit () {
int32_t *getEconLimit () {
return m_botBuyEconomyTable.data ();
}
@ -239,8 +239,8 @@ public:
}
// get's random logo index
int32 getRandomLogoIndex () const {
return static_cast <int32> (m_logos.index (m_logos.random ()));
int32_t getRandomLogoIndex () const {
return static_cast <int32_t> (m_logos.index (m_logos.random ()));
}
// get random name by index