graph: reworked buckets so they can handle very large number of nodes

graph: reworked buckets so they can handle very large number of nodes
aim: bots should more respect headshot allow option (needs testing)
aim: incorporated never-finished changes from pr #204
nav: increased reachability timers a bit
nav: ensure buckets has enough nodes before use they
conf: introduced max recoil in difficulty config file
bot: overall fixes to jason mode, treat knife in hands and no weapons as jason mode too
bot: changed default difficulty level for bots to level 3
fix: knife attacks not working since last commit (fixes #429)
fix: hostage rescue not working since last commit (fixes #427)
refactor: use range loops for graph outside graph class when possible
This commit is contained in:
jeefo 2023-04-11 22:32:28 +03:00
commit 1a650c57ce
No known key found for this signature in database
GPG key ID: 927BCA0779BEA8ED
14 changed files with 426 additions and 347 deletions

View file

@ -259,10 +259,6 @@ public:
friend class Bot;
private:
struct Bucket {
int x, y, z;
};
int m_editFlags {};
int m_loadAttempts {};
int m_cacheNodeIndex {};
@ -297,12 +293,13 @@ private:
IntArray m_rescuePoints {};
IntArray m_visitedGoals {};
SmallArray <int32_t> m_buckets[kMaxBucketsInsidePos][kMaxBucketsInsidePos][kMaxBucketsInsidePos];
SmallArray <Matrix> m_matrix {};
SmallArray <Practice> m_practice {};
SmallArray <Path> m_paths {};
SmallArray <uint8_t> m_vistable {};
HashMap <int32_t, Array <int32_t>, EmptyHash <int32_t>> m_hashTable;
String m_graphAuthor {};
String m_graphModified {};
@ -327,6 +324,7 @@ public:
int getPathDist (int srcIndex, int destIndex);
int clearConnections (int index);
int getBspSize ();
int locateBucket (const Vector &pos);
float calculateTravelTime (float maxSpeed, const Vector &src, const Vector &origin);
@ -394,9 +392,8 @@ public:
const char *getDataDirectory (bool isMemoryFile = false);
const char *getOldFormatGraphName (bool isMemoryFile = false);
Bucket locateBucket (const Vector &pos);
IntArray searchRadius (float radius, const Vector &origin, int maxCount = -1);
const SmallArray <int32_t> &getNodesInBucket (const Vector &pos);
IntArray getNarestInRadius (float radius, const Vector &origin, int maxCount = -1);
const IntArray &getNodesInBucket (const Vector &pos);
public:
size_t getMaxRouteLength () const {
@ -468,6 +465,23 @@ public:
edict_t *getEditor () {
return m_editor;
}
public:
Path *begin () {
return m_paths.begin ();
}
Path *begin () const {
return m_paths.begin ();
}
Path *end () {
return m_paths.end ();
}
Path *end () const {
return m_paths.end ();
}
};
// we're need `bots`