fix: bot glibc dependency when SIMD is disabled fakeping: allow to disable ping average ping calculation from human players (controllable via yb_count_players_for_fakeping)
This commit is contained in:
parent
1dc1043f7d
commit
d5a9253582
3 changed files with 39 additions and 34 deletions
|
|
@ -1 +1 @@
|
||||||
Subproject commit 07c54138879ea360913a594b3c11557361e20fed
|
Subproject commit 72b32ac851400c6abb2332299d42f62b871620dd
|
||||||
|
|
@ -627,7 +627,7 @@ bool Bot::isFriendInLineOfFire (float distance) {
|
||||||
}
|
}
|
||||||
const auto friendDistanceSq = client.ent->v.origin.distanceSq (pev->origin);
|
const auto friendDistanceSq = client.ent->v.origin.distanceSq (pev->origin);
|
||||||
|
|
||||||
if (friendDistanceSq <= distanceSq && util.getShootingCone (ent (), client.ent->v.origin) > friendDistanceSq / (friendDistanceSq + cr::sqrf (1089.0f))) {
|
if (friendDistanceSq <= distanceSq && util.getShootingCone (ent (), client.ent->v.origin) > friendDistanceSq / (friendDistanceSq + cr::sqrf (33.0f))) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -975,9 +975,6 @@ void Bot::fireWeapons () {
|
||||||
|
|
||||||
// or if friend in line of fire, stop this too but do not update shoot time
|
// or if friend in line of fire, stop this too but do not update shoot time
|
||||||
if (isFriendInLineOfFire (distance)) {
|
if (isFriendInLineOfFire (distance)) {
|
||||||
m_fightStyle = Fight::Strafe;
|
|
||||||
m_lastFightStyleCheck = game.time ();
|
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int selectId = Weapon::Knife, selectIndex = 0, choosenWeapon = 0;
|
int selectId = Weapon::Knife, selectIndex = 0, choosenWeapon = 0;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ ConVar cv_display_welcome_text ("display_welcome_text", "1", "Enables or disable
|
||||||
ConVar cv_enable_query_hook ("enable_query_hook", "0", "Enables or disables fake server queries response, that shows bots as real players in server browser.");
|
ConVar cv_enable_query_hook ("enable_query_hook", "0", "Enables or disables fake server queries response, that shows bots as real players in server browser.");
|
||||||
ConVar cv_breakable_health_limit ("breakable_health_limit", "500.0", "Specifies the maximum health of breakable object, that bot will consider to destroy.", true, 1.0f, 3000.0);
|
ConVar cv_breakable_health_limit ("breakable_health_limit", "500.0", "Specifies the maximum health of breakable object, that bot will consider to destroy.", true, 1.0f, 3000.0);
|
||||||
ConVar cv_enable_fake_steamids ("enable_fake_steamids", "0", "Allows or disallows bots to return fake steam id.");
|
ConVar cv_enable_fake_steamids ("enable_fake_steamids", "0", "Allows or disallows bots to return fake steam id.");
|
||||||
|
ConVar cv_count_players_for_fakeping ("count_players_for_fakeping", "1", "Count player pings when calculating average ping for bots. If no, some random ping chosen for bots.");
|
||||||
|
|
||||||
BotSupport::BotSupport () {
|
BotSupport::BotSupport () {
|
||||||
m_needToSendWelcome = false;
|
m_needToSendWelcome = false;
|
||||||
|
|
@ -430,6 +431,8 @@ void BotSupport::syncCalculatePings () {
|
||||||
Twin <int, int> average { 0, 0 };
|
Twin <int, int> average { 0, 0 };
|
||||||
int numHumans = 0;
|
int numHumans = 0;
|
||||||
|
|
||||||
|
// only count player pings if we're allowed to
|
||||||
|
if (cv_count_players_for_fakeping.bool_ ()) {
|
||||||
// first get average ping on server, and store real client pings
|
// first get average ping on server, and store real client pings
|
||||||
for (auto &client : m_clients) {
|
for (auto &client : m_clients) {
|
||||||
if (!(client.flags & ClientFlags::Used) || isFakeClient (client.ent)) {
|
if (!(client.flags & ClientFlags::Used) || isFakeClient (client.ent)) {
|
||||||
|
|
@ -456,12 +459,17 @@ void BotSupport::syncCalculatePings () {
|
||||||
average.second += loss;
|
average.second += loss;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (numHumans > 0) {
|
if (numHumans > bots.getBotCount () / 4) {
|
||||||
average.first /= numHumans;
|
average.first /= numHumans;
|
||||||
average.second /= numHumans;
|
average.second /= numHumans;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
average.first = rg.get (30, 40);
|
average.first = rg.get (10, 20);
|
||||||
|
average.second = rg.get (5, 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
average.first = rg.get (10, 20);
|
||||||
average.second = rg.get (5, 10);
|
average.second = rg.get (5, 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -484,7 +492,7 @@ void BotSupport::syncCalculatePings () {
|
||||||
if (botPing < 2) {
|
if (botPing < 2) {
|
||||||
botPing = rg.get (10, 23);
|
botPing = rg.get (10, 23);
|
||||||
}
|
}
|
||||||
else if (botPing > 300) {
|
else if (botPing > 100) {
|
||||||
botPing = rg.get (30, 40);
|
botPing = rg.get (30, 40);
|
||||||
}
|
}
|
||||||
client.ping = getPingBitmask (client.ent, botLoss, botPing);
|
client.ping = getPingBitmask (client.ent, botLoss, botPing);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue