Corrected usage of think interval for each bot.

Fixed double-jump task behaviour;.
Lowered CPU usage in player avoidance code.
Removed unused commands from 'yb help'.
Dirty fix for #44.
This commit is contained in:
jeefo 2017-02-06 22:31:54 +03:00
commit 62e9cccf7b
8 changed files with 152 additions and 120 deletions

View file

@ -524,6 +524,8 @@ const float TASKPRI_SHOOTBREAKABLE = 100.0f;
const float TASKPRI_ESCAPEFROMBOMB = 100.0f;
const float MAX_GRENADE_TIMER = 2.34f;
const float MAX_SPRAY_DISTANCE = 250.0f;
const float MAX_SPRAY_DISTANCE_X2 = MAX_SPRAY_DISTANCE * 2;
const int MAX_HOSTAGES = 8;
const int MAX_PATH_INDEX = 8;
@ -745,6 +747,9 @@ private:
int m_radioSelect; // radio entry
float m_headedTime;
edict_t *m_avoid; // avoid players on our way
float m_avoidTime; // time to avoid players around
float m_blindRecognizeTime; // time to recognize enemy
float m_itemCheckTime; // time next search for items needs to be done
PickupType m_pickupType; // type of entity which needs to be used/picked up
@ -1177,6 +1182,8 @@ public:
inline Vector Center (void) { return (pev->absmax + pev->absmin) * 0.5; };
inline Vector EyePosition (void) { return pev->origin + pev->view_ofs; };
float GetThinkInterval (void);
// the main function that decides intervals of running bot ai
void Think (void);
@ -1197,6 +1204,7 @@ public:
void EnableChatterIcon (bool show);
void DeleteSearchNodes (void);
void VerifyBreakable (edict_t *touch);
void AvoidPlayersOnTheWay (edict_t *touch);
void PushTask (TaskID id, float desire, int data, float time, bool canContinue);
void RemoveCertainTask (TaskID id);
@ -1220,7 +1228,10 @@ public:
void Kill (void);
void Kick (bool keepQuota = false);
void ResetDoubleJumpState (void);
void StartDoubleJump (edict_t *ent);
int FindPlantedBomb(void);
bool HasHostage (void);

View file

@ -97,8 +97,8 @@ private:
int m_drawModels[DRAW_NUM];
// bot client command
bool m_isBotCommand;
char m_arguments[256];
bool m_isBotCommand;
int m_argumentCount;
edict_t *m_startEntity;
@ -218,7 +218,7 @@ public:
// gets custom engine argv for client command
inline const char *GetOverrideArgv (int num)
{
return ExtractSingleField (m_arguments, num, false);
return ExtractSingleField (m_arguments, num);
}
// gets custom engine argc for client command
@ -298,8 +298,8 @@ public:
}
// static utility functions
public:
static const char *ExtractSingleField (const char *string, int id, bool terminate);
private:
const char *ExtractSingleField (const char *string, int id);
};
// simplify access for console variables