41 CS_CVAR(
this).cvar_cl_accuracy_data_share = 1;
42 CS_CVAR(
this).cvar_cl_accuracy_data_receive = 0;
47 entity bot = spawnclient();
79 CS(
this).movement =
'0 0 0';
125 CS(
this).movement =
'0 0 0';
135 CS(
this).movement =
'0 0 0';
166 int file, tokens, prio;
179 int smallest_team = -1;
180 int smallest_count = -1;
189 if (smallest_count < 0 ||
count < smallest_count)
192 smallest_count =
count;
198 while((readfile =
fgets(file)))
213 bool conflict =
false;
215 if (s == it.cleanname)
228 if (!forced_team || forced_team == smallest_team)
237 string bot_name, bot_model, bot_skin, bot_shirt, bot_pants;
240 if(
argv(0) !=
"") bot_name =
argv(0);
241 else bot_name =
"Bot";
243 if(
argv(1) !=
"") bot_model =
argv(1);
246 if(
argv(2) !=
"") bot_skin =
argv(2);
266 #define READSKILL(f, w, r) MACRO_BEGIN \
267 if(argv(prio) != "") \
268 this.f = stof(argv(prio)) * w; \
270 this.f = (!autocvar_g_campaign) * (2 * random() - 1) * r * w; \
310 if (file >= 0 &&
argv(prio) !=
"")
334 if(it.cleanname ==
name)
346 bot_model =
strcat(bot_model,
".iqm");
353 static string bot_priority_far_prev;
354 static string bot_priority_mid_prev;
355 static string bot_priority_close_prev;
356 static string bot_priority_distances_prev;
387 #define PARSE_WEAPON_PRIORITIES(dist) MACRO_BEGIN \
388 if (bot_priority_##dist##_prev != autocvar_bot_ai_custom_weapon_priority_##dist) { \
389 strcpy(bot_priority_##dist##_prev, autocvar_bot_ai_custom_weapon_priority_##dist); \
390 tokens = tokenizebyseparator(W_NumberWeaponOrder(autocvar_bot_ai_custom_weapon_priority_##dist)," "); \
391 bot_weapons_##dist[0] = -1; \
393 for(i = 0; i < tokens && c < REGISTRY_COUNT(Weapons); ++i) { \
395 if (w >= WEP_FIRST && w <= WEP_LAST) { \
396 bot_weapons_##dist[c] = w; \
400 if (c < REGISTRY_COUNT(Weapons)) \
401 bot_weapons_##dist[c] = -1; \
440 prevbot.nextbot = it;
449 prevbot.nextbot =
NULL;
503 besttime = it.createdtime;
510 thiscount = TeamBalance_GetNumberOfPlayers(balance,
511 Team_TeamToIndex(it.team));
514 if(thiscount > bestcount)
516 bestcount = thiscount;
517 besttime = it.createdtime;
520 else if(thiscount == bestcount && besttime < it.createdtime)
522 besttime = it.createdtime;
552 besttime = it.createdtime;
555 if(besttime < it.createdtime)
557 besttime = it.createdtime;
575 bestplayer =
max(bestplayer, it.totalfrags - it.totalfrags_lastcheck);
577 bestbot =
max(bestbot, it.totalfrags - it.totalfrags_lastcheck);
580 string msg =
strcat(
"autoskill: best player got ",
ftos(bestplayer),
", ""best bot got ",
ftos(bestbot),
"; ");
581 if(bestbot < 0 || bestplayer < 0)
583 msg =
strcat(msg,
"not doing anything");
586 else if(bestbot <= bestplayer * factor - 2)
590 msg =
strcat(msg,
"2 frags difference, increasing skill");
595 else if(bestbot >= bestplayer * factor + 2)
599 msg =
strcat(msg,
"2 frags difference, decreasing skill");
606 msg =
strcat(msg,
"not doing anything");
625 int activerealplayers = 0;
628 activerealplayers =
M_ARGV(0,
int);
629 realplayers =
M_ARGV(1,
int);
652 bots =
max(minbots, minplayers - activerealplayers);
656 bots =
min(bots,
max(player_limit - activerealplayers, 0));
674 bprint(
"Can not add bot, server full.\n");
677 if (!multiple_per_frame)
727 float wpcost_update =
false;
729 wpcost_update =
true;
731 wpcost_update =
true;
775 waypoint_save_links();
809 if (!bot_strategytoken_save)
812 bot_strategytoken_save =
NULL;
void navigation_goalrating_timeout_force(entity this)
bool navigation_goalrating_timeout(entity this)
int bots_would_leave
how many bots would leave so humans can replace them
IntrusiveList g_waypoints
#define MUTATOR_CALLHOOK(id,...)
bool bot_fixcount(bool multiple_per_frame)
void bot_custom_weapon_priority_setup()
void bot_setclientfields(entity this)
void bot_think(entity this)
#define PARSE_WEAPON_PRIORITIES(dist)
void autoskill(float factor)
#define READSKILL(f, w, r)
void bot_calculate_stepheightvec()
void bot_setnameandstuff(entity this)
void bot_removefromlargestteam()
void bot_clientdisconnect(entity this)
void bot_clientconnect(entity this)
void bot_relinkplayerlist()
float autoskill_nextthink
float bot_rangepreference
string playermodel_freeme
float botframe_spawnedwaypoints
float botframe_nextdangertime
float bot_strategytoken_taken
float bot_preferredcolors
const int AI_STATUS_STUCK
var entity(vector mins, vector maxs,.entity tofield) findbox_tofield_OrFallback
#define PHYS_INPUT_BUTTON_CROUCH(s)
float autocvar_sv_jumpvelocity
#define PHYS_INPUT_BUTTON_JUMP(s)
#define PHYS_INPUT_BUTTON_HOOK(s)
#define PHYS_INPUT_BUTTON_CHAT(s)
#define PHYS_INPUT_BUTTON_INFO(s)
#define PHYS_INPUT_BUTTON_USE(s)
#define PHYS_INPUT_BUTTON_ATCK(s)
#define PHYS_INPUT_BUTTON_ZOOM(s)
#define PHYS_INPUT_BUTTON_ATCK2(s)
#define PHYS_INPUT_BUTTON_DRAG(s)
#define autocvar_sv_gravity
float autocvar_sv_stepheight
const float MOVE_NOMONSTERS
float autocvar_bot_ai_thinkinterval
bool autocvar_bot_join_empty
bool autocvar_bot_navigation_ignoreplayers
#define autocvar_bot_suffix
string autocvar_bot_ai_custom_weapon_priority_far
float autocvar_skill_auto
string autocvar_bot_config_file
int autocvar_g_waypointeditor_auto
string autocvar_bot_ai_custom_weapon_priority_distances
bool autocvar_bot_usemodelnames
bool autocvar_waypoint_benchmark
int autocvar_minplayers_per_team
float autocvar_bot_ai_dangerdetectioninterval
string autocvar_bot_ai_custom_weapon_priority_mid
float autocvar_bot_ai_bunnyhop_skilloffset
string autocvar_bot_ai_custom_weapon_priority_close
int autocvar_bot_vs_human
#define autocvar_bot_prefix
float autocvar_bot_ai_dangerdetectionupdates
#define tokenizebyseparator
void bot_clearqueue(entity bot)
void havocbot_setupbot(entity this)
float havocbot_keyboardskill
bool intermission_running
#define IL_EACH(this, cond, body)
#define PutClientInServer
void navigation_unstuck(entity this)
void botframe_updatedangerousobjects(float maxupdate)
float bot_navigation_movemode
entity bot_waypoint_queue_owner
strcat(_("^F4Countdown stopped!"), "\n^BG", _("Teams are too unbalanced."))
void Send_Notification(NOTIF broadcast, entity client, MSG net_type, Notification net_name,...count)
ERASEABLE void RandomSelection_Init()
string RandomSelection_chosen_string
#define RandomSelection_AddString(s, weight, priority)
bool bot_ispaused(entity this)
bool campaign_bots_may_start
campaign mode: bots shall spawn but wait for the player to spawn before they do anything in other gam...
ClientState CS(Client this)
#define STATIC_INIT(func)
during worldspawn
if(frag_attacker.flagcarried)
void TeamBalance_Destroy(entity balance)
Destroy the team balance entity.
int TeamBalance_GetNumberOfPlayers(entity balance, int index)
Returns the number of players (both humans and bots) in a team.
void TeamBalance_GetTeamCounts(entity balance, entity ignore)
Counts the number of players and various other information about each team.
entity TeamBalance_CheckAllowedTeams(entity for_whom)
Checks whether the player can join teams according to global configuration and mutator settings.
bool Team_IsValidTeam(int team_num)
Returns whether team value is valid.
bool Team_IsValidIndex(int index)
Returns whether the team index is valid.
#define IS_REAL_CLIENT(v)
#define FOREACH_CLIENT(cond, body)
#define IS_BOT_CLIENT(v)
want: (IS_CLIENT(v) && !IS_REAL_CLIENT(v))
bool waypoint_load_links()
void waypoint_updatecost_foralllinks()
void waypoint_load_hardwiredlinks()
void botframe_showwaypointlinks()
void botframe_autowaypoints()
bool waypointeditor_enabled
float botframe_cachedwaypointlinks
float botframe_loadedforcedlinks