Skip to content

Commit

Permalink
removal of bot_reaction_time setting, hardwire to setting 2 (which wa…
Browse files Browse the repository at this point in the history
…s the default)
  • Loading branch information
jkivilin committed Dec 3, 2011
1 parent 02e99df commit c6073e4
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 70 deletions.
14 changes: 0 additions & 14 deletions addons/jk_botti/jk_botti.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,6 @@
# to spray a custom spray logo after killing an opponent. The default
# value is 40.
#
# bot_reaction_time <value> - sets the reaction time delay of the bots.
# When the bots see a new enemy they will delay slightly before firing
# to simulate a human reaction time delay. The reaction time delay is
# also based on the bot skill setting for that bot. High skilled bots
# (with skill level of 1 or 2) will have shorter reaction time delays
# than lower skilled bots (with skill level 3, 4, or 5). The delay
# value can be...
# 0 - disables the bot reaction time.
# 1 - very short reaction time delay. (between 0.01 and 0.10 seconds)
# 2 - moderate reaction time delay.
# 3 - fairly long reaction time delay. (between 0.10 and 0.30 seconds)
# The default value is 2.
#
# random_color <value> - sets whether or not you wish to spawn bots with
# random topcolor and bottomcolor values. Set the value to 0 to
# disable random colors. Set the value to 1 to enable random colors.
Expand Down Expand Up @@ -155,7 +142,6 @@ bot_chat_swap_percent 10
bot_chat_lower_percent 50

bot_logo_percent 40
bot_reaction_time 2
random_color 1

# add 5 bots using different skill levels (a random skin and name will be chosen)
Expand Down
13 changes: 4 additions & 9 deletions addons/jk_botti/jk_botti_readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -302,15 +302,10 @@ List of available settings:
How much bot strafes when attacking enemy. This value is percent.
Value: 0-100

- react_delay_min[0]
react_delay_min[1]
react_delay_min[2]
react_delay_max[0]
react_delay_max[1]
react_delay_max[2]
Set range of bot reaction time. [0] is for bot_reaction 1 settings, [1]
for bot_reaction 2, [2] for bot_reaction 3. Exact time is randomized value
between these two. If min is larger than max, then min is used always.
- react_delay_min
react_delay_max
Set range of bot reaction time. Exact time is randomized value between
these two. If min is larger than max, then min is used always.
Value: 0.0-1.0

- weaponchange_rate_min
Expand Down
2 changes: 0 additions & 2 deletions bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ extern int bot_chat_drop_percent;
extern int bot_chat_swap_percent;
extern int bot_chat_lower_percent;
extern qboolean b_random_color;
extern int bot_reaction_time;
extern qboolean debug_minmax;

extern qboolean g_in_intermission;
Expand Down Expand Up @@ -908,7 +907,6 @@ void BotCreate( const char *skin, const char *name, int skill, int top_color, in
pBot.logo_percent = bot_logo_percent;
pBot.f_strafe_direction = 0.0; // not strafing
pBot.f_strafe_time = 0.0;
pBot.reaction_time = bot_reaction_time;

pBot.bot_skill = skill - 1; // 0 based for array indexes
pBot.weapon_skill = skill;
Expand Down
1 change: 0 additions & 1 deletion bot.h
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ typedef struct
int top_color;
int bottom_color;

int reaction_time;
float f_reaction_target_time; // time when enemy targeting starts

float f_weaponchange_time;
Expand Down
19 changes: 6 additions & 13 deletions bot_combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -191,23 +191,16 @@ static Vector GetModifiedEnemyDistance(bot_t &pBot, const Vector & distance)
//
static void BotResetReactionTime(bot_t &pBot, qboolean have_slow_reaction = FALSE)
{
if (pBot.reaction_time >= 1 && pBot.reaction_time <= 3)
{
float react_delay;
float delay_min = skill_settings[pBot.bot_skill].react_delay_min;
float delay_max = skill_settings[pBot.bot_skill].react_delay_max;

int index = pBot.reaction_time - 1;
float react_delay = RANDOM_FLOAT2(delay_min, delay_max);

float delay_min = skill_settings[pBot.bot_skill].react_delay_min[index];
float delay_max = skill_settings[pBot.bot_skill].react_delay_max[index];
if(have_slow_reaction)
react_delay *= 4;

react_delay = RANDOM_FLOAT2(delay_min, delay_max);

if(have_slow_reaction)
react_delay *= 4;
pBot.f_reaction_target_time = gpGlobals->time + react_delay;

pBot.f_reaction_target_time = gpGlobals->time + react_delay;
}

pBot.f_next_find_visible_sound_enemy_time = gpGlobals->time + 0.2f;
}

Expand Down
14 changes: 7 additions & 7 deletions bot_skill.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ typedef struct

6:
float respawn_react_delay; // delay on players after respawn
float react_delay_min[3]; // reaction delay settings (first is for bot_reaction 1, second for 2, etc)
float react_delay_max[3];
float react_delay_min; // reaction delay settings (first is for bot_reaction 1, second for 2, etc)
float react_delay_max;

9:
float weaponchange_rate_min; // how fast changing weapons (min, max)
Expand Down Expand Up @@ -100,7 +100,7 @@ bot_skill_settings_t default_skill_settings[5] = {
//0:
1, 0.05, 0.30, 10.0, 50.0, 80,
//6:
0.6, {0.01, 0.07, 0.10}, {0.04, 0.11, 0.15},
0.6, 0.07, 0.11,
//9:
0.1, 0.3,
//11:
Expand All @@ -122,7 +122,7 @@ bot_skill_settings_t default_skill_settings[5] = {
//0:
2, 0.10, 0.60, 6.0, 30.0, 60,
//6:
0.8, {0.02, 0.09, 0.12}, {0.06, 0.14, 0.18},
0.8, 0.09, 0.14,
//9:
0.2, 0.5,
//11:
Expand All @@ -144,7 +144,7 @@ bot_skill_settings_t default_skill_settings[5] = {
//0:
3, 0.15, 0.80, 4.0, 10.0, 40,
//6:
1.0, {0.03, 0.12, 0.15}, {0.08, 0.18, 0.22},
1.0, 0.12, 0.18,
//9:
0.3, 0.7,
//11:
Expand All @@ -166,7 +166,7 @@ bot_skill_settings_t default_skill_settings[5] = {
//0:
4, 0.20, 0.90, 2.0, 5.0, 25,
//6:
1.20, {0.04, 0.14, 0.18}, {0.10, 0.21, 0.25},
1.20, 0.14, 0.21,
//9:
0.6, 1.4,
//11:
Expand All @@ -188,7 +188,7 @@ bot_skill_settings_t default_skill_settings[5] = {
//0:
5, 0.25, 1.00, 0.5, 0.5, 15,
//6:
1.4, {0.05, 0.17, 0.21}, {0.12, 0.25, 0.30},
1.4, 0.17, 0.25,
//9:
1.2, 2.8,
//11:
Expand Down
4 changes: 2 additions & 2 deletions bot_skill.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ typedef struct
int keep_optimal_dist; // how often bot (out of 100 times) the bot try to keep at optimum distance of weapon when attacking

float respawn_react_delay; // delay on players after respawn
float react_delay_min[3]; // reaction delay settings (first is for bot_reaction 1, second for 2, etc)
float react_delay_max[3];
float react_delay_min; // reaction delay settings (first is for bot_reaction 1, second for 2, etc)
float react_delay_max;

float weaponchange_rate_min; // how fast changing weapons (min, max)
float weaponchange_rate_max;
Expand Down
24 changes: 3 additions & 21 deletions commands.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ extern int bot_chat_drop_percent;
extern int bot_chat_swap_percent;
extern int bot_chat_lower_percent;
extern qboolean b_random_color;
extern int bot_reaction_time;

qboolean isFakeClientCommand = FALSE;
int fake_arg_count;
Expand Down Expand Up @@ -581,20 +580,7 @@ static qboolean ProcessCommand(const int cmdtype, const printfunc_t printfunc, v
}
else if (FStrEq(pcmd, "bot_reaction_time"))
{
if ((arg1 != NULL) && (*arg1 != 0))
{
int temp = atoi(arg1);

if ((temp < 1) || (temp > 3))
printfunc(PRINTFUNC_ERROR, arg, "invalid bot_reaction_time value!\n");
else
bot_reaction_time = temp;
}

if (bot_reaction_time)
safevoid_snprintf(msg, sizeof(msg), "bot_reaction_time is %d\n", bot_reaction_time);
else
safevoid_snprintf(msg, sizeof(msg), "bot_reaction_time is DISABLED\n");
safevoid_snprintf(msg, sizeof(msg), "bot_reaction_time setting was removed in jk_botti v1.42, ignoring setting\n");

printfunc(PRINTFUNC_INFO, arg, msg);

Expand Down Expand Up @@ -921,12 +907,8 @@ static qboolean ProcessCommand(const int cmdtype, const printfunc_t printfunc, v
CHECK_AND_SET_BOTSKILL_FLOAT(track_sound_time_max)

CHECK_AND_SET_BOTSKILL_FLOAT(respawn_react_delay) // delay on players after respawn
CHECK_AND_SET_BOTSKILL_FLOAT(react_delay_min[0]) // reaction delay settings ([0] is for bot_reaction 1, [1] for 2, etc)
CHECK_AND_SET_BOTSKILL_FLOAT(react_delay_max[0]) //
CHECK_AND_SET_BOTSKILL_FLOAT(react_delay_min[1]) //
CHECK_AND_SET_BOTSKILL_FLOAT(react_delay_max[1]) //
CHECK_AND_SET_BOTSKILL_FLOAT(react_delay_min[2]) //
CHECK_AND_SET_BOTSKILL_FLOAT(react_delay_max[2]) //
CHECK_AND_SET_BOTSKILL_FLOAT(react_delay_min) //
CHECK_AND_SET_BOTSKILL_FLOAT(react_delay_max) //

CHECK_AND_SET_BOTSKILL_FLOAT(weaponchange_rate_min) // how fast changing weapons (min, max)
CHECK_AND_SET_BOTSKILL_FLOAT(weaponchange_rate_max) //
Expand Down
1 change: 0 additions & 1 deletion dll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ float bot_think_spf = 1.0/30.0; // == 1 / (30 fps)

qboolean b_random_color = TRUE;
float bot_check_time = 60.0;
int bot_reaction_time = 2;
int min_bots = -1;
int max_bots = -1;
int num_bots = 0;
Expand Down

0 comments on commit c6073e4

Please sign in to comment.